Commit b1839609 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update GPRS Timer

parent e4f9d058
...@@ -132,6 +132,7 @@ constexpr uint8_t kIeiGprsTimer2T3546 = 0x5F; ...@@ -132,6 +132,7 @@ constexpr uint8_t kIeiGprsTimer2T3546 = 0x5F;
constexpr uint8_t kIeiEpsNasMessageContainer = 0x70; constexpr uint8_t kIeiEpsNasMessageContainer = 0x70;
constexpr uint8_t kIeiNasMessageContainer = 0x71; constexpr uint8_t kIeiNasMessageContainer = 0x71;
constexpr uint8_t kIeiPduSessionReactivationResultErrorCause = 0x72; constexpr uint8_t kIeiPduSessionReactivationResultErrorCause = 0x72;
constexpr uint8_t kIeiSorTransparentContainer = 0x73;
constexpr uint8_t kIeiLadnIndication = 0x74; constexpr uint8_t kIeiLadnIndication = 0x74;
constexpr uint8_t kIeiLadnInformation = 0x79; constexpr uint8_t kIeiLadnInformation = 0x79;
constexpr uint8_t kIei5gGuti = 0x77; constexpr uint8_t kIei5gGuti = 0x77;
......
...@@ -41,8 +41,8 @@ ...@@ -41,8 +41,8 @@
#include "EPS_NAS_Message_Container.hpp" #include "EPS_NAS_Message_Container.hpp"
#include "EPS_NAS_Security_Algorithms.hpp" #include "EPS_NAS_Security_Algorithms.hpp"
#include "Extended_DRX_Parameters.hpp" #include "Extended_DRX_Parameters.hpp"
#include "GPRS_Timer_2.hpp" #include "GprsTimer2.hpp"
#include "GPRS_Timer_3.hpp" #include "GprsTimer3.hpp"
#include "IMEISV_Request.hpp" #include "IMEISV_Request.hpp"
#include "LADN_Indication.hpp" #include "LADN_Indication.hpp"
#include "MA_PDU_Session_Information.hpp" #include "MA_PDU_Session_Information.hpp"
......
...@@ -19,38 +19,38 @@ ...@@ -19,38 +19,38 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "GPRS_Timer_2.hpp" #include "GprsTimer2.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GPRS_Timer_2::GPRS_Timer_2(uint8_t iei) : Type4NasIe(iei), value_() { GprsTimer2::GprsTimer2(uint8_t iei) : Type4NasIe(iei), value_() {
SetLengthIndicator(1); SetLengthIndicator(1);
SetIeName(kGprsTimer2IeName); SetIeName(kGprsTimer2IeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GPRS_Timer_2::GPRS_Timer_2(const uint8_t iei, uint8_t value) : Type4NasIe(iei) { GprsTimer2::GprsTimer2(const uint8_t iei, uint8_t value) : Type4NasIe(iei) {
value_ = value; value_ = value;
SetLengthIndicator(1); SetLengthIndicator(1);
SetIeName(kGprsTimer2IeName); SetIeName(kGprsTimer2IeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GPRS_Timer_2::~GPRS_Timer_2() {} GprsTimer2::~GprsTimer2() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GPRS_Timer_2::setValue(uint8_t value) { void GprsTimer2::setValue(uint8_t value) {
value_ = value; value_ = value;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t GPRS_Timer_2::getValue() const { uint8_t GprsTimer2::getValue() const {
return value_; return value_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int GPRS_Timer_2::Encode(uint8_t* buf, int len) { int GprsTimer2::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("Encoding %s", GetIeName().c_str()); Logger::nas_mm().debug("Encoding %s", GetIeName().c_str());
int ie_len = GetIeLength(); int ie_len = GetIeLength();
...@@ -74,7 +74,7 @@ int GPRS_Timer_2::Encode(uint8_t* buf, int len) { ...@@ -74,7 +74,7 @@ int GPRS_Timer_2::Encode(uint8_t* buf, int len) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int GPRS_Timer_2::Decode(uint8_t* buf, int len, bool is_iei) { int GprsTimer2::Decode(uint8_t* buf, int len, bool is_iei) {
if (len < kGprsTimer2Length) { if (len < kGprsTimer2Length) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%d octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
......
...@@ -31,11 +31,11 @@ constexpr auto kGprsTimer2IeName = "GPRS Timer 2"; ...@@ -31,11 +31,11 @@ constexpr auto kGprsTimer2IeName = "GPRS Timer 2";
namespace nas { namespace nas {
class GPRS_Timer_2 : public Type4NasIe { class GprsTimer2 : public Type4NasIe {
public: public:
GPRS_Timer_2(uint8_t iei); GprsTimer2(uint8_t iei);
GPRS_Timer_2(const uint8_t iei, uint8_t value); GprsTimer2(const uint8_t iei, uint8_t value);
~GPRS_Timer_2(); ~GprsTimer2();
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len, bool is_iei); int Decode(uint8_t* buf, int len, bool is_iei);
......
...@@ -19,18 +19,18 @@ ...@@ -19,18 +19,18 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#include "GPRS_Timer_3.hpp" #include "GprsTimer3.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GPRS_Timer_3::GPRS_Timer_3(uint8_t iei) : Type4NasIe(iei), unit_(), value_() { GprsTimer3::GprsTimer3(uint8_t iei) : Type4NasIe(iei), unit_(), value_() {
SetLengthIndicator(1); SetLengthIndicator(1);
SetIeName(kGprsTimer3IeName); SetIeName(kGprsTimer3IeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GPRS_Timer_3::GPRS_Timer_3(const uint8_t iei, uint8_t unit, uint8_t value) GprsTimer3::GprsTimer3(const uint8_t iei, uint8_t unit, uint8_t value)
: Type4NasIe(iei) { : Type4NasIe(iei) {
unit_ = unit; unit_ = unit;
value_ = value; value_ = value;
...@@ -39,26 +39,26 @@ GPRS_Timer_3::GPRS_Timer_3(const uint8_t iei, uint8_t unit, uint8_t value) ...@@ -39,26 +39,26 @@ GPRS_Timer_3::GPRS_Timer_3(const uint8_t iei, uint8_t unit, uint8_t value)
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GPRS_Timer_3::~GPRS_Timer_3() {} GprsTimer3::~GprsTimer3() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GPRS_Timer_3::setValue(uint8_t unit, uint8_t value) { void GprsTimer3::setValue(uint8_t unit, uint8_t value) {
unit_ = unit; unit_ = unit;
value_ = value; value_ = value;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t GPRS_Timer_3::getUnit() const { uint8_t GprsTimer3::getUnit() const {
return unit_; return unit_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t GPRS_Timer_3::getValue() const { uint8_t GprsTimer3::getValue() const {
return value_; return value_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int GPRS_Timer_3::Encode(uint8_t* buf, int len) { int GprsTimer3::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("Encoding %s", GetIeName().c_str()); Logger::nas_mm().debug("Encoding %s", GetIeName().c_str());
int ie_len = GetIeLength(); int ie_len = GetIeLength();
...@@ -83,7 +83,7 @@ int GPRS_Timer_3::Encode(uint8_t* buf, int len) { ...@@ -83,7 +83,7 @@ int GPRS_Timer_3::Encode(uint8_t* buf, int len) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int GPRS_Timer_3::Decode(uint8_t* buf, int len, bool is_iei) { int GprsTimer3::Decode(uint8_t* buf, int len, bool is_iei) {
if (len < kGprsTimer3Length) { if (len < kGprsTimer3Length) {
Logger::nas_mm().error( Logger::nas_mm().error(
"Buffer length is less than the minimum length of this IE (%d octet)", "Buffer length is less than the minimum length of this IE (%d octet)",
......
...@@ -30,11 +30,11 @@ constexpr auto kGprsTimer3IeName = "GPRS Timer 3"; ...@@ -30,11 +30,11 @@ constexpr auto kGprsTimer3IeName = "GPRS Timer 3";
namespace nas { namespace nas {
class GPRS_Timer_3 : public Type4NasIe { class GprsTimer3 : public Type4NasIe {
public: public:
GPRS_Timer_3(uint8_t iei); GprsTimer3(uint8_t iei);
GPRS_Timer_3(uint8_t iei, uint8_t unit, uint8_t value); GprsTimer3(uint8_t iei, uint8_t unit, uint8_t value);
~GPRS_Timer_3(); ~GprsTimer3();
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_option);
......
...@@ -19,100 +19,122 @@ ...@@ -19,100 +19,122 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "SOR_Transparent_Container.hpp" #include "SOR_Transparent_Container.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
SOR_Transparent_Container::SOR_Transparent_Container(uint8_t iei) : _value() { SOR_Transparent_Container::SOR_Transparent_Container()
_iei = iei; : Type6NasIe(kIeiSorTransparentContainer), header_(), sor_mac_i_() {
HEADER = 0; SetLengthIndicator(kSorTransparentContainerIeMinimumLength);
SetIeName(kSorTransparentContainerIeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
SOR_Transparent_Container::SOR_Transparent_Container( SOR_Transparent_Container::SOR_Transparent_Container(
const uint8_t iei, uint8_t header, uint8_t* value) { uint8_t header, const uint8_t (&value)[16]) {
_iei = iei; header_ = header;
HEADER = header;
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
this->_value[i] = value[i]; this->sor_mac_i_[i] = value[i];
} }
SetLengthIndicator(kSorTransparentContainerIeMinimumLength);
SetIeName(kSorTransparentContainerIeName);
} }
//------------------------------------------------------------------------------
SOR_Transparent_Container::SOR_Transparent_Container()
: _iei(), HEADER(), _value() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
SOR_Transparent_Container::~SOR_Transparent_Container() {} SOR_Transparent_Container::~SOR_Transparent_Container() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t SOR_Transparent_Container::getValue() { void SOR_Transparent_Container::getValue(uint8_t (&value)[16]) const {
for (int j = 0; j < 16; j++) { for (int i = 0; i < 16; i++) {
Logger::nas_mm().debug( value[i] = sor_mac_i_[i];
"decoded SOR_Transparent_Container value(0x%2x)", _value[j]);
} }
return 1;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int SOR_Transparent_Container::Encode(uint8_t* buf, int len) { int SOR_Transparent_Container::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("encoding SOR_Transparent_Container iei(0x%x)", _iei); Logger::nas_mm().debug("Encoding %s", GetIeName().c_str());
if (len < 18) {
Logger::nas_mm().error("len is less than 18"); int ie_len = GetIeLength();
return 0;
if (len < ie_len) { // Length of the content + IEI/Len
Logger::nas_mm().error(
"Size of the buffer is not enough to store this IE (IE len %d)",
ie_len);
return KEncodeDecodeError;
} }
int encoded_size = 0; int encoded_size = 0;
if (_iei) { // IEI and Length (later)
*(buf + encoded_size) = _iei; int len_pos = 0;
encoded_size++; int encoded_header_size =
*(buf + encoded_size) = 17; Type6NasIe::Encode(buf + encoded_size, len, len_pos);
encoded_size++; if (encoded_header_size == KEncodeDecodeError) return KEncodeDecodeError;
encoded_size++; encoded_size += encoded_header_size;
*(buf + encoded_size) = HEADER;
encoded_size++; // Header
for (int i = 0; i < 16; i++) { ENCODE_U8(buf + encoded_size, header_, encoded_size);
*(buf + encoded_size) = _value[i]; // SOR-MAC-I
encoded_size++; for (int i = 0; i < 16; i++) {
} ENCODE_U8(buf + encoded_size, sor_mac_i_[i], encoded_size);
return encoded_size;
} else {
// *(buf + encoded_size) = length - 1; encoded_size++;
// *(buf + encoded_size) = _value; encoded_size++; encoded_size++;
} }
// TODO: Encode spare for the rest
uint8_t spare = 0;
int spare_len = ie_len - encoded_size;
for (int i = 0; i < spare_len; i++) {
ENCODE_U8(buf + encoded_size, spare, encoded_size);
}
// Encode length
int encoded_len_ie = 0;
ENCODE_U16(buf + len_pos, encoded_size - GetHeaderLength(), encoded_len_ie);
Logger::nas_mm().debug( Logger::nas_mm().debug(
"encoded SOR_Transparent_Container len(%d)", encoded_size); "Encoded %s, len (%d)", GetIeName().c_str(), encoded_size);
return encoded_size; return encoded_size;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int SOR_Transparent_Container::Decode(uint8_t* buf, int len, bool is_option) { int SOR_Transparent_Container::Decode(uint8_t* buf, int len, bool is_iei) {
Logger::nas_mm().debug("decoding SOR_Transparent_Container iei(0x%x)", *buf); if (len < kSorTransparentContainerMinimumLength) {
int decoded_size = 0; Logger::nas_mm().error(
if (is_option) { "Buffer length is less than the minimum length of this IE (%d octet)",
decoded_size++; kSorTransparentContainerMinimumLength);
return KEncodeDecodeError;
} }
decoded_size++;
decoded_size++; uint8_t decoded_size = 0;
HEADER = *(buf + decoded_size); uint8_t octet = 0;
decoded_size++; Logger::nas_mm().debug("Decoding %s", GetIeName().c_str());
// IEI and Length
int decoded_header_size = Type6NasIe::Decode(buf + decoded_size, len, is_iei);
if (decoded_header_size == KEncodeDecodeError) return KEncodeDecodeError;
decoded_size += decoded_header_size;
DECODE_U8(buf + decoded_size, header_, decoded_size);
// Decode SOR-MAC-I
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
_value[i] = *(buf + decoded_size); DECODE_U8(buf + decoded_size, sor_mac_i_[i], decoded_size);
decoded_size++; }
// TODO: decode the rest as spare for now
uint8_t spare = 0;
for (int i = 0;
i < (GetLengthIndicator() - kSorTransparentContainerIeMinimumLength);
i++) {
DECODE_U8(buf + decoded_size, spare, decoded_size);
} }
Logger::nas_mm().debug("Decoded SOR-MAC-I");
for (int j = 0; j < 16; j++) { for (int j = 0; j < 16; j++) {
Logger::nas_mm().debug( Logger::nas_mm().debug("Value 0x%2x", sor_mac_i_[j]);
"decoded SOR_Transparent_Container value(0x%2x)", _value[j]);
} }
Logger::nas_mm().debug( Logger::nas_mm().debug(
"decoded SOR_Transparent_Container len(%d)", decoded_size); "Decoded %s, len (%d)", GetIeName().c_str(), decoded_size);
return decoded_size; return decoded_size;
} }
...@@ -18,36 +18,34 @@ ...@@ -18,36 +18,34 @@
* For more information about the OpenAirInterface (OAI) Software Alliance: * For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef _SOR_TRANSPARENT_CONTAINER_H_
#define _SOR_TRANSPARENT_CONTAINER_H_
/*! \file #include "Type6NasIe.hpp"
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __SOR_Transparent_Container_H_
#define __SOR_Transparent_Container_H_
#include <stdint.h> #include <stdint.h>
constexpr uint8_t kSorTransparentContainerMinimumLength = 20;
constexpr uint8_t kSorTransparentContainerIeMinimumLength = 17;
constexpr auto kSorTransparentContainerIeName = "SOR Transparent Container";
namespace nas { namespace nas {
class SOR_Transparent_Container { class SOR_Transparent_Container : Type6NasIe {
public: public:
SOR_Transparent_Container(); SOR_Transparent_Container();
SOR_Transparent_Container(uint8_t iei); SOR_Transparent_Container(uint8_t header, const uint8_t (&value)[16]);
SOR_Transparent_Container(const uint8_t iei, uint8_t header, uint8_t* value);
~SOR_Transparent_Container(); ~SOR_Transparent_Container();
// void setValue(uint8_t iei, uint8_t value);
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);
uint8_t getValue();
void getValue(uint8_t (&value)[16]) const;
private: private:
uint8_t _iei; uint8_t header_;
uint8_t HEADER; uint8_t sor_mac_i_[16];
uint8_t _value[16]; std::optional<uint8_t> counter_;
// Other IEs
}; };
} // namespace nas } // namespace nas
......
...@@ -89,7 +89,7 @@ void DLNASTransport::set_5GMM_Cause(uint8_t value) { ...@@ -89,7 +89,7 @@ void DLNASTransport::set_5GMM_Cause(uint8_t value) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DLNASTransport::setBack_off_timer_value(uint8_t unit, uint8_t value) { void DLNASTransport::setBack_off_timer_value(uint8_t unit, uint8_t value) {
ie_back_off_timer_value = new GPRS_Timer_3(0x37, unit, value); ie_back_off_timer_value = new GprsTimer3(0x37, unit, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -219,7 +219,7 @@ int DLNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) { ...@@ -219,7 +219,7 @@ int DLNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) {
} break; } break;
case 0x37: { case 0x37: {
Logger::nas_mm().debug("Decoding IEI (0x37)"); Logger::nas_mm().debug("Decoding IEI (0x37)");
ie_back_off_timer_value = new GPRS_Timer_3(kIeiGprsTimer3BackOffTimer); ie_back_off_timer_value = new GprsTimer3(kIeiGprsTimer3BackOffTimer);
decoded_size += ie_back_off_timer_value->Decode( decoded_size += ie_back_off_timer_value->Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
octet = *(buf + decoded_size); octet = *(buf + decoded_size);
......
...@@ -55,7 +55,7 @@ class DLNASTransport { ...@@ -55,7 +55,7 @@ class DLNASTransport {
PDU_Session_Identity_2* ie_pdu_session_identity_2; PDU_Session_Identity_2* ie_pdu_session_identity_2;
Additional_Information* ie_additional_information; Additional_Information* ie_additional_information;
_5GMM_Cause* ie_5gmm_cause; _5GMM_Cause* ie_5gmm_cause;
GPRS_Timer_3* ie_back_off_timer_value; GprsTimer3* ie_back_off_timer_value;
}; };
} // namespace nas } // namespace nas
......
...@@ -209,26 +209,26 @@ void RegistrationAccept::setNetwork_Slicing_Indication(bool dcni, bool nssci) { ...@@ -209,26 +209,26 @@ void RegistrationAccept::setNetwork_Slicing_Indication(bool dcni, bool nssci) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setT3512_Value(uint8_t unit, uint8_t value) { void RegistrationAccept::setT3512_Value(uint8_t unit, uint8_t value) {
ie_T3512_value = ie_T3512_value =
std::make_optional<GPRS_Timer_3>(kIeiGprsTimer3T3512, unit, value); std::make_optional<GprsTimer3>(kIeiGprsTimer3T3512, unit, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setNon_3GPP_de_registration_timer_value( void RegistrationAccept::setNon_3GPP_de_registration_timer_value(
uint8_t value) { uint8_t value) {
ie_Non_3GPP_de_registration_timer_value = std::make_optional<GPRS_Timer_2>( ie_Non_3GPP_de_registration_timer_value = std::make_optional<GprsTimer2>(
kIeiGprsTimer2Non3gppDeregistration, value); kIeiGprsTimer2Non3gppDeregistration, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setT3502_value(uint8_t value) { void RegistrationAccept::setT3502_value(uint8_t value) {
ie_T3502_value = std::make_optional<GPRS_Timer_2>(kIeiGprsTimer2T3502, value); ie_T3502_value = std::make_optional<GprsTimer2>(kIeiGprsTimer2T3502, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setSOR_Transparent_Container( void RegistrationAccept::setSOR_Transparent_Container(
uint8_t header, uint8_t* value) { uint8_t header, const uint8_t (&value)[16]) {
ie_sor_transparent_container = ie_sor_transparent_container =
std::make_optional<SOR_Transparent_Container>(0x73, header, value); std::make_optional<SOR_Transparent_Container>(header, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -268,17 +268,17 @@ void RegistrationAccept::setExtended_DRX_Parameters( ...@@ -268,17 +268,17 @@ void RegistrationAccept::setExtended_DRX_Parameters(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setT3447_Value(uint8_t unit, uint8_t value) { void RegistrationAccept::setT3447_Value(uint8_t unit, uint8_t value) {
ie_T3447_value = std::make_optional<GPRS_Timer_3>(0x6C, unit, value); ie_T3447_value = std::make_optional<GprsTimer3>(0x6C, unit, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setT3448_Value(uint8_t unit, uint8_t value) { void RegistrationAccept::setT3448_Value(uint8_t unit, uint8_t value) {
ie_T3448_value = std::make_optional<GPRS_Timer_3>(0x6B, unit, value); ie_T3448_value = std::make_optional<GprsTimer3>(0x6B, unit, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationAccept::setT3324_Value(uint8_t unit, uint8_t value) { void RegistrationAccept::setT3324_Value(uint8_t unit, uint8_t value) {
ie_T3324_value = std::make_optional<GPRS_Timer_3>(0x6A, unit, value); ie_T3324_value = std::make_optional<GprsTimer3>(0x6A, unit, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -792,31 +792,31 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) { ...@@ -792,31 +792,31 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) {
*/ */
case kIeiGprsTimer3T3512: { case kIeiGprsTimer3T3512: {
Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3512); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3512);
GPRS_Timer_3 ie_T3512_value_tmp(kIeiGprsTimer3T3512); GprsTimer3 ie_T3512_value_tmp(kIeiGprsTimer3T3512);
decoded_size += ie_T3512_value_tmp.Decode( decoded_size += ie_T3512_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3512_value = std::optional<GPRS_Timer_3>(ie_T3512_value_tmp); ie_T3512_value = std::optional<GprsTimer3>(ie_T3512_value_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;
case kIeiGprsTimer2Non3gppDeregistration: { case kIeiGprsTimer2Non3gppDeregistration: {
Logger::nas_mm().debug( Logger::nas_mm().debug(
"Decoding IEI 0x%x", kIeiGprsTimer2Non3gppDeregistration); "Decoding IEI 0x%x", kIeiGprsTimer2Non3gppDeregistration);
GPRS_Timer_2 ie_Non_3GPP_de_registration_timer_value_tmp( GprsTimer2 ie_Non_3GPP_de_registration_timer_value_tmp(
kIeiGprsTimer2Non3gppDeregistration); kIeiGprsTimer2Non3gppDeregistration);
decoded_size += ie_Non_3GPP_de_registration_timer_value_tmp.Decode( decoded_size += ie_Non_3GPP_de_registration_timer_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_Non_3GPP_de_registration_timer_value = std::optional<GPRS_Timer_2>( ie_Non_3GPP_de_registration_timer_value = std::optional<GprsTimer2>(
ie_Non_3GPP_de_registration_timer_value_tmp); ie_Non_3GPP_de_registration_timer_value_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;
case kIeiGprsTimer2T3502: { case kIeiGprsTimer2T3502: {
Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer2T3502); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer2T3502);
GPRS_Timer_2 ie_T3502_value_tmp(kIeiGprsTimer2T3502); GprsTimer2 ie_T3502_value_tmp(kIeiGprsTimer2T3502);
decoded_size += ie_T3502_value_tmp.Decode( decoded_size += ie_T3502_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3502_value = std::optional<GPRS_Timer_2>(ie_T3502_value_tmp); ie_T3502_value = std::optional<GprsTimer2>(ie_T3502_value_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;
...@@ -871,28 +871,28 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) { ...@@ -871,28 +871,28 @@ int RegistrationAccept::Decode(uint8_t* buf, int len) {
} break; } break;
case kIeiGprsTimer3T3447: { case kIeiGprsTimer3T3447: {
Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3447); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3447);
GPRS_Timer_3 ie_T3447_value_tmp(kIeiGprsTimer3T3447); GprsTimer3 ie_T3447_value_tmp(kIeiGprsTimer3T3447);
decoded_size += ie_T3447_value_tmp.Decode( decoded_size += ie_T3447_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3447_value = std::optional<GPRS_Timer_3>(ie_T3447_value_tmp); ie_T3447_value = std::optional<GprsTimer3>(ie_T3447_value_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;
case kIeiGprsTimer3T3348: { case kIeiGprsTimer3T3348: {
Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3348); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3348);
GPRS_Timer_3 ie_T3448_value_tmp(kIeiGprsTimer3T3348); GprsTimer3 ie_T3448_value_tmp(kIeiGprsTimer3T3348);
decoded_size += ie_T3448_value_tmp.Decode( decoded_size += ie_T3448_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3448_value = std::optional<GPRS_Timer_3>(ie_T3448_value_tmp); ie_T3448_value = std::optional<GprsTimer3>(ie_T3448_value_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;
case kIeiGprsTimer3T3324: { case kIeiGprsTimer3T3324: {
Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3324); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiGprsTimer3T3324);
GPRS_Timer_3 ie_T3324_value_tmp(kIeiGprsTimer3T3324); GprsTimer3 ie_T3324_value_tmp(kIeiGprsTimer3T3324);
decoded_size += ie_T3324_value_tmp.Decode( decoded_size += ie_T3324_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3324_value = std::optional<GPRS_Timer_3>(ie_T3324_value_tmp); ie_T3324_value = std::optional<GprsTimer3>(ie_T3324_value_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;
......
...@@ -107,7 +107,7 @@ class RegistrationAccept : public NasMmPlainHeader { ...@@ -107,7 +107,7 @@ class RegistrationAccept : public NasMmPlainHeader {
// TODO: Emergency number list // TODO: Emergency number list
// TODO: Extended emergency number list // TODO: Extended emergency number list
void setSOR_Transparent_Container(uint8_t header, uint8_t* value); void setSOR_Transparent_Container(uint8_t header, const uint8_t (&value)[16]);
// TODO: Get // TODO: Get
void setEAP_Message(bstring eap); void setEAP_Message(bstring eap);
...@@ -167,10 +167,10 @@ class RegistrationAccept : public NasMmPlainHeader { ...@@ -167,10 +167,10 @@ class RegistrationAccept : public NasMmPlainHeader {
std::optional<NetworkSlicingIndication> std::optional<NetworkSlicingIndication>
ie_network_slicing_indication; // Optional ie_network_slicing_indication; // Optional
// TODO: Service Area List // TODO: Service Area List
std::optional<GPRS_Timer_3> ie_T3512_value; // Optional std::optional<GprsTimer3> ie_T3512_value; // Optional
std::optional<GPRS_Timer_2> std::optional<GprsTimer2>
ie_Non_3GPP_de_registration_timer_value; // Optional ie_Non_3GPP_de_registration_timer_value; // Optional
std::optional<GPRS_Timer_2> ie_T3502_value; // Optional std::optional<GprsTimer2> ie_T3502_value; // Optional
// TODO: Emergency number list // TODO: Emergency number list
// TODO: Extended emergency number list // TODO: Extended emergency number list
std::optional<SOR_Transparent_Container> std::optional<SOR_Transparent_Container>
...@@ -184,10 +184,10 @@ class RegistrationAccept : public NasMmPlainHeader { ...@@ -184,10 +184,10 @@ class RegistrationAccept : public NasMmPlainHeader {
std::optional<EpsBearerContextStatus> std::optional<EpsBearerContextStatus>
ie_eps_bearer_context_status; // Optional ie_eps_bearer_context_status; // Optional
std::optional<Extended_DRX_Parameters> std::optional<Extended_DRX_Parameters>
ie_extended_drx_parameters; // Optional ie_extended_drx_parameters; // Optional
std::optional<GPRS_Timer_3> ie_T3447_value; // Optional std::optional<GprsTimer3> ie_T3447_value; // Optional
std::optional<GPRS_Timer_3> ie_T3448_value; // Optional std::optional<GprsTimer3> ie_T3448_value; // Optional
std::optional<GPRS_Timer_3> ie_T3324_value; // Optional std::optional<GprsTimer3> ie_T3324_value; // Optional
std::optional<UE_Radio_Capability_ID> std::optional<UE_Radio_Capability_ID>
ie_ue_radio_capability_id; // Which Release 16.x.x? ie_ue_radio_capability_id; // Which Release 16.x.x?
std::optional<NSSAI> ie_pending_nssai; // Which Release 16.x.x? std::optional<NSSAI> ie_pending_nssai; // Which Release 16.x.x?
......
...@@ -52,9 +52,8 @@ void RegistrationComplete::setHeader(uint8_t security_header_type) { ...@@ -52,9 +52,8 @@ void RegistrationComplete::setHeader(uint8_t security_header_type) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationComplete::setSOR_Transparent_Container( void RegistrationComplete::setSOR_Transparent_Container(
uint8_t header, uint8_t* value) { uint8_t header, const uint8_t (&value)[16]) {
ie_sor_transparent_container = ie_sor_transparent_container = new SOR_Transparent_Container(header, value);
new SOR_Transparent_Container(0x73, header, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -40,7 +40,7 @@ class RegistrationComplete { ...@@ -40,7 +40,7 @@ class RegistrationComplete {
int Encode(uint8_t* buf, int len); int Encode(uint8_t* buf, int len);
int Decode(NasMmPlainHeader* header, uint8_t* buf, int len); int Decode(NasMmPlainHeader* header, uint8_t* buf, int len);
void setHeader(uint8_t security_header_type); void setHeader(uint8_t security_header_type);
void setSOR_Transparent_Container(uint8_t header, uint8_t* value); void setSOR_Transparent_Container(uint8_t header, const uint8_t (&value)[16]);
public: public:
NasMmPlainHeader* plain_header; NasMmPlainHeader* plain_header;
......
...@@ -51,12 +51,12 @@ void RegistrationReject::set_5GMM_Cause(uint8_t value) { ...@@ -51,12 +51,12 @@ void RegistrationReject::set_5GMM_Cause(uint8_t value) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationReject::setGPRS_Timer_2_3346(uint8_t value) { void RegistrationReject::setGPRS_Timer_2_3346(uint8_t value) {
ie_T3346_value = std::make_optional<GPRS_Timer_2>(kT3346Value, value); ie_T3346_value = std::make_optional<GprsTimer2>(kT3346Value, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void RegistrationReject::setGPRS_Timer_2_3502(uint8_t value) { void RegistrationReject::setGPRS_Timer_2_3502(uint8_t value) {
ie_T3502_value = std::make_optional<GPRS_Timer_2>(kT3502Value, value); ie_T3502_value = std::make_optional<GprsTimer2>(kT3502Value, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -154,19 +154,19 @@ int RegistrationReject::Decode( ...@@ -154,19 +154,19 @@ int RegistrationReject::Decode(
switch (octet) { switch (octet) {
case kT3346Value: { case kT3346Value: {
Logger::nas_mm().debug("Decoding IEI 0x5F: T3346 Value"); Logger::nas_mm().debug("Decoding IEI 0x5F: T3346 Value");
GPRS_Timer_2 ie_T3346_value_tmp(kT3346Value); GprsTimer2 ie_T3346_value_tmp(kT3346Value);
decoded_size += ie_T3346_value_tmp.Decode( decoded_size += ie_T3346_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3346_value = std::optional<GPRS_Timer_2>(ie_T3346_value_tmp); ie_T3346_value = std::optional<GprsTimer2>(ie_T3346_value_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;
case kT3502Value: { case kT3502Value: {
Logger::nas_mm().debug("Decoding IEI 0x16: T3502 Value"); Logger::nas_mm().debug("Decoding IEI 0x16: T3502 Value");
GPRS_Timer_2 ie_T3502_value_tmp(kT3502Value); GprsTimer2 ie_T3502_value_tmp(kT3502Value);
decoded_size += ie_T3502_value_tmp.Decode( decoded_size += ie_T3502_value_tmp.Decode(
buf + decoded_size, len - decoded_size, true); buf + decoded_size, len - decoded_size, true);
ie_T3502_value = std::optional<GPRS_Timer_2>(ie_T3502_value_tmp); ie_T3502_value = std::optional<GprsTimer2>(ie_T3502_value_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;
......
...@@ -53,8 +53,8 @@ class RegistrationReject : public NasMmPlainHeader { ...@@ -53,8 +53,8 @@ class RegistrationReject : public NasMmPlainHeader {
public: public:
_5GMM_Cause ie_5gmm_cause; // Mandatory _5GMM_Cause ie_5gmm_cause; // Mandatory
std::optional<GPRS_Timer_2> ie_T3346_value; // Optional std::optional<GprsTimer2> ie_T3346_value; // Optional
std::optional<GPRS_Timer_2> ie_T3502_value; // Optional std::optional<GprsTimer2> ie_T3502_value; // Optional
std::optional<EAP_Message> ie_eap_message; // Optional std::optional<EAP_Message> ie_eap_message; // Optional
std::optional<Rejected_NSSAI> ie_rejected_nssai; // Release 16.4.1 std::optional<Rejected_NSSAI> ie_rejected_nssai; // Release 16.4.1
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment