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
c4bab8cf
Commit
c4bab8cf
authored
Feb 13, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mapping between TMSI and GUTI
parent
160891e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
16 deletions
+57
-16
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+5
-2
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+8
-8
src/common/conversions.cpp
src/common/conversions.cpp
+32
-5
src/common/conversions.hpp
src/common/conversions.hpp
+12
-1
No files found.
src/amf-app/amf_app.cpp
View file @
c4bab8cf
...
...
@@ -406,14 +406,16 @@ void amf_app::handle_itti_message(
uc
->
isUeContextRequest
=
false
;
else
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
;
if
(
itti_msg
.
is_5g_s_tmsi_present
)
{
guti
=
itti_msg
.
tai
.
mcc
+
itti_msg
.
tai
.
mnc
+
amf_cfg
.
guami
.
regionID
+
itti_msg
.
_5g_s_tmsi
;
guti
=
conv
::
tmsi_to_guti
(
itti_msg
.
tai
.
mcc
,
itti_msg
.
tai
.
mnc
,
amf_cfg
.
guami
.
regionID
,
itti_msg
.
_5g_s_tmsi
);
is_guti_valid
=
true
;
Logger
::
amf_app
().
debug
(
"Receiving GUTI %s"
,
guti
.
c_str
());
}
...
...
@@ -821,6 +823,7 @@ uint32_t amf_app::get_number_registered_ues() const {
std
::
shared_lock
lock
(
m_amf_ue_ngap_id2ue_ctx
);
return
amf_ue_ngap_id2ue_ctx
.
size
();
}
//---------------------------------------------------------------------------------------------
void
amf_app
::
add_n1n2_message_subscription
(
const
std
::
string
&
ue_ctx_id
,
const
n1n2sub_id_t
&
sub_id
,
...
...
src/amf-app/amf_n1.cpp
View file @
c4bab8cf
...
...
@@ -828,9 +828,9 @@ void amf_n1::service_request_handle(
uint8_t
amf_pointer
=
{};
string
tmsi
=
{};
if
(
service_request
->
Get5gSTmsi
(
amf_set_id
,
amf_pointer
,
tmsi
))
{
std
::
string
guti
=
uc
->
tai
.
mcc
+
uc
->
tai
.
mnc
+
amf_cfg
.
guami
.
regionID
+
std
::
to_string
(
amf_set_id
)
+
std
::
to_string
(
amf_pointer
)
+
tmsi
;
std
::
string
guti
=
conv
::
tmsi_to_guti
(
uc
->
tai
.
mcc
,
uc
->
tai
.
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_set_id
,
amf_pointer
,
tmsi
)
;
Logger
::
amf_app
().
debug
(
"GUTI %s, 5G-TMSI %s"
,
guti
.
c_str
(),
tmsi
.
c_str
());
...
...
@@ -1121,7 +1121,7 @@ void amf_n1::registration_request_handle(
}
nc
->
is_imsi_present
=
true
;
nc
->
imsi
=
imsi
.
mcc
+
imsi
.
mnc
+
imsi
.
msin
;
nc
->
imsi
=
conv
::
get_imsi
(
imsi
.
mcc
,
imsi
.
mnc
,
imsi
.
msin
)
;
Logger
::
amf_n1
().
debug
(
"Received IMSI %s"
,
nc
->
imsi
.
c_str
());
// Trigger UE Reachability Status Notify
...
...
@@ -1146,7 +1146,7 @@ void amf_n1::registration_request_handle(
set_supi_2_nas_context
(
supi
,
nc
);
Logger
::
amf_n1
().
info
(
"Associating
IMS
I (%s) with nas_context (%p)"
,
supi
.
c_str
(),
nc
);
"Associating
SUP
I (%s) with nas_context (%p)"
,
supi
.
c_str
(),
nc
);
if
(
!
nc
->
is_stacs_available
)
{
ue_info_t
ueItem
;
ueItem
.
connStatus
=
"5GMM-CONNECTED"
;
//"CM-CONNECTED";
...
...
@@ -2585,9 +2585,9 @@ void amf_n1::security_mode_complete_handle(
mcc
,
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
tmsi
);
std
::
string
guti
=
mcc
+
mnc
+
amf_cfg
.
guami
.
regionID
+
amf_cfg
.
guami
.
AmfSetID
+
amf_cfg
.
guami
.
AmfPointer
+
conv
::
tmsi_to_string
(
tmsi
);
std
::
string
guti
=
conv
::
tmsi_to_guti
(
mcc
,
mnc
,
amf_cfg
.
guami
.
regionID
,
amf_cfg
.
guami
.
AmfSetID
,
amf_cfg
.
guami
.
AmfPointer
,
conv
::
tmsi_to_string
(
tmsi
)
);
Logger
::
amf_n1
().
debug
(
"Allocated GUTI %s"
,
guti
.
c_str
());
// registration_accept->SetT3512Value(0x5, T3512_TIMER_VALUE_MIN);
...
...
src/common/conversions.cpp
View file @
c4bab8cf
...
...
@@ -33,6 +33,9 @@
#include "amf.hpp"
#include "logger.hpp"
constexpr
uint8_t
kTmsiIELength
=
8
;
// 4 bytes -8 characters representation in hex
static
const
char
hex_to_ascii_table
[
16
]
=
{
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
,
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
...
...
@@ -110,8 +113,8 @@ std::string conv::mncToString(
//------------------------------------------------------------------------------
std
::
string
conv
::
tmsi_to_string
(
const
uint32_t
tmsi
)
{
std
::
string
s
=
{};
std
::
string
tmsi_str
=
std
::
to
_string
(
tmsi
);
uint8_t
length
=
4
-
tmsi_str
.
size
();
std
::
string
tmsi_str
=
uint32_to_hex
_string
(
tmsi
);
uint8_t
length
=
kTmsiIELength
-
tmsi_str
.
size
();
for
(
uint8_t
i
=
0
;
i
<
length
;
i
++
)
{
s
.
append
(
"0"
);
}
...
...
@@ -494,19 +497,43 @@ std::string conv::get_serving_network_name(
//------------------------------------------------------------------------------
std
::
string
conv
::
uint32_to_hex_string
(
uint32_t
value
)
{
char
hex_str
[
8
];
char
hex_str
[
kTmsiIELength
+
1
];
sprintf
(
hex_str
,
"%X"
,
value
);
Logger
::
amf_app
().
error
(
"uint32_to_hex_string: %s"
,
std
::
string
(
hex_str
).
c_str
());
return
std
::
string
(
hex_str
);
}
//------------------------------------------------------------------------------
std
::
string
conv
::
tmsi_to_guti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
region_id
,
const
std
::
string
&
tmsi
)
{
return
{
mcc
+
mnc
+
region_id
+
tmsi
};
const
std
::
string
&
region_id
,
const
std
::
string
&
_5g_s_
tmsi
)
{
return
{
mcc
+
mnc
+
region_id
+
_5g_s_
tmsi
};
}
//------------------------------------------------------------------------------
std
::
string
conv
::
tmsi_to_guti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
region_id
,
uint16_t
amf_set_id
,
uint8_t
amf_pointer
,
const
std
::
string
&
tmsi
)
{
return
{
mcc
+
mnc
+
region_id
+
std
::
to_string
(
amf_set_id
)
+
std
::
to_string
(
amf_pointer
)
+
tmsi
};
}
//------------------------------------------------------------------------------
std
::
string
conv
::
tmsi_to_guti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
region_id
,
const
std
::
string
&
amf_set_id
,
const
std
::
string
&
amf_pointer
,
const
std
::
string
&
tmsi
)
{
return
{
mcc
+
mnc
+
region_id
+
amf_set_id
+
amf_pointer
+
tmsi
};
}
//------------------------------------------------------------------------------
std
::
string
conv
::
imsi_to_supi
(
const
std
::
string
&
imsi
)
{
return
{
"imsi-"
+
imsi
};
}
//------------------------------------------------------------------------------
std
::
string
conv
::
get_imsi
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
msin
)
{
return
{
mcc
+
mnc
+
msin
};
}
src/common/conversions.hpp
View file @
c4bab8cf
...
...
@@ -102,8 +102,19 @@ class conv {
static
std
::
string
uint32_to_hex_string
(
uint32_t
value
);
static
std
::
string
tmsi_to_guti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
region_id
,
const
std
::
string
&
tmsi
);
const
std
::
string
&
region_id
,
const
std
::
string
&
_5g_s_tmsi
);
static
std
::
string
tmsi_to_guti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
region_id
,
uint16_t
amf_set_id
,
uint8_t
amf_pointer
,
const
std
::
string
&
tmsi
);
static
std
::
string
tmsi_to_guti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
region_id
,
const
std
::
string
&
amf_set_id
,
const
std
::
string
&
amf_pointer
,
const
std
::
string
&
tmsi
);
static
std
::
string
imsi_to_supi
(
const
std
::
string
&
imsi
);
static
std
::
string
get_imsi
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
msin
);
};
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
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