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
884d221f
Commit
884d221f
authored
Oct 03, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for NonCurrentNativeNasKSI
parent
a130bd2e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
20 deletions
+27
-20
src/nas/ies/5GSMobileIdentity.cpp
src/nas/ies/5GSMobileIdentity.cpp
+4
-1
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+18
-14
src/nas/msgs/RegistrationRequest.hpp
src/nas/msgs/RegistrationRequest.hpp
+5
-5
No files found.
src/nas/ies/5GSMobileIdentity.cpp
View file @
884d221f
...
...
@@ -602,6 +602,7 @@ int _5GSMobileIdentity::suci_decodefrombuffer(
digit
[
3
]
==
0x0f
)
{
supi_format_imsi_tmp
.
routingIndicator
=
std
::
nullopt
;
// No Routing Indicator is configured
Logger
::
nas_mm
().
debug
(
"No Routing Indicator is configured"
);
}
else
{
std
::
string
result
=
{};
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
...
...
@@ -613,6 +614,7 @@ int _5GSMobileIdentity::suci_decodefrombuffer(
Logger
::
nas_mm
().
error
(
"Decoded Routing Indicator is not BCD coding"
);
}
supi_format_imsi_tmp
.
routingIndicator
=
std
::
optional
<
std
::
string
>
(
result
);
Logger
::
nas_mm
().
debug
(
...
...
@@ -640,7 +642,8 @@ int _5GSMobileIdentity::suci_decodefrombuffer(
(
const
std
::
string
)(
std
::
to_string
(
digit_high
)));
}
supi_format_imsi_tmp
.
msin
=
msin
;
Logger
::
nas_mm
().
debug
(
"Decoded MSIN %s"
,
supi_format_imsi
->
msin
.
c_str
());
Logger
::
nas_mm
().
debug
(
"Decoded MSIN %s"
,
supi_format_imsi_tmp
.
msin
.
c_str
());
supi_format_imsi
=
std
::
optional
<
SUCI_imsi_t
>
(
supi_format_imsi_tmp
);
Logger
::
nas_mm
().
debug
(
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
884d221f
...
...
@@ -30,7 +30,7 @@ using namespace nas;
//------------------------------------------------------------------------------
RegistrationRequest
::
RegistrationRequest
()
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
REGISTRATION_REQUEST
)
{
ie_non_current_native_nas_ksi
=
nullptr
;
ie_non_current_native_nas_ksi
=
std
::
nullopt
;
ie_5g_mm_capability
=
nullptr
;
ie_ue_security_capability
=
nullptr
;
ie_requested_NSSAI
=
nullptr
;
...
...
@@ -178,18 +178,19 @@ void RegistrationRequest::set5G_S_TMSI() {}
//------------------------------------------------------------------------------
void
RegistrationRequest
::
setNon_current_native_nas_ksi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_non_current_native_nas_ksi
=
new
NasKeySetIdentifier
(
0xC
,
tsc
,
key_set_id
);
ie_non_current_native_nas_ksi
=
std
::
make_optional
<
NasKeySetIdentifier
>
(
0xC
,
tsc
,
key_set_id
);
}
//------------------------------------------------------------------------------
uint8_t
RegistrationRequest
::
getNonCurrentNativeNasKSI
()
{
if
(
ie_non_current_native_nas_ksi
)
{
uint8_t
a
=
0
;
a
|=
(
ie_non_current_native_nas_ksi
->
getTypeOfSecurityContext
())
|
(
ie_non_current_native_nas_ksi
->
getNasKeyIdentifier
());
return
a
;
bool
RegistrationRequest
::
getNonCurrentNativeNasKSI
(
uint8_t
&
value
)
const
{
if
(
ie_non_current_native_nas_ksi
.
has_value
()
)
{
value
|=
(
ie_non_current_native_nas_ksi
.
value
().
getTypeOfSecurityContext
())
|
(
ie_non_current_native_nas_ksi
.
value
().
getNasKeyIdentifier
());
return
true
;
}
else
{
return
0
;
return
false
;
}
}
...
...
@@ -551,10 +552,10 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
Logger
::
nas_mm
().
error
(
"Encoding IE ie_5gs_mobility_id error"
);
return
0
;
}
if
(
!
ie_non_current_native_nas_ksi
)
{
if
(
!
ie_non_current_native_nas_ksi
.
has_value
()
)
{
Logger
::
nas_mm
().
warn
(
"IE non_current_native_nas_ksi is not available"
);
}
else
{
if
(
ie_non_current_native_nas_ksi
->
encode2Buffer
(
if
(
ie_non_current_native_nas_ksi
.
value
().
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
)
==
1
)
{
encoded_size
++
;
}
else
{
...
...
@@ -819,10 +820,13 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
switch
((
octet
&
0xf0
)
>>
4
)
{
case
0xC
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI(0xC)"
);
ie_non_current_native_nas_ksi
=
new
NasKeySetIdentifier
();
if
((
decoded_result
=
ie_non_current_native_nas_ksi
->
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
,
false
))
<=
0
)
NasKeySetIdentifier
ie_non_current_native_nas_ksi_tmp
=
{};
if
((
decoded_result
=
ie_non_current_native_nas_ksi_tmp
.
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
,
false
))
<=
0
)
return
decoded_result
;
ie_non_current_native_nas_ksi
=
std
::
optional
<
NasKeySetIdentifier
>
(
ie_non_current_native_nas_ksi_tmp
);
decoded_size
+=
decoded_result
;
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI 0x%x"
,
octet
);
...
...
src/nas/msgs/RegistrationRequest.hpp
View file @
884d221f
...
...
@@ -72,7 +72,7 @@ class RegistrationRequest : public NasMmPlainHeader {
bool
getAdditionalGuti
(
nas
::
_5G_GUTI_t
&
guti
);
void
setNon_current_native_nas_ksi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
uint8_t
getNonCurrentNativeNasKSI
()
;
bool
getNonCurrentNativeNasKSI
(
uint8_t
&
value
)
const
;
void
set5G_MM_capability
(
uint8_t
value
);
uint8_t
get5GMMCapability
();
...
...
@@ -151,10 +151,10 @@ class RegistrationRequest : public NasMmPlainHeader {
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
_5GSMobileIdentity
ie_5gs_mobility_id
;
// Mandatory
NasKeySetIdentifier
*
ie_non_current_native_nas_ksi
;
// Optional
_5GMMCapability
*
ie_5g_mm_capability
;
// Optional
UESecurityCapability
*
ie_ue_security_capability
;
// Optional
NSSAI
*
ie_requested_NSSAI
;
// Optional
std
::
optional
<
NasKeySetIdentifier
>
ie_non_current_native_nas_ksi
;
// Optional
_5GMMCapability
*
ie_5g_mm_capability
;
// Optional
UESecurityCapability
*
ie_ue_security_capability
;
// Optional
NSSAI
*
ie_requested_NSSAI
;
// Optional
// TODO: Last visited registered TAI
UENetworkCapability
*
ie_s1_ue_network_capability
;
// Optional
UplinkDataStatus
*
ie_uplink_data_status
;
// 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