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
90bc9a46
Commit
90bc9a46
authored
Jan 09, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Allowed PDU Session Status
parent
11db0623
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
98 additions
and
72 deletions
+98
-72
src/nas/common/Ie_Const.hpp
src/nas/common/Ie_Const.hpp
+3
-2
src/nas/ies/5GMMCapability.cpp
src/nas/ies/5GMMCapability.cpp
+1
-1
src/nas/ies/5GSMobileIdentity.cpp
src/nas/ies/5GSMobileIdentity.cpp
+12
-12
src/nas/ies/5GSMobileIdentity.hpp
src/nas/ies/5GSMobileIdentity.hpp
+3
-3
src/nas/ies/AllowedPDUSessionStatus.cpp
src/nas/ies/AllowedPDUSessionStatus.cpp
+56
-34
src/nas/ies/AllowedPDUSessionStatus.hpp
src/nas/ies/AllowedPDUSessionStatus.hpp
+11
-9
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+5
-5
src/nas/msgs/ServiceRequest.cpp
src/nas/msgs/ServiceRequest.cpp
+7
-6
No files found.
src/nas/common/Ie_Const.hpp
View file @
90bc9a46
...
...
@@ -90,8 +90,9 @@ constexpr uint8_t kIeiNetworkSlicingIndication = 0x09; // 9-(4 higher bits)
constexpr
uint8_t
kIeiMicoIndication
=
0x0B
;
// B-(4 higher bits)
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIeiUeStatus
=
0x2b
;
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIeiAllowedPduSessionStatus
=
0x25
;
constexpr
uint8_t
kIeiUeStatus
=
0x2b
;
constexpr
uint8_t
kIeiUeSecurityCapability
=
0x2e
;
constexpr
uint8_t
kIeiUeNetworkCapability
=
0x17
;
...
...
src/nas/ies/5GMMCapability.cpp
View file @
90bc9a46
...
...
@@ -113,7 +113,7 @@ int _5GMMCapability::Decode(uint8_t* buf, int len, bool is_iei) {
DECODE_U8
(
buf
+
decoded_size
,
octet3_
,
decoded_size
);
// TODO: decode the rest as spare for now
uint8_t
spare
=
0
;
for
(
int
i
=
0
;
i
<
(
li_
-
1
);
i
++
)
{
for
(
int
i
=
0
;
i
<
(
GetLengthIndicator
()
-
1
);
i
++
)
{
DECODE_U8
(
buf
+
decoded_size
,
spare
,
decoded_size
);
}
...
...
src/nas/ies/5GSMobileIdentity.cpp
View file @
90bc9a46
...
...
@@ -264,17 +264,17 @@ int _5GSMobileIdentity::EncodeSuci(uint8_t* buf, int len) {
// Routing Indicator
encoded_size
+=
EncodeRoutingIndicator
(
supi_format_imsi_
.
value
().
routing
I
ndicator
,
buf
+
encoded_size
,
supi_format_imsi_
.
value
().
routing
_i
ndicator
,
buf
+
encoded_size
,
len
-
encoded_size
);
// Protection Scheme
ENCODE_U8
(
buf
+
encoded_size
,
0x0f
&
supi_format_imsi_
.
value
().
protection
SchemeI
d
,
buf
+
encoded_size
,
0x0f
&
supi_format_imsi_
.
value
().
protection
_scheme_i
d
,
encoded_size
);
// Home Network Public Key Identifier
ENCODE_U8
(
buf
+
encoded_size
,
supi_format_imsi_
.
value
().
home
NetworkPKI
,
buf
+
encoded_size
,
supi_format_imsi_
.
value
().
home
_network_pki
,
encoded_size
);
// MSIN
...
...
@@ -339,7 +339,7 @@ int _5GSMobileIdentity::DecodeSuci(uint8_t* buf, int len, int ie_len) {
if
(
!
digit
[
0
]
&&
digit
[
1
]
==
0x0f
&&
digit
[
2
]
==
0x0f
&&
digit
[
3
]
==
0x0f
)
{
supi_format_imsi_tmp
.
routing
I
ndicator
=
supi_format_imsi_tmp
.
routing
_i
ndicator
=
std
::
nullopt
;
// No Routing Indicator is configured
Logger
::
nas_mm
().
debug
(
"No Routing Indicator is configured"
);
}
else
{
...
...
@@ -354,19 +354,19 @@ int _5GSMobileIdentity::DecodeSuci(uint8_t* buf, int len, int ie_len) {
"Decoded Routing Indicator is not BCD coding"
);
}
supi_format_imsi_tmp
.
routing
I
ndicator
=
supi_format_imsi_tmp
.
routing
_i
ndicator
=
std
::
optional
<
std
::
string
>
(
result
);
Logger
::
nas_mm
().
debug
(
"Decoded Routing Indicator %s"
,
supi_format_imsi_tmp
.
routing
I
ndicator
.
value
().
c_str
());
supi_format_imsi_tmp
.
routing
_i
ndicator
.
value
().
c_str
());
}
// Protection scheme Id
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
supi_format_imsi_tmp
.
protection
SchemeI
d
=
0x0f
&
octet
;
supi_format_imsi_tmp
.
protection
_scheme_i
d
=
0x0f
&
octet
;
// Home network public key identifier
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
supi_format_imsi_tmp
.
home
NetworkPKI
=
octet
;
supi_format_imsi_tmp
.
home
_network_pki
=
octet
;
// MSIN
std
::
string
msin
=
{};
...
...
@@ -421,11 +421,11 @@ void _5GSMobileIdentity::SetSuciWithSupiImsi(
supi_format_imsi_tmp
.
supi_format
=
SUPI_FORMAT_IMSI
;
supi_format_imsi_tmp
.
mcc
=
mcc
;
supi_format_imsi_tmp
.
mnc
=
mnc
;
supi_format_imsi_tmp
.
routing
I
ndicator
=
supi_format_imsi_tmp
.
routing
_i
ndicator
=
std
::
optional
<
std
::
string
>
(
routing_ind
);
supi_format_imsi_tmp
.
protection
SchemeI
d
=
protection_sch_id
;
supi_format_imsi_tmp
.
home
NetworkPKI
=
HOME_NETWORK_PKI_0_WHEN_PSI_0
;
supi_format_imsi_tmp
.
msin
=
msin
;
supi_format_imsi_tmp
.
protection
_scheme_i
d
=
protection_sch_id
;
supi_format_imsi_tmp
.
home
_network_pki
=
HOME_NETWORK_PKI_0_WHEN_PSI_0
;
supi_format_imsi_tmp
.
msin
=
msin
;
SetLengthIndicator
(
10
+
ceil
(
msin
.
length
()
/
2
));
supi_format_imsi_
=
std
::
optional
<
SUCI_imsi_t
>
(
supi_format_imsi_tmp
);
...
...
src/nas/ies/5GSMobileIdentity.hpp
View file @
90bc9a46
...
...
@@ -68,9 +68,9 @@ typedef struct SUCI_imsi_s {
uint8_t
supi_format
:
3
;
std
::
string
mcc
;
std
::
string
mnc
;
std
::
optional
<
std
::
string
>
routing
I
ndicator
;
//"1234"
uint8_t
protection
SchemeId
:
4
;
// 0000
uint8_t
home
NetworkPKI
;
// 00000000
std
::
optional
<
std
::
string
>
routing
_i
ndicator
;
//"1234"
uint8_t
protection
_scheme_id
:
4
;
// 0000
uint8_t
home
_network_pki
;
// 00000000
std
::
string
msin
;
// two types of coding; BCD & hexadecimal
}
SUCI_imsi_t
;
// SUPI format "IMSI"
...
...
src/nas/ies/AllowedPDUSessionStatus.cpp
View file @
90bc9a46
...
...
@@ -21,6 +21,7 @@
#include "AllowedPDUSessionStatus.hpp"
#include "Ie_Const.hpp"
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "logger.hpp"
...
...
@@ -28,74 +29,95 @@
using
namespace
nas
;
//------------------------------------------------------------------------------
AllowedPDUSessionStatus
::
AllowedPDUSessionStatus
(
uint8_t
iei
)
{
_iei
=
iei
;
length
=
0
;
AllowedPDUSessionStatus
::
AllowedPDUSessionStatus
()
:
Type4NasIe
(
kIeiAllowedPduSessionStatus
)
{
_value
=
0
;
SetLengthIndicator
(
2
);
SetIeName
(
kAllowedPDUSessionStatusIeName
);
}
//------------------------------------------------------------------------------
AllowedPDUSessionStatus
::
AllowedPDUSessionStatus
(
const
uint8_t
iei
,
uint16_t
value
)
{
_iei
=
iei
;
AllowedPDUSessionStatus
::
AllowedPDUSessionStatus
(
uint16_t
value
)
:
Type4NasIe
(
kIeiAllowedPduSessionStatus
)
{
_value
=
value
;
length
=
4
;
SetLengthIndicator
(
2
);
SetIeName
(
kAllowedPDUSessionStatusIeName
);
}
//------------------------------------------------------------------------------
AllowedPDUSessionStatus
::
AllowedPDUSessionStatus
()
:
_iei
(),
length
(),
_value
()
{}
//------------------------------------------------------------------------------
AllowedPDUSessionStatus
::~
AllowedPDUSessionStatus
()
{}
//------------------------------------------------------------------------------
void
AllowedPDUSessionStatus
::
setValue
(
uint8_t
iei
,
uint16_t
value
)
{
_iei
=
iei
;
void
AllowedPDUSessionStatus
::
SetValue
(
uint16_t
value
)
{
_value
=
value
;
}
uint16_t
AllowedPDUSessionStatus
::
getValue
()
{
//------------------------------------------------------------------------------
uint16_t
AllowedPDUSessionStatus
::
GetValue
()
const
{
return
_value
;
}
//------------------------------------------------------------------------------
int
AllowedPDUSessionStatus
::
encode2Buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding AllowedPDUSessionStatus (IEI 0x%x)"
,
_iei
);
int
AllowedPDUSessionStatus
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
int
ie_len
=
GetIeLength
();
if
((
len
<
kAllowedPDUSessionStatusMinimumLength
)
or
(
len
<
length
+
2
))
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kAllowedPDUSessionStatusMinimumLength
);
if
(
len
<
ie_len
)
{
Logger
::
nas_mm
().
error
(
"Len is less than %d"
,
ie_len
);
return
KEncodeDecodeError
;
}
int
encoded_size
=
0
;
if
(
_iei
)
{
ENCODE_U8
(
buf
+
encoded_size
,
_iei
,
encoded_size
);
}
// IEI and Length
int
encoded_header_size
=
Type4NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
if
(
encoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
encoded_size
+=
encoded_header_size
;
ENCODE_U8
(
buf
+
encoded_size
,
length
,
encoded_size
);
ENCODE_U16
(
buf
+
encoded_size
,
_value
,
encoded_size
);
// TODO: Encode spare for the rest
uint8_t
spare
=
0
;
int
spare_len
=
ie_len
-
encoded_size
;
for
(
int
i
=
0
;
i
<
spare_len
;
i
++
)
{
ENCODE_U8
(
buf
+
encoded_size
,
spare
,
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"
Encoded AllowedPDUSessionStatus (len %d)"
,
encoded_size
);
"
Decoded %s, len (%d)"
,
GetIeName
().
c_str
()
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
AllowedPDUSessionStatus
::
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding AllowedPDUSessionStatus"
);
int
decoded_size
=
0
;
if
(
is_option
)
{
DECODE_U8
(
buf
+
decoded_size
,
_iei
,
decoded_size
)
;
int
AllowedPDUSessionStatus
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
if
(
len
<
kAllowedPDUSessionStatusMinimumLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kAllowedPDUSessionStatusMinimumLength
);
return
KEncodeDecodeError
;
}
DECODE_U8
(
buf
+
decoded_size
,
length
,
decoded_size
);
uint8_t
decoded_size
=
0
;
uint8_t
octet
=
0
;
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
// IEI and Length
int
decoded_header_size
=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
// decoded_size += Type4NasIe::Decode(buf + decoded_size, len, is_iei);
if
(
decoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
+=
decoded_header_size
;
DECODE_U16
(
buf
+
decoded_size
,
_value
,
decoded_size
);
// TODO: decode the rest as spare for now
uint8_t
spare
=
0
;
int
spare_len
=
GetLengthIndicator
()
-
sizeof
(
uint16_t
);
for
(
int
i
=
0
;
i
<
spare_len
;
i
++
)
{
DECODE_U8
(
buf
+
decoded_size
,
spare
,
decoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Decoded
AllowedPDUSessionStatus (value 0x%4x)"
,
_value
);
"Decoded
%s (value 0x%4x)"
,
GetIeName
().
c_str
()
,
_value
);
Logger
::
nas_mm
().
debug
(
"Decoded
AllowedPDUSessionStatus (len %d)"
,
decoded_size
);
"Decoded
%s, len (%d)"
,
GetIeName
().
c_str
()
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/AllowedPDUSessionStatus.hpp
View file @
90bc9a46
...
...
@@ -22,27 +22,29 @@
#ifndef _ALLOWED_PDU_SESSION_STATUS_H_
#define _ALLOWED_PDU_SESSION_STATUS_H_
#include "Type4NasIe.hpp"
#include <stdint.h>
constexpr
uint8_t
kAllowedPDUSessionStatusMinimumLength
=
4
;
constexpr
uint8_t
kAllowedPDUSessionStatusMaximumLength
=
34
;
constexpr
auto
kAllowedPDUSessionStatusIeName
=
"Allowed PDU Session Status"
;
namespace
nas
{
class
AllowedPDUSessionStatus
{
class
AllowedPDUSessionStatus
:
public
Type4NasIe
{
public:
AllowedPDUSessionStatus
();
AllowedPDUSessionStatus
(
uint8_t
iei
);
AllowedPDUSessionStatus
(
const
uint8_t
iei
,
uint16_t
value
);
AllowedPDUSessionStatus
(
uint16_t
value
);
~
AllowedPDUSessionStatus
();
void
setValue
(
uint8_t
iei
,
uint16_t
value
);
int
encode2Buffer
(
uint8_t
*
buf
,
int
len
);
int
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
uint16_t
getValue
();
void
SetValue
(
uint16_t
value
);
uint16_t
GetValue
()
const
;
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
);
private:
uint8_t
_iei
;
uint8_t
length
;
uint16_t
_value
;
// TODO: spare
};
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
90bc9a46
...
...
@@ -352,14 +352,14 @@ bool RegistrationRequest::getUeStatus(uint8_t& n1ModeReg, uint8_t& s1ModeReg) {
//------------------------------------------------------------------------------
void
RegistrationRequest
::
setAllowedPDUSessionStatus
(
uint16_t
value
)
{
ie_allowed_PDU_session_status
=
std
::
make_optional
<
AllowedPDUSessionStatus
>
(
0x25
,
value
);
// TODO: remove hardcoded value
ie_allowed_PDU_session_status
=
std
::
make_optional
<
AllowedPDUSessionStatus
>
(
value
);
}
//------------------------------------------------------------------------------
uint16_t
RegistrationRequest
::
getAllowedPduSessionStatus
()
{
if
(
ie_allowed_PDU_session_status
.
has_value
())
{
return
ie_allowed_PDU_session_status
.
value
().
g
etValue
();
return
ie_allowed_PDU_session_status
.
value
().
G
etValue
();
}
else
{
return
0
;
}
...
...
@@ -704,7 +704,7 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_allowed_PDU_session_status
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_allowed_PDU_session_status is not available"
);
}
else
{
if
(
int
size
=
ie_allowed_PDU_session_status
.
value
().
encode2Buffer
(
if
(
int
size
=
ie_allowed_PDU_session_status
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
...
...
@@ -998,7 +998,7 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
case
0x25
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI(0x25)"
);
AllowedPDUSessionStatus
ie_allowed_PDU_session_status_tmp
=
{};
decoded_size
+=
ie_allowed_PDU_session_status_tmp
.
decodeFromBuffer
(
decoded_size
+=
ie_allowed_PDU_session_status_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
ie_allowed_PDU_session_status
=
std
::
optional
<
AllowedPDUSessionStatus
>
(
ie_allowed_PDU_session_status_tmp
);
...
...
src/nas/msgs/ServiceRequest.cpp
View file @
90bc9a46
...
...
@@ -84,7 +84,7 @@ void ServiceRequest::setPDU_session_status(uint16_t value) {
//------------------------------------------------------------------------------
void
ServiceRequest
::
setAllowed_PDU_Session_Status
(
uint16_t
value
)
{
ie_allowed_PDU_session_status
=
new
AllowedPDUSessionStatus
(
0x25
,
value
);
ie_allowed_PDU_session_status
=
new
AllowedPDUSessionStatus
(
value
);
}
//------------------------------------------------------------------------------
...
...
@@ -161,7 +161,7 @@ int ServiceRequest::encode2Buffer(uint8_t* buf, int len) {
if
(
!
ie_allowed_PDU_session_status
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_allowed_PDU_session_status is not available"
);
}
else
{
size
=
ie_allowed_PDU_session_status
->
encode2Buffer
(
size
=
ie_allowed_PDU_session_status
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
0
)
{
encoded_size
+=
size
;
...
...
@@ -223,11 +223,12 @@ int ServiceRequest::decodeFromBuffer(
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
0x25
:
{
case
kIeiAllowedPduSessionStatus
:
{
Logger
::
nas_mm
().
debug
(
"Decoding ie_allowed_PDU_session_status (IEI: 0x25)"
);
"Decoding ie_allowed_PDU_session_status, IEI 0x%x"
,
kIeiAllowedPduSessionStatus
);
ie_allowed_PDU_session_status
=
new
AllowedPDUSessionStatus
();
decoded_size
+=
ie_allowed_PDU_session_status
->
decodeFromBuffer
(
decoded_size
+=
ie_allowed_PDU_session_status
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
...
...
@@ -279,7 +280,7 @@ uint16_t ServiceRequest::getPduSessionStatus() {
//------------------------------------------------------------------------------
uint16_t
ServiceRequest
::
getAllowedPduSessionStatus
()
{
if
(
ie_allowed_PDU_session_status
)
{
return
ie_allowed_PDU_session_status
->
g
etValue
();
return
ie_allowed_PDU_session_status
->
G
etValue
();
}
else
{
return
0
;
}
...
...
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