Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
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-AMF
Commits
c241a274
Commit
c241a274
authored
Jul 28, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid using namespace std
parent
a5e65b39
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
112 additions
and
127 deletions
+112
-127
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+4
-5
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+5
-7
src/amf-app/amf_config.hpp
src/amf-app/amf_config.hpp
+25
-26
src/amf-app/amf_module_from_config.cpp
src/amf-app/amf_module_from_config.cpp
+1
-3
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+1
-3
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+2
-2
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+26
-21
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+10
-11
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+4
-5
src/amf-app/amf_n2.hpp
src/amf-app/amf_n2.hpp
+2
-2
src/amf-app/amf_statistics.cpp
src/amf-app/amf_statistics.cpp
+1
-2
src/amf-app/amf_statistics.hpp
src/amf-app/amf_statistics.hpp
+11
-12
src/common/comUt.hpp
src/common/comUt.hpp
+1
-2
src/contexts/gNB_context.hpp
src/contexts/gNB_context.hpp
+2
-3
src/contexts/nas_context.hpp
src/contexts/nas_context.hpp
+1
-1
src/contexts/pdu_session_context.hpp
src/contexts/pdu_session_context.hpp
+2
-3
src/ngap/ngap_app/ngap_app.cpp
src/ngap/ngap_app/ngap_app.cpp
+1
-1
src/ngap/ngap_app/ngap_app.hpp
src/ngap/ngap_app/ngap_app.hpp
+1
-1
src/oai-amf/main.cpp
src/oai-amf/main.cpp
+1
-2
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
.../amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
+1
-1
src/sbi/smf_client/smf-client.hpp
src/sbi/smf_client/smf-client.hpp
+7
-7
src/sctp/sctp_server.cpp
src/sctp/sctp_server.cpp
+0
-1
src/sctp/sctp_server.hpp
src/sctp/sctp_server.hpp
+1
-2
src/utils/String2Value.hpp
src/utils/String2Value.hpp
+2
-3
src/utils/http_multi_parser.cpp
src/utils/http_multi_parser.cpp
+0
-1
No files found.
src/amf-app/amf_app.hpp
View file @
c241a274
...
@@ -41,7 +41,6 @@
...
@@ -41,7 +41,6 @@
#include "ue_context.hpp"
#include "ue_context.hpp"
using
namespace
config
;
using
namespace
config
;
using
namespace
std
;
static
uint32_t
amf_app_ue_ngap_id_generator
=
1
;
static
uint32_t
amf_app_ue_ngap_id_generator
=
1
;
...
@@ -69,13 +68,13 @@ class amf_app {
...
@@ -69,13 +68,13 @@ class amf_app {
std
::
shared_ptr
<
ue_context
>
amf_ue_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
)
const
;
std
::
shared_ptr
<
ue_context
>
amf_ue_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
)
const
;
void
set_amf_ue_ngap_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>
uc
);
void
set_amf_ue_ngap_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>
uc
);
bool
is_ran_amf_id_2_ue_context
(
const
string
&
ue_context_key
)
const
;
bool
is_ran_amf_id_2_ue_context
(
const
st
d
::
st
ring
&
ue_context_key
)
const
;
std
::
shared_ptr
<
ue_context
>
ran_amf_id_2_ue_context
(
const
string
&
ue_context_key
)
const
;
std
::
shared_ptr
<
ue_context
>
ran_amf_id_2_ue_context
(
const
st
d
::
st
ring
&
ue_context_key
)
const
;
void
set_ran_amf_id_2_ue_context
(
const
string
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>
uc
);
void
set_ran_amf_id_2_ue_context
(
const
st
d
::
st
ring
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>
uc
);
// SMF Client response handlers
// SMF Client response handlers
void
handle_post_sm_context_response_error_400
();
void
handle_post_sm_context_response_error_400
();
//others
//others
bool
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
st
ring
&
mcc
,
string
&
mnc
,
uint32_t
&
tmsi
);
bool
generate_5g_guti
(
uint32_t
ranid
,
long
amfid
,
st
d
::
string
&
mcc
,
std
::
string
&
mnc
,
uint32_t
&
tmsi
);
};
};
}
}
...
...
src/amf-app/amf_config.cpp
View file @
c241a274
...
@@ -47,7 +47,6 @@ extern "C" {
...
@@ -47,7 +47,6 @@ extern "C" {
#include <iostream>
#include <iostream>
using
namespace
libconfig
;
using
namespace
libconfig
;
using
namespace
std
;
using
namespace
amf_application
;
using
namespace
amf_application
;
namespace
config
{
namespace
config
{
...
@@ -62,8 +61,7 @@ amf_config::~amf_config() {
...
@@ -62,8 +61,7 @@ amf_config::~amf_config() {
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
amf_config
::
load
(
const
std
::
string
&
config_file
)
{
int
amf_config
::
load
(
const
std
::
string
&
config_file
)
{
cout
<<
endl
;
Logger
::
amf_app
().
debug
(
"
\n
Load AMF system configuration file(%s)"
,
config_file
.
c_str
());
Logger
::
amf_app
().
debug
(
"Load AMF system configuration file(%s)"
,
config_file
.
c_str
());
Config
cfg
;
Config
cfg
;
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
unsigned
char
buf_in6_addr
[
sizeof
(
struct
in6_addr
)];
try
{
try
{
...
@@ -167,7 +165,7 @@ int amf_config::load(const std::string &config_file) {
...
@@ -167,7 +165,7 @@ int amf_config::load(const std::string &config_file) {
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
const
Setting
&
smf_addr_item
=
smf_addr_pool
[
i
];
const
Setting
&
smf_addr_item
=
smf_addr_pool
[
i
];
smf_inst_t
smf_inst
;
smf_inst_t
smf_inst
;
string
selected
;
st
d
::
st
ring
selected
;
smf_addr_item
.
lookupValue
(
AMF_CONFIG_STRING_SMF_INSTANCE_ID
,
smf_inst
.
id
);
smf_addr_item
.
lookupValue
(
AMF_CONFIG_STRING_SMF_INSTANCE_ID
,
smf_inst
.
id
);
smf_addr_item
.
lookupValue
(
AMF_CONFIG_STRING_IPV4_ADDRESS
,
smf_inst
.
ipv4
);
smf_addr_item
.
lookupValue
(
AMF_CONFIG_STRING_IPV4_ADDRESS
,
smf_inst
.
ipv4
);
smf_addr_item
.
lookupValue
(
AMF_CONFIG_STRING_SMF_INSTANCE_PORT
,
smf_inst
.
port
);
smf_addr_item
.
lookupValue
(
AMF_CONFIG_STRING_SMF_INSTANCE_PORT
,
smf_inst
.
port
);
...
@@ -208,7 +206,7 @@ int amf_config::load(const std::string &config_file) {
...
@@ -208,7 +206,7 @@ int amf_config::load(const std::string &config_file) {
int
intCount
=
intAlg
.
getLength
();
int
intCount
=
intAlg
.
getLength
();
for
(
int
i
=
0
;
i
<
intCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
intCount
;
i
++
)
{
string
intAlgStr
=
intAlg
[
i
];
st
d
::
st
ring
intAlgStr
=
intAlg
[
i
];
if
(
!
intAlgStr
.
compare
(
"NIA0"
))
if
(
!
intAlgStr
.
compare
(
"NIA0"
))
nas_cfg
.
prefered_integrity_algorithm
[
i
]
=
IA0_5G
;
nas_cfg
.
prefered_integrity_algorithm
[
i
]
=
IA0_5G
;
if
(
!
intAlgStr
.
compare
(
"NIA1"
))
if
(
!
intAlgStr
.
compare
(
"NIA1"
))
...
@@ -222,7 +220,7 @@ int amf_config::load(const std::string &config_file) {
...
@@ -222,7 +220,7 @@ int amf_config::load(const std::string &config_file) {
const
Setting
&
encAlg
=
nas
[
AMF_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST
];
const
Setting
&
encAlg
=
nas
[
AMF_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST
];
int
encCount
=
encAlg
.
getLength
();
int
encCount
=
encAlg
.
getLength
();
for
(
int
i
=
0
;
i
<
encCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
encCount
;
i
++
)
{
string
encAlgStr
=
encAlg
[
i
];
st
d
::
st
ring
encAlgStr
=
encAlg
[
i
];
if
(
!
encAlgStr
.
compare
(
"NEA0"
))
if
(
!
encAlgStr
.
compare
(
"NEA0"
))
nas_cfg
.
prefered_ciphering_algorithm
[
i
]
=
EA0_5G
;
nas_cfg
.
prefered_ciphering_algorithm
[
i
]
=
EA0_5G
;
if
(
!
encAlgStr
.
compare
(
"NEA1"
))
if
(
!
encAlgStr
.
compare
(
"NEA1"
))
...
@@ -272,7 +270,7 @@ void amf_config::display() {
...
@@ -272,7 +270,7 @@ void amf_config::display() {
Logger
::
config
().
info
(
"- random ..........................: %s"
,
auth_para
.
random
.
c_str
());
Logger
::
config
().
info
(
"- random ..........................: %s"
,
auth_para
.
random
.
c_str
());
Logger
::
config
().
info
(
"- Remote SMF Pool..................: "
);
Logger
::
config
().
info
(
"- Remote SMF Pool..................: "
);
for
(
int
i
=
0
;
i
<
smf_pool
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
smf_pool
.
size
();
i
++
)
{
string
selected
;
st
d
::
st
ring
selected
;
if
(
smf_pool
[
i
].
selected
)
if
(
smf_pool
[
i
].
selected
)
selected
=
"true"
;
selected
=
"true"
;
else
else
...
...
src/amf-app/amf_config.hpp
View file @
c241a274
...
@@ -96,17 +96,16 @@
...
@@ -96,17 +96,16 @@
#define AMF_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST "ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST"
#define AMF_CONFIG_STRING_NAS_SUPPORTED_CIPHERING_ALGORITHM_LIST "ORDERED_SUPPORTED_CIPHERING_ALGORITHM_LIST"
using
namespace
libconfig
;
using
namespace
libconfig
;
using
namespace
std
;
namespace
config
{
namespace
config
{
typedef
struct
{
typedef
struct
{
string
mysql_server
;
st
d
::
st
ring
mysql_server
;
string
mysql_user
;
st
d
::
st
ring
mysql_user
;
string
mysql_pass
;
st
d
::
st
ring
mysql_pass
;
string
mysql_db
;
st
d
::
st
ring
mysql_db
;
string
operator_key
;
st
d
::
st
ring
operator_key
;
string
random
;
st
d
::
st
ring
random
;
}
auth_conf
;
}
auth_conf
;
typedef
struct
interface_cfg_s
{
typedef
struct
interface_cfg_s
{
...
@@ -128,23 +127,23 @@ typedef struct itti_cfg_s {
...
@@ -128,23 +127,23 @@ typedef struct itti_cfg_s {
}
itti_cfg_t
;
}
itti_cfg_t
;
typedef
struct
guami_s
{
typedef
struct
guami_s
{
string
mcc
;
st
d
::
st
ring
mcc
;
string
mnc
;
st
d
::
st
ring
mnc
;
string
regionID
;
st
d
::
st
ring
regionID
;
string
AmfSetID
;
st
d
::
st
ring
AmfSetID
;
string
AmfPointer
;
st
d
::
st
ring
AmfPointer
;
}
guami_t
;
}
guami_t
;
typedef
struct
slice_s
{
typedef
struct
slice_s
{
string
sST
;
st
d
::
st
ring
sST
;
string
sD
;
st
d
::
st
ring
sD
;
}
slice_t
;
}
slice_t
;
typedef
struct
plmn_support_item_s
{
typedef
struct
plmn_support_item_s
{
string
mcc
;
st
d
::
st
ring
mcc
;
string
mnc
;
st
d
::
st
ring
mnc
;
uint32_t
tac
;
uint32_t
tac
;
vector
<
slice_t
>
slice_list
;
std
::
vector
<
slice_t
>
slice_list
;
}
plmn_item_t
;
}
plmn_item_t
;
typedef
struct
{
typedef
struct
{
...
@@ -154,9 +153,9 @@ typedef struct {
...
@@ -154,9 +153,9 @@ typedef struct {
typedef
struct
{
typedef
struct
{
int
id
;
int
id
;
string
ipv4
;
st
d
::
st
ring
ipv4
;
string
port
;
st
d
::
st
ring
port
;
string
version
;
st
d
::
st
ring
version
;
bool
selected
;
bool
selected
;
}
smf_inst_t
;
}
smf_inst_t
;
...
@@ -170,19 +169,19 @@ class amf_config {
...
@@ -170,19 +169,19 @@ class amf_config {
void
display
();
void
display
();
public:
public:
unsigned
int
instance
;
unsigned
int
instance
;
string
pid_dir
;
st
d
::
st
ring
pid_dir
;
interface_cfg_t
n2
;
interface_cfg_t
n2
;
itti_cfg_t
itti
;
itti_cfg_t
itti
;
unsigned
int
statistics_interval
;
unsigned
int
statistics_interval
;
string
AMF_Name
;
st
d
::
st
ring
AMF_Name
;
guami_t
guami
;
guami_t
guami
;
vector
<
guami_t
>
guami_list
;
std
::
vector
<
guami_t
>
guami_list
;
unsigned
int
relativeAMFCapacity
;
unsigned
int
relativeAMFCapacity
;
vector
<
plmn_item_t
>
plmn_list
;
std
::
vector
<
plmn_item_t
>
plmn_list
;
string
is_emergency_support
;
st
d
::
st
ring
is_emergency_support
;
auth_conf
auth_para
;
auth_conf
auth_para
;
nas_conf_t
nas_cfg
;
nas_conf_t
nas_cfg
;
vector
<
smf_inst_t
>
smf_pool
;
std
::
vector
<
smf_inst_t
>
smf_pool
;
};
};
}
}
...
...
src/amf-app/amf_module_from_config.cpp
View file @
c241a274
...
@@ -30,14 +30,12 @@
...
@@ -30,14 +30,12 @@
#include "logger.hpp"
#include "logger.hpp"
#include <iostream>
#include <iostream>
#include <string>
#include <string>
using
namespace
std
;
namespace
config
{
namespace
config
{
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
amf_modules
::
load
(
const
std
::
string
&
config_file
)
{
int
amf_modules
::
load
(
const
std
::
string
&
config_file
)
{
cout
<<
endl
;
Logger
::
amf_app
().
debug
(
"
\n
Load AMF module configuration file(%s)"
,
config_file
.
c_str
());
Logger
::
amf_app
().
debug
(
"Load AMF module configuration file(%s)"
,
config_file
.
c_str
());
Config
cfg
;
Config
cfg
;
try
{
try
{
cfg
.
readFile
(
config_file
.
c_str
());
cfg
.
readFile
(
config_file
.
c_str
());
...
...
src/amf-app/amf_n1.cpp
View file @
c241a274
...
@@ -390,9 +390,8 @@ void amf_n1::service_request_handle(bool isNasSig, std::shared_ptr<nas_context>
...
@@ -390,9 +390,8 @@ void amf_n1::service_request_handle(bool isNasSig, std::shared_ptr<nas_context>
/* by liuyu */
/* by liuyu */
supi2amfId
[
supi
]
=
amf_ue_ngap_id
;
supi2amfId
[
supi
]
=
amf_ue_ngap_id
;
Logger
::
amf_n1
().
debug
(
"amf_ue_ngap_id-----------------------------------(%d)"
,
amf_ue_ngap_id
);
supi2ranId
[
supi
]
=
ran_ue_ngap_id
;
supi2ranId
[
supi
]
=
ran_ue_ngap_id
;
Logger
::
amf_n1
().
debug
(
"
ran_ue_ngap_id-----------------------------------(%d)"
,
ran_ue_ngap_id
);
Logger
::
amf_n1
().
debug
(
"
amf_ue_ngap_id %d, ran_ue_ngap_id %d"
,
amf_ue_ngap_id
,
ran_ue_ngap_id
);
Logger
::
amf_n1
().
debug
(
"Key for pdu session context: supi(%s)"
,
supi
.
c_str
());
Logger
::
amf_n1
().
debug
(
"Key for pdu session context: supi(%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
))
{
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
))
{
...
@@ -413,7 +412,6 @@ void amf_n1::service_request_handle(bool isNasSig, std::shared_ptr<nas_context>
...
@@ -413,7 +412,6 @@ void amf_n1::service_request_handle(bool isNasSig, std::shared_ptr<nas_context>
itti_msg
->
is_sr
=
true
;
//service request indicator
itti_msg
->
is_sr
=
true
;
//service request indicator
itti_msg
->
pdu_session_id
=
psc
.
get
()
->
pdu_session_id
;
itti_msg
->
pdu_session_id
=
psc
.
get
()
->
pdu_session_id
;
itti_msg
->
n2sm
=
psc
.
get
()
->
n2sm
;
itti_msg
->
n2sm
=
psc
.
get
()
->
n2sm
;
//Logger::amf_n1().debug("n2sm size in amf_n1(%d)", blength(psc.get()->n2sm));
std
::
shared_ptr
<
itti_initial_context_setup_request
>
i
=
std
::
shared_ptr
<
itti_initial_context_setup_request
>
(
itti_msg
);
std
::
shared_ptr
<
itti_initial_context_setup_request
>
i
=
std
::
shared_ptr
<
itti_initial_context_setup_request
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
if
(
0
!=
ret
)
{
...
...
src/amf-app/amf_n1.hpp
View file @
c241a274
...
@@ -77,7 +77,7 @@ class amf_n1 {
...
@@ -77,7 +77,7 @@ class amf_n1 {
public:
public:
std
::
map
<
long
,
std
::
shared_ptr
<
nas_context
>>
amfueid2nas_context
;
// amf ue ngap id
std
::
map
<
long
,
std
::
shared_ptr
<
nas_context
>>
amfueid2nas_context
;
// amf ue ngap id
std
::
map
<
string
,
std
::
shared_ptr
<
nas_context
>>
imsi2nas_context
;
std
::
map
<
st
d
::
st
ring
,
std
::
shared_ptr
<
nas_context
>>
imsi2nas_context
;
std
::
map
<
std
::
string
,
long
>
supi2amfId
;
std
::
map
<
std
::
string
,
long
>
supi2amfId
;
std
::
map
<
std
::
string
,
uint32_t
>
supi2ranId
;
std
::
map
<
std
::
string
,
uint32_t
>
supi2ranId
;
...
@@ -142,7 +142,7 @@ class amf_n1 {
...
@@ -142,7 +142,7 @@ class amf_n1 {
public:
public:
void
send_itti_to_smf_services_consumer
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
uint8_t
request_type
,
uint8_t
pdu_session_id
,
bstring
dnn
,
bstring
sm_msg
);
void
send_itti_to_smf_services_consumer
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
uint8_t
request_type
,
uint8_t
pdu_session_id
,
bstring
dnn
,
bstring
sm_msg
);
public:
public:
void
update_ue_information_statics
(
ue_infos
&
ueItem
,
const
st
ring
connStatus
,
const
string
registerStatus
,
uint32_t
ranid
,
uint32_t
amfid
,
string
imsi
,
string
guti
,
string
mcc
,
string
mnc
,
uint32_t
cellId
);
void
update_ue_information_statics
(
ue_infos
&
ueItem
,
const
st
d
::
string
connStatus
,
const
std
::
string
registerStatus
,
uint32_t
ranid
,
uint32_t
amfid
,
std
::
string
imsi
,
std
::
string
guti
,
std
::
string
mcc
,
std
::
string
mnc
,
uint32_t
cellId
);
};
};
}
}
...
...
src/amf-app/amf_n11.cpp
View file @
c241a274
...
@@ -62,17 +62,19 @@ extern amf_n1 *amf_n1_inst;
...
@@ -62,17 +62,19 @@ extern amf_n1 *amf_n1_inst;
extern
void
msg_str_2_msg_hex
(
std
::
string
msg
,
bstring
&
b
);
extern
void
msg_str_2_msg_hex
(
std
::
string
msg
,
bstring
&
b
);
extern
void
convert_string_2_hex
(
std
::
string
&
input
,
std
::
string
&
output
);
extern
void
convert_string_2_hex
(
std
::
string
&
input
,
std
::
string
&
output
);
extern
void
print_buffer
(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
extern
void
print_buffer
(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
extern
bool
multipart_parser
(
st
ring
input
,
string
&
jsonData
,
string
&
n1sm
,
string
&
n2sm
);
extern
bool
multipart_parser
(
st
d
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
);
extern
unsigned
char
*
format_string_as_hex
(
std
::
string
str
);
extern
unsigned
char
*
format_string_as_hex
(
std
::
string
str
);
extern
char
*
bstring2charString
(
bstring
b
);
extern
char
*
bstring2charString
(
bstring
b
);
//------------------------------------------------------------------------------
std
::
size_t
callback
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
std
::
size_t
callback
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
const
std
::
size_t
totalBytes
(
size
*
num
);
const
std
::
size_t
totalBytes
(
size
*
num
);
out
->
append
(
in
,
totalBytes
);
out
->
append
(
in
,
totalBytes
);
return
totalBytes
;
return
totalBytes
;
}
}
void
octet_stream_2_hex_stream
(
uint8_t
*
buf
,
int
len
,
string
&
out
)
{
//------------------------------------------------------------------------------
void
octet_stream_2_hex_stream
(
uint8_t
*
buf
,
int
len
,
std
::
string
&
out
)
{
out
=
""
;
out
=
""
;
char
*
tmp
=
(
char
*
)
calloc
(
1
,
2
*
len
*
sizeof
(
uint8_t
)
+
1
);
char
*
tmp
=
(
char
*
)
calloc
(
1
,
2
*
len
*
sizeof
(
uint8_t
)
+
1
);
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
for
(
int
i
=
0
;
i
<
len
;
i
++
)
{
...
@@ -88,6 +90,7 @@ void octet_stream_2_hex_stream(uint8_t *buf, int len, string &out) {
...
@@ -88,6 +90,7 @@ void octet_stream_2_hex_stream(uint8_t *buf, int len, string &out) {
/***************************************************/
/***************************************************/
void
amf_n11_task
(
void
*
);
void
amf_n11_task
(
void
*
);
//------------------------------------------------------------------------------
void
amf_n11_task
(
void
*
)
{
void
amf_n11_task
(
void
*
)
{
const
task_id_t
task_id
=
TASK_AMF_N11
;
const
task_id_t
task_id
=
TASK_AMF_N11
;
itti_inst
->
notify_task_ready
(
task_id
);
itti_inst
->
notify_task_ready
(
task_id
);
...
@@ -138,16 +141,16 @@ void amf_n11::handle_itti_message(itti_pdu_session_resource_setup_response &itti
...
@@ -138,16 +141,16 @@ void amf_n11::handle_itti_message(itti_pdu_session_resource_setup_response &itti
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n11
::
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
)
{
void
amf_n11
::
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
)
{
string
supi
=
pduid2supi
.
at
(
itti_msg
.
pdu_session_id
);
st
d
::
st
ring
supi
=
pduid2supi
.
at
(
itti_msg
.
pdu_session_id
);
Logger
::
amf_n11
().
debug
(
"Try to find supi(%s) from pdusession_id(%d)"
,
supi
.
c_str
(),
itti_msg
.
pdu_session_id
);
Logger
::
amf_n11
().
debug
(
"Try to find supi(%s) from pdusession_id(%d)"
,
supi
.
c_str
(),
itti_msg
.
pdu_session_id
);
std
::
shared_ptr
<
pdu_session_context
>
psc
;
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
is_supi_to_pdu_ctx
(
supi
))
{
if
(
is_supi_to_pdu_ctx
(
supi
))
{
psc
=
supi_to_pdu_ctx
(
supi
);
psc
=
supi_to_pdu_ctx
(
supi
);
}
else
{
}
else
{
Logger
::
amf_n11
().
error
(
"Trying to find psu_session_context with supi(%s), Fa
li
ed"
,
supi
.
c_str
());
Logger
::
amf_n11
().
error
(
"Trying to find psu_session_context with supi(%s), Fa
il
ed"
,
supi
.
c_str
());
return
;
return
;
}
}
string
smf_addr
;
st
d
::
st
ring
smf_addr
;
if
(
!
psc
.
get
()
->
smf_avaliable
)
{
if
(
!
psc
.
get
()
->
smf_avaliable
)
{
if
(
!
smf_selection_from_configuration
(
smf_addr
))
{
if
(
!
smf_selection_from_configuration
(
smf_addr
))
{
Logger
::
amf_n11
().
error
(
"No candidate SMF is available"
);
Logger
::
amf_n11
().
error
(
"No candidate SMF is available"
);
...
@@ -156,7 +159,8 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_m
...
@@ -156,7 +159,8 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_m
}
else
{
}
else
{
smf_selection_from_context
(
smf_addr
);
smf_selection_from_context
(
smf_addr
);
}
}
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/v2/sm-contexts/"
+
"1"
+
"/modify"
;
//scid
//TODO:Remove hardcoded value (1 - SCID)
std
::
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/v2/sm-contexts/"
+
"1"
+
"/modify"
;
//scid
nlohmann
::
json
pdu_session_update_request
;
nlohmann
::
json
pdu_session_update_request
;
pdu_session_update_request
[
"n2SmInfoType"
]
=
"PDU_RES_SETUP_RSP"
;
pdu_session_update_request
[
"n2SmInfoType"
]
=
"PDU_RES_SETUP_RSP"
;
pdu_session_update_request
[
"n2SmInfo"
][
"contentId"
]
=
"n2SmMsg"
;
pdu_session_update_request
[
"n2SmInfo"
][
"contentId"
]
=
"n2SmMsg"
;
...
@@ -170,7 +174,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_m
...
@@ -170,7 +174,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_m
void
amf_n11
::
handle_itti_message
(
itti_smf_services_consumer
&
smf
)
{
void
amf_n11
::
handle_itti_message
(
itti_smf_services_consumer
&
smf
)
{
std
::
shared_ptr
<
nas_context
>
nc
;
std
::
shared_ptr
<
nas_context
>
nc
;
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
smf
.
amf_ue_ngap_id
);
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
smf
.
amf_ue_ngap_id
);
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
st
d
::
st
ring
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
std
::
shared_ptr
<
pdu_session_context
>
psc
;
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
is_supi_to_pdu_ctx
(
supi
))
{
if
(
is_supi_to_pdu_ctx
(
supi
))
{
...
@@ -198,7 +202,7 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
...
@@ -198,7 +202,7 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
Logger
::
amf_n11
().
debug
(
"Requested DNN: %s"
,
dnn
.
c_str
());
Logger
::
amf_n11
().
debug
(
"Requested DNN: %s"
,
dnn
.
c_str
());
psc
.
get
()
->
dnn
=
dnn
;
psc
.
get
()
->
dnn
=
dnn
;
string
smf_addr
;
st
d
::
st
ring
smf_addr
;
if
(
!
psc
.
get
()
->
smf_avaliable
)
{
if
(
!
psc
.
get
()
->
smf_avaliable
)
{
if
(
!
smf_selection_from_configuration
(
smf_addr
))
{
if
(
!
smf_selection_from_configuration
(
smf_addr
))
{
Logger
::
amf_n11
().
error
(
"No candidate for SMF is available"
);
Logger
::
amf_n11
().
error
(
"No candidate for SMF is available"
);
...
@@ -223,8 +227,9 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
...
@@ -223,8 +227,9 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n11
::
handle_pdu_session_initial_request
(
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
string
smf_addr
,
bstring
sm_msg
,
string
dnn
)
{
void
amf_n11
::
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
)
{
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/v2/sm-contexts"
;
//TODO: Remove hardcoded values
std
::
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/v2/sm-contexts"
;
nlohmann
::
json
pdu_session_establishment_request
;
nlohmann
::
json
pdu_session_establishment_request
;
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
...
@@ -251,12 +256,12 @@ void amf_n11::handle_pdu_session_initial_request(string supi, std::shared_ptr<pd
...
@@ -251,12 +256,12 @@ void amf_n11::handle_pdu_session_initial_request(string supi, std::shared_ptr<pd
//Context management functions
//Context management functions
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n11
::
is_supi_to_pdu_ctx
(
const
string
&
supi
)
const
{
bool
amf_n11
::
is_supi_to_pdu_ctx
(
const
st
d
::
st
ring
&
supi
)
const
{
std
::
shared_lock
lock
(
m_supi2pdu
);
std
::
shared_lock
lock
(
m_supi2pdu
);
return
bool
{
supi2pdu
.
count
(
supi
)
>
0
};
return
bool
{
supi2pdu
.
count
(
supi
)
>
0
};
}
}
std
::
shared_ptr
<
pdu_session_context
>
amf_n11
::
supi_to_pdu_ctx
(
const
string
&
supi
)
const
{
std
::
shared_ptr
<
pdu_session_context
>
amf_n11
::
supi_to_pdu_ctx
(
const
st
d
::
st
ring
&
supi
)
const
{
std
::
shared_lock
lock
(
m_supi2pdu
);
std
::
shared_lock
lock
(
m_supi2pdu
);
return
supi2pdu
.
at
(
supi
);
return
supi2pdu
.
at
(
supi
);
}
}
...
@@ -269,7 +274,7 @@ void amf_n11::set_supi_to_pdu_ctx(const string &supi, std::shared_ptr<pdu_sessio
...
@@ -269,7 +274,7 @@ void amf_n11::set_supi_to_pdu_ctx(const string &supi, std::shared_ptr<pdu_sessio
//SMF selection
//SMF selection
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n11
::
smf_selection_from_configuration
(
string
&
smf_addr
)
{
bool
amf_n11
::
smf_selection_from_configuration
(
st
d
::
st
ring
&
smf_addr
)
{
for
(
int
i
=
0
;
i
<
amf_cfg
.
smf_pool
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
amf_cfg
.
smf_pool
.
size
();
i
++
)
{
if
(
amf_cfg
.
smf_pool
[
i
].
selected
)
{
if
(
amf_cfg
.
smf_pool
[
i
].
selected
)
{
smf_addr
=
"http://"
+
amf_cfg
.
smf_pool
[
i
].
ipv4
+
":"
+
amf_cfg
.
smf_pool
[
i
].
port
;
smf_addr
=
"http://"
+
amf_cfg
.
smf_pool
[
i
].
ipv4
+
":"
+
amf_cfg
.
smf_pool
[
i
].
port
;
...
@@ -280,7 +285,7 @@ bool amf_n11::smf_selection_from_configuration(string &smf_addr) {
...
@@ -280,7 +285,7 @@ bool amf_n11::smf_selection_from_configuration(string &smf_addr) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
amf_n11
::
smf_selection_from_context
(
string
&
smf_addr
)
{
bool
amf_n11
::
smf_selection_from_context
(
st
d
::
st
ring
&
smf_addr
)
{
}
}
// handlers for smf client response
// handlers for smf client response
...
@@ -289,7 +294,7 @@ void amf_n11::handle_post_sm_context_response_error_400() {
...
@@ -289,7 +294,7 @@ void amf_n11::handle_post_sm_context_response_error_400() {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n11
::
handle_post_sm_context_response_error
(
long
code
,
st
ring
cause
,
bstring
n1sm
,
string
supi
,
uint8_t
pdu_session_id
)
{
void
amf_n11
::
handle_post_sm_context_response_error
(
long
code
,
st
d
::
string
cause
,
bstring
n1sm
,
std
::
string
supi
,
uint8_t
pdu_session_id
)
{
print_buffer
(
"amf_n11"
,
"n1 sm"
,
(
uint8_t
*
)
bdata
(
n1sm
),
blength
(
n1sm
));
print_buffer
(
"amf_n11"
,
"n1 sm"
,
(
uint8_t
*
)
bdata
(
n1sm
),
blength
(
n1sm
));
itti_n1n2_message_transfer_request
*
itti_msg
=
new
itti_n1n2_message_transfer_request
(
TASK_AMF_N11
,
TASK_AMF_APP
);
itti_n1n2_message_transfer_request
*
itti_msg
=
new
itti_n1n2_message_transfer_request
(
TASK_AMF_N11
,
TASK_AMF_APP
);
itti_msg
->
n1sm
=
n1sm
;
itti_msg
->
n1sm
=
n1sm
;
...
@@ -304,7 +309,7 @@ void amf_n11::handle_post_sm_context_response_error(long code, string cause, bst
...
@@ -304,7 +309,7 @@ void amf_n11::handle_post_sm_context_response_error(long code, string cause, bst
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
amf_n11
::
curl_http_client
(
st
ring
remoteUri
,
string
jsonData
,
string
n1SmMsg
,
string
n2SmMsg
,
string
supi
,
uint8_t
pdu_session_id
)
{
void
amf_n11
::
curl_http_client
(
st
d
::
string
remoteUri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
)
{
Logger
::
amf_n11
().
debug
(
"Call SMF service operation: %s"
,
remoteUri
.
c_str
());
Logger
::
amf_n11
().
debug
(
"Call SMF service operation: %s"
,
remoteUri
.
c_str
());
CURL
*
curl
=
curl_easy_init
();
CURL
*
curl
=
curl_easy_init
();
if
(
curl
)
{
if
(
curl
)
{
...
@@ -361,10 +366,10 @@ void amf_n11::curl_http_client(string remoteUri, string jsonData, string n1SmMsg
...
@@ -361,10 +366,10 @@ void amf_n11::curl_http_client(string remoteUri, string jsonData, string n1SmMsg
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
//get cause from the response
//get cause from the response
string
response
=
*
httpData
.
get
();
st
d
::
st
ring
response
=
*
httpData
.
get
();
string
jsonData
=
""
;
st
d
::
st
ring
jsonData
=
""
;
string
n1sm
=
""
;
st
d
::
st
ring
n1sm
=
""
;
string
n2sm
=
""
;
st
d
::
st
ring
n2sm
=
""
;
bool
is_response_ok
=
true
;
bool
is_response_ok
=
true
;
Logger
::
amf_n11
().
debug
(
"Get response with httpcode (%d)"
,
httpCode
);
Logger
::
amf_n11
().
debug
(
"Get response with httpcode (%d)"
,
httpCode
);
if
(
httpCode
==
0
)
{
if
(
httpCode
==
0
)
{
...
@@ -386,7 +391,7 @@ void amf_n11::curl_http_client(string remoteUri, string jsonData, string n1SmMsg
...
@@ -386,7 +391,7 @@ void amf_n11::curl_http_client(string remoteUri, string jsonData, string n1SmMsg
msg_str_2_msg_hex
(
n1sm
.
substr
(
0
,
n1sm
.
length
()
-
2
),
n1sm_hex
);
//pdu session establishment reject bugs from SMF
msg_str_2_msg_hex
(
n1sm
.
substr
(
0
,
n1sm
.
length
()
-
2
),
n1sm_hex
);
//pdu session establishment reject bugs from SMF
print_buffer
(
"amf_n11"
,
"Get response with n1sm:"
,
(
uint8_t
*
)
bdata
(
n1sm_hex
),
blength
(
n1sm_hex
));
print_buffer
(
"amf_n11"
,
"Get response with n1sm:"
,
(
uint8_t
*
)
bdata
(
n1sm_hex
),
blength
(
n1sm_hex
));
string
cause
=
response_data
[
"error"
][
"cause"
];
st
d
::
st
ring
cause
=
response_data
[
"error"
][
"cause"
];
Logger
::
amf_n11
().
error
(
"Call Network Function services failure "
);
Logger
::
amf_n11
().
error
(
"Call Network Function services failure "
);
Logger
::
amf_n11
().
info
(
"Cause value: %s"
,
cause
.
c_str
());
Logger
::
amf_n11
().
info
(
"Cause value: %s"
,
cause
.
c_str
());
if
(
!
cause
.
compare
(
"DNN_DENIED"
))
if
(
!
cause
.
compare
(
"DNN_DENIED"
))
...
...
src/amf-app/amf_n11.hpp
View file @
c241a274
...
@@ -33,7 +33,6 @@
...
@@ -33,7 +33,6 @@
#include <shared_mutex>
#include <shared_mutex>
#include "pdu_session_context.hpp"
#include "pdu_session_context.hpp"
#include <string>
#include <string>
using
namespace
std
;
namespace
amf_application
{
namespace
amf_application
{
...
@@ -43,22 +42,22 @@ class amf_n11 {
...
@@ -43,22 +42,22 @@ class amf_n11 {
~
amf_n11
();
~
amf_n11
();
void
handle_itti_message
(
itti_smf_services_consumer
&
);
void
handle_itti_message
(
itti_smf_services_consumer
&
);
void
handle_pdu_session_initial_request
(
st
ring
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
string
smf_addr
,
bstring
sm_msg
,
string
dnn
);
void
handle_pdu_session_initial_request
(
st
d
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
std
::
map
<
string
,
std
::
shared_ptr
<
pdu_session_context
>>
supi2pdu
;
// amf ue ngap id
std
::
map
<
st
d
::
st
ring
,
std
::
shared_ptr
<
pdu_session_context
>>
supi2pdu
;
// amf ue ngap id
mutable
std
::
shared_mutex
m_supi2pdu
;
mutable
std
::
shared_mutex
m_supi2pdu
;
bool
is_supi_to_pdu_ctx
(
const
string
&
supi
)
const
;
bool
is_supi_to_pdu_ctx
(
const
st
d
::
st
ring
&
supi
)
const
;
std
::
shared_ptr
<
pdu_session_context
>
supi_to_pdu_ctx
(
const
string
&
supi
)
const
;
std
::
shared_ptr
<
pdu_session_context
>
supi_to_pdu_ctx
(
const
st
d
::
st
ring
&
supi
)
const
;
void
set_supi_to_pdu_ctx
(
const
string
&
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
);
void
set_supi_to_pdu_ctx
(
const
st
d
::
st
ring
&
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
);
std
::
map
<
uint8_t
,
string
>
pduid2supi
;
std
::
map
<
uint8_t
,
st
d
::
st
ring
>
pduid2supi
;
bool
smf_selection_from_configuration
(
string
&
smf_addr
);
bool
smf_selection_from_configuration
(
st
d
::
st
ring
&
smf_addr
);
bool
smf_selection_from_context
(
string
&
smf_addr
);
bool
smf_selection_from_context
(
st
d
::
st
ring
&
smf_addr
);
void
handle_post_sm_context_response_error_400
();
void
handle_post_sm_context_response_error_400
();
void
handle_post_sm_context_response_error
(
long
code
,
st
ring
cause
,
bstring
n1sm
,
string
supi
,
uint8_t
pdu_session_id
);
void
handle_post_sm_context_response_error
(
long
code
,
st
d
::
string
cause
,
bstring
n1sm
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
void
curl_http_client
(
st
ring
remoteUri
,
string
jsonData
,
string
n1SmMsg
,
string
n2SmMsg
,
string
supi
,
uint8_t
pdu_session_id
);
void
curl_http_client
(
st
d
::
string
remoteUri
,
std
::
string
jsonData
,
std
::
string
n1SmMsg
,
std
::
string
n2SmMsg
,
std
::
string
supi
,
uint8_t
pdu_session_id
);
};
};
}
}
...
...
src/amf-app/amf_n2.cpp
View file @
c241a274
...
@@ -47,7 +47,6 @@
...
@@ -47,7 +47,6 @@
#include "Ngap_TimeToWait.h"
#include "Ngap_TimeToWait.h"
using
namespace
amf_application
;
using
namespace
amf_application
;
using
namespace
std
;
using
namespace
config
;
using
namespace
config
;
extern
itti_mw
*
itti_inst
;
extern
itti_mw
*
itti_inst
;
extern
amf_n2
*
amf_n2_inst
;
extern
amf_n2
*
amf_n2_inst
;
...
@@ -127,7 +126,7 @@ void amf_n2_task(void *args_p) {
...
@@ -127,7 +126,7 @@ void amf_n2_task(void *args_p) {
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
amf_n2
::
amf_n2
(
const
string
&
address
,
const
uint16_t
port_num
)
amf_n2
::
amf_n2
(
const
st
d
::
st
ring
&
address
,
const
uint16_t
port_num
)
:
:
ngap_app
(
address
,
port_num
)
{
ngap_app
(
address
,
port_num
)
{
if
(
itti_inst
->
create_task
(
TASK_AMF_N2
,
amf_n2_task
,
nullptr
))
{
if
(
itti_inst
->
create_task
(
TASK_AMF_N2
,
amf_n2_task
,
nullptr
))
{
...
@@ -169,8 +168,8 @@ void amf_n2::handle_itti_message(itti_ng_setup_request &itti_msg) {
...
@@ -169,8 +168,8 @@ void amf_n2::handle_itti_message(itti_ng_setup_request &itti_msg) {
//Get IE Global RAN Node ID
//Get IE Global RAN Node ID
uint32_t
gnb_id
;
uint32_t
gnb_id
;
string
gnb_mcc
;
st
d
::
st
ring
gnb_mcc
;
string
gnb_mnc
;
st
d
::
st
ring
gnb_mnc
;
if
(
!
itti_msg
.
ngSetupReq
->
getGlobalGnbID
(
gnb_id
,
gnb_mcc
,
gnb_mnc
))
{
if
(
!
itti_msg
.
ngSetupReq
->
getGlobalGnbID
(
gnb_id
,
gnb_mcc
,
gnb_mnc
))
{
Logger
::
amf_n2
().
error
(
"Missing Mandatory IE GlobalGnbID"
);
Logger
::
amf_n2
().
error
(
"Missing Mandatory IE GlobalGnbID"
);
return
;
return
;
...
@@ -179,7 +178,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request &itti_msg) {
...
@@ -179,7 +178,7 @@ void amf_n2::handle_itti_message(itti_ng_setup_request &itti_msg) {
gc
->
globalRanNodeId
=
gnb_id
;
gc
->
globalRanNodeId
=
gnb_id
;
gnbItem
.
gnb_id
=
gnb_id
;
gnbItem
.
gnb_id
=
gnb_id
;
string
gnb_name
;
st
d
::
st
ring
gnb_name
;
if
(
!
itti_msg
.
ngSetupReq
->
getRanNodeName
(
gnb_name
))
{
if
(
!
itti_msg
.
ngSetupReq
->
getRanNodeName
(
gnb_name
))
{
Logger
::
amf_n2
().
warn
(
"IE RanNodeName not existed"
);
Logger
::
amf_n2
().
warn
(
"IE RanNodeName not existed"
);
}
else
{
}
else
{
...
...
src/amf-app/amf_n2.hpp
View file @
c241a274
...
@@ -37,7 +37,7 @@ namespace amf_application{
...
@@ -37,7 +37,7 @@ namespace amf_application{
class
amf_n2
:
public
ngap
::
ngap_app
{
class
amf_n2
:
public
ngap
::
ngap_app
{
public:
public:
amf_n2
(
const
string
&
address
,
const
uint16_t
port_num
);
amf_n2
(
const
st
d
::
st
ring
&
address
,
const
uint16_t
port_num
);
~
amf_n2
();
~
amf_n2
();
//void handle_receive(bstring payload, sctp_assoc_id_t assoc_id, sctp_stream_id_t stream, sctp_stream_id_t instreams, sctp_stream_id_t outstreams);
//void handle_receive(bstring payload, sctp_assoc_id_t assoc_id, sctp_stream_id_t stream, sctp_stream_id_t instreams, sctp_stream_id_t outstreams);
void
handle_itti_message
(
itti_new_sctp_association
&
new_assoc
);
void
handle_itti_message
(
itti_new_sctp_association
&
new_assoc
);
...
@@ -49,7 +49,7 @@ class amf_n2 : public ngap::ngap_app{
...
@@ -49,7 +49,7 @@ class amf_n2 : public ngap::ngap_app{
void
handle_itti_message
(
itti_pdu_session_resource_setup_request
&
itti_msg
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_request
&
itti_msg
);
void
handle_itti_message
(
itti_ue_context_release_request
&
itti_msg
);
void
handle_itti_message
(
itti_ue_context_release_request
&
itti_msg
);
void
handle_itti_message
(
itti_ue_radio_capability_indication
&
itti_msg
);
void
handle_itti_message
(
itti_ue_radio_capability_indication
&
itti_msg
);
bool
verifyPlmn
(
vector
<
SupportedItem_t
>
list
);
bool
verifyPlmn
(
std
::
vector
<
SupportedItem_t
>
list
);
private:
private:
std
::
map
<
uint32_t
,
std
::
shared_ptr
<
ue_ngap_context
>>
ranid2uecontext
;
// ran ue ngap id
std
::
map
<
uint32_t
,
std
::
shared_ptr
<
ue_ngap_context
>>
ranid2uecontext
;
// ran ue ngap id
mutable
std
::
shared_mutex
m_ranid2uecontext
;
mutable
std
::
shared_mutex
m_ranid2uecontext
;
...
...
src/amf-app/amf_statistics.cpp
View file @
c241a274
...
@@ -29,11 +29,10 @@
...
@@ -29,11 +29,10 @@
#include "amf_statistics.hpp"
#include "amf_statistics.hpp"
#include "logger.hpp"
#include "logger.hpp"
#include <iostream>
#include <iostream>
using
namespace
std
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
statistics
::
display
()
{
void
statistics
::
display
()
{
cout
<<
endl
;
Logger
::
amf_app
().
info
(
""
)
;
//Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("| connected gNBs | connected UEs | registered UEs |");
//Logger::amf_app().info("| connected gNBs | connected UEs | registered UEs |");
//Logger::amf_app().info("--------------------------------------------------");
//Logger::amf_app().info("--------------------------------------------------");
...
...
src/amf-app/amf_statistics.hpp
View file @
c241a274
...
@@ -35,26 +35,25 @@
...
@@ -35,26 +35,25 @@
#include <vector>
#include <vector>
#include <string>
#include <string>
using
namespace
std
;
typedef
struct
{
typedef
struct
{
uint32_t
gnb_id
;
uint32_t
gnb_id
;
string
mcc
;
st
d
::
st
ring
mcc
;
string
mnc
;
st
d
::
st
ring
mnc
;
string
gnb_name
;
st
d
::
st
ring
gnb_name
;
uint32_t
tac
;
uint32_t
tac
;
//long nrCellId;
//long nrCellId;
}
gnb_infos
;
}
gnb_infos
;
typedef
struct
{
typedef
struct
{
string
connStatus
;
st
d
::
st
ring
connStatus
;
string
registerStatus
;
st
d
::
st
ring
registerStatus
;
uint32_t
ranid
;
uint32_t
ranid
;
long
amfid
;
long
amfid
;
string
imsi
;
st
d
::
st
ring
imsi
;
string
guti
;
st
d
::
st
ring
guti
;
string
mcc
;
st
d
::
st
ring
mcc
;
string
mnc
;
st
d
::
st
ring
mnc
;
uint32_t
cellId
;
uint32_t
cellId
;
}
ue_infos
;
}
ue_infos
;
...
@@ -68,8 +67,8 @@ class statistics {
...
@@ -68,8 +67,8 @@ class statistics {
uint32_t
UE_connected
;
uint32_t
UE_connected
;
uint32_t
UE_registred
;
uint32_t
UE_registred
;
//uint32_t system_pdu_sessions;
//uint32_t system_pdu_sessions;
vector
<
gnb_infos
>
gnbs
;
std
::
vector
<
gnb_infos
>
gnbs
;
vector
<
ue_infos
>
ues
;
std
::
vector
<
ue_infos
>
ues
;
};
};
...
...
src/common/comUt.hpp
View file @
c241a274
...
@@ -31,10 +31,9 @@
...
@@ -31,10 +31,9 @@
#include "logger.hpp"
#include "logger.hpp"
#include <string>
#include <string>
using
namespace
std
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
print_buffer
(
const
st
ring
app
,
const
string
commit
,
uint8_t
*
buf
,
int
len
)
{
void
print_buffer
(
const
st
d
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
)
{
if
(
!
app
.
compare
(
"amf_app"
))
if
(
!
app
.
compare
(
"amf_app"
))
Logger
::
amf_app
().
debug
(
commit
.
c_str
());
Logger
::
amf_app
().
debug
(
commit
.
c_str
());
if
(
!
app
.
compare
(
"amf_n1"
))
if
(
!
app
.
compare
(
"amf_n1"
))
...
...
src/contexts/gNB_context.hpp
View file @
c241a274
...
@@ -40,7 +40,6 @@ extern "C" {
...
@@ -40,7 +40,6 @@ extern "C" {
}
}
using
namespace
sctp
;
using
namespace
sctp
;
using
namespace
std
;
using
namespace
ngap
;
using
namespace
ngap
;
enum
amf_ng_gnb_state_s
{
enum
amf_ng_gnb_state_s
{
...
@@ -53,10 +52,10 @@ class gnb_context {
...
@@ -53,10 +52,10 @@ class gnb_context {
public:
public:
enum
amf_ng_gnb_state_s
ng_state
;
enum
amf_ng_gnb_state_s
ng_state
;
string
gnb_name
;
st
d
::
st
ring
gnb_name
;
long
globalRanNodeId
;
long
globalRanNodeId
;
e_Ngap_PagingDRX
default_paging_drx
;
//v32, v64, v128, v256
e_Ngap_PagingDRX
default_paging_drx
;
//v32, v64, v128, v256
vector
<
SupportedItem_t
>
s_ta_list
;
std
::
vector
<
SupportedItem_t
>
s_ta_list
;
bstring
ue_radio_cap_ind
;
bstring
ue_radio_cap_ind
;
sctp_assoc_id_t
sctp_assoc_id
;
sctp_assoc_id_t
sctp_assoc_id
;
...
...
src/contexts/nas_context.hpp
View file @
c241a274
...
@@ -45,7 +45,7 @@ class nas_context {
...
@@ -45,7 +45,7 @@ class nas_context {
bool
is_stacs_available
;
bool
is_stacs_available
;
long
amf_ue_ngap_id
;
long
amf_ue_ngap_id
;
uint32_t
ran_ue_ngap_id
;
uint32_t
ran_ue_ngap_id
;
string
nas_status
;
st
d
::
st
ring
nas_status
;
/************ parameters from Registration request *************/
/************ parameters from Registration request *************/
uint8_t
registration_type
:
3
;
uint8_t
registration_type
:
3
;
...
...
src/contexts/pdu_session_context.hpp
View file @
c241a274
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include <string>
#include <string>
#include "bstrlib.h"
#include "bstrlib.h"
using
namespace
std
;
class
pdu_session_context
{
class
pdu_session_context
{
public:
public:
...
@@ -43,8 +42,8 @@ class pdu_session_context {
...
@@ -43,8 +42,8 @@ class pdu_session_context {
uint8_t
req_type
;
uint8_t
req_type
;
uint8_t
pdu_session_id
;
uint8_t
pdu_session_id
;
bstring
n2sm
;
bstring
n2sm
;
string
dnn
;
st
d
::
st
ring
dnn
;
string
remote_smf_addr
[
0
];
//"192.168.12.10:8080"
st
d
::
st
ring
remote_smf_addr
[
0
];
//"192.168.12.10:8080"
bool
smf_avaliable
;
bool
smf_avaliable
;
};
};
#endif
#endif
src/ngap/ngap_app/ngap_app.cpp
View file @
c241a274
...
@@ -42,7 +42,7 @@ using namespace config;
...
@@ -42,7 +42,7 @@ using namespace config;
using
namespace
ngap
;
using
namespace
ngap
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
ngap_app
::
ngap_app
(
const
string
&
address
,
const
uint16_t
port_num
)
ngap_app
::
ngap_app
(
const
st
d
::
st
ring
&
address
,
const
uint16_t
port_num
)
:
:
ppid_
(
60
),
ppid_
(
60
),
sctp_s_38412
(
address
.
c_str
(),
port_num
)
{
sctp_s_38412
(
address
.
c_str
(),
port_num
)
{
...
...
src/ngap/ngap_app/ngap_app.hpp
View file @
c241a274
...
@@ -45,7 +45,7 @@ static const char *const ng_gnb_state_str[] = { "NGAP_INIT", "NGAP_RESETTING", "
...
@@ -45,7 +45,7 @@ static const char *const ng_gnb_state_str[] = { "NGAP_INIT", "NGAP_RESETTING", "
class
ngap_app
:
public
sctp_application
{
class
ngap_app
:
public
sctp_application
{
public:
public:
ngap_app
(
const
string
&
address
,
const
uint16_t
port_num
);
ngap_app
(
const
st
d
::
st
ring
&
address
,
const
uint16_t
port_num
);
~
ngap_app
();
~
ngap_app
();
uint32_t
getPpid
();
uint32_t
getPpid
();
protected:
protected:
...
...
src/oai-amf/main.cpp
View file @
c241a274
...
@@ -30,7 +30,6 @@ extern void hexStr2Byte(const char *src, unsigned char *dest, int len);
...
@@ -30,7 +30,6 @@ extern void hexStr2Byte(const char *src, unsigned char *dest, int len);
extern
void
print_buffer
(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
extern
void
print_buffer
(
const
std
::
string
app
,
const
std
::
string
commit
,
uint8_t
*
buf
,
int
len
);
extern
void
ue_gnb_simulator
();
extern
void
ue_gnb_simulator
();
using
namespace
std
;
using
namespace
config
;
using
namespace
config
;
using
namespace
amf_application
;
using
namespace
amf_application
;
...
@@ -45,7 +44,7 @@ int main(int argc, char **argv) {
...
@@ -45,7 +44,7 @@ int main(int argc, char **argv) {
srand
(
time
(
NULL
));
srand
(
time
(
NULL
));
if
(
!
Options
::
parse
(
argc
,
argv
))
{
if
(
!
Options
::
parse
(
argc
,
argv
))
{
cout
<<
"Options::parse() failed"
<<
endl
;
std
::
cout
<<
"Options::parse() failed"
<<
std
::
endl
;
return
1
;
return
1
;
}
}
...
...
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
View file @
c241a274
...
@@ -52,7 +52,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(const std::str
...
@@ -52,7 +52,7 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(const std::str
Logger
::
amf_server
().
debug
(
"receive N1N2MessageTransfer Request, handling..."
);
Logger
::
amf_server
().
debug
(
"receive N1N2MessageTransfer Request, handling..."
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
string
supi
=
ueContextId
;
st
d
::
st
ring
supi
=
ueContextId
;
Logger
::
amf_server
().
debug
(
"Key for pdu session context: supi(%s)"
,
supi
.
c_str
());
Logger
::
amf_server
().
debug
(
"Key for pdu session context: supi(%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
std
::
shared_ptr
<
pdu_session_context
>
psc
;
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
)){
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
)){
...
...
src/sbi/smf_client/smf-client.hpp
View file @
c241a274
...
@@ -30,7 +30,7 @@ extern std::size_t callback(
...
@@ -30,7 +30,7 @@ extern std::size_t callback(
std
::
size_t
size
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
size_t
num
,
std
::
string
*
out
);
std
::
string
*
out
);
extern
bool
multipart_parser
(
st
ring
input
,
string
&
jsonData
,
string
&
n1sm
,
string
&
n2sm
);
extern
bool
multipart_parser
(
st
d
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
);
//---------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------
void
send_pdu_session_establishment_request
()
void
send_pdu_session_establishment_request
()
...
@@ -124,10 +124,10 @@ void send_pdu_session_establishment_request()
...
@@ -124,10 +124,10 @@ void send_pdu_session_establishment_request()
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
//get cause from the response
//get cause from the response
string
response
=
*
httpData
.
get
();
st
d
::
st
ring
response
=
*
httpData
.
get
();
string
jsonData
=
""
;
st
d
::
st
ring
jsonData
=
""
;
string
n1sm
=
""
;
st
d
::
st
ring
n1sm
=
""
;
string
n2sm
=
""
;
st
d
::
st
ring
n2sm
=
""
;
if
(
httpCode
!=
200
&&
httpCode
!=
201
){
if
(
httpCode
!=
200
&&
httpCode
!=
201
){
if
(
!
(
multipart_parser
(
response
,
jsonData
,
n1sm
,
n2sm
))){
if
(
!
(
multipart_parser
(
response
,
jsonData
,
n1sm
,
n2sm
))){
std
::
cout
<<
"Could not get the cause from the response"
<<
std
::
endl
;
std
::
cout
<<
"Could not get the cause from the response"
<<
std
::
endl
;
...
@@ -419,9 +419,9 @@ int main_test()
...
@@ -419,9 +419,9 @@ int main_test()
}
}
extern
void
octet_stream_2_hex_stream
(
uint8_t
*
buf
,
int
len
,
string
&
out
);
extern
void
octet_stream_2_hex_stream
(
uint8_t
*
buf
,
int
len
,
st
d
::
st
ring
&
out
);
void
hexTest
(){
void
hexTest
(){
string
hexString
;
st
d
::
st
ring
hexString
;
uint8_t
test
[
4
]
=
{
0x12
,
0x43
,
0x00
,
0x45
};
uint8_t
test
[
4
]
=
{
0x12
,
0x43
,
0x00
,
0x45
};
octet_stream_2_hex_stream
(
test
,
4
,
hexString
);
octet_stream_2_hex_stream
(
test
,
4
,
hexString
);
printf
(
"hexStream: %s
\n
"
,
hexString
.
c_str
());
printf
(
"hexStream: %s
\n
"
,
hexString
.
c_str
());
...
...
src/sctp/sctp_server.cpp
View file @
c241a274
...
@@ -47,7 +47,6 @@ extern "C" {
...
@@ -47,7 +47,6 @@ extern "C" {
}
}
#include <iostream>
#include <iostream>
using
namespace
std
;
namespace
sctp
{
namespace
sctp
{
...
...
src/sctp/sctp_server.hpp
View file @
c241a274
...
@@ -38,7 +38,6 @@ extern "C" {
...
@@ -38,7 +38,6 @@ extern "C" {
}
}
#include <vector>
#include <vector>
#include <iostream>
#include <iostream>
using
namespace
std
;
#define SCTP_RECV_BUFFER_SIZE 1024
#define SCTP_RECV_BUFFER_SIZE 1024
#define SCTP_RC_ERROR -1
#define SCTP_RC_ERROR -1
...
@@ -106,7 +105,7 @@ class sctp_server {
...
@@ -106,7 +105,7 @@ class sctp_server {
sctp_descriptor_t
sctp_desc
;
sctp_descriptor_t
sctp_desc
;
struct
sockaddr_in
serverAddr_
;
struct
sockaddr_in
serverAddr_
;
struct
sctp_event_subscribe
events_
;
struct
sctp_event_subscribe
events_
;
vector
<
sctp_association_t
*>
sctp_ctx
;
std
::
vector
<
sctp_association_t
*>
sctp_ctx
;
};
};
}
}
...
...
src/utils/String2Value.hpp
View file @
c241a274
#include <iostream>
#include <iostream>
#include <sstream>
#include <sstream>
#include <string>
#include <string>
using
namespace
std
;
template
<
class
T
>
template
<
class
T
>
inline
T
fromString
(
const
string
&
str
){
inline
T
fromString
(
const
st
d
::
st
ring
&
str
){
istringstream
is
(
str
);
std
::
istringstream
is
(
str
);
T
v
;
T
v
;
is
>>
v
;
is
>>
v
;
return
v
;
return
v
;
...
...
src/utils/http_multi_parser.cpp
View file @
c241a274
#include "mime_parser.hpp"
#include "mime_parser.hpp"
#include <string>
#include <string>
#include <iostream>
#include <iostream>
using
namespace
std
;
bool
multipart_parser
(
std
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
)
{
bool
multipart_parser
(
std
::
string
input
,
std
::
string
&
jsonData
,
std
::
string
&
n1sm
,
std
::
string
&
n2sm
)
{
...
...
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