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
a130bd2e
Commit
a130bd2e
authored
Sep 30, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code refactor for Mobile Identity
parent
7aac5ad7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
50 deletions
+18
-50
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+17
-49
src/nas/msgs/RegistrationRequest.hpp
src/nas/msgs/RegistrationRequest.hpp
+1
-1
No files found.
src/nas/msgs/RegistrationRequest.cpp
View file @
a130bd2e
...
@@ -30,10 +30,6 @@ using namespace nas;
...
@@ -30,10 +30,6 @@ using namespace nas;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
RegistrationRequest
::
RegistrationRequest
()
RegistrationRequest
::
RegistrationRequest
()
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
REGISTRATION_REQUEST
)
{
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
REGISTRATION_REQUEST
)
{
// plain_header = nullptr;
// ie_5gsregistrationtype = nullptr;
// ie_ngKSI = nullptr;
ie_5gs_mobility_id
=
nullptr
;
ie_non_current_native_nas_ksi
=
nullptr
;
ie_non_current_native_nas_ksi
=
nullptr
;
ie_5g_mm_capability
=
nullptr
;
ie_5g_mm_capability
=
nullptr
;
ie_ue_security_capability
=
nullptr
;
ie_ue_security_capability
=
nullptr
;
...
@@ -104,48 +100,35 @@ void RegistrationRequest::setSUCI_SUPI_format_IMSI(
...
@@ -104,48 +100,35 @@ void RegistrationRequest::setSUCI_SUPI_format_IMSI(
"interface"
);
"interface"
);
return
;
return
;
}
else
{
}
else
{
ie_5gs_mobility_id
=
new
_5GSMobileIdentity
();
ie_5gs_mobility_id
.
setSuciWithSupiImsi
(
ie_5gs_mobility_id
->
setSuciWithSupiImsi
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint8_t
RegistrationRequest
::
getMobilityIdentityType
()
{
uint8_t
RegistrationRequest
::
getMobilityIdentityType
()
{
if
(
ie_5gs_mobility_id
)
{
return
ie_5gs_mobility_id
.
getTypeOfIdentity
();
return
ie_5gs_mobility_id
->
getTypeOfIdentity
();
}
else
{
return
0
;
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
RegistrationRequest
::
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
{
bool
RegistrationRequest
::
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
{
if
(
ie_5gs_mobility_id
)
{
ie_5gs_mobility_id
.
getSuciWithSupiImsi
(
imsi
);
ie_5gs_mobility_id
->
getSuciWithSupiImsi
(
imsi
);
return
true
;
return
true
;
}
else
{
return
false
;
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
std
::
string
RegistrationRequest
::
get_5g_guti
()
{
std
::
string
RegistrationRequest
::
get_5g_guti
()
{
if
(
ie_5gs_mobility_id
)
{
std
::
optional
<
nas
::
_5G_GUTI_t
>
guti
=
std
::
nullopt
;
std
::
optional
<
nas
::
_5G_GUTI_t
>
guti
=
std
::
nullopt
;
ie_5gs_mobility_id
.
get5GGUTI
(
guti
);
ie_5gs_mobility_id
->
get5GGUTI
(
guti
);
if
(
!
guti
.
has_value
())
return
{};
if
(
!
guti
.
has_value
())
return
{};
std
::
string
guti_str
=
guti
.
value
().
mcc
+
guti
.
value
().
mnc
+
std
::
string
guti_str
=
guti
.
value
().
mcc
+
guti
.
value
().
mnc
+
std
::
to_string
(
guti
.
value
().
amf_region_id
)
+
std
::
to_string
(
guti
.
value
().
amf_region_id
)
+
std
::
to_string
(
guti
.
value
().
amf_set_id
)
+
std
::
to_string
(
guti
.
value
().
amf_set_id
)
+
std
::
to_string
(
guti
.
value
().
amf_pointer
)
+
std
::
to_string
(
guti
.
value
().
amf_pointer
)
+
conv
::
tmsi_to_string
(
guti
.
value
().
_5g_tmsi
);
conv
::
tmsi_to_string
(
guti
.
value
().
_5g_tmsi
);
Logger
::
nas_mm
().
debug
(
"5G GUTI %s"
,
guti_str
.
c_str
());
Logger
::
nas_mm
().
debug
(
"5G GUTI %s"
,
guti_str
.
c_str
());
return
guti_str
;
return
guti_str
;
}
else
{
return
{};
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -547,20 +530,6 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
...
@@ -547,20 +530,6 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
Logger
::
nas_mm
().
debug
(
"Encoding RegistrationRequest message"
);
Logger
::
nas_mm
().
debug
(
"Encoding RegistrationRequest message"
);
int
encoded_size
=
0
;
int
encoded_size
=
0
;
/* if (!ie_5gsregistrationtype) {
Logger::nas_mm().error("Mandatory IE missing ie_5gsregistrationtype");
return 0;
}
*/
/*if (!ie_ngKSI) {
Logger::nas_mm().error("Mandatory IE missing ie_ngKSI");
return 0;
}*/
if
(
!
ie_5gs_mobility_id
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing ie_5gs_mobility_id"
);
return
0
;
}
if
(
!
(
NasMmPlainHeader
::
encode2Buffer
(
buf
,
len
)))
return
0
;
if
(
!
(
NasMmPlainHeader
::
encode2Buffer
(
buf
,
len
)))
return
0
;
encoded_size
+=
3
;
encoded_size
+=
3
;
if
(
!
(
ie_5gsregistrationtype
.
encode2Buffer
(
if
(
!
(
ie_5gsregistrationtype
.
encode2Buffer
(
...
@@ -575,7 +544,7 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
...
@@ -575,7 +544,7 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
Logger
::
nas_mm
().
error
(
"Encoding IE 5gsregistrationtype error"
);
Logger
::
nas_mm
().
error
(
"Encoding IE 5gsregistrationtype error"
);
return
0
;
return
0
;
}
}
if
(
int
size
=
ie_5gs_mobility_id
->
encode2Buffer
(
if
(
int
size
=
ie_5gs_mobility_id
.
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
encoded_size
+=
size
;
}
else
{
}
else
{
...
@@ -842,8 +811,7 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
...
@@ -842,8 +811,7 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
decoded_size
+=
ie_ngKSI
.
decodeFromBuffer
(
decoded_size
+=
ie_ngKSI
.
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
true
);
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
true
);
decoded_size
++
;
decoded_size
++
;
ie_5gs_mobility_id
=
new
_5GSMobileIdentity
();
decoded_size
+=
ie_5gs_mobility_id
.
decodeFromBuffer
(
decoded_size
+=
ie_5gs_mobility_id
->
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"First option IEI 0x%x"
,
octet
);
Logger
::
nas_mm
().
debug
(
"First option IEI 0x%x"
,
octet
);
...
...
src/nas/msgs/RegistrationRequest.hpp
View file @
a130bd2e
...
@@ -149,7 +149,7 @@ class RegistrationRequest : public NasMmPlainHeader {
...
@@ -149,7 +149,7 @@ class RegistrationRequest : public NasMmPlainHeader {
// NasMmPlainHeader* plain_header;
// NasMmPlainHeader* plain_header;
_5GSRegistrationType
ie_5gsregistrationtype
;
// Mandatory
_5GSRegistrationType
ie_5gsregistrationtype
;
// Mandatory
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
_5GSMobileIdentity
*
ie_5gs_mobility_id
;
// Mandatory
_5GSMobileIdentity
ie_5gs_mobility_id
;
// Mandatory
NasKeySetIdentifier
*
ie_non_current_native_nas_ksi
;
// Optional
NasKeySetIdentifier
*
ie_non_current_native_nas_ksi
;
// Optional
_5GMMCapability
*
ie_5g_mm_capability
;
// Optional
_5GMMCapability
*
ie_5g_mm_capability
;
// Optional
...
...
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