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