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
11db0623
Commit
11db0623
authored
Jan 09, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for 5GS Mobile Identity
parent
6010b358
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
198 additions
and
204 deletions
+198
-204
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+1
-1
src/nas/ies/5GSMobileIdentity.cpp
src/nas/ies/5GSMobileIdentity.cpp
+105
-106
src/nas/ies/5GSMobileIdentity.hpp
src/nas/ies/5GSMobileIdentity.hpp
+31
-33
src/nas/msgs/DeregistrationRequest.cpp
src/nas/msgs/DeregistrationRequest.cpp
+9
-9
src/nas/msgs/DeregistrationRequest.hpp
src/nas/msgs/DeregistrationRequest.hpp
+1
-1
src/nas/msgs/IdentityResponse.cpp
src/nas/msgs/IdentityResponse.cpp
+6
-6
src/nas/msgs/IdentityResponse.hpp
src/nas/msgs/IdentityResponse.hpp
+1
-1
src/nas/msgs/RegistrationAccept.cpp
src/nas/msgs/RegistrationAccept.cpp
+7
-7
src/nas/msgs/RegistrationAccept.hpp
src/nas/msgs/RegistrationAccept.hpp
+1
-1
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+11
-11
src/nas/msgs/RegistrationRequest.hpp
src/nas/msgs/RegistrationRequest.hpp
+2
-3
src/nas/msgs/SecurityModeComplete.cpp
src/nas/msgs/SecurityModeComplete.cpp
+12
-13
src/nas/msgs/SecurityModeComplete.hpp
src/nas/msgs/SecurityModeComplete.hpp
+2
-2
src/nas/msgs/ServiceRequest.cpp
src/nas/msgs/ServiceRequest.cpp
+7
-8
src/nas/msgs/ServiceRequest.hpp
src/nas/msgs/ServiceRequest.hpp
+2
-2
No files found.
src/amf-app/amf_n1.cpp
View file @
11db0623
...
...
@@ -712,7 +712,7 @@ void amf_n1::identity_response_handle(
string
supi
=
{};
if
(
identity_response
->
ie_mobility_id
)
{
nas
::
SUCI_imsi_t
imsi
;
identity_response
->
ie_mobility_id
->
g
etSuciWithSupiImsi
(
imsi
);
identity_response
->
ie_mobility_id
->
G
etSuciWithSupiImsi
(
imsi
);
supi
=
imsi
.
mcc
+
imsi
.
mnc
+
imsi
.
msin
;
Logger
::
amf_n1
().
debug
(
"Identity Response: SUCI (%s)"
,
supi
.
c_str
());
}
...
...
src/nas/ies/5GSMobileIdentity.cpp
View file @
11db0623
This diff is collapsed.
Click to expand it.
src/nas/ies/5GSMobileIdentity.hpp
View file @
11db0623
...
...
@@ -51,7 +51,7 @@ typedef struct _5G_GUTI_s {
// IMEI or IMEISV
typedef
struct
IMEI_or_IMEISV_s
{
uint8_t
type
OfIdentity
:
3
;
uint8_t
type
_of_identity_
:
3
;
bool
odd_even_indic
;
// for imei, even means bits 5 to 8 of last octet is
// "1111", for imeisv, bits 5 to 8 of last octet is
// "1111"
...
...
@@ -93,64 +93,62 @@ class _5GSMobileIdentity : public Type6NasIe {
~
_5GSMobileIdentity
();
// Common
void
c
learIe
();
uint8_t
getTypeOfIdentity
()
const
{
return
typeOfIdentity
;
};
int
encode2Buffer
(
uint8_t
*
buf
,
int
len
);
int
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
);
void
C
learIe
();
uint8_t
GetTypeOfIdentity
()
const
{
return
type_of_identity_
;
};
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
);
// 5G GUTI
int
_5g_guti_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_guti_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
void
set5GGUTI
(
int
Encode5gGuti
(
uint8_t
*
buf
,
int
len
);
int
Decode5gGuti
(
uint8_t
*
buf
,
int
len
);
void
Set5gGuti
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
uint8_t
&
amf_region_id
,
const
uint16_t
&
amf_set_id
,
const
uint8_t
&
amf_pointer
,
const
uint32_t
&
_5g_tmsi
);
void
get5GGUTI
(
std
::
optional
<
_5G_GUTI_t
>&
)
const
;
void
Get5gGuti
(
std
::
optional
<
_5G_GUTI_t
>&
)
const
;
// SUCI
int
suci_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
suci_decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
int
length
);
void
s
etSuciWithSupiImsi
(
int
EncodeSuci
(
uint8_t
*
buf
,
int
len
);
int
DecodeSuci
(
uint8_t
*
buf
,
int
len
,
int
length
);
void
S
etSuciWithSupiImsi
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
routing_ind
,
const
uint8_t
protection_sch_id
,
const
std
::
string
&
msin
);
// TODO: SetSUCI, SUCI and SUPI format IMSI
void
s
etSuciWithSupiImsi
(
void
S
etSuciWithSupiImsi
(
const
std
::
string
&
mcc
,
const
std
::
string
&
mnc
,
const
std
::
string
&
routing_ind
,
const
uint8_t
protection_sch_id
,
const
uint8_t
home_pki
,
const
std
::
string
&
msin_digits
);
bool
g
etSuciWithSupiImsi
(
SUCI_imsi_t
&
suci
)
const
;
bool
G
etSuciWithSupiImsi
(
SUCI_imsi_t
&
suci
)
const
;
int
encodeRoutingIndicator2buffe
r
(
int
EncodeRoutingIndicato
r
(
std
::
optional
<
std
::
string
>
routing_indicator
,
uint8_t
*
buf
,
int
len
);
int
encodeMSIN2buffer
(
const
std
::
string
&
msin_str
,
uint8_t
*
buf
,
int
len
);
int
EncodeMsin
(
const
std
::
string
&
msin_str
,
uint8_t
*
buf
,
int
len
);
// TMSI
int
_5g_s_tmsi_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
_5g_s_tmsi_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
int
Encode5gSTmsi
(
uint8_t
*
buf
,
int
len
);
int
Decode5gSTmsi
(
uint8_t
*
buf
,
int
len
);
void
set5G_S_TMSI
(
void
Set5gSTmsi
(
const
uint16_t
amf_set_id
,
const
uint8_t
amf_pointer
,
const
std
::
string
&
tmsi
);
bool
get5G_S_TMSI
(
bool
Get5gSTmsi
(
uint16_t
&
amf_set_id
,
uint8_t
&
amf_pointer
,
std
::
string
&
tmsi
)
const
;
// IMEISV
int
imeisv_encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
imeisv_decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
int
EncodeImeisv
(
uint8_t
*
buf
,
int
len
);
int
DecodeImeisv
(
uint8_t
*
buf
,
int
len
);
void
setIMEISV
(
const
IMEISV_t
&
imeisv
);
bool
getIMEISV
(
IMEISV_t
&
imeisv
)
const
;
void
SetImeisv
(
const
IMEISV_t
&
imeisv
);
bool
GetImeisv
(
IMEISV_t
&
imeisv
)
const
;
private:
// uint8_t iei_;
// uint16_t length;
uint8_t
typeOfIdentity
:
3
;
std
::
optional
<
SUCI_imsi_t
>
supi_format_imsi
;
std
::
optional
<
_5G_GUTI_t
>
_5g_guti
;
std
::
optional
<
IMEI_IMEISV_t
>
_imei
;
// TODO:
std
::
optional
<
IMEISV_t
>
_IMEISV
;
std
::
optional
<
_5G_S_TMSI_t
>
_5g_s_tmsi
;
uint8_t
type_of_identity_
:
3
;
std
::
optional
<
SUCI_imsi_t
>
supi_format_imsi_
;
std
::
optional
<
_5G_GUTI_t
>
_5g_guti_
;
std
::
optional
<
IMEI_IMEISV_t
>
imei_
;
// TODO:
std
::
optional
<
IMEISV_t
>
imeisv_
;
std
::
optional
<
_5G_S_TMSI_t
>
_5g_s_tmsi_
;
};
}
// namespace nas
...
...
src/nas/msgs/DeregistrationRequest.cpp
View file @
11db0623
...
...
@@ -107,7 +107,7 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI(
return
;
}
else
{
ie_5gs_mobility_id
=
new
_5GSMobileIdentity
();
ie_5gs_mobility_id
->
s
etSuciWithSupiImsi
(
ie_5gs_mobility_id
->
S
etSuciWithSupiImsi
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
}
}
...
...
@@ -115,7 +115,7 @@ void DeregistrationRequest::setSUCI_SUPI_format_IMSI(
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
getMobilityIdentityType
(
uint8_t
&
type
)
{
if
(
ie_5gs_mobility_id
)
{
type
=
ie_5gs_mobility_id
->
g
etTypeOfIdentity
();
type
=
ie_5gs_mobility_id
->
G
etTypeOfIdentity
();
}
else
{
type
=
0
;
}
...
...
@@ -124,7 +124,7 @@ void DeregistrationRequest::getMobilityIdentityType(uint8_t& type) {
//------------------------------------------------------------------------------
bool
DeregistrationRequest
::
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
{
if
(
ie_5gs_mobility_id
)
{
ie_5gs_mobility_id
->
g
etSuciWithSupiImsi
(
imsi
);
ie_5gs_mobility_id
->
G
etSuciWithSupiImsi
(
imsi
);
return
true
;
}
else
{
return
false
;
...
...
@@ -135,7 +135,7 @@ bool DeregistrationRequest::getSuciSupiFormatImsi(nas::SUCI_imsi_t& imsi) {
std
::
string
DeregistrationRequest
::
get_5g_guti
()
{
if
(
ie_5gs_mobility_id
)
{
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
{};
std
::
string
guti_str
=
guti
.
value
().
mcc
+
guti
.
value
().
mnc
+
...
...
@@ -162,7 +162,7 @@ void DeregistrationRequest::set5G_GUTI() {}
void
DeregistrationRequest
::
setIMEI_IMEISV
()
{}
//------------------------------------------------------------------------------
void
DeregistrationRequest
::
set5G_S_TMSI
()
{}
void
DeregistrationRequest
::
Set5gSTmsi
()
{}
//------------------------------------------------------------------------------
int
DeregistrationRequest
::
encode2Buffer
(
uint8_t
*
buf
,
int
len
)
{
...
...
@@ -199,8 +199,8 @@ int DeregistrationRequest::encode2Buffer(uint8_t* buf, int len) {
Logger
::
nas_mm
().
error
(
"Encoding IE Deregistration Type error"
);
return
0
;
}
if
(
int
size
=
ie_5gs_mobility_id
->
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
if
(
int
size
=
ie_5gs_mobility_id
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding IE ie_5gs_mobility_id error"
);
...
...
@@ -227,8 +227,8 @@ int DeregistrationRequest::decodeFromBuffer(
false
);
// High position, 1/2 octet
decoded_size
++
;
// 1/2 octet for Deregistration type, 1/2 for ngKSI
ie_5gs_mobility_id
=
new
_5GSMobileIdentity
();
decoded_size
+=
ie_5gs_mobility_id
->
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
decoded_size
+=
ie_5gs_mobility_id
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"Decoded DeregistrationRequest message (len %d)"
,
decoded_size
);
return
1
;
...
...
src/nas/msgs/DeregistrationRequest.hpp
View file @
11db0623
...
...
@@ -54,7 +54,7 @@ class DeregistrationRequest {
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
);
void
set5G_GUTI
();
void
setIMEI_IMEISV
();
void
set5G_S_TMSI
();
void
Set5gSTmsi
();
void
getDeregistrationType
(
uint8_t
&
dereg_type
);
void
getDeregistrationType
(
_5gs_deregistration_type_t
&
type
);
...
...
src/nas/msgs/IdentityResponse.cpp
View file @
11db0623
...
...
@@ -61,7 +61,7 @@ void IdentityResponse::setSUCI_SUPI_format_IMSI(
return
;
}
else
{
ie_mobility_id
=
new
_5GSMobileIdentity
();
ie_mobility_id
->
s
etSuciWithSupiImsi
(
ie_mobility_id
->
S
etSuciWithSupiImsi
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
}
}
...
...
@@ -78,7 +78,7 @@ void IdentityResponse::set5G_GUTI() {}
void
IdentityResponse
::
setIMEI_IMEISV
()
{}
//------------------------------------------------------------------------------
void
IdentityResponse
::
set5G_S_TMSI
()
{}
void
IdentityResponse
::
Set5gSTmsi
()
{}
//------------------------------------------------------------------------------
int
IdentityResponse
::
encode2Buffer
(
uint8_t
*
buf
,
int
len
)
{
...
...
@@ -93,8 +93,8 @@ int IdentityResponse::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_mobility_id
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_mobility_id is not available"
);
}
else
{
if
(
int
size
=
ie_mobility_id
->
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
if
(
int
size
=
ie_mobility_id
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_mobility_id error"
);
...
...
@@ -113,8 +113,8 @@ int IdentityResponse::decodeFromBuffer(
int
decoded_size
=
3
;
plain_header
=
header
;
ie_mobility_id
=
new
_5GSMobileIdentity
();
decoded_size
+=
ie_mobility_id
->
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
decoded_size
+=
ie_mobility_id
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
Logger
::
nas_mm
().
debug
(
"decoded_size(%d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"decoded IdentityResponse message len(%d)"
,
decoded_size
);
...
...
src/nas/msgs/IdentityResponse.hpp
View file @
11db0623
...
...
@@ -48,7 +48,7 @@ class IdentityResponse {
uint8_t
protection_sch_id
,
uint8_t
hnpki
,
const
string
msin
);
void
set5G_GUTI
();
void
setIMEI_IMEISV
();
void
set5G_S_TMSI
();
void
Set5gSTmsi
();
/*** belongs to _5GSMobileIdentity**/
public:
NasMmPlainHeader
*
plain_header
;
...
...
src/nas/msgs/RegistrationAccept.cpp
View file @
11db0623
...
...
@@ -93,7 +93,7 @@ void RegistrationAccept::setSUCI_SUPI_format_IMSI(
}
else
{
_5GSMobileIdentity
ie_5g_guti_tmp
=
{};
ie_5g_guti_tmp
.
SetIei
(
kIei5gGuti
);
ie_5g_guti_tmp
.
s
etSuciWithSupiImsi
(
ie_5g_guti_tmp
.
S
etSuciWithSupiImsi
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
ie_5g_guti
=
std
::
optional
<
_5GSMobileIdentity
>
(
ie_5g_guti_tmp
);
}
...
...
@@ -117,7 +117,7 @@ void RegistrationAccept::set5G_GUTI(
int
setId
=
fromString
<
int
>
(
amfSetId
);
int
pointer
=
fromString
<
int
>
(
amfPointer
);
ie_5g_guti_tmp
.
SetIei
(
kIei5gGuti
);
ie_5g_guti_tmp
.
set5GGUTI
(
ie_5g_guti_tmp
.
Set5gGuti
(
mcc
,
mnc
,
(
uint8_t
)
regionId
,
(
uint16_t
)
setId
,
(
uint8_t
)
pointer
,
tmsi
);
ie_5g_guti
=
std
::
optional
<
_5GSMobileIdentity
>
(
ie_5g_guti_tmp
);
}
...
...
@@ -126,7 +126,7 @@ void RegistrationAccept::set5G_GUTI(
void
RegistrationAccept
::
setIMEI_IMEISV
()
{}
//------------------------------------------------------------------------------
void
RegistrationAccept
::
set5G_S_TMSI
()
{}
void
RegistrationAccept
::
Set5gSTmsi
()
{}
//------------------------------------------------------------------------------
void
RegistrationAccept
::
setEquivalent_PLMNs
(
...
...
@@ -306,8 +306,8 @@ int RegistrationAccept::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_5g_guti
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_5g_guti is not available"
);
}
else
{
int
size
=
ie_5g_guti
.
value
().
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
);
int
size
=
ie_5g_guti
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
)
{
encoded_size
+=
size
;
}
else
{
...
...
@@ -675,8 +675,8 @@ int RegistrationAccept::decodeFromBuffer(uint8_t* buf, int len) {
case
0x77
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x77)"
);
_5GSMobileIdentity
ie_5g_guti_tmp
=
{};
decoded_size
+=
ie_5g_guti_tmp
.
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
decoded_size
+=
ie_5g_guti_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
ie_5g_guti
=
std
::
optional
<
_5GSMobileIdentity
>
(
ie_5g_guti_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
...
...
src/nas/msgs/RegistrationAccept.hpp
View file @
11db0623
...
...
@@ -56,7 +56,7 @@ class RegistrationAccept : public NasMmPlainHeader {
const
std
::
string
&
amfRegionId
,
const
std
::
string
&
amfSetId
,
const
std
::
string
&
amfPointer
,
const
uint32_t
&
tmsi
);
void
setIMEI_IMEISV
();
// TODO:
void
set5G_S_TMSI
();
// TODO:
void
Set5gSTmsi
();
// TODO:
// TODO: Get
// Equivalent PLMNs
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
11db0623
...
...
@@ -99,26 +99,26 @@ void RegistrationRequest::setSUCI_SUPI_format_IMSI(
"interface"
);
return
;
}
else
{
ie_5gs_mobile_identity
.
s
etSuciWithSupiImsi
(
ie_5gs_mobile_identity
.
S
etSuciWithSupiImsi
(
mcc
,
mnc
,
routingInd
,
protection_sch_id
,
msin
);
}
}
//------------------------------------------------------------------------------
uint8_t
RegistrationRequest
::
getMobileIdentityType
()
{
return
ie_5gs_mobile_identity
.
g
etTypeOfIdentity
();
return
ie_5gs_mobile_identity
.
G
etTypeOfIdentity
();
}
//------------------------------------------------------------------------------
bool
RegistrationRequest
::
getSuciSupiFormatImsi
(
nas
::
SUCI_imsi_t
&
imsi
)
{
ie_5gs_mobile_identity
.
g
etSuciWithSupiImsi
(
imsi
);
ie_5gs_mobile_identity
.
G
etSuciWithSupiImsi
(
imsi
);
return
true
;
}
//------------------------------------------------------------------------------
std
::
string
RegistrationRequest
::
get_5g_guti
()
{
std
::
optional
<
nas
::
_5G_GUTI_t
>
guti
=
std
::
nullopt
;
ie_5gs_mobile_identity
.
get5GGUTI
(
guti
);
ie_5gs_mobile_identity
.
Get5gGuti
(
guti
);
if
(
!
guti
.
has_value
())
return
{};
std
::
string
guti_str
=
guti
.
value
().
mcc
+
guti
.
value
().
mnc
+
...
...
@@ -138,7 +138,7 @@ void RegistrationRequest::setAdditional_GUTI_SUCI_SUPI_format_IMSI(
_5GSMobileIdentity
ie_additional_guti_tmp
=
{};
ie_additional_guti_tmp
.
SetIei
(
kIei5gGuti
);
uint32_t
tmsi
=
fromString
<
uint32_t
>
(
_5g_tmsi
);
ie_additional_guti_tmp
.
set5GGUTI
(
ie_additional_guti_tmp
.
Set5gGuti
(
mcc
,
mnc
,
amf_region_id
,
amf_set_id
,
amf_pointer
,
tmsi
);
ie_additional_guti
=
std
::
optional
<
_5GSMobileIdentity
>
(
ie_additional_guti_tmp
);
...
...
@@ -148,7 +148,7 @@ void RegistrationRequest::setAdditional_GUTI_SUCI_SUPI_format_IMSI(
bool
RegistrationRequest
::
getAdditionalGuti
(
nas
::
_5G_GUTI_t
&
guti
)
{
if
(
ie_additional_guti
.
has_value
())
{
std
::
optional
<
nas
::
_5G_GUTI_t
>
guti
=
std
::
nullopt
;
ie_additional_guti
.
value
().
get5GGUTI
(
guti
);
ie_additional_guti
.
value
().
Get5gGuti
(
guti
);
if
(
!
guti
.
has_value
())
return
false
;
return
true
;
}
else
{
...
...
@@ -168,7 +168,7 @@ void RegistrationRequest::set5G_GUTI() {}
void
RegistrationRequest
::
setIMEI_IMEISV
()
{}
//------------------------------------------------------------------------------
void
RegistrationRequest
::
set5G_S_TMSI
()
{}
void
RegistrationRequest
::
Set5gSTmsi
()
{}
//------------------------------------------------------------------------------
void
RegistrationRequest
::
setNonCurrentNativeNasKSI
(
...
...
@@ -559,7 +559,7 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
encoded_size
+=
1
;
// 1/2 for 5GS registration type and 1/2 for ngKSI
// 5GS Mobile Identity
if
((
encoded_ie_size
=
ie_5gs_mobile_identity
.
encode2Buffer
(
if
((
encoded_ie_size
=
ie_5gs_mobile_identity
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
==
KEncodeDecodeError
)
{
Logger
::
nas_mm
().
error
(
"Encoding IE 5GS Mobile Identity error"
);
return
KEncodeDecodeError
;
...
...
@@ -693,7 +693,7 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_additional_guti
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_additional_guti- is not available"
);
}
else
{
if
(
int
size
=
ie_additional_guti
.
value
().
encode2Buffer
(
if
(
int
size
=
ie_additional_guti
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
...
...
@@ -844,7 +844,7 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
buf
+
decoded_size
,
len
-
decoded_size
,
true
,
false
);
// high, 1/2 octet
decoded_size
++
;
// 1/2 octet for ie_5gs_registration_type, 1/2 octet for
// ie_ngKSI
decoded_size
+=
ie_5gs_mobile_identity
.
decodeFromBuffer
(
decoded_size
+=
ie_5gs_mobile_identity
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"First option IEI 0x%x"
,
octet
);
...
...
@@ -987,7 +987,7 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
case
0x77
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x77)"
);
_5GSMobileIdentity
ie_additional_guti_tmp
=
{};
decoded_size
+=
ie_additional_guti_tmp
.
decodeFromBuffer
(
decoded_size
+=
ie_additional_guti_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
ie_additional_guti
=
std
::
optional
<
_5GSMobileIdentity
>
(
ie_additional_guti_tmp
);
...
...
src/nas/msgs/RegistrationRequest.hpp
View file @
11db0623
...
...
@@ -65,7 +65,7 @@ class RegistrationRequest : public NasMmPlainHeader {
std
::
string
get_5g_guti
();
void
setIMEI_IMEISV
();
void
set5G_S_TMSI
();
void
Set5gSTmsi
();
void
setAdditional_GUTI_SUCI_SUPI_format_IMSI
(
const
string
mcc
,
const
string
mnc
,
uint8_t
amf_region_id
,
uint8_t
amf_set_id
,
uint8_t
amf_pointer
,
const
string
_5g_tmsi
);
...
...
@@ -161,8 +161,7 @@ class RegistrationRequest : public NasMmPlainHeader {
std
::
optional
<
PDUSessionStatus
>
ie_PDU_session_status
;
// Optional
std
::
optional
<
MicoIndication
>
ie_MICO_indication
;
// Optional
std
::
optional
<
UEStatus
>
ie_ue_status
;
// Optional
std
::
optional
<
_5GSMobileIdentity
>
ie_additional_guti
;
// Optional
std
::
optional
<
_5GSMobileIdentity
>
ie_additional_guti
;
// Optional
std
::
optional
<
AllowedPDUSessionStatus
>
ie_allowed_PDU_session_status
;
// Optional
std
::
optional
<
UEUsageSetting
>
ie_ues_usage_setting
;
// Optional
...
...
src/nas/msgs/SecurityModeComplete.cpp
View file @
11db0623
...
...
@@ -54,10 +54,10 @@ void SecurityModeComplete::setHeader(uint8_t security_header_type) {
}
//------------------------------------------------------------------------------
void
SecurityModeComplete
::
setIMEISV
(
IMEISV_t
imeisv
)
{
void
SecurityModeComplete
::
SetImeisv
(
IMEISV_t
imeisv
)
{
ie_imeisv
=
new
_5GSMobileIdentity
();
ie_imeisv
->
SetIei
(
kIeiImeisv
);
ie_imeisv
->
setIMEISV
(
imeisv
);
ie_imeisv
->
SetImeisv
(
imeisv
);
}
//------------------------------------------------------------------------------
...
...
@@ -69,13 +69,13 @@ void SecurityModeComplete::setNAS_Message_Container(bstring value) {
void
SecurityModeComplete
::
setNON_IMEISV
(
IMEISV_t
imeisv
)
{
ie_non_imeisvpei
=
new
_5GSMobileIdentity
();
ie_non_imeisvpei
->
SetIei
(
kIeiNonImeisvPei
);
ie_non_imeisvpei
->
setIMEISV
(
imeisv
);
ie_non_imeisvpei
->
SetImeisv
(
imeisv
);
}
//------------------------------------------------------------------------------
bool
SecurityModeComplete
::
getIMEISV
(
IMEISV_t
&
imeisv
)
{
bool
SecurityModeComplete
::
GetImeisv
(
IMEISV_t
&
imeisv
)
{
if
(
ie_imeisv
)
{
ie_imeisv
->
getIMEISV
(
imeisv
);
ie_imeisv
->
GetImeisv
(
imeisv
);
return
true
;
}
else
{
return
false
;
...
...
@@ -95,7 +95,7 @@ bool SecurityModeComplete::getNasMessageContainer(bstring& nas) {
//------------------------------------------------------------------------------
bool
SecurityModeComplete
::
getNON_IMEISV
(
IMEISV_t
&
imeisv
)
{
if
(
ie_non_imeisvpei
)
{
ie_non_imeisvpei
->
getIMEISV
(
imeisv
);
ie_non_imeisvpei
->
GetImeisv
(
imeisv
);
return
true
;
}
else
{
return
false
;
...
...
@@ -115,8 +115,7 @@ int SecurityModeComplete::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_imeisv
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_imeisv is not available"
);
}
else
{
if
(
int
size
=
ie_imeisv
->
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
if
(
int
size
=
ie_imeisv
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding IE ie_imeisv error"
);
...
...
@@ -137,8 +136,8 @@ int SecurityModeComplete::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_non_imeisvpei
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_non_imeisvpei is not available"
);
}
else
{
if
(
int
size
=
ie_non_imeisvpei
->
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
if
(
int
size
=
ie_non_imeisvpei
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding IE ie_non_imeisvpei error"
);
...
...
@@ -166,8 +165,8 @@ int SecurityModeComplete::decodeFromBuffer(
case
0x77
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x77)"
);
ie_imeisv
=
new
_5GSMobileIdentity
();
decoded_size
+=
ie_imeisv
->
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
decoded_size
+=
ie_imeisv
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
}
break
;
case
0x71
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x71)"
);
...
...
@@ -178,7 +177,7 @@ int SecurityModeComplete::decodeFromBuffer(
case
0x78
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x78)"
);
ie_non_imeisvpei
=
new
_5GSMobileIdentity
();
decoded_size
+=
ie_non_imeisvpei
->
decodeFromBuffer
(
decoded_size
+=
ie_non_imeisvpei
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
}
break
;
default:
{
...
...
src/nas/msgs/SecurityModeComplete.hpp
View file @
11db0623
...
...
@@ -41,11 +41,11 @@ class SecurityModeComplete {
int
decodeFromBuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
);
void
setHeader
(
uint8_t
security_header_type
);
void
setIMEISV
(
IMEISV_t
imeisv
);
void
SetImeisv
(
IMEISV_t
imeisv
);
void
setNAS_Message_Container
(
bstring
value
);
void
setNON_IMEISV
(
IMEISV_t
imeisv
);
bool
getIMEISV
(
IMEISV_t
&
imeisv
);
bool
GetImeisv
(
IMEISV_t
&
imeisv
);
bool
getNasMessageContainer
(
bstring
&
nas
);
bool
getNON_IMEISV
(
IMEISV_t
&
imeisv
);
...
...
src/nas/msgs/ServiceRequest.cpp
View file @
11db0623
...
...
@@ -66,10 +66,10 @@ void ServiceRequest::setServiceType(uint8_t stp) {
}
//------------------------------------------------------------------------------
void
ServiceRequest
::
set5G_S_TMSI
(
void
ServiceRequest
::
Set5gSTmsi
(
uint16_t
amfSetId
,
uint8_t
amfPointer
,
string
tmsi
)
{
ie_5g_s_tmsi
=
new
_5GSMobileIdentity
(
0x00
);
ie_5g_s_tmsi
->
set5G_S_TMSI
(
amfSetId
,
amfPointer
,
tmsi
);
ie_5g_s_tmsi
->
Set5gSTmsi
(
amfSetId
,
amfPointer
,
tmsi
);
}
//------------------------------------------------------------------------------
...
...
@@ -127,8 +127,7 @@ int ServiceRequest::encode2Buffer(uint8_t* buf, int len) {
Logger
::
nas_mm
().
error
(
"Encoding ie_ngKSI error"
);
return
0
;
}
int
size
=
ie_5g_s_tmsi
->
encode2Buffer
(
buf
+
encoded_size
,
len
-
encoded_size
);
int
size
=
ie_5g_s_tmsi
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
0
)
{
encoded_size
+=
size
;
}
else
{
...
...
@@ -201,8 +200,8 @@ int ServiceRequest::decodeFromBuffer(
buf
+
decoded_size
,
len
-
decoded_size
,
false
,
true
);
decoded_size
++
;
// 1/2 octet for ngKSI, 1/2 for Service Type
ie_5g_s_tmsi
=
new
_5GSMobileIdentity
();
decoded_size
+=
ie_5g_s_tmsi
->
decodeFromBuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
decoded_size
+=
ie_5g_s_tmsi
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
false
);
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"First optional IE (0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
...
...
@@ -305,10 +304,10 @@ uint8_t ServiceRequest::getServiceType() {
}
//------------------------------------------------------------------------------
bool
ServiceRequest
::
get5G_S_TMSI
(
bool
ServiceRequest
::
Get5gSTmsi
(
uint16_t
&
amfSetId
,
uint8_t
&
amfPointer
,
string
&
tmsi
)
{
if
(
ie_5g_s_tmsi
)
return
ie_5g_s_tmsi
->
get5G_S_TMSI
(
amfSetId
,
amfPointer
,
tmsi
);
return
ie_5g_s_tmsi
->
Get5gSTmsi
(
amfSetId
,
amfPointer
,
tmsi
);
else
return
false
;
}
src/nas/msgs/ServiceRequest.hpp
View file @
11db0623
...
...
@@ -47,7 +47,7 @@ class ServiceRequest {
void
setHeader
(
uint8_t
security_header_type
);
void
setngKSI
(
uint8_t
tsc
,
uint8_t
key_set_id
);
void
setServiceType
(
uint8_t
stp
);
void
set5G_S_TMSI
(
uint16_t
amfSetId
,
uint8_t
amfPointer
,
string
tmsi
);
void
Set5gSTmsi
(
uint16_t
amfSetId
,
uint8_t
amfPointer
,
string
tmsi
);
void
setUplink_data_status
(
uint16_t
value
);
void
setPDU_session_status
(
uint16_t
value
);
void
setAllowed_PDU_Session_Status
(
uint16_t
value
);
...
...
@@ -58,7 +58,7 @@ class ServiceRequest {
int
decodeFromBuffer
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
);
bool
getngKSI
(
uint8_t
&
ng_ksi
);
uint8_t
getServiceType
();
bool
get5G_S_TMSI
(
uint16_t
&
amfSetId
,
uint8_t
&
amfPointer
,
string
&
tmsi
);
bool
Get5gSTmsi
(
uint16_t
&
amfSetId
,
uint8_t
&
amfPointer
,
string
&
tmsi
);
uint16_t
getUplinkDataStatus
();
uint16_t
getPduSessionStatus
();
uint16_t
getAllowedPduSessionStatus
();
...
...
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