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
4b0b2e1b
Commit
4b0b2e1b
authored
Aug 20, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Directly use shared_ptr instead of raw ptr
parent
622341fb
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
613 additions
and
666 deletions
+613
-666
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+39
-41
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+4
-4
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+366
-398
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+137
-150
src/amf-app/amf_sbi.cpp
src/amf-app/amf_sbi.cpp
+44
-48
src/ngap/ngap_app/ngap_app.cpp
src/ngap/ngap_app/ngap_app.cpp
+9
-10
src/ngap/ngap_app/ngap_message_callback.hpp
src/ngap/ngap_app/ngap_message_callback.hpp
+4
-4
src/sbi/amf_server/amf-http2-server.cpp
src/sbi/amf_server/amf-http2-server.cpp
+5
-5
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
.../amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
+5
-6
No files found.
src/amf-app/amf_app.cpp
View file @
4b0b2e1b
...
...
@@ -238,7 +238,7 @@ bool amf_app::ran_amf_id_2_ue_context(
std
::
shared_lock
lock
(
m_ue_ctx_key
);
if
(
ue_ctx_key
.
count
(
ue_context_key
)
>
0
)
{
uc
=
ue_ctx_key
.
at
(
ue_context_key
);
if
(
uc
.
get
()
==
nullptr
)
return
false
;
if
(
uc
==
nullptr
)
return
false
;
return
true
;
}
else
return
false
;
...
...
@@ -278,7 +278,7 @@ bool amf_app::find_pdu_session_context(
if
(
!
is_supi_2_ue_context
(
supi
))
return
false
;
std
::
shared_ptr
<
ue_context
>
uc
=
{};
uc
=
supi_2_ue_context
(
supi
);
if
(
!
uc
.
get
()
->
find_pdu_session_context
(
pdu_session_id
,
psc
))
return
false
;
if
(
!
uc
->
find_pdu_session_context
(
pdu_session_id
,
psc
))
return
false
;
return
true
;
}
...
...
@@ -289,7 +289,7 @@ bool amf_app::get_pdu_sessions_context(
if
(
!
is_supi_2_ue_context
(
supi
))
return
false
;
std
::
shared_ptr
<
ue_context
>
uc
=
{};
uc
=
supi_2_ue_context
(
supi
);
if
(
!
uc
.
get
()
->
get_pdu_sessions_context
(
sessions_ctx
))
return
false
;
if
(
!
uc
->
get_pdu_sessions_context
(
sessions_ctx
))
return
false
;
return
true
;
}
...
...
@@ -311,8 +311,8 @@ void amf_app::handle_itti_message(
"Handle ITTI N1N2 Message Transfer Request for Paging"
);
std
::
shared_ptr
<
itti_paging
>
i
=
std
::
make_shared
<
itti_paging
>
(
TASK_AMF_APP
,
TASK_AMF_N2
);
amf_n1_inst
->
supi_2_amf_id
(
itti_msg
.
supi
,
i
.
get
()
->
amf_ue_ngap_id
);
amf_n1_inst
->
supi_2_ran_id
(
itti_msg
.
supi
,
i
.
get
()
->
ran_ue_ngap_id
);
amf_n1_inst
->
supi_2_amf_id
(
itti_msg
.
supi
,
i
->
amf_ue_ngap_id
);
amf_n1_inst
->
supi_2_ran_id
(
itti_msg
.
supi
,
i
->
ran_ue_ngap_id
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
...
...
@@ -388,27 +388,26 @@ void amf_app::handle_itti_message(
itti_msg
.
ran_ue_ngap_id
);
}
else
{
unc
=
amf_n2_inst
->
ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
);
unc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
unc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
amf_n2_inst
->
set_amf_ue_ngap_id_2_ue_ngap_context
(
amf_ue_ngap_id
,
unc
);
}
// Create UE Context and store related information information
if
(
uc
.
get
()
==
nullptr
)
{
if
(
uc
==
nullptr
)
{
Logger
::
amf_app
().
error
(
"Failed to create ue_context with ran_amf_id %s"
,
ue_context_key
.
c_str
());
}
else
{
uc
.
get
()
->
cgi
=
itti_msg
.
cgi
;
uc
.
get
()
->
tai
=
itti_msg
.
tai
;
uc
->
cgi
=
itti_msg
.
cgi
;
uc
->
tai
=
itti_msg
.
tai
;
if
(
itti_msg
.
rrc_cause
!=
-
1
)
uc
.
get
()
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
itti_msg
.
rrc_cause
;
uc
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
itti_msg
.
rrc_cause
;
if
(
itti_msg
.
ueCtxReq
==
-
1
)
uc
.
get
()
->
isUeContextRequest
=
false
;
uc
->
isUeContextRequest
=
false
;
else
uc
.
get
()
->
isUeContextRequest
=
true
;
uc
.
get
()
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
uc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
uc
->
isUeContextRequest
=
true
;
uc
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
uc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
std
::
string
guti
;
bool
is_guti_valid
=
false
;
...
...
@@ -536,7 +535,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
long
amf_ue_ngap_id
=
INVALID_AMF_UE_NGAP_ID
;
// Generate AMF UE NGAP ID if necessary
if
(
!
uc
.
get
()
)
{
// No UE context existed
if
(
!
uc
)
{
// No UE context existed
amf_ue_ngap_id
=
generate_amf_ue_ngap_id
();
}
else
{
if
((
amf_ue_ngap_id
=
uc
->
amf_ue_ngap_id
)
==
INVALID_AMF_UE_NGAP_ID
)
{
...
...
@@ -550,7 +549,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
Logger
::
amf_app
().
debug
(
"No existing UE Context associated with UE Context Key %s"
,
ue_context_key
.
c_str
());
if
(
!
uc
.
get
()
)
{
if
(
!
uc
)
{
// Create a new UE Context
Logger
::
amf_app
().
debug
(
"Create a new UE Context with UE Context Key"
,
...
...
@@ -562,14 +561,14 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
uc
=
ran_amf_id_2_ue_context
(
ue_context_key
);
}
// Return if UE Context is still invalid
if
(
!
uc
.
get
()
)
{
if
(
!
uc
)
{
Logger
::
amf_app
().
error
(
"Failed to get UE Context"
);
return
;
}
// Update info for UE context
uc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
uc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
uc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
uc
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
// RrcEstCause
if
(
registration_context
.
rrcEstCauseIsSet
())
{
uint8_t
rrc_cause
=
{};
...
...
@@ -583,10 +582,10 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
rrc_cause
=
0
;
}
uc
.
get
()
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
rrc_cause
;
uc
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
rrc_cause
;
}
// ueContextRequest
uc
.
get
()
->
isUeContextRequest
=
registration_context
.
isUeContextRequest
();
uc
->
isUeContextRequest
=
registration_context
.
isUeContextRequest
();
// Step 4. Create UE NGAP Context if necessary
// Create/Update UE NGAP Context
...
...
@@ -599,7 +598,7 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
amf_n2_inst
->
set_ran_ue_ngap_id_2_ue_ngap_context
(
ran_ue_ngap_id
,
unc
);
}
else
{
unc
=
amf_n2_inst
->
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
);
if
(
!
unc
.
get
()
)
{
if
(
!
unc
)
{
Logger
::
amf_app
().
error
(
"Failed to get UE NGAP context for "
"ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
...
...
@@ -609,12 +608,12 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
}
// Store related information into UE NGAP context
unc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
// TODO: unc
.get()
->sctp_stream_recv
// TODO: unc
.get()
->sctp_stream_send
// TODO: gc
.get()
->next_sctp_stream
// TODO: unc
.get()
->gnb_assoc_id
// TODO: unc
.get()
->tai
unc
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
// TODO: unc->sctp_stream_recv
// TODO: unc->sctp_stream_send
// TODO: gc->next_sctp_stream
// TODO: unc->gnb_assoc_id
// TODO: unc->tai
// Step 5. Trigger the procedure following RegistrationRequest
...
...
@@ -864,10 +863,10 @@ bool amf_app::generate_5g_guti(
}
std
::
shared_ptr
<
ue_context
>
uc
=
{};
uc
=
ran_amf_id_2_ue_context
(
ue_context_key
);
mcc
=
uc
.
get
()
->
tai
.
mcc
;
mnc
=
uc
.
get
()
->
tai
.
mnc
;
mcc
=
uc
->
tai
.
mcc
;
mnc
=
uc
->
tai
.
mnc
;
tmsi
=
generate_tmsi
();
uc
.
get
()
->
tmsi
=
tmsi
;
uc
->
tmsi
=
tmsi
;
return
true
;
}
...
...
@@ -889,19 +888,18 @@ evsub_id_t amf_app::handle_event_exposure_subscription(
// store subscription
for
(
auto
i
:
event_subscriptions
)
{
std
::
shared_ptr
<
amf_subscription
>
ss
=
std
::
make_shared
<
amf_subscription
>
();
ss
.
get
()
->
sub_id
=
evsub_id
;
ss
->
sub_id
=
evsub_id
;
// TODO:
if
(
msg
->
event_exposure
.
is_supi_is_set
())
{
ss
.
get
()
->
supi
=
msg
->
event_exposure
.
get_supi
();
ss
.
get
()
->
supi_is_set
=
true
;
ss
->
supi
=
msg
->
event_exposure
.
get_supi
();
ss
->
supi_is_set
=
true
;
}
ss
.
get
()
->
notify_correlation_id
=
msg
->
event_exposure
.
get_notify_correlation_id
();
ss
.
get
()
->
notify_uri
=
msg
->
event_exposure
.
get_notify_uri
();
ss
.
get
()
->
nf_id
=
msg
->
event_exposure
.
get_nf_id
();
ss
.
get
()
->
ev_type
=
i
.
type
;
ss
->
notify_correlation_id
=
msg
->
event_exposure
.
get_notify_correlation_id
();
ss
->
notify_uri
=
msg
->
event_exposure
.
get_notify_uri
();
ss
->
nf_id
=
msg
->
event_exposure
.
get_nf_id
();
ss
->
ev_type
=
i
.
type
;
add_event_subscription
(
evsub_id
,
i
.
type
,
ss
);
ss
.
get
()
->
display
();
ss
->
display
();
}
return
evsub_id
;
}
...
...
src/amf-app/amf_config.cpp
View file @
4b0b2e1b
...
...
@@ -967,7 +967,7 @@ bool amf_config::get_smf_pdu_session_context_uri(
const
std
::
shared_ptr
<
pdu_session_context
>&
psc
,
std
::
string
&
smf_uri
)
{
if
(
!
psc
)
return
false
;
if
(
!
psc
.
get
()
->
smf_info
.
info_available
)
{
if
(
!
psc
->
smf_info
.
info_available
)
{
Logger
::
amf_sbi
().
error
(
"No SMF is available for this PDU session"
);
return
false
;
}
...
...
@@ -986,11 +986,11 @@ bool amf_config::get_smf_pdu_session_context_uri(
else
smf_ip_addr
=
smf_addr
;
std
::
size_t
found
=
psc
.
get
()
->
smf_info
.
context_location
.
find
(
smf_ip_addr
);
std
::
size_t
found
=
psc
->
smf_info
.
context_location
.
find
(
smf_ip_addr
);
if
(
found
!=
std
::
string
::
npos
)
smf_uri
=
psc
.
get
()
->
smf_info
.
context_location
;
smf_uri
=
psc
->
smf_info
.
context_location
;
else
smf_uri
=
smf_addr
+
":"
+
smf_port
+
psc
.
get
()
->
smf_info
.
context_location
;
smf_uri
=
smf_addr
+
":"
+
smf_port
+
psc
->
smf_info
.
context_location
;
return
true
;
}
...
...
src/amf-app/amf_n1.cpp
View file @
4b0b2e1b
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n2.cpp
View file @
4b0b2e1b
This diff is collapsed.
Click to expand it.
src/amf-app/amf_sbi.cpp
View file @
4b0b2e1b
This diff is collapsed.
Click to expand it.
src/ngap/ngap_app/ngap_app.cpp
View file @
4b0b2e1b
...
...
@@ -94,28 +94,27 @@ void ngap_app::handle_sctp_new_association(
gc
=
std
::
shared_ptr
<
gnb_context
>
(
new
gnb_context
());
set_assoc_id_2_gnb_context
(
assoc_id
,
gc
);
}
else
{
if
(
gc
.
get
()
->
ng_state
==
NGAP_RESETING
||
gc
.
get
()
->
ng_state
==
NGAP_SHUTDOWN
)
{
if
(
gc
->
ng_state
==
NGAP_RESETING
||
gc
->
ng_state
==
NGAP_SHUTDOWN
)
{
Logger
::
ngap
().
warn
(
"Received a new association request on an association that is being "
"%s, ignoring"
,
ng_gnb_state_str
[
gc
.
get
()
->
ng_state
]);
ng_gnb_state_str
[
gc
->
ng_state
]);
}
else
{
Logger
::
ngap
().
debug
(
"Update gNB context with assoc id (%d)"
,
assoc_id
);
}
}
if
(
gc
.
get
()
==
nullptr
)
{
if
(
gc
==
nullptr
)
{
Logger
::
ngap
().
error
(
"Failed to create gNB context for assoc_id (%d)"
,
assoc_id
);
return
;
};
gc
.
get
()
->
sctp_assoc_id
=
assoc_id
;
gc
.
get
()
->
instreams
=
instreams
;
gc
.
get
()
->
outstreams
=
outstreams
;
gc
.
get
()
->
next_sctp_stream
=
1
;
gc
.
get
()
->
ng_state
=
NGAP_INIT
;
gc
->
sctp_assoc_id
=
assoc_id
;
gc
->
instreams
=
instreams
;
gc
->
outstreams
=
outstreams
;
gc
->
next_sctp_stream
=
1
;
gc
->
ng_state
=
NGAP_INIT
;
}
//------------------------------------------------------------------------------
...
...
@@ -152,7 +151,7 @@ bool ngap_app::is_assoc_id_2_gnb_context(
std
::
shared_lock
lock
(
m_assoc2gnbContext
);
if
(
assoc2gnbContext
.
count
(
assoc_id
)
>
0
)
{
gc
=
assoc2gnbContext
.
at
(
assoc_id
);
if
(
gc
.
get
()
!=
nullptr
)
return
true
;
if
(
gc
!=
nullptr
)
return
true
;
}
return
false
;
}
...
...
src/ngap/ngap_app/ngap_message_callback.hpp
View file @
4b0b2e1b
...
...
@@ -410,7 +410,7 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
"No UE NAS context with amf_ue_ngap_id (0x%x)"
,
amf_ue_ngap_id
);
return
RETURNerror
;
}
itti_msg
->
supi
=
"imsi-"
+
nct
.
get
()
->
imsi
;
itti_msg
->
supi
=
"imsi-"
+
nct
->
imsi
;
itti_msg
->
pdu_session_id
=
list
[
0
].
pduSessionId
;
itti_msg
->
n2sm
=
blk2bstr
(
list
[
0
].
pduSessionResourceSetupResponseTransfer
.
buf
,
...
...
@@ -477,16 +477,16 @@ int ngap_amf_handle_pdu_session_resource_setup_response(
return
RETURNerror
;
}
string
supi
=
"imsi-"
+
nct
.
get
()
->
imsi
;
string
supi
=
"imsi-"
+
nct
->
imsi
;
std
::
shared_ptr
<
pdu_session_context
>
psc
=
{};
if
(
amf_app_inst
->
find_pdu_session_context
(
supi
,
list_fail
[
0
].
pduSessionId
,
psc
))
{
if
(
psc
.
get
()
==
nullptr
)
{
if
(
psc
==
nullptr
)
{
Logger
::
ngap
().
error
(
"Cannot get pdu_session_context"
);
return
RETURNerror
;
}
}
psc
.
get
()
->
is_n2sm_avaliable
=
false
;
psc
->
is_n2sm_avaliable
=
false
;
Logger
::
ngap
().
debug
(
"Receive pdu session resource setup response fail (multi pdu session "
"id),set pdu session context is_n2sm_avaliable = false"
);
...
...
src/sbi/amf_server/amf-http2-server.cpp
View file @
4b0b2e1b
...
...
@@ -184,14 +184,14 @@ void amf_http2_server::n1_n2_message_transfer_handler(
bstring
n2sm
;
if
(
!
n2sm_str
.
empty
())
{
conv
::
msg_str_2_msg_hex
(
n2sm_str
,
n2sm
);
psc
.
get
()
->
n2sm
=
n2sm
;
psc
.
get
()
->
is_n2sm_avaliable
=
true
;
psc
->
n2sm
=
n2sm
;
psc
->
is_n2sm_avaliable
=
true
;
}
else
{
psc
.
get
()
->
is_n2sm_avaliable
=
false
;
psc
->
is_n2sm_avaliable
=
false
;
}
psc
.
get
()
->
n1sm
=
n1sm
;
psc
.
get
()
->
is_n1sm_avaliable
=
true
;
psc
->
n1sm
=
n1sm
;
psc
->
is_n1sm_avaliable
=
true
;
itti_n1n2_message_transfer_request
*
itti_msg
=
new
itti_n1n2_message_transfer_request
(
AMF_SERVER
,
TASK_AMF_APP
);
...
...
src/sbi/amf_server/impl/N1N2MessageCollectionDocumentApiImpl.cpp
View file @
4b0b2e1b
...
...
@@ -95,12 +95,11 @@ void N1N2MessageCollectionDocumentApiImpl::n1_n2_message_transfer(
bstring
n2sm
;
conv
::
msg_str_2_msg_hex
(
n2sm_str
,
n2sm
);
psc
.
get
()
->
n1sm
=
n1sm
;
psc
.
get
()
->
is_n1sm_avaliable
=
true
;
psc
.
get
()
->
n2sm
=
n2sm
;
psc
.
get
()
->
is_n2sm_avaliable
=
true
;
Logger
::
amf_server
().
debug
(
"n2sm size in amf_server(%d)"
,
blength
(
psc
.
get
()
->
n2sm
));
psc
->
n1sm
=
n1sm
;
psc
->
is_n1sm_avaliable
=
true
;
psc
->
n2sm
=
n2sm
;
psc
->
is_n2sm_avaliable
=
true
;
Logger
::
amf_server
().
debug
(
"n2sm size in amf_server(%d)"
,
blength
(
psc
->
n2sm
));
itti_n1n2_message_transfer_request
*
itti_msg
=
new
itti_n1n2_message_transfer_request
(
AMF_SERVER
,
TASK_AMF_APP
);
...
...
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