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
360eb958
Commit
360eb958
authored
Jan 12, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 5GSTrackingAreaIdList
parent
b4e76614
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
77 deletions
+75
-77
src/nas/ies/_5GSTrackingAreaIdList.cpp
src/nas/ies/_5GSTrackingAreaIdList.cpp
+50
-54
src/nas/ies/_5GSTrackingAreaIdList.hpp
src/nas/ies/_5GSTrackingAreaIdList.hpp
+5
-5
src/nas/msgs/RegistrationAccept.cpp
src/nas/msgs/RegistrationAccept.cpp
+19
-17
src/nas/msgs/RegistrationAccept.hpp
src/nas/msgs/RegistrationAccept.hpp
+1
-1
No files found.
src/nas/ies/_5GSTrackingAreaIdList.cpp
View file @
360eb958
...
...
@@ -18,56 +18,84 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "_5GSTrackingAreaIdList.hpp"
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "Ie_Const.hpp"
#include "logger.hpp"
#include "String2Value.hpp"
#include "NasUtils.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
_5GSTrackingAreaIdList
::
_5GSTrackingAreaIdList
()
:
Type4NasIe
(
kIei5gsTrackingAreaIdentityList
),
m_tai_list
()
{
SetLengthIndicator
(
k5gsTrackingAreaIdListMinimumLength
-
2
);
// Minimim length - 2 bytes for header
SetIeName
(
k5gsTrackingAreaIdListIeName
);
}
//------------------------------------------------------------------------------
_5GSTrackingAreaIdList
::
_5GSTrackingAreaIdList
(
uint8_t
iei
,
std
::
vector
<
p_tai_t
>
tai_list
)
{
const
std
::
vector
<
p_tai_t
>&
tai_list
)
:
Type4NasIe
(
kIei5gsTrackingAreaIdentityList
)
{
m_tai_list
=
tai_list
;
m_iei
=
iei
;
length
=
0
;
// TODO:
// Don't know Length Indicator for now
SetIeName
(
k5gsTrackingAreaIdListIeName
);
}
//------------------------------------------------------------------------------
int
_5GSTrackingAreaIdList
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
int
encoded_size
=
0
;
int
len_pos
=
0
;
if
(
m_iei
)
{
ENCODE_U8
(
buf
+
encoded_size
,
m_iei
,
encoded_size
);
// IEI
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
int
ie_len
=
GetIeLength
();
if
(
len
<
ie_len
)
{
Logger
::
nas_mm
().
error
(
"Len is less than %d"
,
ie_len
);
return
KEncodeDecodeError
;
}
len_pos
=
encoded_size
;
// position to encode Length
encoded_size
++
;
// for length octet later on
int
encoded_size
=
0
;
// IEI and Length
int
len_pos
=
0
;
int
encoded_header_size
=
Type4NasIe
::
Encode
(
buf
+
encoded_size
,
len
,
len_pos
);
if
(
encoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
encoded_size
+=
encoded_header_size
;
for
(
int
i
=
0
;
i
<
m_tai_list
.
size
();
i
++
)
{
int
item_len
=
0
;
switch
(
m_tai_list
[
i
].
type
)
{
case
0x00
:
{
i
tem_len
+
=
encode_00_type
(
i
nt
encode_00_type_size
=
encode_00_type
(
m_tai_list
[
i
],
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
encode_00_type_size
==
KEncodeDecodeError
)
break
;
item_len
+=
encode_00_type_size
;
}
break
;
case
0x01
:
{
i
tem_len
+
=
encode_01_type
(
i
nt
encode_01_type_size
=
encode_01_type
(
m_tai_list
[
i
],
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
encode_01_type_size
==
KEncodeDecodeError
)
break
;
item_len
+=
encode_01_type_size
;
}
break
;
case
0x10
:
{
i
tem_len
+
=
encode_10_type
(
i
nt
encode_10_type_size
=
encode_10_type
(
m_tai_list
[
i
],
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
encode_10_type_size
==
KEncodeDecodeError
)
break
;
item_len
+=
encode_10_type_size
;
}
break
;
}
encoded_size
+=
item_len
;
length
+=
item_len
;
}
//*(buf + encoded_size - length - 1) = length;
uint8_t
encoded_size_ie
=
0
;
ENCODE_U8
(
buf
+
len_pos
,
length
,
encoded_size_ie
);
// Encode length
int
encoded_len_ie
=
0
;
ENCODE_U8
(
buf
+
len_pos
,
encoded_size
-
GetHeaderLength
(),
encoded_len_ie
);
Logger
::
nas_mm
().
debug
(
"Encoded %s, len (%d)"
,
GetIeName
().
c_str
(),
encoded_size
);
return
encoded_size
;
}
...
...
@@ -75,9 +103,10 @@ int _5GSTrackingAreaIdList::Encode(uint8_t* buf, int len) {
int
_5GSTrackingAreaIdList
::
encode_00_type
(
p_tai_t
item
,
uint8_t
*
buf
,
int
len
)
{
int
encoded_size
=
0
;
uint8_t
octet
=
0x00
|
((
item
.
tac_list
.
size
()
-
1
)
&
// Type of list/Number of elements
uint8_t
octet
=
0x00
|
((
item
.
tac_list
.
size
()
-
1
)
&
0x1f
);
// see Table 9.11.3.9.1@3GPP TS 24.501 V16.1.0
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
// IEI
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
// Encode PLMN
encoded_size
+=
NasUtils
::
encodeMccMnc2Buffer
(
...
...
@@ -86,15 +115,7 @@ int _5GSTrackingAreaIdList::encode_00_type(
// Encode TAC list
for
(
int
i
=
0
;
i
<
item
.
tac_list
.
size
();
i
++
)
{
// TODO: use ENCODE_U24
ENCODE_U24
(
buf
+
encoded_size
,
item
.
tac_list
[
i
],
encoded_size
);
/*
octet = (item.tac_list[i] & 0x00ff0000) >> 16;
ENCODE_U8(buf + encoded_size, octet, encoded_size);
octet = (item.tac_list[i] & 0x0000ff00) >> 8;
ENCODE_U8(buf + encoded_size, octet, encoded_size);
octet = (item.tac_list[i] & 0x000000ff) >> 0;
ENCODE_U8(buf + encoded_size, octet, encoded_size);*/
}
return
encoded_size
;
}
...
...
@@ -103,37 +124,12 @@ ENCODE_U8(buf + encoded_size, octet, encoded_size);*/
int
_5GSTrackingAreaIdList
::
encode_01_type
(
p_tai_t
item
,
uint8_t
*
buf
,
int
len
)
{
// TODO:
return
1
;
return
KEncodeDecodeError
;
}
//------------------------------------------------------------------------------
int
_5GSTrackingAreaIdList
::
encode_10_type
(
p_tai_t
item
,
uint8_t
*
buf
,
int
len
)
{
// TODO:
return
1
;
}
//------------------------------------------------------------------------------
int
_5GSTrackingAreaIdList
::
encode_mcc_mnc
(
nas_plmn_t
plmn
,
uint8_t
*
buf
,
int
len
)
{
int
encoded_size
=
0
;
int
mcc
=
fromString
<
int
>
(
plmn
.
mcc
);
int
mnc
=
fromString
<
int
>
(
plmn
.
mnc
);
*
(
buf
+
encoded_size
)
=
(
0x0f
&
(
mcc
/
100
))
|
((
0x0f
&
((
mcc
%
100
)
/
10
))
<<
4
);
encoded_size
+=
1
;
if
(
!
(
mnc
/
100
))
{
*
(
buf
+
encoded_size
)
=
(
0x0f
&
(
mcc
%
10
))
|
0xf0
;
encoded_size
+=
1
;
*
(
buf
+
encoded_size
)
=
(
0x0f
&
((
mnc
%
100
)
/
10
))
|
((
0x0f
&
(
mnc
%
10
))
<<
4
);
encoded_size
+=
1
;
}
else
{
*
(
buf
+
encoded_size
)
=
(
0x0f
&
(
mcc
%
10
))
|
((
0x0f
&
(
mnc
%
10
))
<<
4
);
encoded_size
+=
1
;
*
(
buf
+
encoded_size
)
=
((
0x0f
&
((
mnc
%
100
)
/
10
))
<<
4
)
|
(
0x0f
&
(
mnc
/
100
));
encoded_size
+=
1
;
}
return
encoded_size
;
return
KEncodeDecodeError
;
}
src/nas/ies/_5GSTrackingAreaIdList.hpp
View file @
360eb958
...
...
@@ -22,30 +22,30 @@
#ifndef _5GS_TRACKING_AREA_ID_LIST_H_
#define _5GS_TRACKING_AREA_ID_LIST_H_
#include "Type4NasIe.hpp"
#include <vector>
#include "struct.hpp"
constexpr
uint8_t
k5gsTrackingAreaIdListMinimumLength
=
9
;
constexpr
uint8_t
k5gsTrackingAreaIdListMaximumLength
=
114
;
constexpr
auto
k5gsTrackingAreaIdListIeName
=
"5GS Tracking Area Identity List"
;
namespace
nas
{
class
_5GSTrackingAreaIdList
{
class
_5GSTrackingAreaIdList
:
public
Type4NasIe
{
public:
_5GSTrackingAreaIdList
(
uint8_t
iei
,
std
::
vector
<
p_tai_t
>
tai_list
);
_5GSTrackingAreaIdList
();
_5GSTrackingAreaIdList
(
const
std
::
vector
<
p_tai_t
>&
tai_list
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
private:
uint8_t
m_iei
;
uint8_t
length
;
std
::
vector
<
p_tai_t
>
m_tai_list
;
private:
int
encode_00_type
(
p_tai_t
item
,
uint8_t
*
buf
,
int
len
);
int
encode_01_type
(
p_tai_t
item
,
uint8_t
*
buf
,
int
len
);
int
encode_10_type
(
p_tai_t
item
,
uint8_t
*
buf
,
int
len
);
int
encode_mcc_mnc
(
nas_plmn_t
plmn
,
uint8_t
*
buf
,
int
len
);
};
}
// namespace nas
...
...
src/nas/msgs/RegistrationAccept.cpp
View file @
360eb958
...
...
@@ -63,7 +63,7 @@ RegistrationAccept::RegistrationAccept()
ie_T3324_value
=
nullptr
;
ie_ue_radio_capability_id
=
nullptr
;
ie_pending_nssai
=
nullptr
;
ie_tai_list
=
nullptr
;
ie_tai_list
=
std
::
nullopt
;
}
//------------------------------------------------------------------------------
...
...
@@ -279,7 +279,7 @@ void RegistrationAccept::setPending_NSSAI(std::vector<struct SNSSAI_s> nssai) {
//------------------------------------------------------------------------------
void
RegistrationAccept
::
setTaiList
(
std
::
vector
<
p_tai_t
>
tai_list
)
{
ie_tai_list
=
new
_5GSTrackingAreaIdList
(
0x54
,
tai_list
);
ie_tai_list
=
std
::
make_optional
<
_5GSTrackingAreaIdList
>
(
tai_list
);
}
//------------------------------------------------------------------------------
...
...
@@ -315,10 +315,11 @@ int RegistrationAccept::Encode(uint8_t* buf, int len) {
return
0
;
}
}
if
(
!
ie_tai_list
)
{
if
(
!
ie_tai_list
.
has_value
()
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_tai_list is not available"
);
}
else
{
int
size
=
ie_tai_list
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
int
size
=
ie_tai_list
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
);
if
(
size
!=
-
1
)
{
encoded_size
+=
size
;
}
else
{
...
...
@@ -606,19 +607,6 @@ int RegistrationAccept::Encode(uint8_t* buf, int len) {
return
0
;
}
}
#if 0
if(!ie_tai_list){
Logger::nas_mm().warn("IE ie_tai_list is not available");
}else{
int size = ie_tai_list->Encode(buf+encoded_size, len-encoded_size);
if(size != -1){
encoded_size += size;
}else{
Logger::nas_mm().error("Encoding ie_tai_list error");
return 0;
}
}
#endif
Logger
::
nas_mm
().
debug
(
"Encoded RegistrationAccept message len (%d)"
,
encoded_size
);
return
encoded_size
;
...
...
@@ -850,6 +838,20 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) {
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
kIei5gsTrackingAreaIdentityList
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI 0x%x"
,
kIei5gsTrackingAreaIdentityList
);
_5GSTrackingAreaIdList
ie_tai_list_tmp
=
{};
decoded_size
+=
ie_tai_list_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
ie_tai_list
=
std
::
optional
<
_5GSTrackingAreaIdList
>
(
ie_tai_list_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
default:
{
break
;
}
}
}
Logger
::
nas_mm
().
debug
(
...
...
src/nas/msgs/RegistrationAccept.hpp
View file @
360eb958
...
...
@@ -150,7 +150,7 @@ class RegistrationAccept : public NasMmPlainHeader {
std
::
optional
<
_5GSMobileIdentity
>
ie_5g_guti
;
// Optional
std
::
optional
<
PlmnList
>
ie_equivalent_plmns
;
// Optional
_5GSTrackingAreaIdList
*
ie_tai_list
;
// Optional
std
::
optional
<
_5GSTrackingAreaIdList
>
ie_tai_list
;
// Optional
NSSAI
*
ie_allowed_nssai
;
// Optional
Rejected_NSSAI
*
ie_rejected_nssai
;
// Optional
NSSAI
*
ie_configured_nssai
;
// Optional
...
...
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