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
3e503cfb
Commit
3e503cfb
authored
Jan 13, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update IMEISV Request and EPS NAS Security Alg
parent
2542778d
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
238 additions
and
63 deletions
+238
-63
src/nas/common/Ie_Const.hpp
src/nas/common/Ie_Const.hpp
+9
-6
src/nas/common/NasIeHeader.hpp
src/nas/common/NasIeHeader.hpp
+2
-2
src/nas/ies/EpsNasSecurityAlgorithms.cpp
src/nas/ies/EpsNasSecurityAlgorithms.cpp
+132
-0
src/nas/ies/EpsNasSecurityAlgorithms.hpp
src/nas/ies/EpsNasSecurityAlgorithms.hpp
+20
-20
src/nas/ies/ImeisvRequest.cpp
src/nas/ies/ImeisvRequest.cpp
+50
-0
src/nas/ies/ImeisvRequest.hpp
src/nas/ies/ImeisvRequest.hpp
+11
-20
src/nas/msgs/SecurityModeCommand.cpp
src/nas/msgs/SecurityModeCommand.cpp
+12
-13
src/nas/msgs/SecurityModeCommand.hpp
src/nas/msgs/SecurityModeCommand.hpp
+2
-2
No files found.
src/nas/common/Ie_Const.hpp
View file @
3e503cfb
...
@@ -89,10 +89,11 @@ constexpr uint8_t kIeiShortNameForNetwork = 0x45;
...
@@ -89,10 +89,11 @@ constexpr uint8_t kIeiShortNameForNetwork = 0x45;
constexpr
uint8_t
kIeiPayloadContainerType
=
0x08
;
// Should be verified
constexpr
uint8_t
kIeiPayloadContainerType
=
0x08
;
// Should be verified
constexpr
uint8_t
kIeiNetworkSlicingIndication
=
0x09
;
// 9-(4 higher bits)
constexpr
uint8_t
kIeiNetworkSlicingIndication
=
0x09
;
// 9-(4 higher bits)
constexpr
uint8_t
kIeiNssaiInclusionMode
=
0x0A
;
//
B
-(4 higher bits)
constexpr
uint8_t
kIeiNssaiInclusionMode
=
0x0A
;
//
A
-(4 higher bits)
constexpr
uint8_t
kIeiMicoIndication
=
0x0B
;
// B-(4 higher bits)
constexpr
uint8_t
kIeiMicoIndication
=
0x0B
;
// B-(4 higher bits)
constexpr
uint8_t
kIeiNasKeySetIdentifier
=
0x0C
;
// C-(4 higher bits)
constexpr
uint8_t
kIeiNasKeySetIdentifier
=
0x0C
;
// C-(4 higher bits)
constexpr
uint8_t
kIeiNon3gppNwProvidedPolicies
=
0x0D
;
// C-(4 higher bits)
constexpr
uint8_t
kIeiNon3gppNwProvidedPolicies
=
0x0D
;
// D-(4 higher bits)
constexpr
uint8_t
kIeiImeisvRequest
=
0x0E
;
// E-(4 higher bits)
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIei5gmmCapability
=
0x10
;
constexpr
uint8_t
kIeiUeUsageSetting
=
0x18
;
constexpr
uint8_t
kIeiUeUsageSetting
=
0x18
;
...
@@ -108,7 +109,8 @@ constexpr uint8_t kIeiAuthenticationResponseParameter = 0x2D;
...
@@ -108,7 +109,8 @@ constexpr uint8_t kIeiAuthenticationResponseParameter = 0x2D;
constexpr
uint8_t
kIeiUeSecurityCapability
=
0x2e
;
constexpr
uint8_t
kIeiUeSecurityCapability
=
0x2e
;
constexpr
uint8_t
kIeiUeNetworkCapability
=
0x17
;
constexpr
uint8_t
kIeiUeNetworkCapability
=
0x17
;
constexpr
uint8_t
kIeiAbba
=
0x38
;
constexpr
uint8_t
kIeiAdditional5gSecurityInformation
=
0x36
;
constexpr
uint8_t
kIeiAbba
=
0x38
;
constexpr
uint8_t
kIeiUplinkDataStatus
=
0x40
;
constexpr
uint8_t
kIeiUplinkDataStatus
=
0x40
;
...
@@ -116,9 +118,10 @@ constexpr uint8_t kT3502Value = 0x16;
...
@@ -116,9 +118,10 @@ constexpr uint8_t kT3502Value = 0x16;
constexpr
uint8_t
kEquivalentPlmns
=
0x4A
;
constexpr
uint8_t
kEquivalentPlmns
=
0x4A
;
constexpr
uint8_t
kIeiPduSessionStatus
=
0x50
;
constexpr
uint8_t
kIeiPduSessionStatus
=
0x50
;
constexpr
uint8_t
kIei5gsUpdateType
=
0x53
;
constexpr
uint8_t
kIei5gsUpdateType
=
0x53
;
constexpr
uint8_t
kT3346Value
=
0x5f
;
constexpr
uint8_t
kIeiEpsNasSecurityAlgorithms
=
0x57
;
constexpr
uint8_t
kT3346Value
=
0x5f
;
constexpr
uint8_t
kIeiEpsBearerContextStatus
=
0x60
;
constexpr
uint8_t
kIeiEpsBearerContextStatus
=
0x60
;
constexpr
uint8_t
kIeiUeRadioCapabilityId
=
0x67
;
constexpr
uint8_t
kIeiUeRadioCapabilityId
=
0x67
;
...
...
src/nas/common/NasIeHeader.hpp
View file @
3e503cfb
...
@@ -39,11 +39,11 @@
...
@@ -39,11 +39,11 @@
#include "EapMessage.hpp"
#include "EapMessage.hpp"
#include "EpsBearerContextStatus.hpp"
#include "EpsBearerContextStatus.hpp"
#include "EPS_NAS_Message_Container.hpp"
#include "EPS_NAS_Message_Container.hpp"
#include "E
PS_NAS_Security_
Algorithms.hpp"
#include "E
psNasSecurity
Algorithms.hpp"
#include "Extended_DRX_Parameters.hpp"
#include "Extended_DRX_Parameters.hpp"
#include "GprsTimer2.hpp"
#include "GprsTimer2.hpp"
#include "GprsTimer3.hpp"
#include "GprsTimer3.hpp"
#include "I
MEISV_
Request.hpp"
#include "I
meisv
Request.hpp"
#include "LADN_Indication.hpp"
#include "LADN_Indication.hpp"
#include "MA_PDU_Session_Information.hpp"
#include "MA_PDU_Session_Information.hpp"
#include "NasMessageContainer.hpp"
#include "NasMessageContainer.hpp"
...
...
src/nas/ies/E
PS_NAS_Security_
Algorithms.cpp
→
src/nas/ies/E
psNasSecurity
Algorithms.cpp
View file @
3e503cfb
...
@@ -19,92 +19,114 @@
...
@@ -19,92 +19,114 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file
#include "EpsNasSecurityAlgorithms.hpp"
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "EPS_NAS_Security_Algorithms.hpp"
#include <iostream>
#include "logger.hpp"
using
namespace
nas
;
using
namespace
nas
;
using
namespace
std
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
EPS_NAS_Security_Algorithms
::
EPS_NAS_Security_Algorithms
()
{}
EpsNasSecurityAlgorithms
::
EpsNasSecurityAlgorithms
()
:
Type3NasIe
(
kIeiEpsNasSecurityAlgorithms
),
type_of_ciphering_algorithm_
(),
type_of_integrity_protection_algorithm_
()
{
SetIeName
(
kEpsNasSecurityAlgorithmsIeName
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
EPS_NAS_Security_Algorithms
::~
EPS_NAS_Security_Algorithms
()
{}
EpsNasSecurityAlgorithms
::
EpsNasSecurityAlgorithms
(
uint8_t
ciphering
,
uint8_t
integrity_protection
)
:
Type3NasIe
(
kIeiEpsNasSecurityAlgorithms
)
{
type_of_ciphering_algorithm_
=
ciphering
&
0x07
;
type_of_integrity_protection_algorithm_
=
integrity_protection
&
0x07
;
SetIeName
(
kEpsNasSecurityAlgorithmsIeName
);
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
EPS_NAS_Security_Algorithms
::
EPS_NAS_Security_Algorithms
(
EpsNasSecurityAlgorithms
::~
EpsNasSecurityAlgorithms
()
{}
uint8_t
iei
,
uint8_t
ciphering
,
uint8_t
integrity_protection
)
{
_iei
=
iei
;
CIPHERING
=
ciphering
;
INTEGRITY_PROTECTION
=
integrity_protection
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
E
PS_NAS_Security_
Algorithms
::
SetTypeOfCipheringAlgorithm
(
uint8_t
value
)
{
void
E
psNasSecurity
Algorithms
::
SetTypeOfCipheringAlgorithm
(
uint8_t
value
)
{
CIPHERING
=
value
;
type_of_ciphering_algorithm_
=
value
&
0x07
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
E
PS_NAS_Security_
Algorithms
::
SetTypeOfIntegrityProtectionAlgorithm
(
void
E
psNasSecurity
Algorithms
::
SetTypeOfIntegrityProtectionAlgorithm
(
uint8_t
value
)
{
uint8_t
value
)
{
INTEGRITY_PROTECTION
=
value
;
type_of_integrity_protection_algorithm_
=
value
&
0x07
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint8_t
E
PS_NAS_Security_Algorithms
::
GetTypeOfCipheringAlgorithm
()
{
uint8_t
E
psNasSecurityAlgorithms
::
GetTypeOfCipheringAlgorithm
()
const
{
return
CIPHERING
;
return
type_of_ciphering_algorithm_
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint8_t
EPS_NAS_Security_Algorithms
::
GetTypeOfIntegrityProtectionAlgorithm
()
{
uint8_t
EpsNasSecurityAlgorithms
::
GetTypeOfIntegrityProtectionAlgorithm
()
return
INTEGRITY_PROTECTION
;
const
{
return
type_of_integrity_protection_algorithm_
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
EPS_NAS_Security_Algorithms
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
void
EpsNasSecurityAlgorithms
::
Set
(
Logger
::
nas_mm
().
debug
(
uint8_t
ciphering
,
uint8_t
integrity_protection
)
{
"encoding EPS_NAS_Security_Algorithms iei(0x%x)"
,
_iei
);
type_of_ciphering_algorithm_
=
ciphering
&
0x0f
;
int
encoded_size
=
0
;
type_of_integrity_protection_algorithm_
=
integrity_protection
&
0x0f
;
if
(
len
<
2
)
{
}
Logger
::
nas_mm
().
error
(
"len is less than 2"
);
//------------------------------------------------------------------------------
return
-
1
;
void
EpsNasSecurityAlgorithms
::
Get
(
}
uint8_t
&
ciphering
,
uint8_t
&
integrity_protection
)
const
{
ciphering
=
type_of_ciphering_algorithm_
;
integrity_protection
=
type_of_integrity_protection_algorithm_
;
}
//------------------------------------------------------------------------------
int
EpsNasSecurityAlgorithms
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
Logger
::
nas_mm
().
debug
(
"Encoding %s"
,
GetIeName
().
c_str
());
else
{
if
(
len
<
kEpsNasSecurityAlgorithmsLength
)
{
*
(
buf
+
encoded_size
)
=
_iei
;
Logger
::
nas_mm
().
error
(
encoded_size
++
;
"Buffer length is less than the minimum length of this IE (%d octet)"
,
*
(
buf
+
encoded_size
)
=
kEpsNasSecurityAlgorithmsLength
);
((
CIPHERING
&
0x07
)
<<
4
)
|
(
INTEGRITY_PROTECTION
&
0x07
);
return
KEncodeDecodeError
;
encoded_size
++
;
Logger
::
nas_mm
().
debug
(
"encoded EPS_NAS_Security_Algorithms IE 0x%x"
,
*
buf
);
}
}
int
encoded_size
=
0
;
// IEI
encoded_size
+=
Type3NasIe
::
Encode
(
buf
+
encoded_size
,
len
);
uint8_t
octet
=
0
;
octet
=
((
type_of_ciphering_algorithm_
&
0x07
)
<<
4
)
|
(
type_of_integrity_protection_algorithm_
&
0x07
);
ENCODE_U8
(
buf
+
encoded_size
,
octet
,
encoded_size
);
Logger
::
nas_mm
().
debug
(
"Encoded %s, len (%d)"
,
GetIeName
().
c_str
(),
encoded_size
);
return
encoded_size
;
return
encoded_size
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
EPS_NAS_Security_Algorithms
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
int
EpsNasSecurityAlgorithms
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_iei
)
{
Logger
::
nas_mm
().
debug
(
"decoding EPS_NAS_Security_Algorithms IE"
);
Logger
::
nas_mm
().
debug
(
"Decoding %s"
,
GetIeName
().
c_str
());
if
(
len
<
2
)
{
Logger
::
nas_mm
().
error
(
"len is less than 2"
);
if
(
len
<
kEpsNasSecurityAlgorithmsLength
)
{
return
0
;
Logger
::
nas_mm
().
error
(
}
else
{
"Buffer length is less than the minimum length of this IE (%d octet)"
,
int
decoded_size
=
0
;
kEpsNasSecurityAlgorithmsLength
);
decoded_size
++
;
return
KEncodeDecodeError
;
CIPHERING
=
(
*
(
buf
+
decoded_size
)
&
0x70
)
>>
4
;
INTEGRITY_PROTECTION
=
*
(
buf
+
decoded_size
)
&
0x07
;
decoded_size
++
;
Logger
::
nas_mm
().
debug
(
"decoded NAS_Security_Algorithms len 1 "
"octet,CIPHERING=0x%x,INTEGRITY_PROTECTION=0x%x"
,
CIPHERING
,
INTEGRITY_PROTECTION
);
return
decoded_size
;
}
}
int
decoded_size
=
0
;
// IEI and Length
decoded_size
+=
Type3NasIe
::
Decode
(
buf
+
decoded_size
,
len
,
is_iei
);
uint8_t
octet
=
0
;
DECODE_U8
(
buf
+
decoded_size
,
octet
,
decoded_size
);
type_of_ciphering_algorithm_
=
(
octet
&
0x70
)
>>
4
;
type_of_integrity_protection_algorithm_
=
octet
&
0x07
;
Logger
::
nas_mm
().
debug
(
"Decoded %s, len (%d)"
,
GetIeName
().
c_str
(),
decoded_size
);
return
decoded_size
;
}
}
src/nas/ies/E
PS_NAS_Security_
Algorithms.hpp
→
src/nas/ies/E
psNasSecurity
Algorithms.hpp
View file @
3e503cfb
...
@@ -19,37 +19,37 @@
...
@@ -19,37 +19,37 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file
#ifndef _EPS_NAS_SECURITY_ALGORITHS_H
\brief
#define _EPS_NAS_SECURITY_ALGORITHS_H
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __EPS_NAS_Security_Algorithms_H
#include "Type3NasIe.hpp"
#define __EPS_NAS_Security_Algorithms_H
#include <stdint.h>
constexpr
uint8_t
kEpsNasSecurityAlgorithmsLength
=
2
;
constexpr
auto
kEpsNasSecurityAlgorithmsIeName
=
"EPS NAS Security Algorithms"
;
namespace
nas
{
namespace
nas
{
class
E
PS_NAS_Security_Algorithms
{
class
E
psNasSecurityAlgorithms
:
public
Type3NasIe
{
public:
public:
E
PS_NAS_Security_
Algorithms
();
E
psNasSecurity
Algorithms
();
~
EPS_NAS_Security_Algorithms
(
);
EpsNasSecurityAlgorithms
(
uint8_t
ciphering
,
uint8_t
integrity_protection
);
EPS_NAS_Security_Algorithms
(
~
EpsNasSecurityAlgorithms
();
uint8_t
iei
,
uint8_t
ciphering
,
uint8_t
integrity_protection
);
void
SetTypeOfCipheringAlgorithm
(
uint8_t
value
);
void
SetTypeOfCipheringAlgorithm
(
uint8_t
value
);
uint8_t
GetTypeOfCipheringAlgorithm
()
const
;
void
SetTypeOfIntegrityProtectionAlgorithm
(
uint8_t
value
);
void
SetTypeOfIntegrityProtectionAlgorithm
(
uint8_t
value
);
uint8_t
GetTypeOfCipheringAlgorithm
();
uint8_t
GetTypeOfIntegrityProtectionAlgorithm
()
const
;
uint8_t
GetTypeOfIntegrityProtectionAlgorithm
();
void
Set
(
uint8_t
ciphering
,
uint8_t
integrity_protection
);
void
Get
(
uint8_t
&
ciphering
,
uint8_t
&
integrity_protection
)
const
;
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Encode
(
uint8_t
*
buf
,
int
len
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_
option
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_
iei
);
private:
private:
uint8_t
_iei
;
uint8_t
type_of_ciphering_algorithm_
;
uint8_t
CIPHERING
;
uint8_t
type_of_integrity_protection_algorithm_
;
uint8_t
INTEGRITY_PROTECTION
;
};
};
}
// namespace nas
}
// namespace nas
...
...
src/nas/ies/I
MEISV_
Request.cpp
→
src/nas/ies/I
meisv
Request.cpp
View file @
3e503cfb
...
@@ -19,82 +19,32 @@
...
@@ -19,82 +19,32 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file
#include "ImeisvRequest.hpp"
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "IMEISV_Request.hpp"
#include "logger.hpp"
#include "logger.hpp"
using
namespace
nas
;
using
namespace
nas
;
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
IMEISV_Request
::
IMEISV_Request
(
uint8_t
iei
)
{
ImeisvRequest
::
ImeisvRequest
()
:
Type1NasIeFormatTv
(
kIeiImeisvRequest
)
{
_iei
=
iei
;
SetIeName
(
kImeisvRequestIeName
);
_value
=
0
;
}
//------------------------------------------------------------------------------
IMEISV_Request
::
IMEISV_Request
(
const
uint8_t
iei
,
uint8_t
value
)
{
_iei
=
iei
;
_value
=
value
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
IMEISV_Request
::
IMEISV_Request
()
:
_iei
(),
_value
()
{}
ImeisvRequest
::
ImeisvRequest
(
uint8_t
value
)
:
Type1NasIeFormatTv
(
kIeiImeisvRequest
)
{
//------------------------------------------------------------------------------
SetValue
(
value
&
0x07
);
IMEISV_Request
::~
IMEISV_Request
()
{}
SetIeName
(
kImeisvRequestIeName
);
//------------------------------------------------------------------------------
void
IMEISV_Request
::
setValue
(
uint8_t
value
)
{
_value
=
value
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
uint8_t
IMEISV_Request
::
getValue
()
{
ImeisvRequest
::~
ImeisvRequest
()
{}
return
_value
;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
IMEISV_Request
::
Encode
(
uint8_t
*
buf
,
int
len
)
{
void
ImeisvRequest
::
Set
(
uint8_t
value
)
{
Logger
::
nas_mm
().
debug
(
"Encoding IMEISV_Request iei (0x%x)"
,
_iei
);
SetValue
(
value
&
0x07
);
if
(
len
<
1
)
{
Logger
::
nas_mm
().
error
(
"Len is less than 1"
);
return
0
;
}
uint8_t
octet
=
0
;
if
(
!
(
_iei
&
0x0f
))
{
// octet = (0x0f) & ((tsc << 3) | key_id);
//*buf = octet;
// Logger::nas_mm().debug("encoded Payload_Container_Type IE(len(1/2
// octet))"); return 0;
}
else
{
octet
=
(
_iei
<<
4
)
|
(
_value
&
0x07
);
*
buf
=
octet
;
Logger
::
nas_mm
().
debug
(
"Encoded IMEISV_Request IE (len - 1 octet)"
);
return
1
;
}
return
1
;
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
int
IMEISV_Request
::
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
)
{
uint8_t
ImeisvRequest
::
Get
()
const
{
if
(
len
<
1
)
{
return
GetValue
()
&
0x07
;
Logger
::
nas_mm
().
error
(
"Len is less than one"
);
return
0
;
}
else
{
uint8_t
octet
=
(
*
buf
);
if
(
is_option
)
{
_iei
=
(
octet
&
0xf0
)
>>
4
;
}
else
{
_iei
=
0
;
}
_value
=
octet
&
0x07
;
Logger
::
nas_mm
().
debug
(
"Decoded IMEISV_Request value (0x%x)"
,
_value
);
return
1
;
}
}
}
src/nas/ies/I
MEISV_
Request.hpp
→
src/nas/ies/I
meisv
Request.hpp
View file @
3e503cfb
...
@@ -19,34 +19,25 @@
...
@@ -19,34 +19,25 @@
* contact@openairinterface.org
* contact@openairinterface.org
*/
*/
/*! \file
#ifndef _IMEISV_REQUEST_H_
\brief
#define _IMEISV_REQUEST_H_
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __IMEISV_Request_H_
#include "Type1NasIeFormatTv.hpp"
#define __IMEISV_Request_H_
#include <stdint.h>
constexpr
auto
kImeisvRequestIeName
=
"IMEISV Request"
;
namespace
nas
{
namespace
nas
{
class
I
MEISV_Request
{
class
I
meisvRequest
:
public
Type1NasIeFormatTv
{
public:
public:
IMEISV_Request
();
ImeisvRequest
();
IMEISV_Request
(
uint8_t
iei
);
ImeisvRequest
(
uint8_t
value
);
IMEISV_Request
(
const
uint8_t
iei
,
uint8_t
value
);
~
ImeisvRequest
();
~
IMEISV_Request
();
int
Encode
(
uint8_t
*
buf
,
int
len
);
void
Set
(
uint8_t
value
);
int
Decode
(
uint8_t
*
buf
,
int
len
,
bool
is_option
);
uint8_t
Get
()
const
;
void
setValue
(
uint8_t
value
);
uint8_t
getValue
();
private:
private:
uint8_t
_iei
;
uint8_t
_value
;
};
};
}
// namespace nas
}
// namespace nas
...
...
src/nas/msgs/SecurityModeCommand.cpp
View file @
3e503cfb
...
@@ -71,15 +71,14 @@ void SecurityModeCommand::setUE_Security_Capability(
...
@@ -71,15 +71,14 @@ void SecurityModeCommand::setUE_Security_Capability(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setIMEISV_Request
(
uint8_t
value
)
{
void
SecurityModeCommand
::
setIMEISV_Request
(
uint8_t
value
)
{
ie_imeisv_request
=
std
::
make_optional
<
I
MEISV_Request
>
(
0x0E
,
value
);
ie_imeisv_request
=
std
::
make_optional
<
I
meisvRequest
>
(
value
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
SecurityModeCommand
::
setEPS_NAS_Security_Algorithms
(
void
SecurityModeCommand
::
setEPS_NAS_Security_Algorithms
(
uint8_t
ciphering
,
uint8_t
integrity
)
{
uint8_t
ciphering
,
uint8_t
integrity
)
{
ie_eps_nas_security_algorithms
=
ie_eps_nas_security_algorithms
=
std
::
make_optional
<
EPS_NAS_Security_Algorithms
>
(
std
::
make_optional
<
EpsNasSecurityAlgorithms
>
(
ciphering
,
integrity
);
0x57
,
ciphering
,
integrity
);
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
@@ -267,31 +266,31 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
...
@@ -267,31 +266,31 @@ int SecurityModeCommand::Decode(uint8_t* buf, int len) {
Logger
::
nas_mm
().
debug
(
"First option IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"First option IEI (0x%x)"
,
octet
);
while
((
octet
!=
0x0
))
{
while
((
octet
!=
0x0
))
{
switch
((
octet
&
0xf0
)
>>
4
)
{
switch
((
octet
&
0xf0
)
>>
4
)
{
case
0xE
:
{
case
kIeiImeisvRequest
:
{
Logger
::
nas_mm
().
debug
(
"Decoding IEI
(0xE)"
);
Logger
::
nas_mm
().
debug
(
"Decoding IEI
0x%x"
,
kIeiImeisvRequest
);
I
MEISV_
Request
ie_imeisv_request_tmp
=
{};
I
meisv
Request
ie_imeisv_request_tmp
=
{};
if
((
decoded_result
=
ie_imeisv_request_tmp
.
Decode
(
if
((
decoded_result
=
ie_imeisv_request_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
KEncodeDecodeError
)
KEncodeDecodeError
)
return
decoded_result
;
return
decoded_result
;
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_imeisv_request
=
ie_imeisv_request
=
std
::
optional
<
ImeisvRequest
>
(
ie_imeisv_request_tmp
);
std
::
optional
<
IMEISV_Request
>
(
ie_imeisv_request_tmp
);
octet
=
*
(
buf
+
decoded_size
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
}
break
;
}
break
;
}
}
switch
(
octet
)
{
switch
(
octet
)
{
case
0x57
:
{
case
kIeiEpsNasSecurityAlgorithms
:
{
Logger
::
nas_mm
().
debug
(
"decoding IEI (0x57)"
);
Logger
::
nas_mm
().
debug
(
EPS_NAS_Security_Algorithms
ie_eps_nas_security_algorithms_tmp
=
{};
"decoding IEI 0x%x"
,
kIeiEpsNasSecurityAlgorithms
);
EpsNasSecurityAlgorithms
ie_eps_nas_security_algorithms_tmp
=
{};
if
((
decoded_result
=
ie_eps_nas_security_algorithms_tmp
.
Decode
(
if
((
decoded_result
=
ie_eps_nas_security_algorithms_tmp
.
Decode
(
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
buf
+
decoded_size
,
len
-
decoded_size
,
true
))
==
KEncodeDecodeError
)
KEncodeDecodeError
)
return
decoded_result
;
return
decoded_result
;
decoded_size
+=
decoded_result
;
decoded_size
+=
decoded_result
;
ie_eps_nas_security_algorithms
=
ie_eps_nas_security_algorithms
=
std
::
optional
<
E
PS_NAS_Security_
Algorithms
>
(
std
::
optional
<
E
psNasSecurity
Algorithms
>
(
ie_eps_nas_security_algorithms_tmp
);
ie_eps_nas_security_algorithms_tmp
);
octet
=
*
(
buf
+
decoded_size
);
octet
=
*
(
buf
+
decoded_size
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
Logger
::
nas_mm
().
debug
(
"Next IEI (0x%x)"
,
octet
);
...
...
src/nas/msgs/SecurityModeCommand.hpp
View file @
3e503cfb
...
@@ -71,8 +71,8 @@ class SecurityModeCommand : public NasMmPlainHeader {
...
@@ -71,8 +71,8 @@ class SecurityModeCommand : public NasMmPlainHeader {
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
NasKeySetIdentifier
ie_ngKSI
;
// Mandatory
UESecurityCapability
ie_ue_security_capability
;
// Mandatory
UESecurityCapability
ie_ue_security_capability
;
// Mandatory
std
::
optional
<
I
MEISV_
Request
>
ie_imeisv_request
;
// Optional
std
::
optional
<
I
meisv
Request
>
ie_imeisv_request
;
// Optional
std
::
optional
<
E
PS_NAS_Security_
Algorithms
>
std
::
optional
<
E
psNasSecurity
Algorithms
>
ie_eps_nas_security_algorithms
;
// Optional
ie_eps_nas_security_algorithms
;
// Optional
std
::
optional
<
Additional_5G_Security_Information
>
std
::
optional
<
Additional_5G_Security_Information
>
ie_additional_5G_security_information
;
// Optional
ie_additional_5G_security_information
;
// 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