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
ef3b798f
Commit
ef3b798f
authored
Apr 13, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix member scope - AMF N1
parent
ad3820f9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
43 deletions
+151
-43
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+4
-4
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+83
-22
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+64
-17
No files found.
src/amf-app/amf_app.cpp
View file @
ef3b798f
...
...
@@ -280,8 +280,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
);
i
.
get
()
->
amf_ue_ngap_id
=
amf_n1_inst
->
supi2amfId
.
at
(
itti_msg
.
supi
);
i
.
get
()
->
ran_ue_ngap_id
=
amf_n1_inst
->
supi2ranId
.
at
(
itti_msg
.
supi
);
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
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
...
...
@@ -315,8 +315,8 @@ void amf_app::handle_itti_message(
dl_msg
->
is_n2sm_set
=
true
;
dl_msg
->
n2sm_info_type
=
itti_msg
.
n2sm_info_type
;
}
dl_msg
->
amf_ue_ngap_id
=
amf_n1_inst
->
supi2amfId
.
at
(
itti_msg
.
supi
);
dl_msg
->
ran_ue_ngap_id
=
amf_n1_inst
->
supi2ranId
.
at
(
itti_msg
.
supi
);
amf_n1_inst
->
supi_2_amf_id
(
itti_msg
.
supi
,
dl_msg
->
amf_ue_ngap_id
);
amf_n1_inst
->
supi_2_ran_id
(
itti_msg
.
supi
,
dl_msg
->
ran_ue_ngap_id
);
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
i
=
std
::
shared_ptr
<
itti_downlink_nas_transfer
>
(
dl_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
...
...
src/amf-app/amf_n1.cpp
View file @
ef3b798f
...
...
@@ -722,8 +722,8 @@ void amf_n1::identity_response_handle(
nc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
nc
.
get
()
->
is_imsi_present
=
true
;
nc
.
get
()
->
imsi
=
supi
;
s
upi2amfId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
amf_ue_ngap_id
;
s
upi2ranId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
ran_ue_ngap_id
;
s
et_supi_2_amf_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
amf_ue_ngap_id
)
;
s
et_supi_2_ran_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
ran_ue_ngap_id
)
;
// Stop Mobile Reachable Timer/Implicit Deregistration Timer
itti_inst
->
timer_remove
(
nc
.
get
()
->
mobile_reachable_timer
);
itti_inst
->
timer_remove
(
nc
.
get
()
->
implicit_deregistration_timer
);
...
...
@@ -785,8 +785,9 @@ void amf_n1::service_request_handle(
service_accept
->
setHeader
(
PLAIN_5GS_MSG
);
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
uc
.
get
()
->
supi
=
supi
;
supi2amfId
[
supi
]
=
amf_ue_ngap_id
;
supi2ranId
[
supi
]
=
ran_ue_ngap_id
;
set_supi_2_amf_id
(
supi
,
amf_ue_ngap_id
);
set_supi_2_ran_id
(
supi
,
ran_ue_ngap_id
);
Logger
::
amf_n1
().
debug
(
"amf_ue_ngap_id "
AMF_UE_NGAP_ID_FMT
", ran_ue_ngap_id "
GNB_UE_NGAP_ID_FMT
,
...
...
@@ -998,8 +999,9 @@ void amf_n1::registration_request_handle(
nc
.
get
()
->
is_imsi_present
=
true
;
nc
.
get
()
->
imsi
=
imsi
.
mcc
+
imsi
.
mnc
+
imsi
.
msin
;
Logger
::
amf_n1
().
debug
(
"Received IMSI %s"
,
nc
.
get
()
->
imsi
.
c_str
());
supi2amfId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
amf_ue_ngap_id
;
supi2ranId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
ran_ue_ngap_id
;
set_supi_2_amf_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
amf_ue_ngap_id
);
set_supi_2_ran_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
ran_ue_ngap_id
);
// try to find old nas_context and release
std
::
shared_ptr
<
nas_context
>
old_nc
=
{};
...
...
@@ -1059,8 +1061,8 @@ void amf_n1::registration_request_handle(
// Update Nas Context
nc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
s
upi2amfId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
amf_ue_ngap_id
;
s
upi2ranId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
ran_ue_ngap_id
;
s
et_supi_2_amf_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
amf_ue_ngap_id
)
;
s
et_supi_2_ran_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
ran_ue_ngap_id
)
;
nc
.
get
()
->
is_auth_vectors_present
=
false
;
nc
.
get
()
->
is_current_security_available
=
false
;
if
(
nc
.
get
()
->
security_ctx
)
...
...
@@ -1115,8 +1117,9 @@ void amf_n1::registration_request_handle(
set_amf_ue_ngap_id_2_nas_context
(
amf_ue_ngap_id
,
nc
);
nc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
supi2amfId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
amf_ue_ngap_id
;
supi2ranId
[(
"imsi-"
+
nc
.
get
()
->
imsi
)]
=
ran_ue_ngap_id
;
set_supi_2_amf_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
amf_ue_ngap_id
);
set_supi_2_ran_id
(
"imsi-"
+
nc
.
get
()
->
imsi
,
ran_ue_ngap_id
);
nc
.
get
()
->
is_auth_vectors_present
=
false
;
nc
.
get
()
->
is_current_security_available
=
false
;
if
(
nc
.
get
()
->
security_ctx
)
...
...
@@ -1399,6 +1402,64 @@ bool amf_n1::remove_amf_ue_ngap_id_2_nas_context(const long& amf_ue_ngap_id) {
return
false
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
set_supi_2_amf_id
(
const
std
::
string
&
supi
,
const
long
&
amf_ue_ngap_id
)
{
std
::
unique_lock
lock
(
m_nas_context
);
supi2amfId
[
supi
]
=
amf_ue_ngap_id
;
}
//------------------------------------------------------------------------------
bool
amf_n1
::
supi_2_amf_id
(
const
std
::
string
&
supi
,
long
&
amf_ue_ngap_id
)
{
std
::
shared_lock
lock
(
m_nas_context
);
if
(
supi2amfId
.
count
(
supi
)
>
0
)
{
amf_ue_ngap_id
=
supi2amfId
.
at
(
supi
);
return
true
;
}
else
{
return
false
;
}
}
//------------------------------------------------------------------------------
bool
amf_n1
::
remove_supi_2_amf_id
(
const
std
::
string
&
supi
)
{
std
::
unique_lock
lock
(
m_nas_context
);
if
(
supi2amfId
.
count
(
supi
)
>
0
)
{
supi2amfId
.
erase
(
supi
);
return
true
;
}
else
{
return
false
;
}
}
//------------------------------------------------------------------------------
void
amf_n1
::
set_supi_2_ran_id
(
const
std
::
string
&
supi
,
const
uint32_t
&
ran_ue_ngap_id
)
{
std
::
unique_lock
lock
(
m_nas_context
);
supi2ranId
[
supi
]
=
ran_ue_ngap_id
;
}
//------------------------------------------------------------------------------
bool
amf_n1
::
supi_2_ran_id
(
const
std
::
string
&
supi
,
uint32_t
&
ran_ue_ngap_id
)
{
std
::
shared_lock
lock
(
m_nas_context
);
if
(
supi2amfId
.
count
(
supi
)
>
0
)
{
ran_ue_ngap_id
=
supi2ranId
.
at
(
supi
);
return
true
;
}
else
{
return
false
;
}
}
//------------------------------------------------------------------------------
bool
amf_n1
::
remove_supi_2_ran_id
(
const
std
::
string
&
supi
)
{
std
::
unique_lock
lock
(
m_nas_context
);
if
(
supi2ranId
.
count
(
supi
)
>
0
)
{
supi2ranId
.
erase
(
supi
);
return
true
;
}
else
{
return
false
;
}
}
//------------------------------------------------------------------------------
bool
amf_n1
::
is_guti_2_nas_context
(
const
std
::
string
&
guti
)
const
{
std
::
shared_lock
lock
(
m_guti2nas_context
);
...
...
src/amf-app/amf_n1.hpp
View file @
ef3b798f
...
...
@@ -57,23 +57,6 @@ namespace amf_application {
class
amf_n1
{
public:
std
::
map
<
long
,
std
::
shared_ptr
<
nas_context
>>
amfueid2nas_context
;
// amf ue ngap id
mutable
std
::
shared_mutex
m_amfueid2nas_context
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nas_context
>>
imsi2nas_context
;
std
::
map
<
std
::
string
,
long
>
supi2amfId
;
std
::
map
<
std
::
string
,
uint32_t
>
supi2ranId
;
mutable
std
::
shared_mutex
m_nas_context
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nas_context
>>
guti2nas_context
;
mutable
std
::
shared_mutex
m_guti2nas_context
;
static
std
::
map
<
std
::
string
,
std
::
string
>
rand_record
;
static
uint8_t
no_random_delta
;
random_state_t
random_state
;
database_t
*
db_desc
;
amf_n1
();
~
amf_n1
();
...
...
@@ -193,6 +176,53 @@ class amf_n1 {
*/
bool
remove_amf_ue_ngap_id_2_nas_context
(
const
long
&
amf_ue_ngap_id
);
/*
* Store the mapping between SUPI and AMF UE NGAP ID
* @param [const std::string&] SUPI: UE SUPI
*@param [const long& ] amf_ue_ngap_id: AMF UE NGAP ID
* @return void
*/
void
set_supi_2_amf_id
(
const
std
::
string
&
supi
,
const
long
&
amf_ue_ngap_id
);
/*
* Get AMF UE NGAP ID
* @param [const std::string&] SUPI: UE SUPI
* @param [long& ] amf_ue_ngap_id: AMF UE NGAP ID
* @return true if success
*/
bool
supi_2_amf_id
(
const
std
::
string
&
supi
,
long
&
amf_ue_ngap_id
);
/*
* Remove AMF UE NGAP ID from the map with SUPI
* @param [const std::string&] SUPI: UE SUPI
* @return true if success
*/
bool
remove_supi_2_amf_id
(
const
std
::
string
&
supi
);
/*
* Store the mapping between SUPI and RAN UE NGAP ID
* @param [const std::string&] SUPI: UE SUPI
*@param [const uint32_t&] ran_ue_ngap_id: RAN UE NGAP ID
* @return void
*/
void
set_supi_2_ran_id
(
const
std
::
string
&
supi
,
const
uint32_t
&
ran_ue_ngap_id
);
/*
* Get RAN UE NGAP ID
* @param [const std::string&] SUPI: UE SUPI
* @param [uint32_t& ] ran_ue_ngap_id: RAN UE NGAP ID
* @return true if success
*/
bool
supi_2_ran_id
(
const
std
::
string
&
supi
,
uint32_t
&
ran_ue_ngap_id
);
/*
* Remove RAN UE NGAP ID from the map with SUPI
* @param [const std::string&] SUPI: UE SUPI
* @return true if success
*/
bool
remove_supi_2_ran_id
(
const
std
::
string
&
supi
);
/*
* Get UE NAS context associated with an IMSI
* @param [const std::string&] imsi: UE IMSI
...
...
@@ -928,6 +958,23 @@ class amf_n1 {
const
uint8_t
cause_value
,
const
uint32_t
ran_ue_ngap_id
,
const
long
amf_ue_ngap_id
);
std
::
map
<
long
,
std
::
shared_ptr
<
nas_context
>>
amfueid2nas_context
;
// amf ue ngap id
mutable
std
::
shared_mutex
m_amfueid2nas_context
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nas_context
>>
imsi2nas_context
;
std
::
map
<
std
::
string
,
long
>
supi2amfId
;
std
::
map
<
std
::
string
,
uint32_t
>
supi2ranId
;
mutable
std
::
shared_mutex
m_nas_context
;
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nas_context
>>
guti2nas_context
;
mutable
std
::
shared_mutex
m_guti2nas_context
;
static
std
::
map
<
std
::
string
,
std
::
string
>
rand_record
;
static
uint8_t
no_random_delta
;
random_state_t
random_state
;
database_t
*
db_desc
;
// for Event Handling
amf_event
event_sub
;
bs2
::
connection
ee_ue_location_report_connection
;
...
...
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