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
f867e38c
Commit
f867e38c
authored
Sep 20, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minimal fix for Decoding RegistrationRequest from COTS UE
parent
19603037
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
92 deletions
+85
-92
src/nas/ies/5GMMCapability.cpp
src/nas/ies/5GMMCapability.cpp
+37
-32
src/nas/ies/5GMMCapability.hpp
src/nas/ies/5GMMCapability.hpp
+11
-13
src/nas/ies/UENetworkCapability.cpp
src/nas/ies/UENetworkCapability.cpp
+33
-39
src/nas/ies/UENetworkCapability.hpp
src/nas/ies/UENetworkCapability.hpp
+4
-8
No files found.
src/nas/ies/5GMMCapability.cpp
View file @
f867e38c
...
...
@@ -19,15 +19,9 @@
* contact@openairinterface.org
*/
/*! \file 5GMMCapability.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "5GMMCapability.hpp"
#include "common_defs.h"
#include "logger.hpp"
using
namespace
nas
;
...
...
@@ -35,8 +29,8 @@ using namespace nas;
//------------------------------------------------------------------------------
_5GMMCapability
::
_5GMMCapability
(
const
uint8_t
iei
,
uint8_t
value
)
{
m_iei
=
iei
;
m_value
=
value
;
length
=
3
;
octet3_
=
value
;
length
=
k5gmmCapabilityMinimumLength
;
}
//------------------------------------------------------------------------------
...
...
@@ -48,51 +42,62 @@ _5GMMCapability::~_5GMMCapability() {}
//------------------------------------------------------------------------------
void
_5GMMCapability
::
setValue
(
uint8_t
iei
,
uint8_t
value
)
{
m_iei
=
iei
;
m_value
=
value
;
octet3_
=
value
;
}
//------------------------------------------------------------------------------
uint8_t
_5GMMCapability
::
getValue
()
{
return
m_value
;
return
octet3_
;
}
//------------------------------------------------------------------------------
int
_5GMMCapability
::
encode2buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"
encoding _5GMMCapability iei
(0x%x)"
,
m_iei
);
Logger
::
nas_mm
().
debug
(
"
Encoding _5GMMCapability IEI
(0x%x)"
,
m_iei
);
if
(
len
<
length
)
{
Logger
::
nas_mm
().
error
(
"
l
en is less than %d"
,
length
);
Logger
::
nas_mm
().
error
(
"
L
en is less than %d"
,
length
);
return
0
;
}
int
encoded_size
=
0
;
if
(
m_iei
)
{
*
(
buf
+
encoded_size
)
=
m_iei
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
length
-
2
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
m_value
;
encoded_size
++
;
ENCODE_U8
(
buf
+
encoded_size
,
m_iei
,
encoded_size
);
ENCODE_U8
(
buf
+
encoded_size
,
length
-
2
,
encoded_size
);
}
else
{
*
(
buf
+
encoded_size
)
=
length
-
1
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
m_value
;
encoded_size
++
;
ENCODE_U8
(
buf
+
encoded_size
,
length
-
1
,
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"encoded _5GMMCapability len(%d)"
,
encoded_size
);
ENCODE_U8
(
buf
+
encoded_size
,
octet3_
,
encoded_size
);
// TODO: Encode spare for the rest
uint8_t
spare
=
0
;
for
(
int
i
=
0
;
i
<
(
length
-
encoded_size
);
i
++
)
{
ENCODE_U8
(
buf
+
encoded_size
,
spare
,
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Encoded _5GMMCapability len (%d)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
_5GMMCapability
::
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"decoding _5GMMCapability iei(0x%x)"
,
*
buf
);
int
decoded_size
=
0
;
uint8_t
decoded_size
=
0
;
Logger
::
nas_mm
().
debug
(
"Decoding _5GMMCapability IEI (0x%x)"
,
*
buf
);
if
(
is_option
)
{
decoded_size
++
;
}
length
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
m_value
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"decoded _5GMMCapability value(0x%x)"
,
m_value
);
Logger
::
nas_mm
().
debug
(
"decoded _5GMMCapability len(%d)"
,
decoded_size
);
uint8_t
ie_len
=
0
;
DECODE_U8
(
buf
+
decoded_size
,
ie_len
,
decoded_size
);
length
=
ie_len
+
decoded_size
;
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
<
(
ie_len
-
1
);
i
++
)
{
ENCODE_U8
(
buf
+
decoded_size
,
spare
,
decoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Decoded _5GMMCapability value(0x%x)"
,
octet3_
);
Logger
::
nas_mm
().
debug
(
"Decoded _5GMMCapability len(%d)"
,
decoded_size
);
return
decoded_size
;
}
src/nas/ies/5GMMCapability.hpp
View file @
f867e38c
...
...
@@ -19,18 +19,14 @@
* contact@openairinterface.org
*/
/*! \file 5GMMCapability.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __5GMMCapability_H_
#define __5GMMCapability_H_
#ifndef _5GMM_CAPABILITY_H_
#define _5GMM_CAPABILITY_H_
#include <stdint.h>
constexpr
uint8_t
k5gmmCapabilityMinimumLength
=
3
;
constexpr
uint8_t
k5gmmCapabilityMaximumLength
=
15
;
namespace
nas
{
class
_5GMMCapability
{
...
...
@@ -38,15 +34,17 @@ class _5GMMCapability {
_5GMMCapability
();
_5GMMCapability
(
const
uint8_t
iei
,
uint8_t
value
);
~
_5GMMCapability
();
void
setValue
(
uint8_t
iei
,
uint8_t
value
);
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
uint8_t
getValue
();
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
=
true
);
private:
uint8_t
m_iei
;
uint8_t
m_value
;
in
t
length
;
uint8_t
octet3_
;
// minimum length of 3 octets
uint8_
t
length
;
};
}
// namespace nas
...
...
src/nas/ies/UENetworkCapability.cpp
View file @
f867e38c
...
...
@@ -19,20 +19,12 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "UENetworkCapability.hpp"
#include <iostream>
#include "common_defs.h"
#include "logger.hpp"
using
namespace
nas
;
using
namespace
std
;
//------------------------------------------------------------------------------
UENetworkCapability
::
UENetworkCapability
(
uint8_t
iei
)
{
...
...
@@ -59,7 +51,7 @@ UENetworkCapability::UENetworkCapability(
_iei
=
iei
;
_5g_EEASel
=
_5gg_EEASel
;
_5g_EIASel
=
_5gg_EIASel
;
length
=
4
;
// Minimum length
length
=
kUeNetworkCapabilityMinimumLength
;
Logger
::
nas_mm
().
debug
(
"decoded UENetworkCapability EA(0x%d),IA(0x%d)"
,
_5g_EEASel
,
_5g_EIASel
);
}
...
...
@@ -93,22 +85,21 @@ int UENetworkCapability::encode2buffer(uint8_t* buf, int len) {
}
int
encoded_size
=
0
;
if
(
_iei
)
{
*
(
buf
+
encoded_size
)
=
_iei
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
length
-
2
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
_5g_EEASel
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
_5g_EIASel
;
encoded_size
++
;
ENCODE_U8
(
buf
+
encoded_size
,
_iei
,
encoded_size
);
ENCODE_U8
(
buf
+
encoded_size
,
length
-
2
,
encoded_size
);
}
else
{
*
(
buf
+
encoded_size
)
=
length
-
1
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
_5g_EEASel
;
encoded_size
++
;
*
(
buf
+
encoded_size
)
=
_5g_EIASel
;
encoded_size
++
;
ENCODE_U8
(
buf
+
encoded_size
,
length
-
1
,
encoded_size
);
}
ENCODE_U8
(
buf
+
encoded_size
,
_5g_EEASel
,
encoded_size
);
ENCODE_U8
(
buf
+
encoded_size
,
_5g_EIASel
,
encoded_size
);
// TODO: Encode the rest as spare for now
uint8_t
spare
=
0
;
for
(
int
i
=
0
;
i
<
(
length
-
encoded_size
);
i
++
)
{
ENCODE_U8
(
buf
+
encoded_size
,
spare
,
encoded_size
);
}
Logger
::
nas_mm
().
debug
(
"Encoded UENetworkCapability len (%d)"
,
encoded_size
);
return
encoded_size
;
}
...
...
@@ -118,25 +109,28 @@ int UENetworkCapability::decodefrombuffer(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding UENetworkCapability IEI"
);
int
decoded_size
=
0
;
int
ie_length
=
0
;
if
(
is_option
)
{
_iei
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
DECODE_U8
(
buf
+
decoded_size
,
_iei
,
decoded_size
);
}
uint8_t
ie_len
=
0
;
DECODE_U8
(
buf
+
decoded_size
,
ie_len
,
decoded_size
);
length
=
ie_len
+
decoded_size
;
DECODE_U8
(
buf
+
decoded_size
,
_5g_EEASel
,
decoded_size
);
DECODE_U8
(
buf
+
decoded_size
,
_5g_EIASel
,
decoded_size
);
// TODO: decode the rest as spare for now
uint8_t
spare
=
0
;
for
(
int
i
=
0
;
i
<
(
ie_len
-
2
);
i
++
)
{
ENCODE_U8
(
buf
+
decoded_size
,
spare
,
decoded_size
);
}
length
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
ie_length
=
length
+
decoded_size
;
_5g_EEASel
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
_5g_EIASel
=
*
(
buf
+
decoded_size
);
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"Decoded UENetworkCapability EA (0x%d), IA (0x%d)"
,
_5g_EEASel
,
_5g_EIASel
);
Logger
::
nas_mm
().
debug
(
"Decoded UENetworkCapability
len 0x%d, actual length 0x%d"
,
decoded_size
,
ie_length
);
"Decoded UENetworkCapability
IE len 0x%d, actual length 0x%d"
,
ie_len
,
decoded_size
);
return
ie_length
;
return
decoded_size
;
}
src/nas/ies/UENetworkCapability.hpp
View file @
f867e38c
...
...
@@ -19,18 +19,14 @@
* contact@openairinterface.org
*/
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef _UENetworkCapability_H
#define _UENetworkCapability_H
#include <stdint.h>
constexpr
uint8_t
kUeNetworkCapabilityMinimumLength
=
4
;
constexpr
uint8_t
kUeNetworkCapabilityMaximumLength
=
15
;
namespace
nas
{
class
UENetworkCapability
{
...
...
@@ -45,7 +41,7 @@ class UENetworkCapability {
uint8_t
getEEASel
();
uint8_t
getEIASel
();
int
encode2buffer
(
uint8_t
*
buf
,
int
len
);
int
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
int
decodefrombuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
=
true
);
private:
uint8_t
_iei
;
...
...
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