Commit 8d48f47e authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update Request Type

parent 73b60f8f
...@@ -72,7 +72,6 @@ constexpr uint8_t kIeiRejectedNssaiCuc = 0x11; ...@@ -72,7 +72,6 @@ constexpr uint8_t kIeiRejectedNssaiCuc = 0x11;
constexpr uint8_t kIeiReleaseAssistanceIndication = 0xf0; constexpr uint8_t kIeiReleaseAssistanceIndication = 0xf0;
constexpr uint8_t kIeiRequestedQosFlowDescriptions = 0x79; constexpr uint8_t kIeiRequestedQosFlowDescriptions = 0x79;
constexpr uint8_t kIeiRequestedQosRules = 0x7a; constexpr uint8_t kIeiRequestedQosRules = 0x7a;
constexpr uint8_t kIeiRequestType = 0x80;
constexpr uint8_t kIeiRqTimerValue = 0x56; constexpr uint8_t kIeiRqTimerValue = 0x56;
constexpr uint8_t kIeiServingPlmnRateControlPsea = 0x18; constexpr uint8_t kIeiServingPlmnRateControlPsea = 0x18;
constexpr uint8_t kIeiServingPlmnRateControlPsmc = 0x1e; constexpr uint8_t kIeiServingPlmnRateControlPsmc = 0x1e;
...@@ -87,6 +86,7 @@ constexpr uint8_t kIeiShortNameForNetwork = 0x45; ...@@ -87,6 +86,7 @@ constexpr uint8_t kIeiShortNameForNetwork = 0x45;
// OK // OK
constexpr uint8_t kIeiPayloadContainerType = 0x08; // Should be verified constexpr uint8_t kIeiPayloadContainerType = 0x08; // Should be verified
constexpr uint8_t kIeiRequestType = 0x08; // 8-(4 higher bits)
constexpr uint8_t kIeiNetworkSlicingIndication = 0x09; // 9-(4 higher bits) constexpr uint8_t kIeiNetworkSlicingIndication = 0x09; // 9-(4 higher bits)
constexpr uint8_t kIeiNssaiInclusionMode = 0x0A; // A-(4 higher bits) constexpr uint8_t kIeiNssaiInclusionMode = 0x0A; // A-(4 higher bits)
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#include "PayloadContainerType.hpp" #include "PayloadContainerType.hpp"
#include "Rejected_NSSAI.hpp" #include "Rejected_NSSAI.hpp"
#include "Release_Assistance_Indication.hpp" #include "Release_Assistance_Indication.hpp"
#include "Request_Type.hpp" #include "RequestType.hpp"
#include "S1UeSecurityCapability.hpp" #include "S1UeSecurityCapability.hpp"
#include "SOR_Transparent_Container.hpp" #include "SOR_Transparent_Container.hpp"
#include "S_NSSAI.hpp" #include "S_NSSAI.hpp"
......
...@@ -26,20 +26,20 @@ using namespace nas; ...@@ -26,20 +26,20 @@ using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionIdentity2::PduSessionIdentity2(uint8_t iei) : Type3NasIe(iei) { PduSessionIdentity2::PduSessionIdentity2(uint8_t iei) : Type3NasIe(iei) {
_value = 0; value_ = 0;
SetIeName(kPduSessionIdentity2IeName); SetIeName(kPduSessionIdentity2IeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionIdentity2::PduSessionIdentity2(const uint8_t iei, uint8_t value) PduSessionIdentity2::PduSessionIdentity2(const uint8_t iei, uint8_t value)
: Type3NasIe(iei) { : Type3NasIe(iei) {
_value = value; value_ = value;
SetIeName(kPduSessionIdentity2IeName); SetIeName(kPduSessionIdentity2IeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PduSessionIdentity2::PduSessionIdentity2() : Type3NasIe() { PduSessionIdentity2::PduSessionIdentity2() : Type3NasIe() {
_value = 0; value_ = 0;
SetIeName(kPduSessionIdentity2IeName); SetIeName(kPduSessionIdentity2IeName);
} }
...@@ -48,12 +48,12 @@ PduSessionIdentity2::~PduSessionIdentity2() {} ...@@ -48,12 +48,12 @@ PduSessionIdentity2::~PduSessionIdentity2() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PduSessionIdentity2::SetValue(uint8_t value) { void PduSessionIdentity2::SetValue(uint8_t value) {
_value = value; value_ = value;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t PduSessionIdentity2::GetValue() { uint8_t PduSessionIdentity2::GetValue() const {
return _value; return value_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -71,7 +71,7 @@ int PduSessionIdentity2::Encode(uint8_t* buf, int len) { ...@@ -71,7 +71,7 @@ int PduSessionIdentity2::Encode(uint8_t* buf, int len) {
// IEI // IEI
encoded_size += Type3NasIe::Encode(buf + encoded_size, len); encoded_size += Type3NasIe::Encode(buf + encoded_size, len);
// Value // Value
ENCODE_U8(buf + encoded_size, _value, encoded_size); ENCODE_U8(buf + encoded_size, value_, encoded_size);
Logger::nas_mm().debug( Logger::nas_mm().debug(
"Encoded %s, len (%d)", GetIeName().c_str(), encoded_size); "Encoded %s, len (%d)", GetIeName().c_str(), encoded_size);
...@@ -93,9 +93,9 @@ int PduSessionIdentity2::Decode(uint8_t* buf, int len, bool is_iei) { ...@@ -93,9 +93,9 @@ int PduSessionIdentity2::Decode(uint8_t* buf, int len, bool is_iei) {
// IEI and Length // IEI and Length
decoded_size += Type3NasIe::Decode(buf + decoded_size, len, true); decoded_size += Type3NasIe::Decode(buf + decoded_size, len, true);
DECODE_U8(buf + decoded_size, _value, decoded_size); DECODE_U8(buf + decoded_size, value_, decoded_size);
Logger::nas_mm().debug("Decoded value 0x%x", _value); Logger::nas_mm().debug("Decoded value 0x%x", value_);
Logger::nas_mm().debug( Logger::nas_mm().debug(
"Decoded %s, len (%d)", GetIeName().c_str(), decoded_size); "Decoded %s, len (%d)", GetIeName().c_str(), decoded_size);
return decoded_size; return decoded_size;
......
...@@ -35,13 +35,15 @@ class PduSessionIdentity2 : public Type3NasIe { ...@@ -35,13 +35,15 @@ class PduSessionIdentity2 : public Type3NasIe {
PduSessionIdentity2(uint8_t iei); PduSessionIdentity2(uint8_t iei);
PduSessionIdentity2(const uint8_t iei, uint8_t value); PduSessionIdentity2(const uint8_t iei, uint8_t value);
~PduSessionIdentity2(); ~PduSessionIdentity2();
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);
void SetValue(uint8_t value); void SetValue(uint8_t value);
uint8_t GetValue(); uint8_t GetValue() const;
private: private:
uint8_t _value; uint8_t value_;
}; };
} // namespace nas } // namespace nas
......
...@@ -26,73 +26,32 @@ ...@@ -26,73 +26,32 @@
\email: contact@openairinterface.org \email: contact@openairinterface.org
*/ */
#include "Request_Type.hpp" #include "RequestType.hpp"
#include "logger.hpp" #include "logger.hpp"
using namespace nas; using namespace nas;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Request_Type::Request_Type(uint8_t iei) { RequestType::RequestType() : Type1NasIeFormatTv(kIeiRequestType) {
_iei = iei; value_ = 0;
_value = 0; SetIeName(kRequestTypeIeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Request_Type::Request_Type(const uint8_t iei, uint8_t value) { RequestType::RequestType(uint8_t value) : Type1NasIeFormatTv(kIeiRequestType) {
_iei = iei; value_ = value;
_value = value; SetIeName(kRequestTypeIeName);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Request_Type::Request_Type() { RequestType::~RequestType() {}
_iei = 0;
_value = 0;
}
//------------------------------------------------------------------------------
Request_Type::~Request_Type() {}
//------------------------------------------------------------------------------
void Request_Type::setValue(uint8_t value) {
_value = value;
}
//------------------------------------------------------------------------------
uint8_t Request_Type::getValue() {
return _value;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int Request_Type::Encode(uint8_t* buf, int len) { void RequestType::SetValue(uint8_t value) {
Logger::nas_mm().debug("encoding Request_Type iei(0x%x)", _iei); Type1NasIeFormatTv::SetValue(value_ & 0x07);
if (len < 1) {
Logger::nas_mm().error("len is less than 1");
return 0;
}
int encoded_size = 0;
if (_iei) {
*(buf + encoded_size) = ((_iei & 0x0f) << 4) | _value & 0x07;
encoded_size++;
} else {
*(buf + encoded_size) = _value & 0x07;
encoded_size++;
}
Logger::nas_mm().debug("encoded Request_Type len(%d)", encoded_size);
return encoded_size;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int Request_Type::Decode(uint8_t* buf, int len, bool is_option) { uint8_t RequestType::GetValue() const {
Logger::nas_mm().debug("decoding Request_Type iei(0x%x)", *buf); return (Type1NasIeFormatTv::GetValue() & 0x07);
int decoded_size = 0;
uint8_t octet = 0;
if (is_option) {
octet = *buf;
decoded_size++;
}
_value = 0x00;
_value = octet & 0x07;
Logger::nas_mm().debug("decoded Request_Type _value(0x%x)", _value);
Logger::nas_mm().debug("decoded Request_Type len(%d)", decoded_size);
return decoded_size;
} }
...@@ -19,34 +19,27 @@ ...@@ -19,34 +19,27 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file #ifndef _REQUEST_TYPE_H_
\brief #define _REQUEST_TYPE_H_
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#ifndef __Request_Type_H_ #include "Type1NasIeFormatTv.hpp"
#define __Request_Type_H_ #include "NasIe.hpp"
#include <stdint.h> constexpr auto kRequestTypeIeName = "Request Type";
namespace nas { namespace nas {
class Request_Type { class RequestType : public Type1NasIeFormatTv {
public: public:
Request_Type(); RequestType();
Request_Type(uint8_t iei); RequestType(uint8_t value);
Request_Type(const uint8_t iei, uint8_t value); ~RequestType();
~Request_Type();
int Encode(uint8_t* buf, int len); void SetValue(uint8_t value);
int Decode(uint8_t* buf, int len, bool is_option); uint8_t GetValue() const;
void setValue(uint8_t value);
uint8_t getValue();
private: private:
uint8_t _iei; uint8_t value_;
uint8_t _value;
}; };
} // namespace nas } // namespace nas
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#ifndef _TYPE1_NAS_IE_FORMAT_TV_H_ #ifndef _TYPE1_NAS_IE_FORMAT_TV_H_
#define _TYPE1_NAS_IE_FORMAT_TV_H_ #define _TYPE1_NAS_IE_FORMAT_TV_H_
#include "NasIe.hpp" #include "NasIe.hpp"
constexpr uint8_t kType1NasIeFormatTvLength = 1; constexpr uint8_t kType1NasIeFormatTvLength = 1;
......
...@@ -19,13 +19,6 @@ ...@@ -19,13 +19,6 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "DLNASTransport.hpp" #include "DLNASTransport.hpp"
#include "3gpp_24.501.hpp" #include "3gpp_24.501.hpp"
......
...@@ -77,7 +77,7 @@ void ULNASTransport::GetPayloadContainer( ...@@ -77,7 +77,7 @@ void ULNASTransport::GetPayloadContainer(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ULNASTransport::SetPduSessionIdentity2(uint8_t value) { void ULNASTransport::SetPduSessionIdentity2(uint8_t value) {
ie_pdu_session_identity_2 = ie_pdu_session_identity_2 =
std::make_optional<PduSessionIdentity2>(0x12, value); std::make_optional<PduSessionIdentity2>(kIeiPduSessionId, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -92,7 +92,7 @@ uint8_t ULNASTransport::GetPduSessionId() { ...@@ -92,7 +92,7 @@ uint8_t ULNASTransport::GetPduSessionId() {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ULNASTransport::SetOldPduSessionIdentity2(uint8_t value) { void ULNASTransport::SetOldPduSessionIdentity2(uint8_t value) {
ie_old_pdu_session_identity_2 = ie_old_pdu_session_identity_2 =
std::make_optional<PduSessionIdentity2>(0x59, value); std::make_optional<PduSessionIdentity2>(kIeiOldPduSessionId, value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -107,13 +107,13 @@ bool ULNASTransport::GetOldPduSessionId(uint8_t& value) { ...@@ -107,13 +107,13 @@ bool ULNASTransport::GetOldPduSessionId(uint8_t& value) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void ULNASTransport::SetRequestType(uint8_t value) { void ULNASTransport::SetRequestType(uint8_t value) {
ie_request_type = std::make_optional<Request_Type>(0x08, value); ie_request_type = std::make_optional<RequestType>(value);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool ULNASTransport::GetRequestType(uint8_t& value) { bool ULNASTransport::GetRequestType(uint8_t& value) {
if (ie_request_type.has_value()) { if (ie_request_type.has_value()) {
value = ie_request_type.value().getValue(); value = ie_request_type.value().GetValue();
return true; return true;
} else { } else {
return false; return false;
...@@ -351,15 +351,15 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) { ...@@ -351,15 +351,15 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) {
bool flag = false; bool flag = false;
while ((octet != 0x0)) { while ((octet != 0x0)) {
switch ((octet & 0xf0) >> 4) { switch ((octet & 0xf0) >> 4) {
case 0x8: { case kIeiRequestType: {
Logger::nas_mm().debug("Decoding IEI (0x8)"); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiRequestType);
Request_Type ie_request_type_tmp = {}; RequestType ie_request_type_tmp = {};
if ((decoded_result = ie_request_type_tmp.Decode( if ((decoded_result = ie_request_type_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_request_type = std::optional<Request_Type>(ie_request_type_tmp); ie_request_type = std::optional<RequestType>(ie_request_type_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;
...@@ -396,8 +396,8 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) { ...@@ -396,8 +396,8 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) {
} }
} }
switch (octet) { switch (octet) {
case 0x12: { case kIeiPduSessionId: {
Logger::nas_mm().debug("Decoding IEI (0x12)"); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiPduSessionId);
PduSessionIdentity2 ie_pdu_session_identity_2_tmp = {}; PduSessionIdentity2 ie_pdu_session_identity_2_tmp = {};
if ((decoded_result = ie_pdu_session_identity_2_tmp.Decode( if ((decoded_result = ie_pdu_session_identity_2_tmp.Decode(
buf + decoded_size, len - decoded_size, true)) == buf + decoded_size, len - decoded_size, true)) ==
...@@ -409,8 +409,8 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) { ...@@ -409,8 +409,8 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) {
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 0x59: { case kIeiOldPduSessionId: {
Logger::nas_mm().debug("Decoding IEI (0x59)"); Logger::nas_mm().debug("Decoding IEI 0x%x", kIeiOldPduSessionId);
PduSessionIdentity2 ie_old_pdu_session_identity_2_tmp = {}; PduSessionIdentity2 ie_old_pdu_session_identity_2_tmp = {};
if ((decoded_result = ie_old_pdu_session_identity_2_tmp.Decode( if ((decoded_result = ie_old_pdu_session_identity_2_tmp.Decode(
buf + decoded_size, len - decoded_size, true)) == buf + decoded_size, len - decoded_size, true)) ==
......
...@@ -70,7 +70,7 @@ class ULNASTransport : public NasMmPlainHeader { ...@@ -70,7 +70,7 @@ class ULNASTransport : public NasMmPlainHeader {
std::optional<PduSessionIdentity2> ie_pdu_session_identity_2; // Optional std::optional<PduSessionIdentity2> ie_pdu_session_identity_2; // Optional
std::optional<PduSessionIdentity2> ie_old_pdu_session_identity_2; // Optional std::optional<PduSessionIdentity2> ie_old_pdu_session_identity_2; // Optional
std::optional<Request_Type> ie_request_type; // Optional std::optional<RequestType> ie_request_type; // Optional
std::optional<S_NSSAI> ie_s_nssai; // Optional std::optional<S_NSSAI> ie_s_nssai; // Optional
std::optional<DNN> ie_dnn; // Optional std::optional<DNN> ie_dnn; // Optional
std::optional<Additional_Information> ie_additional_information; // Optional std::optional<Additional_Information> ie_additional_information; // Optional
......
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