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
3568333c
Commit
3568333c
authored
Feb 03, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use unique_ptr instead of naked pointer
parent
edf07137
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
36 deletions
+37
-36
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+14
-15
src/amf-app/amf_config.hpp
src/amf-app/amf_config.hpp
+0
-1
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+4
-4
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+1
-4
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+0
-2
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+18
-10
No files found.
src/amf-app/amf_config.cpp
View file @
3568333c
...
...
@@ -63,7 +63,7 @@ amf_config::amf_config() {
enable_nf_registration
=
false
;
enable_smf_selection
=
false
;
enable_external_ausf
=
false
;
enable_external_udm
=
false
;
enable_external_udm
=
false
;
// TODO:
}
...
...
@@ -241,7 +241,7 @@ int amf_config::load(const std::string& config_file) {
struct
in_addr
ausf_ipv4_addr
;
unsigned
int
ausf_port
=
0
;
std
::
string
ausf_api_version
;
//string address;
//
string address;
ausf_cfg
.
lookupValue
(
AMF_CONFIG_STRING_IPV4_ADDRESS
,
address
);
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
address
).
c_str
(),
ausf_ipv4_addr
,
...
...
@@ -450,24 +450,23 @@ void amf_config::display() {
Logger
::
config
().
info
(
" port ..................: %d"
,
n11
.
port
);
if
(
enable_nf_registration
or
enable_smf_selection
)
{
Logger
::
config
().
info
(
"- NRF:"
);
Logger
::
config
().
info
(
" IP addr ..............: %s"
,
inet_ntoa
(
nrf_addr
.
ipv4_addr
));
Logger
::
config
().
info
(
" Port .................: %d"
,
nrf_addr
.
port
);
Logger
::
config
().
info
(
" Api version ..........: %s"
,
nrf_addr
.
api_version
.
c_str
());
Logger
::
config
().
info
(
"- NRF:"
);
Logger
::
config
().
info
(
" IP addr ..............: %s"
,
inet_ntoa
(
nrf_addr
.
ipv4_addr
));
Logger
::
config
().
info
(
" Port .................: %d"
,
nrf_addr
.
port
);
Logger
::
config
().
info
(
" Api version ..........: %s"
,
nrf_addr
.
api_version
.
c_str
());
}
if
(
enable_external_ausf
)
{
Logger
::
config
().
info
(
"- AUSF:"
);
Logger
::
config
().
info
(
" IP addr ..............: %s"
,
inet_ntoa
(
ausf_addr
.
ipv4_addr
));
Logger
::
config
().
info
(
" Port .................: %d"
,
ausf_addr
.
port
);
Logger
::
config
().
info
(
" Api version ..........: %s"
,
ausf_addr
.
api_version
.
c_str
());
Logger
::
config
().
info
(
"- AUSF:"
);
Logger
::
config
().
info
(
" IP addr ..............: %s"
,
inet_ntoa
(
ausf_addr
.
ipv4_addr
));
Logger
::
config
().
info
(
" Port .................: %d"
,
ausf_addr
.
port
);
Logger
::
config
().
info
(
" Api version ..........: %s"
,
ausf_addr
.
api_version
.
c_str
());
}
// Logger::config().info(" HTTP2 port ............: %d", n11_http2_port);
Logger
::
config
().
info
(
"- Remote SMF Pool.........: "
);
...
...
src/amf-app/amf_config.hpp
View file @
3568333c
...
...
@@ -209,7 +209,6 @@ class amf_config {
unsigned
int
port
;
std
::
string
api_version
;
}
ausf_addr
;
}
;
}
// namespace config
...
...
src/amf-app/amf_n1.cpp
View file @
3568333c
...
...
@@ -1166,15 +1166,16 @@ void amf_n1::run_registration_procedure(std::shared_ptr<nas_context>& nc) {
}
//------------------------------------------------------------------------------
// Get authentication vectors either from AUSF(UDM) or from AMF (generate locally)
// Get authentication vectors either from AUSF(UDM) or from AMF (generate
// locally)
bool
amf_n1
::
auth_vectors_generator
(
std
::
shared_ptr
<
nas_context
>&
nc
)
{
Logger
::
amf_n1
().
debug
(
"Start to generate authentication vectors"
);
authentication_vectors_generator_in_udm
(
nc
);
if
(
amf_cfg
.
enable_external_ausf
)
{
//
get authentication vectors from AUSF
//
get authentication vectors from AUSF
if
(
!
get_authentication_vectors_from_ausf
(
nc
))
return
false
;
}
else
{
//
generate authentication vectors locally
//
generate authentication vectors locally
authentication_vectors_generator_in_ausf
(
nc
);
Logger
::
amf_n1
().
debug
(
"Deriving kamf"
);
for
(
int
i
=
0
;
i
<
MAX_5GS_AUTH_VECTORS
;
i
++
)
{
...
...
@@ -1213,7 +1214,6 @@ bool amf_n1::get_authentication_vectors_from_ausf(
if
(
amf_n11_inst
->
send_ue_authentication_request
(
authenticationinfo
,
ueauthenticationctx
,
1
))
{
unsigned
char
*
r5gauthdata_rand
=
format_string_as_hex
(
ueauthenticationctx
.
getR5gAuthData
().
getRand
());
memcpy
(
nc
.
get
()
->
_5g_av
[
0
].
rand
,
r5gauthdata_rand
,
16
);
...
...
src/amf-app/amf_n11.cpp
View file @
3568333c
...
...
@@ -946,13 +946,12 @@ bool amf_n11::send_ue_authentication_request(
}
//-----------------------------------------------------------------------------------------------------
//From AMF_N1, need to be reworked
//
From AMF_N1, need to be reworked
void
amf_n11
::
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
Method
,
std
::
string
msgBody
,
std
::
string
&
Response
)
{
Logger
::
amf_n1
().
info
(
"Send HTTP message with body %s"
,
msgBody
.
c_str
());
uint32_t
str_len
=
msgBody
.
length
();
char
*
body_data
=
(
char
*
)
malloc
(
str_len
+
1
);
memset
(
body_data
,
0
,
str_len
+
1
);
...
...
@@ -1064,6 +1063,4 @@ void amf_n11::curl_http_client(
body_data
=
NULL
;
}
fflush
(
stdout
);
}
src/amf-app/amf_n11.hpp
View file @
3568333c
...
...
@@ -91,8 +91,6 @@ class amf_n11 {
bool
send_ue_authentication_request
(
oai
::
amf
::
model
::
AuthenticationInfo
&
auth_info
,
oai
::
amf
::
model
::
UEAuthenticationCtx
&
ue_auth_ctx
,
uint8_t
http_version
);
};
}
// namespace amf_application
...
...
src/amf-app/amf_n2.cpp
View file @
3568333c
...
...
@@ -968,7 +968,9 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
/**********************send handover request to target
* gnb*******************************/
HandoverRequest
*
handoverrequest
=
new
HandoverRequest
();
// HandoverRequest* handoverrequest = new HandoverRequest();
std
::
unique_ptr
<
HandoverRequest
>
handoverrequest
=
std
::
make_unique
<
HandoverRequest
>
();
handoverrequest
->
setMessageType
();
handoverrequest
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
handoverrequest
->
setHandoverType
(
0
);
...
...
@@ -1044,7 +1046,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
handoverrequest
->
setGUAMI
(
m_plmnId
,
m_aMFRegionID
,
m_aMFSetID
,
m_aMFPointer
);
uint8_t
buffer
[
20240
];
int
encoded_size
=
handoverrequest
->
encode2buffer
(
buffer
,
20240
);
delete
handoverrequest
;
//
delete handoverrequest;
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
std
::
shared_ptr
<
gnb_context
>
gc_target
;
gc_target
=
gnb_id_2_gnb_context
(
gnbid
->
getValue
());
...
...
@@ -1113,7 +1115,9 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
/**************************send HandoverCommandMsg to Source
* gnb**************************/
HandoverCommandMsg
*
handovercommand
=
new
HandoverCommandMsg
();
// HandoverCommandMsg* handovercommand = new HandoverCommandMsg();
std
::
unique_ptr
<
HandoverCommandMsg
>
handovercommand
=
std
::
make_unique
<
HandoverCommandMsg
>
();
handovercommand
->
setMessageType
();
handovercommand
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
handovercommand
->
setRanUeNgapId
(
ran_id_Global
);
...
...
@@ -1158,7 +1162,7 @@ void amf_n2::handle_itti_message(itti_handover_request_Ack& itti_msg) {
/**************************setPduSessionResourceHandoverList_PDYSessionID_handovercommandtransfer-end**************************/
uint8_t
buffer
[
10240
];
int
encoded_size
=
handovercommand
->
encode2buffer
(
buffer
,
10240
);
delete
handovercommand
;
//
delete handovercommand;
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_id_Global
))
{
...
...
@@ -1198,15 +1202,17 @@ void amf_n2::handle_itti_message(itti_handover_notify& itti_msg) {
Logger
::
amf_n2
().
debug
(
"Missing IE UserLocationInformationNR"
);
return
;
}
UEContextReleaseCommandMsg
*
ueContextReleaseCommand
=
new
UEContextReleaseCommandMsg
();
// UEContextReleaseCommandMsg* ueContextReleaseCommand =
// new UEContextReleaseCommandMsg();
std
::
unique_ptr
<
UEContextReleaseCommandMsg
>
ueContextReleaseCommand
=
std
::
make_unique
<
UEContextReleaseCommandMsg
>
();
ueContextReleaseCommand
->
setMessageType
();
ueContextReleaseCommand
->
setUeNgapIdPair
(
amf_ue_ngap_id
,
ran_id_Global
);
ueContextReleaseCommand
->
setCauseRadioNetwork
(
Ngap_CauseRadioNetwork_successful_handover
);
uint8_t
buffer
[
10240
];
int
encoded_size
=
ueContextReleaseCommand
->
encode2buffer
(
buffer
,
10240
);
delete
ueContextReleaseCommand
;
//
delete ueContextReleaseCommand;
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
std
::
shared_ptr
<
nas_context
>
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
...
...
@@ -1283,8 +1289,10 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
amf_DL_value
->
getvalue
(
amf_dl_pdcp
,
amf_hfn_dl_pdcp
);
long
amf_drb_id
;
amf_drb_id
=
*
amf_dRB_id
;
DownlinkRANStatusTransfer
*
downLinkranstatustransfer
=
new
DownlinkRANStatusTransfer
();
// DownlinkRANStatusTransfer* downLinkranstatustransfer =
// new DownlinkRANStatusTransfer();
std
::
unique_ptr
<
DownlinkRANStatusTransfer
>
downLinkranstatustransfer
=
std
::
make_unique
<
DownlinkRANStatusTransfer
>
();
downLinkranstatustransfer
->
setmessagetype
();
downLinkranstatustransfer
->
setAmfUeNgapId
(
amf_ue_ngap_id
);
downLinkranstatustransfer
->
setRanUeNgapId
(
AMF_TARGET_ran_id_global
);
...
...
@@ -1292,7 +1300,7 @@ void amf_n2::handle_itti_message(itti_uplinkranstatsutransfer& itti_msg) {
amf_drb_id
,
amf_ul_pdcp
,
amf_hfn_ul_pdcp
,
amf_dl_pdcp
,
amf_hfn_dl_pdcp
);
uint8_t
buffer
[
1024
];
int
encode_size
=
downLinkranstatustransfer
->
encodetobuffer
(
buffer
,
1024
);
delete
downLinkranstatustransfer
;
//
delete downLinkranstatustransfer;
bstring
b
=
blk2bstr
(
buffer
,
encode_size
);
// std::shared_ptr<ue_ngap_context> ngc =
// ran_ue_id_2_ue_ngap_context(AMF_TARGET_ran_id_global);
...
...
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