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
c1fe24fb
Commit
c1fe24fb
authored
Jan 10, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update 5GS Update Type
parent
520b0ee6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
191 additions
and
34 deletions
+191
-34
src/nas/common/NasIeHeader.hpp
src/nas/common/NasIeHeader.hpp
+1
-1
src/nas/ies/_5gsUpdateType.cpp
src/nas/ies/_5gsUpdateType.cpp
+156
-0
src/nas/ies/_5gsUpdateType.hpp
src/nas/ies/_5gsUpdateType.hpp
+24
-23
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+8
-8
src/nas/msgs/RegistrationRequest.hpp
src/nas/msgs/RegistrationRequest.hpp
+2
-2
No files found.
src/nas/common/NasIeHeader.hpp
View file @
c1fe24fb
...
...
@@ -78,7 +78,7 @@
#include "_5GS_Network_Feature_Support.hpp"
#include "_5GS_Registration_Result.hpp"
#include "_5GSTrackingAreaIdentity.hpp"
#include "_5
GS_Update_
Type.hpp"
#include "_5
gsUpdate
Type.hpp"
#include "struct.hpp"
#include "Ie_Const.hpp"
#include "NetworkName.hpp"
src/nas/ies/_5
GS_Update_
Type.cpp
→
src/nas/ies/_5
gsUpdate
Type.cpp
View file @
c1fe24fb
...
...
@@ -19,133 +19,138 @@
* contact@openairinterface.org
*/
#include "_5
GS_Update_
Type.hpp"
#include "_5
gsUpdate
Type.hpp"
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "Ie_Const.hpp"
#include "logger.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
_5
GS_Update_Type
::
_5GS_Update_Type
(
uint8_t
iei
)
{
_iei
=
iei
;
EPS_PNB_CIoT
=
0
;
_5GS_PNB_CIoT
=
0
;
NG_RAN
=
false
;
S
MS
=
false
;
length
=
0
;
_5
gsUpdateType
::
_5gsUpdateType
()
:
Type4NasIe
(
kIei5gsUpdateType
)
{
eps_pnb_ciot_
=
0
;
_5gs_pnb_ciot_
=
0
;
ng_ran_
=
false
;
sms_
=
false
;
S
etLengthIndicator
(
1
)
;
SetIeName
(
k5gsUpdateTypeIeName
)
;
}
//------------------------------------------------------------------------------
_5GS_Update_Type
::
_5GS_Update_Type
()
{
_iei
=
0
;
EPS_PNB_CIoT
=
0
;
_5GS_PNB_CIoT
=
0
;
NG_RAN
=
false
;
SMS
=
false
;
length
=
0
;
_5gsUpdateType
::
_5gsUpdateType
(
uint8_t
eps_PNB_CIoT
,
uint8_t
_5gs_PNB_CIoT
,
bool
ng_RAN
,
bool
sms
)
:
Type4NasIe
(
kIei5gsUpdateType
)
{
eps_pnb_ciot_
=
eps_PNB_CIoT
;
_5gs_pnb_ciot_
=
_5gs_PNB_CIoT
;
ng_ran_
=
ng_RAN
;
sms_
=
sms
;
SetLengthIndicator
(
1
);
SetIeName
(
k5gsUpdateTypeIeName
);
}
//------------------------------------------------------------------------------
_5
GS_Update_Type
::~
_5GS_Update_
Type
()
{}
_5
gsUpdateType
::~
_5gsUpdate
Type
()
{}
//------------------------------------------------------------------------------
_5GS_Update_Type
::
_5GS_Update_Type
(
const
uint8_t
iei
,
uint8_t
eps_PNB_CIoT
,
uint8_t
_5gs_PNB_CIoT
,
bool
ng_RAN
,
bool
sms
)
{
_iei
=
iei
;
EPS_PNB_CIoT
=
eps_PNB_CIoT
;
_5GS_PNB_CIoT
=
_5gs_PNB_CIoT
;
NG_RAN
=
ng_RAN
;
SMS
=
sms
;
length
=
k5gsUpdateTypeLength
;
void
_5gsUpdateType
::
SetEpsPnbCiot
(
uint8_t
value
)
{
eps_pnb_ciot_
=
value
&
0x03
;
// 2 bits
}
//------------------------------------------------------------------------------
void
_5
GS_Update_Type
::
setEPS_PNB_CIoT
(
uint8_t
value
)
{
EPS_PNB_CIoT
=
value
&
0x03
;
// 2 bits
void
_5
gsUpdateType
::
Set5gsPnbCiot
(
uint8_t
value
)
{
_5gs_pnb_ciot_
=
value
&
0x03
;
// 2 bits
}
//------------------------------------------------------------------------------
void
_5
GS_Update_Type
::
set_5GS_PNB_CIoT
(
uint8_t
value
)
{
_5GS_PNB_CIoT
=
value
&
0x03
;
// 2 bits
void
_5
gsUpdateType
::
SetNgRan
(
uint8_t
value
)
{
ng_ran_
=
value
&
0x01
;
// 1 bit
}
//------------------------------------------------------------------------------
void
_5
GS_Update_Type
::
setNG_RAN
(
uint8_t
value
)
{
NG_RAN
=
value
&
0x01
;
// 1 bit
void
_5
gsUpdateType
::
SetSms
(
uint8_t
value
)
{
sms_
=
value
&
0x01
;
// 1 bit
}
//------------------------------------------------------------------------------
void
_5GS_Update_Type
::
setSMS
(
uint8_t
value
)
{
SMS
=
value
&
0x01
;
// 1 bit
uint8_t
_5gsUpdateType
::
GetEpsPnbCiot
(
)
{
return
eps_pnb_ciot_
;
}
//------------------------------------------------------------------------------
uint8_t
_5
GS_Update_Type
::
getEPS_PNB_CIoT
()
{
return
EPS_PNB_CIoT
;
uint8_t
_5
gsUpdateType
::
Get5gsPnbCiot
()
{
return
_5gs_pnb_ciot_
;
}
//------------------------------------------------------------------------------
uint8_t
_5GS_Update_Type
::
get_5GS_PNB_CIoT
()
{
return
_5GS_PNB_CIoT
;
bool
_5gsUpdateType
::
GetNgRan
()
{
return
ng_ran_
;
}
//------------------------------------------------------------------------------
bool
_5
GS_Update_Type
::
getNG_RAN
()
{
return
NG_RAN
;
bool
_5
gsUpdateType
::
GetSms
()
{
return
sms_
;
}
//------------------------------------------------------------------------------
bool
_5GS_Update_Type
::
getSMS
(
)
{
return
SMS
;
}
int
_5gsUpdateType
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
())
;
int
ie_len
=
GetIeLength
();
//------------------------------------------------------------------------------
int
_5GS_Update_Type
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding _5GS_Update_Type"
);
if
(
len
<
k5gsUpdateTypeLength
)
{
if
(
len
<
ie_len
)
{
// Length of the content + IEI/Len
Logger
::
nas_mm
().
error
(
"
Buffer length is less than the minimum length of this IE (%d octet
)"
,
k5gsUpdateTypeLength
);
"
Size of the buffer is not enough to store this IE (IE len %d
)"
,
ie_len
);
return
KEncodeDecodeError
;
}
int
encoded_size
=
0
;
if
(
_iei
)
{
ENCODE_U8
(
buf
+
encoded_size
,
_iei
,
encoded_size
);
}
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
;
uint8_t
octet
=
0
;
octet
=
(
EPS_PNB_CIoT
<<
4
)
|
(
_5GS_PNB_CIoT
<<
2
)
|
(
NG_RAN
<<
1
)
|
SMS
;
octet
=
(
eps_pnb_ciot_
<<
4
)
|
(
_5gs_pnb_ciot_
<<
2
)
|
(
ng_ran_
<<
1
)
|
sms_
;
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"encoded _5GS_Update_Type (len %d)"
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Encoded %s, len (%d)"
,
GetIeName
().
c_str
(),
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
_5
GS_Update_Type
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding _5GS_Update_Type"
);
int
decoded_size
=
0
;
if
(
is_option
)
{
DECODE_U8
(
buf
+
decoded_size
,
_iei
,
decoded_size
)
;
int
_5
gsUpdateType
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
if
(
len
<
k5gsUpdateTypeLength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
k5gsUpdateTypeLength
);
return
KEncodeDecodeError
;
}
// Length
DECODE_U8
(
buf
+
decoded_size
,
length
,
decoded_size
);
uint8_t
octet
=
0
;
uint8_t
decoded_size
=
0
;
uint8_t
octet
=
0
;
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
// IEI and Length
int
decoded_header_size
=
Type4NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
// decoded_size += Type4NasIe::Decode(buf + decoded_size, len, is_iei);
if
(
decoded_header_size
==
KEncodeDecodeError
)
return
KEncodeDecodeError
;
decoded_size
+=
decoded_header_size
;
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
EPS_PNB_CIoT
=
(
octet
&
0x30
)
>>
4
;
_5GS_PNB_CIoT
=
(
octet
&
0x0c
)
>>
2
;
NG_RAN
=
(
octet
&
0x02
)
>>
1
;
SMS
=
(
octet
&
0x01
);
eps_pnb_ciot_
=
(
octet
&
0x30
)
>>
4
;
_5gs_pnb_ciot_
=
(
octet
&
0x0c
)
>>
2
;
ng_ran_
=
(
octet
&
0x02
)
>>
1
;
sms_
=
(
octet
&
0x01
);
Logger
::
nas_mm
().
debug
(
"EPS_PNB_CIoT 0x%x, _5GS_PNB_CIoT 0x%x, NG RAN 0x%x, SMS 0x%x"
,
eps_pnb_ciot_
,
_5gs_pnb_ciot_
,
ng_ran_
,
sms_
);
Logger
::
nas_mm
().
debug
(
"decoded _5GS_Update_Type, "
"EPS_PNB_CIoT 0x%x, _5GS_PNB_CIoT 0x%x, NG_RAN 0x%x, SMS 0x%x"
,
EPS_PNB_CIoT
,
_5GS_PNB_CIoT
,
NG_RAN
,
SMS
);
Logger
::
nas_mm
().
debug
(
"Decoded _5GS_Update_Type (len %d)"
,
decoded_size
);
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
decoded_size
);
return
decoded_size
;
}
src/nas/ies/_5
GS_Update_
Type.hpp
→
src/nas/ies/_5
gsUpdate
Type.hpp
View file @
c1fe24fb
...
...
@@ -19,40 +19,41 @@
* contact@openairinterface.org
*/
#ifndef _5GS_U
pdate_Type
_H
#define _5GS_U
pdate_Type
_H
#ifndef _5GS_U
PDATE_TYPE
_H
#define _5GS_U
PDATE_TYPE
_H
#include "Type4NasIe.hpp"
#include <stdint.h>
constexpr
uint8_t
k5gsUpdateTypeLength
=
3
;
constexpr
auto
k5gsUpdateTypeIeName
=
"5GS Update Type"
;
namespace
nas
{
class
_5
GS_Update_Typ
e
{
class
_5
gsUpdateType
:
public
Type4NasI
e
{
public:
_5
GS_Update_
Type
();
_5
GS_Update_Type
(
uint8_t
iei
);
~
_5GS_Update_Type
(
);
_5GS_Update_Type
(
const
uint8_t
iei
,
uint8_t
eps_PNB_CIoT
,
uint8_t
_5gs_PNB_CIoT
,
bool
ng_RAN
,
bool
sms
);
void
setEPS_PNB_CIoT
(
uint8_t
value
);
void
set_5GS_PNB_CIoT
(
uint8_t
value
);
void
setNG_RAN
(
uint8_t
value
);
void
setSMS
(
uint8_t
value
);
uint8_t
getEPS_PNB_CIoT
();
uint8_t
get_5GS_PNB_CIoT
();
bool
getNG_RAN
();
bool
getSMS
();
_5
gsUpdate
Type
();
_5
gsUpdateType
(
uint8_t
eps_PNB_CIoT
,
uint8_t
_5gs_PNB_CIoT
,
bool
ng_RAN
,
bool
sms
);
~
_5gsUpdateType
();
void
SetEpsPnbCiot
(
uint8_t
value
);
void
Set5gsPnbCiot
(
uint8_t
value
);
void
SetNgRan
(
uint8_t
value
);
void
SetSms
(
uint8_t
value
);
uint8_t
GetEpsPnbCiot
(
);
uint8_t
Get5gsPnbCiot
();
bool
GetNgRan
();
bool
GetSms
();
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
private:
uint8_t
_iei
;
uint8_t
length
;
uint8_t
EPS_PNB_CIoT
;
// bit 4,5
uint8_t
_5GS_PNB_CIoT
;
// bit 2,3
bool
NG_RAN
;
// bit 1
bool
SMS
;
// bit 0
uint8_t
eps_pnb_ciot_
;
// bit 4,5
uint8_t
_5gs_pnb_ciot_
;
// bit 2,3
bool
ng_ran_
;
// bit 1
bool
sms_
;
// bit 0
};
}
// namespace nas
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
c1fe24fb
...
...
@@ -477,8 +477,8 @@ bool RegistrationRequest::getNetworkSlicingIndication(
//------------------------------------------------------------------------------
void
RegistrationRequest
::
set_5GS_Update_Type
(
uint8_t
eps_pnb_ciot
,
uint8_t
_5gs_pnb_ciot
,
bool
ng_ran
,
bool
sms
)
{
ie_5gs_update_type
=
std
::
make_optional
<
_5
GS_Update_
Type
>
(
kIei5gsUpdateType
,
eps_pnb_ciot
,
_5gs_pnb_ciot
,
ng_ran
,
sms
);
ie_5gs_update_type
=
std
::
make_optional
<
_5
gsUpdate
Type
>
(
eps_pnb_ciot
,
_5gs_pnb_ciot
,
ng_ran
,
sms
);
}
//------------------------------------------------------------------------------
...
...
@@ -486,10 +486,10 @@ bool RegistrationRequest::get5GSUpdateType(
uint8_t
&
eps_pnb_ciot
,
uint8_t
&
_5gs_pnb_ciot
,
bool
&
ng_ran_rcu
,
bool
&
sms_requested
)
{
if
(
ie_5gs_update_type
.
has_value
())
{
eps_pnb_ciot
=
ie_5gs_update_type
.
value
().
getEPS_PNB_CIoT
();
_5gs_pnb_ciot
=
ie_5gs_update_type
.
value
().
get_5GS_PNB_CIoT
();
ng_ran_rcu
=
ie_5gs_update_type
.
value
().
getNG_RAN
();
sms_requested
=
ie_5gs_update_type
.
value
().
getSMS
();
eps_pnb_ciot
=
ie_5gs_update_type
.
value
().
GetEpsPnbCiot
();
_5gs_pnb_ciot
=
ie_5gs_update_type
.
value
().
Get5gsPnbCiot
();
ng_ran_rcu
=
ie_5gs_update_type
.
value
().
GetNgRan
();
sms_requested
=
ie_5gs_update_type
.
value
().
GetSms
();
return
true
;
}
else
{
return
false
;
...
...
@@ -1057,11 +1057,11 @@ int RegistrationRequest::Decode(uint8_t* buf, int len) {
}
break
;
case
0x53
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI(0x53)"
);
_5
GS_Update_
Type
ie_5gs_update_type_tmp
=
{};
_5
gsUpdate
Type
ie_5gs_update_type_tmp
=
{};
decoded_size
+=
ie_5gs_update_type_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
ie_5gs_update_type
=
std
::
optional
<
_5
GS_Update_
Type
>
(
ie_5gs_update_type_tmp
);
std
::
optional
<
_5
gsUpdate
Type
>
(
ie_5gs_update_type_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI 0x%x"
,
octet
);
}
break
;
...
...
src/nas/msgs/RegistrationRequest.hpp
View file @
c1fe24fb
...
...
@@ -172,8 +172,8 @@ class RegistrationRequest : public NasMmPlainHeader {
std
::
optional
<
PayloadContainerType
>
ie_payload_container_type
;
// Optional
std
::
optional
<
Payload_Container
>
ie_payload_container
;
// Optional
std
::
optional
<
NetworkSlicingIndication
>
ie_network_slicing_indication
;
// Optional
std
::
optional
<
_5
GS_Update_
Type
>
ie_5gs_update_type
;
// Optional
ie_network_slicing_indication
;
// Optional
std
::
optional
<
_5
gsUpdate
Type
>
ie_5gs_update_type
;
// Optional
// TODO: Mobile station classmark 2
// TODO: Supported codecs
std
::
optional
<
NAS_Message_Container
>
ie_nas_message_container
;
// 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