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
2717c5f8
Commit
2717c5f8
authored
Jan 05, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 5GMM Capability
parent
16e14ef5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
30 deletions
+39
-30
src/nas/ies/5GMMCapability.cpp
src/nas/ies/5GMMCapability.cpp
+27
-23
src/nas/ies/5GMMCapability.hpp
src/nas/ies/5GMMCapability.hpp
+4
-3
src/nas/ies/Type4NasIe.cpp
src/nas/ies/Type4NasIe.cpp
+7
-4
src/nas/ies/Type4NasIe.hpp
src/nas/ies/Type4NasIe.hpp
+1
-0
No files found.
src/nas/ies/5GMMCapability.cpp
View file @
2717c5f8
...
...
@@ -23,28 +23,36 @@
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "Ie_Const.hpp"
#include "logger.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
_5GMMCapability
::
_5GMMCapability
(
const
uint8_t
iei
,
uint8_t
octet3
)
{
iei_
=
iei
;
_5GMMCapability
::
_5GMMCapability
(
const
uint8_t
iei
,
uint8_t
octet3
)
:
Type4NasIe
(
kIei5gmmCapability
)
{
octet3_
=
octet3
;
octet4_
=
std
::
nullopt
;
octet5_
=
std
::
nullopt
;
length
=
1
;
SetLengthIndicator
(
1
);
SetIeName
(
k5gmmCapabilityIeName
);
}
//------------------------------------------------------------------------------
_5GMMCapability
::
_5GMMCapability
()
{}
_5GMMCapability
::
_5GMMCapability
()
:
Type4NasIe
(
kIei5gmmCapability
)
{
octet4_
=
std
::
nullopt
;
octet5_
=
std
::
nullopt
;
SetLengthIndicator
(
1
);
SetIeName
(
k5gmmCapabilityIeName
);
}
//------------------------------------------------------------------------------
_5GMMCapability
::~
_5GMMCapability
()
{}
//------------------------------------------------------------------------------
void
_5GMMCapability
::
setOctet3
(
const
uint8_t
iei
,
uint8_t
octet3
)
{
iei_
=
iei
;
SetIei
(
iei
);
SetLengthIndicator
(
1
);
octet3_
=
octet3
;
}
...
...
@@ -55,8 +63,9 @@ uint8_t _5GMMCapability::getOctet3() const {
//------------------------------------------------------------------------------
int
_5GMMCapability
::
encode2Buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding _5GMMCapability IEI"
);
int
ie_len
=
iei_
?
(
length
+
2
)
:
(
length
+
1
);
// 1 for IEI, 1 for Length
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
int
ie_len
=
iei_
.
has_value
()
?
(
li_
+
2
)
:
(
li_
+
1
);
// 1 for IEI, 1 for Length
if
(
len
<
ie_len
)
{
Logger
::
nas_mm
().
error
(
"Len is less than %d"
,
ie_len
);
...
...
@@ -64,12 +73,8 @@ int _5GMMCapability::encode2Buffer(uint8_t* buf, int len) {
}
int
encoded_size
=
0
;
// IEI
if
(
iei_
)
{
ENCODE_U8
(
buf
+
encoded_size
,
iei_
,
encoded_size
);
}
// Length
ENCODE_U8
(
buf
+
encoded_size
,
length
,
encoded_size
);
// IEI and Length
encoded_size
+=
Type4NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
// Octet 3
ENCODE_U8
(
buf
+
encoded_size
,
octet3_
,
encoded_size
);
// TODO: Encode spare for the rest
...
...
@@ -79,7 +84,8 @@ int _5GMMCapability::encode2Buffer(uint8_t* buf, int len) {
ENCODE_U8
(
buf
+
encoded_size
,
spare
,
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Encoded _5GMMCapability len (%d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
encoded_size
);
return
encoded_size
;
}
...
...
@@ -94,23 +100,21 @@ int _5GMMCapability::decodeFromBuffer(uint8_t* buf, int len, bool is_option) {
uint8_t
decoded_size
=
0
;
uint8_t
octet
=
0
;
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
Logger
::
nas_mm
().
debug
(
"Decoding _5GMMCapability IE"
);
if
(
is_option
)
{
DECODE_U8
(
buf
+
decoded_size
,
iei_
,
decoded_size
);
}
DECODE_U8
(
buf
+
decoded_size
,
length
,
decoded_size
);
// IEI and Length
decoded_size
+=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_option
);
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
<
(
l
ength
-
1
);
i
++
)
{
for
(
int
i
=
0
;
i
<
(
l
i_
-
1
);
i
++
)
{
ENCODE_U8
(
buf
+
decoded_size
,
spare
,
decoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Decoded _5GMMCapability Octet3 value (0x%x)"
,
octet3_
);
Logger
::
nas_mm
().
debug
(
"Decoded _5GMMCapability len (%d)"
,
decoded_size
);
"Decoded %s, Octet3 value (0x%x)"
,
GetIeName
().
c_str
(),
octet3_
);
Logger
::
nas_mm
().
debug
(
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
decoded_size
);
return
decoded_size
;
}
src/nas/ies/5GMMCapability.hpp
View file @
2717c5f8
...
...
@@ -22,15 +22,18 @@
#ifndef _5GMM_CAPABILITY_H_
#define _5GMM_CAPABILITY_H_
#include "Type4NasIe.hpp"
#include <optional>
#include <stdint.h>
constexpr
uint8_t
k5gmmCapabilityMinimumLength
=
3
;
constexpr
uint8_t
k5gmmCapabilityMaximumLength
=
15
;
constexpr
auto
k5gmmCapabilityIeName
=
"5GMM Capability"
;
namespace
nas
{
class
_5GMMCapability
{
class
_5GMMCapability
:
public
Type4NasIe
{
public:
_5GMMCapability
();
_5GMMCapability
(
const
uint8_t
iei
,
uint8_t
octet3
);
...
...
@@ -43,11 +46,9 @@ class _5GMMCapability {
int
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
=
true
);
private:
uint8_t
iei_
;
uint8_t
octet3_
;
// minimum length of 3 octets
std
::
optional
<
uint8_t
>
octet4_
;
std
::
optional
<
uint8_t
>
octet5_
;
uint8_t
length
;
};
}
// namespace nas
...
...
src/nas/ies/Type4NasIe.cpp
View file @
2717c5f8
...
...
@@ -45,6 +45,11 @@ void Type4NasIe::SetIei(const uint8_t& iei) {
iei_
=
std
::
optional
<
uint8_t
>
(
iei
);
}
//------------------------------------------------------------------------------
void
Type4NasIe
::
SetLengthIndicator
(
const
uint8_t
&
li
)
{
li_
=
li
;
}
//------------------------------------------------------------------------------
bool
Type4NasIe
::
Validate
(
const
int
&
len
)
const
{
uint8_t
actual_lengh
=
...
...
@@ -78,8 +83,6 @@ int Type4NasIe::Encode(uint8_t* buf, const int& len) {
//------------------------------------------------------------------------------
int
Type4NasIe
::
Decode
(
const
uint8_t
*
const
buf
,
const
int
&
len
,
bool
is_iei
)
{
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
if
(
!
Validate
(
len
))
return
KEncodeDecodeError
;
int
decoded_size
=
0
;
...
...
@@ -92,7 +95,7 @@ int Type4NasIe::Decode(const uint8_t* const buf, const int& len, bool is_iei) {
DECODE_U8
(
buf
+
decoded_size
,
li_
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Decoded %s (len %d)"
,
GetIeName
().
c_str
(),
decoded_size
);
//
Logger::nas_mm().debug(
//
"Decoded %s (len %d)", GetIeName().c_str(), decoded_size);
return
decoded_size
;
}
src/nas/ies/Type4NasIe.hpp
View file @
2717c5f8
...
...
@@ -34,6 +34,7 @@ class Type4NasIe : public NasIe {
bool
Validate
(
const
int
&
len
)
const
override
;
void
SetIei
(
const
uint8_t
&
iei
);
void
SetLengthIndicator
(
const
uint8_t
&
li
);
int
Encode
(
uint8_t
*
buf
,
const
int
&
len
)
override
;
int
Decode
(
...
...
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