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
525280bd
Commit
525280bd
authored
Feb 08, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for DeregistrationRequest
parent
e925922f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
37 deletions
+38
-37
src/nas/msgs/DeregistrationRequest.cpp
src/nas/msgs/DeregistrationRequest.cpp
+24
-23
src/nas/msgs/DeregistrationRequest.hpp
src/nas/msgs/DeregistrationRequest.hpp
+14
-14
No files found.
src/nas/msgs/DeregistrationRequest.cpp
View file @
525280bd
...
...
@@ -21,8 +21,6 @@
#include "DeregistrationRequest.hpp"
#include <string>
#include "3gpp_24.501.hpp"
#include "conversions.hpp"
#include "logger.hpp"
...
...
@@ -49,45 +47,45 @@ void DeregistrationRequest::SetHeader(uint8_t security_header_type) {
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
s
etDeregistrationType
(
uint8_t
dereg_type
)
{
void
DeregistrationRequest
::
S
etDeregistrationType
(
uint8_t
dereg_type
)
{
ie_deregistrationtype
.
set
(
dereg_type
);
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
s
etDeregistrationType
(
_5gs_deregistration_type_t
type
)
{
void
DeregistrationRequest
::
S
etDeregistrationType
(
const
_5gs_deregistration_type_t
&
type
)
{
ie_deregistrationtype
.
set
(
type
);
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
)
{
ie_ng
KSI
.
Set
(
true
);
// high position
ie_ng
KSI
.
SetTypeOfSecurityContext
(
tsc
);
ie_ng
KSI
.
SetNasKeyIdentifier
(
key_set_id
);
ie_ng
_ksi
.
Set
(
true
);
// high position
ie_ng
_ksi
.
SetTypeOfSecurityContext
(
tsc
);
ie_ng
_ksi
.
SetNasKeyIdentifier
(
key_set_id
);
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getDeregistrationType
(
uint8_t
&
dereg_type
)
{
void
DeregistrationRequest
::
GetDeregistrationType
(
uint8_t
&
dereg_type
)
const
{
ie_deregistrationtype
.
get
(
dereg_type
);
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
g
etDeregistrationType
(
_5gs_deregistration_type_t
&
type
)
{
void
DeregistrationRequest
::
G
etDeregistrationType
(
_5gs_deregistration_type_t
&
type
)
const
{
ie_deregistrationtype
.
get
(
type
);
}
//------------------------------------------------------------------------------
bool
DeregistrationRequest
::
getngKSI
(
uint8_t
&
ng_ksi
)
{
bool
DeregistrationRequest
::
GetNgKsi
(
uint8_t
&
ng_ksi
)
const
{
ng_ksi
=
(
ie_ng
KSI
.
GetTypeOfSecurityContext
())
|
ie_ngKSI
.
GetNasKeyIdentifier
();
(
ie_ng
_ksi
.
GetTypeOfSecurityContext
())
|
ie_ng_ksi
.
GetNasKeyIdentifier
();
return
true
;
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
SetSuciSupiFormatImsi
(
const
string
mcc
,
const
string
mnc
,
const
string
routingI
nd
,
uint8_t
protection_sch_id
,
const
string
msin
)
{
const
string
&
mcc
,
const
string
&
mnc
,
const
string
&
routing_i
nd
,
uint8_t
protection_sch_id
,
const
string
&
msin
)
{
if
(
protection_sch_id
!=
NULL_SCHEME
)
{
Logger
::
nas_mm
().
error
(
"Encoding SUCI and SUPI format for IMSI error, please choose correct "
...
...
@@ -95,23 +93,24 @@ void DeregistrationRequest::SetSuciSupiFormatImsi(
return
;
}
else
{
ie_5gs_mobility_id
.
SetSuciWithSupiImsi
(
mcc
,
mnc
,
routing
I
nd
,
protection_sch_id
,
msin
);
mcc
,
mnc
,
routing
_i
nd
,
protection_sch_id
,
msin
);
}
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getMobilityIdentityType
(
uint8_t
&
type
)
{
void
DeregistrationRequest
::
GetMobilityIdentityType
(
uint8_t
&
type
)
const
{
type
=
ie_5gs_mobility_id
.
GetTypeOfIdentity
();
}
//------------------------------------------------------------------------------
bool
DeregistrationRequest
::
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
{
bool
DeregistrationRequest
::
GetSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
const
{
ie_5gs_mobility_id
.
GetSuciWithSupiImsi
(
imsi
);
return
true
;
}
//------------------------------------------------------------------------------
std
::
string
DeregistrationRequest
::
Get5gGuti
()
{
std
::
string
DeregistrationRequest
::
Get5gGuti
()
const
{
std
::
optional
<
nas
::
_5G_GUTI_t
>
guti
=
std
::
nullopt
;
ie_5gs_mobility_id
.
Get5gGuti
(
guti
);
if
(
!
guti
.
has_value
())
return
{};
...
...
@@ -127,8 +126,10 @@ std::string DeregistrationRequest::Get5gGuti() {
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
SetSuciSupiFormatImsi
(
const
string
mcc
,
const
string
mnc
,
const
string
routingInd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
)
{}
const
string
&
mcc
,
const
string
&
mnc
,
const
string
&
routing_ind
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
&
msin
)
{
// TODO:
}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
Set5gGuti
()
{}
...
...
@@ -169,7 +170,7 @@ int DeregistrationRequest::Encode(uint8_t* buf, int len) {
return
KEncodeDecodeError
;
}
size
=
ie_ng
KSI
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
size
=
ie_ng
_ksi
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
++
;
// 1/2 octet for Deregistration Type, 1/2 for ngKSI
}
else
{
...
...
@@ -216,7 +217,7 @@ int DeregistrationRequest::Decode(uint8_t* buf, int len) {
"Decoding %s error"
,
_5GSDeregistrationType
::
GetIeName
().
c_str
());
return
KEncodeDecodeError
;
}
decoded_result
=
ie_ng
KSI
.
Decode
(
decoded_result
=
ie_ng
_ksi
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
,
false
);
// 4 higher bits
if
(
decoded_result
==
KEncodeDecodeError
)
{
Logger
::
nas_mm
().
error
(
...
...
src/nas/msgs/DeregistrationRequest.hpp
View file @
525280bd
...
...
@@ -37,28 +37,28 @@ class DeregistrationRequest : public NasMmPlainHeader {
void
SetHeader
(
uint8_t
security_header_type
);
void
s
etDeregistrationType
(
uint8_t
dereg_type
);
void
getDeregistrationType
(
uint8_t
&
dereg_type
)
;
void
S
etDeregistrationType
(
uint8_t
dereg_type
);
void
GetDeregistrationType
(
uint8_t
&
dereg_type
)
const
;
void
setDeregistrationType
(
_5gs_deregistration_type_t
type
);
void
getDeregistrationType
(
_5gs_deregistration_type_t
&
type
)
;
void
SetDeregistrationType
(
const
_5gs_deregistration_type_t
&
type
);
void
GetDeregistrationType
(
_5gs_deregistration_type_t
&
type
)
const
;
void
SetNgKsi
(
uint8_t
tsc
,
uint8_t
key_set_id
);
bool
getngKSI
(
uint8_t
&
ng_ksi
)
;
bool
GetNgKsi
(
uint8_t
&
ng_ksi
)
const
;
void
s
etMobilityIdentityType
(
uint8_t
type
);
void
getMobilityIdentityType
(
uint8_t
&
type
)
;
void
S
etMobilityIdentityType
(
uint8_t
type
);
void
GetMobilityIdentityType
(
uint8_t
&
type
)
const
;
void
SetSuciSupiFormatImsi
(
const
string
mcc
,
const
string
mnc
,
const
string
routingI
nd
,
uint8_t
protection_sch_id
,
const
string
msin
);
const
string
&
mcc
,
const
string
&
mnc
,
const
string
&
routing_i
nd
,
uint8_t
protection_sch_id
,
const
string
&
msin
);
void
SetSuciSupiFormatImsi
(
const
string
mcc
,
const
string
mnc
,
const
string
routingI
nd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
);
bool
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
;
const
string
&
mcc
,
const
string
&
mnc
,
const
string
&
routing_i
nd
,
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
&
msin
);
bool
GetSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
const
;
void
Set5gGuti
();
std
::
string
Get5gGuti
();
std
::
string
Get5gGuti
()
const
;
void
SetImeiImeisv
();
// TODO: Get
...
...
@@ -68,7 +68,7 @@ class DeregistrationRequest : public NasMmPlainHeader {
public:
_5GSDeregistrationType
ie_deregistrationtype
;
// Mandatory
NasKeySetIdentifier
ie_ng
KSI
;
// Mandatory
NasKeySetIdentifier
ie_ng
_ksi
;
// Mandatory
_5GSMobileIdentity
ie_5gs_mobility_id
;
// Mandatory
};
...
...
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