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
670c2dcf
Commit
670c2dcf
authored
Jan 08, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update MICO Indication
parent
a59d9367
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
109 additions
and
95 deletions
+109
-95
src/nas/common/Ie_Const.hpp
src/nas/common/Ie_Const.hpp
+2
-0
src/nas/ies/MICOIndication.cpp
src/nas/ies/MICOIndication.cpp
+56
-54
src/nas/ies/MICOIndication.hpp
src/nas/ies/MICOIndication.hpp
+21
-17
src/nas/ies/Type1NasIeFormatTv.cpp
src/nas/ies/Type1NasIeFormatTv.cpp
+5
-0
src/nas/ies/Type1NasIeFormatTv.hpp
src/nas/ies/Type1NasIeFormatTv.hpp
+2
-1
src/nas/msgs/RegistrationAccept.cpp
src/nas/msgs/RegistrationAccept.cpp
+9
-9
src/nas/msgs/RegistrationAccept.hpp
src/nas/msgs/RegistrationAccept.hpp
+1
-1
src/nas/msgs/RegistrationRequest.cpp
src/nas/msgs/RegistrationRequest.cpp
+9
-9
src/nas/msgs/RegistrationRequest.hpp
src/nas/msgs/RegistrationRequest.hpp
+4
-4
No files found.
src/nas/common/Ie_Const.hpp
View file @
670c2dcf
...
...
@@ -88,6 +88,8 @@ constexpr uint8_t kIeiShortNameForNetwork = 0x45;
constexpr
uint8_t
kIeiPayloadContainerType
=
0x08
;
// Should be verified
constexpr
uint8_t
kIeiNetworkSlicingIndication
=
0x09
;
// 9-(4 higher bits)
constexpr
uint8_t
kIeiMicoIndication
=
0x0B
;
// B-(4 higher bits)
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIeiUeSecurityCapability
=
0x2e
;
constexpr
uint8_t
kIeiUeNetworkCapability
=
0x17
;
...
...
src/nas/ies/MICOIndication.cpp
View file @
670c2dcf
...
...
@@ -19,67 +19,91 @@
* contact@openairinterface.org
*/
#include "MICOIndication.hpp"
#include "3gpp_24.501.hpp"
#include "common_defs.h"
#include "Ie_Const.hpp"
#include "logger.hpp"
#include "MICOIndication.hpp"
using
namespace
nas
;
//------------------------------------------------------------------------------
MICOIndication
::
MICOIndication
(
const
uint8_t
_iei
,
bool
sprti
,
bool
raai
)
{
iei
=
_iei
;
RAAI
=
raai
;
SPRTI
=
sprti
;
MicoIndication
::
MicoIndication
(
bool
sprti
,
bool
raai
)
:
Type1NasIeFormatTv
(
kIeiMicoIndication
)
{
raai_
=
raai
;
sprti_
=
sprti
;
SetIeName
(
kMicoIndicationIeName
);
}
//------------------------------------------------------------------------------
MicoIndication
::
MicoIndication
()
:
Type1NasIeFormatTv
(
kIeiMicoIndication
)
{
raai_
=
false
;
sprti_
=
false
;
SetIeName
(
kMicoIndicationIeName
);
}
//------------------------------------------------------------------------------
MicoIndication
::~
MicoIndication
(){};
//------------------------------------------------------------------------------
void
MicoIndication
::
SetValue
()
{
uint8_t
octet
=
(
kIeiMicoIndication
<<
4
)
|
(
sprti_
<<
1
)
|
raai_
;
Type1NasIeFormatTv
::
SetValue
(
octet
);
}
//------------------------------------------------------------------------------
void
MicoIndication
::
SetSprti
(
bool
value
)
{
sprti_
=
value
;
}
//------------------------------------------------------------------------------
MICOIndication
::
MICOIndication
(
bool
sprti
,
bool
raai
)
{
this
->
iei
=
0
;
this
->
RAAI
=
raai
;
this
->
SPRTI
=
sprti
;
bool
MicoIndication
::
GetSprti
()
const
{
return
sprti_
;
}
//------------------------------------------------------------------------------
MICOIndication
::
MICOIndication
()
{
iei
=
0
;
RAAI
=
false
;
SPRTI
=
false
;
void
MicoIndication
::
SetRaai
(
bool
value
)
{
raai_
=
value
;
}
//------------------------------------------------------------------------------
MICOIndication
::~
MICOIndication
(){};
bool
MicoIndication
::
GetRaai
()
const
{
return
raai_
;
}
//------------------------------------------------------------------------------
int
MICOIndication
::
encode2Buffer
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding MICOIndication IE ( IEI 0x%x)"
,
iei
);
int
MicoIndication
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
int
ie_len
=
GetIeLength
();
if
(
len
<
kMICOIndicationIELength
)
{
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
)"
,
kMICOIndicationIELength
);
"
Size of the buffer is not enough to store this IE (IE len %d
)"
,
ie_len
);
return
KEncodeDecodeError
;
}
uint8_t
octet
=
0
;
int
encoded_size
=
0
;
octet
=
(
iei
<<
4
)
|
(
SPRTI
<<
1
)
|
RAAI
;
octet
=
(
kIeiMicoIndication
<<
4
)
|
(
sprti_
<<
1
)
|
raai_
;
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Encoded M
ICO
Indication IE (len: %d octet)"
,
encoded_size
);
"Encoded M
ico
Indication IE (len: %d octet)"
,
encoded_size
);
return
encoded_size
;
}
//------------------------------------------------------------------------------
int
M
ICOIndication
::
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
Logger
::
nas_mm
().
debug
(
"Decoding
MICOIndication IE"
);
if
(
len
<
kM
ICO
IndicationIELength
)
{
int
M
icoIndication
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
Logger
::
nas_mm
().
debug
(
"Decoding
%s"
,
GetIeName
().
c_str
()
);
if
(
len
<
kM
ico
IndicationIELength
)
{
Logger
::
nas_mm
().
error
(
"Buffer length is less than the minimum length of this IE (%d octet)"
,
kM
ICO
IndicationIELength
);
kM
ico
IndicationIELength
);
return
KEncodeDecodeError
;
}
...
...
@@ -87,36 +111,14 @@ int MICOIndication::decodeFromBuffer(uint8_t* buf, int len, bool is_option) {
int
decoded_size
=
0
;
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
if
(
is_option
)
{
iei
=
(
octet
&
0xf0
)
>>
4
;
}
else
{
iei
=
0
;
}
SPRTI
=
octet
&
0x02
;
RAAI
=
octet
&
0x01
;
Logger
::
nas_mm
().
debug
(
"Decoded MICOIndication IEI 0x%x, SPRTI 0x%x, RAAI 0x%x"
,
iei
,
SPRTI
,
RAAI
);
return
decoded_size
;
}
//------------------------------------------------------------------------------
void
MICOIndication
::
setSPRTI
(
bool
value
)
{
SPRTI
=
value
;
}
// TODO: validate IEI
//------------------------------------------------------------------------------
void
MICOIndication
::
setRAAI
(
bool
value
)
{
RAAI
=
value
;
}
sprti_
=
octet
&
0x02
;
raai_
=
octet
&
0x01
;
//------------------------------------------------------------------------------
bool
MICOIndication
::
getSPRTI
()
{
return
SPRTI
;
}
Logger
::
nas_mm
().
debug
(
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
decoded_size
);
//------------------------------------------------------------------------------
bool
MICOIndication
::
getRAAI
()
{
return
RAAI
;
Logger
::
nas_mm
().
debug
(
"SPRTI 0x%x, RAAI 0x%x"
,
sprti_
,
raai_
);
return
decoded_size
;
}
src/nas/ies/MICOIndication.hpp
View file @
670c2dcf
...
...
@@ -19,34 +19,38 @@
* contact@openairinterface.org
*/
#ifndef _MICO_I
ndication
_H
#define _MICO_I
ndication
_H
#ifndef _MICO_I
NDICATION
_H
#define _MICO_I
NDICATION
_H
#include "Type1NasIeFormatTv.hpp"
#include <stdint.h>
constexpr
uint8_t
kMICOIndicationIELength
=
1
;
constexpr
uint8_t
kMicoIndicationIELength
=
1
;
constexpr
auto
kMicoIndicationIeName
=
"MICO Indication"
;
namespace
nas
{
class
M
ICOIndication
{
class
M
icoIndication
:
public
Type1NasIeFormatTv
{
public:
M
ICO
Indication
();
M
ICO
Indication
(
const
uint8_t
_iei
,
bool
sprti
,
bool
raai
);
M
ICO
Indication
(
bool
sprti
,
bool
raai
);
~
M
ICO
Indication
();
M
ico
Indication
();
M
ico
Indication
(
const
uint8_t
_iei
,
bool
sprti
,
bool
raai
);
M
ico
Indication
(
bool
sprti
,
bool
raai
);
~
M
ico
Indication
();
int
encode2Buffer
(
uint8_t
*
buf
,
int
len
);
int
decodeFromBuffer
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
void
setSPRTI
(
bool
value
);
void
setRAAI
(
bool
value
);
bool
getRAAI
();
bool
getSPRTI
();
void
SetSprti
(
bool
value
);
bool
GetSprti
()
const
;
void
SetRaai
(
bool
value
);
bool
GetRaai
()
const
;
void
SetValue
();
private:
uint8_t
iei
;
bool
SPRTI
;
bool
RAAI
;
bool
sprti_
;
bool
raai_
;
};
}
// namespace nas
...
...
src/nas/ies/Type1NasIeFormatTv.cpp
View file @
670c2dcf
...
...
@@ -56,6 +56,11 @@ bool Type1NasIeFormatTv::Validate(const int& len) const {
return
true
;
}
//------------------------------------------------------------------------------
uint8_t
Type1NasIeFormatTv
::
GetIeLength
()
const
{
return
kType1NasIeFormatTvLength
;
}
//------------------------------------------------------------------------------
void
Type1NasIeFormatTv
::
SetValue
(
const
uint8_t
&
value
)
{
value_
=
value
&
0x0f
;
// 4 lower bits
...
...
src/nas/ies/Type1NasIeFormatTv.hpp
View file @
670c2dcf
...
...
@@ -37,9 +37,10 @@ class Type1NasIeFormatTv : public NasIe {
void
SetIei
(
const
uint8_t
&
iei
);
void
SetValue
(
const
uint8_t
&
value
);
void
SetValue
();
void
GetValue
();
uint8_t
GetIeLength
()
const
;
int
Encode
(
uint8_t
*
buf
,
const
int
&
len
)
override
;
int
Decode
(
const
uint8_t
*
const
buf
,
const
int
&
len
,
bool
is_iei
=
true
)
override
;
...
...
src/nas/msgs/RegistrationAccept.cpp
View file @
670c2dcf
...
...
@@ -46,7 +46,7 @@ RegistrationAccept::RegistrationAccept()
ie_PDU_session_status
=
nullptr
;
ie_pdu_session_reactivation_result
=
nullptr
;
ie_pdu_session_reactivation_result_error_cause
=
nullptr
;
ie_MICO_indication
l
=
nullptr
;
ie_MICO_indication
=
nullptr
;
ie_network_slicing_indication
=
nullptr
;
ie_T3512_value
=
nullptr
;
ie_Non_3GPP_de_registration_timer_value
=
nullptr
;
...
...
@@ -188,7 +188,7 @@ void RegistrationAccept::setPDU_session_reactivation_result_error_cause(
//------------------------------------------------------------------------------
void
RegistrationAccept
::
setMICO_Indication
(
bool
sprti
,
bool
raai
)
{
ie_MICO_indication
l
=
new
MICOIndication
(
0x0B
,
sprti
,
raai
);
ie_MICO_indication
=
new
MicoIndication
(
sprti
,
raai
);
}
//------------------------------------------------------------------------------
...
...
@@ -419,14 +419,14 @@ int RegistrationAccept::encode2Buffer(uint8_t* buf, int len) {
return
0
;
}
}
if
(
!
ie_MICO_indication
l
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_MICO_indication
l
is not available"
);
if
(
!
ie_MICO_indication
)
{
Logger
::
nas_mm
().
warn
(
"IE ie_MICO_indication is not available"
);
}
else
{
if
(
int
size
=
ie_MICO_indication
l
->
encode2Buffer
(
if
(
int
size
=
ie_MICO_indication
->
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"Encoding ie_MICO_indication
l
error"
);
Logger
::
nas_mm
().
error
(
"Encoding ie_MICO_indication error"
);
return
0
;
}
}
...
...
@@ -640,8 +640,8 @@ int RegistrationAccept::decodeFromBuffer(uint8_t* buf, int len) {
switch
((
octet
&
0xf0
)
>>
4
)
{
case
0xB
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0xB)"
);
ie_MICO_indication
l
=
new
MICO
Indication
();
decoded_size
+=
ie_MICO_indication
l
->
decodeFromBuffer
(
ie_MICO_indication
=
new
Mico
Indication
();
decoded_size
+=
ie_MICO_indication
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
...
...
@@ -714,7 +714,7 @@ int RegistrationAccept::decodeFromBuffer(uint8_t* buf, int len) {
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
case
kIeiPduSessionStatus
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI
(0x50)"
);
Logger
::
nas_mm
().
debug
(
"Decoding IEI
0x%x"
,
kIeiPduSessionStatus
);
ie_PDU_session_status
=
new
PDUSessionStatus
();
decoded_size
+=
ie_PDU_session_status
->
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
...
...
src/nas/msgs/RegistrationAccept.hpp
View file @
670c2dcf
...
...
@@ -162,7 +162,7 @@ class RegistrationAccept : public NasMmPlainHeader {
PDU_Session_Reactivation_Result_Error_Cause
*
ie_pdu_session_reactivation_result_error_cause
;
// Optional
// TODO: LADN information
M
ICOIndication
*
ie_MICO_indicationl
;
// Optional
M
icoIndication
*
ie_MICO_indication
;
// Optional
NetworkSlicingIndication
*
ie_network_slicing_indication
;
// Optional
// TODO: Service Area List
GPRS_Timer_3
*
ie_T3512_value
;
// Optional
...
...
src/nas/msgs/RegistrationRequest.cpp
View file @
670c2dcf
...
...
@@ -320,14 +320,14 @@ uint16_t RegistrationRequest::getPduSessionStatus() {
//------------------------------------------------------------------------------
void
RegistrationRequest
::
setMICOIndication
(
bool
sprti
,
bool
raai
)
{
ie_MICO_indication
=
std
::
make_optional
<
M
ICOIndication
>
(
0x0B
,
sprti
,
raai
);
ie_MICO_indication
=
std
::
make_optional
<
M
icoIndication
>
(
sprti
,
raai
);
}
//------------------------------------------------------------------------------
bool
RegistrationRequest
::
getMicoIndication
(
uint8_t
&
sprti
,
uint8_t
&
raai
)
{
if
(
ie_MICO_indication
.
has_value
())
{
sprti
=
ie_MICO_indication
.
value
().
getSPRTI
();
raai
=
ie_MICO_indication
.
value
().
getRAAI
();
sprti
=
ie_MICO_indication
.
value
().
GetSprti
();
raai
=
ie_MICO_indication
.
value
().
GetRaai
();
return
true
;
}
else
{
return
false
;
...
...
@@ -669,13 +669,13 @@ int RegistrationRequest::encode2Buffer(uint8_t* buf, int len) {
}
}
if
(
!
ie_MICO_indication
.
has_value
())
{
Logger
::
nas_mm
().
warn
(
"IE ie_MICO_indication
l
is not available"
);
Logger
::
nas_mm
().
warn
(
"IE ie_MICO_indication is not available"
);
}
else
{
if
(
int
size
=
ie_MICO_indication
.
value
().
encode2Buffer
(
if
(
int
size
=
ie_MICO_indication
.
value
().
Encode
(
buf
+
encoded_size
,
len
-
encoded_size
))
{
encoded_size
+=
size
;
}
else
{
Logger
::
nas_mm
().
error
(
"encoding ie_MICO_indication
l
error"
);
Logger
::
nas_mm
().
error
(
"encoding ie_MICO_indication error"
);
return
0
;
}
}
...
...
@@ -864,11 +864,11 @@ int RegistrationRequest::decodeFromBuffer(uint8_t* buf, int len) {
}
break
;
case
0xB
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI (0xB)"
);
M
ICO
Indication
ie_MICO_indication_tmp
=
{};
decoded_size
+=
ie_MICO_indication_tmp
.
decodeFromBuffer
(
M
ico
Indication
ie_MICO_indication_tmp
=
{};
decoded_size
+=
ie_MICO_indication_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
);
ie_MICO_indication
=
std
::
optional
<
M
ICO
Indication
>
(
ie_MICO_indication_tmp
);
std
::
optional
<
M
ico
Indication
>
(
ie_MICO_indication_tmp
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI 0x%x"
,
octet
);
}
break
;
...
...
src/nas/msgs/RegistrationRequest.hpp
View file @
670c2dcf
...
...
@@ -158,11 +158,11 @@ class RegistrationRequest : public NasMmPlainHeader {
ie_last_visited_registered_TAI
;
// Optional
std
::
optional
<
UENetworkCapability
>
ie_s1_ue_network_capability
;
// Optional
std
::
optional
<
UplinkDataStatus
>
ie_uplink_data_status
;
// Optional
std
::
optional
<
PDUSessionStatus
>
ie_PDU_session_status
;
// Optional
std
::
optional
<
PDUSessionStatus
>
ie_PDU_session_status
;
// Optional
std
::
optional
<
MICOIndication
>
ie_MICO_indication
;
// Optional
std
::
optional
<
UEStatus
>
ie_ue_status
;
// Optional
std
::
optional
<
_5GSMobileIdentity
>
ie_additional_guti
;
// Optional
std
::
optional
<
MicoIndication
>
ie_MICO_indication
;
// Optional
std
::
optional
<
UEStatus
>
ie_ue_status
;
// Optional
std
::
optional
<
_5GSMobileIdentity
>
ie_additional_guti
;
// Optional
std
::
optional
<
AllowedPDUSessionStatus
>
ie_allowed_PDU_session_status
;
// Optional
std
::
optional
<
UEUsageSetting
>
ie_ues_usage_setting
;
// 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