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
2581c2eb
Commit
2581c2eb
authored
Jan 15, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Configuration Update Command
parent
4fa0f372
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
57 additions
and
48 deletions
+57
-48
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+1
-1
src/nas/ies/NetworkName.cpp
src/nas/ies/NetworkName.cpp
+1
-1
src/nas/ies/NetworkName.hpp
src/nas/ies/NetworkName.hpp
+1
-1
src/nas/ies/Rejected_NSSAI.cpp
src/nas/ies/Rejected_NSSAI.cpp
+1
-1
src/nas/ies/Rejected_SNSSAI.cpp
src/nas/ies/Rejected_SNSSAI.cpp
+1
-1
src/nas/ies/Rejected_SNSSAI.hpp
src/nas/ies/Rejected_SNSSAI.hpp
+1
-1
src/nas/msgs/ConfigurationUpdateCommand.cpp
src/nas/msgs/ConfigurationUpdateCommand.cpp
+46
-30
src/nas/msgs/ConfigurationUpdateCommand.hpp
src/nas/msgs/ConfigurationUpdateCommand.hpp
+1
-3
src/nas/msgs/DLNASTransport.cpp
src/nas/msgs/DLNASTransport.cpp
+2
-7
src/nas/msgs/ULNASTransport.cpp
src/nas/msgs/ULNASTransport.cpp
+1
-1
src/nas/msgs/ULNASTransport.hpp
src/nas/msgs/ULNASTransport.hpp
+1
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
2581c2eb
...
...
@@ -3220,7 +3220,7 @@ void amf_n1::ul_nas_transport_handle(
// Decode UL_NAS_TRANSPORT message
Logger
::
amf_n1
().
debug
(
"Handling UL NAS Transport"
);
auto
ul_nas
=
std
::
make_unique
<
ULNASTransport
>
();
ul_nas
->
Decode
(
NULL
,
(
uint8_t
*
)
bdata
(
nas
),
blength
(
nas
));
ul_nas
->
Decode
((
uint8_t
*
)
bdata
(
nas
),
blength
(
nas
));
uint8_t
payload_type
=
ul_nas
->
GetPayloadContainerType
();
uint8_t
pdu_session_id
=
ul_nas
->
GetPduSessionId
();
...
...
src/nas/ies/NetworkName.cpp
View file @
2581c2eb
...
...
@@ -111,7 +111,7 @@ void NetworkName::setTextString(const bstring& str) {
}
//------------------------------------------------------------------------------
int
NetworkName
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
int
NetworkName
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding NetworkName"
);
if
(
len
<
kNetworkNameMinimumLength
)
{
...
...
src/nas/ies/NetworkName.hpp
View file @
2581c2eb
...
...
@@ -47,7 +47,7 @@ class NetworkName {
void
setTextString
(
const
std
::
string
&
str
);
void
setTextString
(
const
bstring
&
str
);
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
=
true
);
private:
...
...
src/nas/ies/Rejected_NSSAI.cpp
View file @
2581c2eb
...
...
@@ -80,7 +80,7 @@ int Rejected_NSSAI::Encode(uint8_t* buf, int len) {
uint8_t
payload_len
=
0
;
for
(
auto
n
:
rejected_nssais
)
{
int
size
=
n
.
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
);
int
size
=
n
.
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
KEncodeDecodeError
)
{
encoded_size
+=
size
;
payload_len
+=
size
;
...
...
src/nas/ies/Rejected_SNSSAI.cpp
View file @
2581c2eb
...
...
@@ -107,7 +107,7 @@ void Rejected_SNSSAI::getCause(uint8_t& cause) {
}
//------------------------------------------------------------------------------
int
Rejected_SNSSAI
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
int
Rejected_SNSSAI
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding Rejected_SNSSAI"
);
if
(
len
<
length_
+
1
)
{
Logger
::
nas_mm
().
error
(
"len is less than %d"
,
length_
);
...
...
src/nas/ies/Rejected_SNSSAI.hpp
View file @
2581c2eb
...
...
@@ -47,7 +47,7 @@ class Rejected_SNSSAI {
uint8_t
getCause
();
void
getCause
(
uint8_t
&
cause
);
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
decodefrombuffer
(
uint8_t
*
buf
,
int
len
);
private:
...
...
src/nas/msgs/ConfigurationUpdateCommand.cpp
View file @
2581c2eb
...
...
@@ -28,8 +28,8 @@
using
namespace
nas
;
//------------------------------------------------------------------------------
ConfigurationUpdateCommand
::
ConfigurationUpdateCommand
()
{
plain_header
=
nullptr
;
ConfigurationUpdateCommand
::
ConfigurationUpdateCommand
()
:
NasMmPlainHeader
(
EPD_5GS_MM_MSG
,
CONFIGURATION_UPDATE_COMMAND
)
{
full_name_for_network
=
nullopt
;
short_name_for_network
=
nullopt
;
}
...
...
@@ -39,9 +39,7 @@ ConfigurationUpdateCommand::~ConfigurationUpdateCommand() {}
//------------------------------------------------------------------------------
void
ConfigurationUpdateCommand
::
SetHeader
(
uint8_t
security_header_type
)
{
plain_header
=
new
NasMmPlainHeader
();
plain_header
->
SetHeader
(
EPD_5GS_MM_MSG
,
security_header_type
,
CONFIGURATION_UPDATE_COMMAND
);
NasMmPlainHeader
::
SetSecurityHeaderType
(
security_header_type
);
}
//------------------------------------------------------------------------------
...
...
@@ -94,36 +92,41 @@ void ConfigurationUpdateCommand::getShortNameForNetwork(
//------------------------------------------------------------------------------
int
ConfigurationUpdateCommand
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding ConfigurationUpdateCommand message"
);
int
encoded_size
=
0
;
if
(
!
plain_header
)
{
Logger
::
nas_mm
().
error
(
"Mandatory IE missing Header"
);
return
-
1
;
int
encoded_size
=
0
;
int
encoded_ie_size
=
0
;
// Header
if
((
encoded_ie_size
=
NasMmPlainHeader
::
Encode
(
buf
,
len
))
==
KEncodeDecodeError
)
{
Logger
::
nas_mm
().
error
(
"Encoding NAS Header error"
);
return
KEncodeDecodeError
;
}
uint8_t
encoded_size_ie
=
0
;
if
(
!
(
encoded_size_ie
=
plain_header
->
Encode
(
buf
,
len
)))
return
0
;
encoded_size
+=
encoded_size_ie
;
encoded_size
+=
encoded_ie_size
;
if
(
!
full_name_for_network
.
has_value
())
{
Logger
::
nas_mm
().
debug
(
"IE Full Name For Network is not available"
);
}
else
{
if
(
int
size
=
full_name_for_network
.
value
().
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
encoded_ie_size
=
full_name_for_network
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
encoded_ie_size
!=
KEncodeDecodeError
)
{
encoded_size
+=
encoded_ie_size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding Full Name For Network error"
);
return
0
;
return
KEncodeDecodeError
;
}
}
if
(
!
short_name_for_network
.
has_value
())
{
Logger
::
nas_mm
().
debug
(
"IE Short Name For Network is not available"
);
}
else
{
if
(
int
size
=
short_name_for_network
.
value
().
encode2buffer
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
encoded_ie_size
=
short_name_for_network
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
encoded_ie_size
!=
KEncodeDecodeError
)
{
encoded_size
+=
encoded_ie_size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding Short Name For Network error"
);
return
0
;
return
KEncodeDecodeError
;
}
}
...
...
@@ -135,10 +138,17 @@ int ConfigurationUpdateCommand::Encode(uint8_t* buf, int len) {
//------------------------------------------------------------------------------
int
ConfigurationUpdateCommand
::
Decode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Decoding ConfigurationUpdateCommand message"
);
int
decoded_size
=
0
;
uint8_t
decoded_size_ie
=
0
;
if
(
!
(
decoded_size_ie
=
plain_header
->
Decode
(
buf
,
len
)))
return
0
;
decoded_size
+=
decoded_size_ie
;
int
decoded_size
=
0
;
int
decoded_result
=
0
;
// Header
decoded_result
=
NasMmPlainHeader
::
Decode
(
buf
,
len
);
if
(
decoded_result
==
KEncodeDecodeError
)
{
Logger
::
nas_mm
().
error
(
"Decoding NAS Header error"
);
return
KEncodeDecodeError
;
}
decoded_size
+=
decoded_result
;
uint8_t
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"First option IEI (0x%x)"
,
octet
);
...
...
@@ -146,9 +156,12 @@ int ConfigurationUpdateCommand::Decode(uint8_t* buf, int len) {
switch
(
octet
)
{
case
kIeiFullNameForNetwork
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI 0x43: Full Name for Network"
);
NetworkName
full_name_for_network_tmp
;
decoded_size
+=
full_name_for_network_tmp
.
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
NetworkName
full_name_for_network_tmp
=
{};
if
((
decoded_result
=
full_name_for_network_tmp
.
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
KEncodeDecodeError
)
return
decoded_result
;
decoded_size
+=
decoded_result
;
full_name_for_network
=
std
::
optional
<
NetworkName
>
(
full_name_for_network_tmp
);
octet
=
*
(
buf
+
decoded_size
);
...
...
@@ -156,9 +169,12 @@ int ConfigurationUpdateCommand::Decode(uint8_t* buf, int len) {
}
break
;
case
kIeiShortNameForNetwork
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI 0x45: Short Name for Network"
);
NetworkName
short_name_for_network_tmp
;
decoded_size
+=
short_name_for_network_tmp
.
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
NetworkName
short_name_for_network_tmp
=
{};
if
((
decoded_result
=
short_name_for_network_tmp
.
decodefrombuffer
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
KEncodeDecodeError
)
return
decoded_result
;
decoded_size
+=
decoded_result
;
short_name_for_network
=
std
::
optional
<
NetworkName
>
(
short_name_for_network_tmp
);
octet
=
*
(
buf
+
decoded_size
);
...
...
src/nas/msgs/ConfigurationUpdateCommand.hpp
View file @
2581c2eb
...
...
@@ -29,7 +29,7 @@
#include "NasIeHeader.hpp"
namespace
nas
{
class
ConfigurationUpdateCommand
{
class
ConfigurationUpdateCommand
:
public
NasMmPlainHeader
{
public:
ConfigurationUpdateCommand
();
~
ConfigurationUpdateCommand
();
...
...
@@ -50,8 +50,6 @@ class ConfigurationUpdateCommand {
int
Decode
(
uint8_t
*
buf
,
int
len
);
public:
NasMmPlainHeader
*
plain_header
;
// TODO: Should be removed in the new NAS version
// Optional
// TODO: Configuration update indication
// TODO: 5G-GUTI
...
...
src/nas/msgs/DLNASTransport.cpp
View file @
2581c2eb
...
...
@@ -233,13 +233,11 @@ int DLNASTransport::Decode(uint8_t* buf, int len) {
decoded_size
+=
decoded_result
;
ie_additional_information
=
std
::
optional
<
AdditionalInformation
>
(
ie_additional_information_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
kIei5gmmCause
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x58)"
);
_5GMM_Cause
ie_5gmm_cause_tmp
=
{};
if
((
decoded_result
=
ie_5gmm_cause_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
...
...
@@ -247,13 +245,11 @@ int DLNASTransport::Decode(uint8_t* buf, int len) {
return
decoded_result
;
decoded_size
+=
decoded_result
;
ie_5gmm_cause
=
std
::
optional
<
_5GMM_Cause
>
(
ie_5gmm_cause_tmp
);
octet
=
*
(
buf
+
decoded_size
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
kIeiGprsTimer3BackOffTimer
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0x37)"
);
GprsTimer3
ie_back_off_timer_value_tmp
(
kIeiGprsTimer3BackOffTimer
);
if
((
decoded_result
=
ie_back_off_timer_value_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
...
...
@@ -262,7 +258,6 @@ int DLNASTransport::Decode(uint8_t* buf, int len) {
decoded_size
+=
decoded_result
;
ie_back_off_timer_value
=
std
::
optional
<
GprsTimer3
>
(
ie_back_off_timer_value_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
...
...
@@ -270,5 +265,5 @@ int DLNASTransport::Decode(uint8_t* buf, int len) {
}
Logger
::
nas_mm
().
debug
(
"Decoded DLNASTransport message len (%d)"
,
decoded_size
);
return
1
;
return
decoded_size
;
}
src/nas/msgs/ULNASTransport.cpp
View file @
2581c2eb
...
...
@@ -317,7 +317,7 @@ int ULNASTransport::Encode(uint8_t* buf, int len) {
}
//------------------------------------------------------------------------------
int
ULNASTransport
::
Decode
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
)
{
int
ULNASTransport
::
Decode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Decoding ULNASTransport message"
);
int
decoded_size
=
0
;
int
decoded_result
=
0
;
...
...
src/nas/msgs/ULNASTransport.hpp
View file @
2581c2eb
...
...
@@ -34,7 +34,7 @@ class ULNASTransport : public NasMmPlainHeader {
void
SetHeader
(
uint8_t
security_header_type
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
NasMmPlainHeader
*
header
,
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
);
void
SetPayloadContainerType
(
uint8_t
value
);
uint8_t
GetPayloadContainerType
();
...
...
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