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
af488084
Commit
af488084
authored
Jan 12, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update PLMN List
parent
0870f6ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
30 deletions
+44
-30
src/nas/ies/PLMN_List.cpp
src/nas/ies/PLMN_List.cpp
+40
-27
src/nas/ies/PLMN_List.hpp
src/nas/ies/PLMN_List.hpp
+4
-3
No files found.
src/nas/ies/PLMN_List.cpp
View file @
af488084
...
...
@@ -29,15 +29,15 @@
using
namespace
nas
;
//------------------------------------------------------------------------------
PLMN_List
::
PLMN_List
(
uint8_t
iei
)
{
_iei
=
iei
;
length
=
2
;
PLMN_List
::
PLMN_List
(
uint8_t
iei
)
:
Type4NasIe
(
iei
)
{
SetLengthIndicator
(
0
)
;
SetIeName
(
kPlmnListIeName
)
;
}
//------------------------------------------------------------------------------
PLMN_List
::
PLMN_List
()
{
_iei
=
0
;
length
=
2
;
PLMN_List
::
PLMN_List
()
:
Type4NasIe
()
{
SetLengthIndicator
(
0
)
;
SetIeName
(
kPlmnListIeName
)
;
}
//------------------------------------------------------------------------------
...
...
@@ -45,14 +45,16 @@ PLMN_List::~PLMN_List() {}
//------------------------------------------------------------------------------
void
PLMN_List
::
set
(
uint8_t
iei
,
const
std
::
vector
<
nas_plmn_t
>&
list
)
{
_iei
=
iei
;
plmn_list
=
list
;
plmn_list
=
list
;
int
length
=
0
;
if
(
list
.
size
()
>
0
)
length
=
kPlmnListMinimumLength
+
(
list
.
size
()
-
1
)
*
3
;
// 3 - size of each PLMN
// size of the first PLMN is included in kPlmnListMinimumLength
SetLengthIndicator
(
length
);
}
//------------------------------------------------------------------------------
...
...
@@ -62,39 +64,49 @@ void PLMN_List::getPLMNList(std::vector<nas_plmn_t>& list) {
//------------------------------------------------------------------------------
int
PLMN_List
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding
PLMN_List"
);
Logger
::
nas_mm
().
debug
(
"Encoding
%s"
,
GetIeName
().
c_str
()
);
if
(
len
<
length
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the length of this IE (%d octet)"
,
length
);
int
ie_len
=
GetIeLength
();
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
}
// Length
ENCODE_U8
(
buf
+
encoded_size
,
length
,
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
;
for
(
auto
it
:
plmn_list
)
encoded_size
+=
NasUtils
::
encodeMccMnc2Buffer
(
it
.
mcc
,
it
.
mnc
,
buf
+
encoded_size
,
len
-
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Encoded PLMN_List (len %d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Encoded %s, len (%d)"
,
GetIeName
().
c_str
(),
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
PLMN_List
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding PLMN_List"
);
int
decoded_size
=
0
;
if
(
is_option
)
{
DECODE_U8
(
buf
+
decoded_size
,
_iei
,
decoded_size
);
// IEI
int
PLMN_List
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
if
(
len
<
kPlmnListMinimumLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kPlmnListMinimumLength
);
return
KEncodeDecodeError
;
}
// Length
DECODE_U8
(
buf
+
decoded_size
,
length
,
decoded_size
);
uint8_t
len_ie
=
length
;
int
decoded_size
=
0
;
// IEI and Length
int
decoded_header_size
=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
true
);
if
(
decoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
+=
decoded_header_size
;
uint8_t
len_ie
=
GetLengthIndicator
();
while
(
len_ie
>
0
)
{
nas_plmn_t
nas_plmn
=
{};
uint8_t
size
=
NasUtils
::
decodeMccMncFromBuffer
(
...
...
@@ -106,6 +118,7 @@ int PLMN_List::Decode(uint8_t* buf, int len, bool is_option) {
break
;
}
}
Logger
::
nas_mm
().
debug
(
"Decoded PLMN_List (len %d)"
,
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
decoded_size
);
return
decoded_size
;
}
src/nas/ies/PLMN_List.hpp
View file @
af488084
...
...
@@ -22,16 +22,19 @@
#ifndef _PLMN_LIST_H_
#define _PLMN_LIST_H_
#include "Type4NasIe.hpp"
#include "struct.hpp"
#include <stdint.h>
#include <vector>
constexpr
uint8_t
kPlmnListMinimumLength
=
5
;
constexpr
uint8_t
kPlmnListMaximumLength
=
47
;
constexpr
auto
kPlmnListIeName
=
"PLMN List"
;
namespace
nas
{
class
PLMN_List
{
class
PLMN_List
:
public
Type4NasIe
{
public:
PLMN_List
();
PLMN_List
(
uint8_t
iei
);
...
...
@@ -44,8 +47,6 @@ class PLMN_List {
void
getPLMNList
(
std
::
vector
<
nas_plmn_t
>&
list
);
private:
uint8_t
_iei
;
uint8_t
length
;
std
::
vector
<
nas_plmn_t
>
plmn_list
;
};
}
// namespace nas
...
...
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