Commit 696d8f9b authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Update Payload Container Type

parent 1f43ee67
......@@ -29,7 +29,7 @@ using namespace nas;
//------------------------------------------------------------------------------
_5GSRegistrationType::_5GSRegistrationType()
: Type1NasIeFormatTv(), follow_on_req_(false), reg_type_(0) {
SetIeName("5GS Registration Type");
SetIeName(k5gsRegistrationTypeName);
}
//------------------------------------------------------------------------------
......
......@@ -27,30 +27,33 @@
using namespace nas;
//------------------------------------------------------------------------------
Payload_Container_Type::Payload_Container_Type(
const uint8_t iei, uint8_t value) {
_iei = iei;
_value = value & 0x0f;
PayloadContainerType::PayloadContainerType(const uint8_t iei, uint8_t value)
: Type1NasIeFormatTv(iei) {
SetValue(value & 0x0f);
SetIeName(kPayloadContainerTypeIeName);
}
//------------------------------------------------------------------------------
Payload_Container_Type::Payload_Container_Type() {}
PayloadContainerType::PayloadContainerType() : Type1NasIeFormatTv() {
SetIeName(kPayloadContainerTypeIeName);
}
//------------------------------------------------------------------------------
Payload_Container_Type::~Payload_Container_Type(){};
PayloadContainerType::~PayloadContainerType(){};
/*
//------------------------------------------------------------------------------
void Payload_Container_Type::setValue(const uint8_t value) {
void PayloadContainerType::SetValue(const uint8_t value) {
_value = value & 0x0f;
}
//------------------------------------------------------------------------------
uint8_t Payload_Container_Type::getValue() {
uint8_t PayloadContainerType::GetValue() const {
return _value;
}
//------------------------------------------------------------------------------
int Payload_Container_Type::Encode(uint8_t* buf, int len) {
int PayloadContainerType::Encode(uint8_t* buf, int len) {
Logger::nas_mm().debug("Encoding Payload_Container_Type IE");
if (len < kPayloadContainerTypeLength) {
......@@ -74,7 +77,7 @@ int Payload_Container_Type::Encode(uint8_t* buf, int len) {
}
//------------------------------------------------------------------------------
int Payload_Container_Type::Decode(uint8_t* buf, int len, bool is_option) {
int PayloadContainerType::Decode(uint8_t* buf, int len, bool is_option) {
Logger::nas_mm().debug("decoding Payload_Container_Type IE");
if (len < kPayloadContainerTypeLength) {
......@@ -97,3 +100,4 @@ int Payload_Container_Type::Decode(uint8_t* buf, int len, bool is_option) {
"Decoded Payload_Container_Type (IEI 0x%x, value 0x%x)", _iei, _value);
return decoded_size;
}
*/
......@@ -19,28 +19,31 @@
* contact@openairinterface.org
*/
#ifndef _Payload_Container_Type_H
#define _Payload_Container_Type_H
#ifndef _PAYLOAD_CONTAINER_TYPE_H
#define _PAYLOAD_CONTAINER_TYPE_H
#include "Type1NasIeFormatTv.hpp"
#include <stdint.h>
constexpr uint8_t kPayloadContainerTypeLength = 1;
constexpr auto kPayloadContainerTypeIeName = "Payload Container Type";
namespace nas {
class Payload_Container_Type {
class PayloadContainerType : public Type1NasIeFormatTv {
public:
Payload_Container_Type();
Payload_Container_Type(const uint8_t iei, uint8_t value);
~Payload_Container_Type();
int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len, bool is_option);
void setValue(const uint8_t value);
uint8_t getValue();
PayloadContainerType();
PayloadContainerType(const uint8_t iei, uint8_t value);
~PayloadContainerType();
/* void setValue(const uint8_t value);
uint8_t getValue();
int Encode(uint8_t* buf, int len);
int Decode(uint8_t* buf, int len, bool is_option);
*/
private:
uint8_t _iei;
uint8_t _value;
};
} // namespace nas
......
......@@ -66,6 +66,10 @@ void Type1NasIeFormatTv::SetValue(const uint8_t& value) {
value_ = value & 0x0f; // 4 lower bits
}
//------------------------------------------------------------------------------
uint8_t Type1NasIeFormatTv::GetValue() const {
return value_;
}
//------------------------------------------------------------------------------
int Type1NasIeFormatTv::Encode(uint8_t* buf, const int& len) {
Logger::nas_mm().debug("Encoding %s", GetIeName().c_str());
......
......@@ -37,7 +37,7 @@ class Type1NasIeFormatTv : public NasIe {
void SetIei(const uint8_t& iei);
void SetValue(const uint8_t& value);
void GetValue();
uint8_t GetValue() const;
uint8_t GetIeLength() const;
......
......@@ -57,7 +57,7 @@ void DLNASTransport::setHeader(uint8_t security_header_type) {
//------------------------------------------------------------------------------
void DLNASTransport::setPayload_Container_Type(uint8_t value) {
ie_payload_container_type = new Payload_Container_Type(0x00, value);
ie_payload_container_type = new PayloadContainerType(0x00, value);
}
//------------------------------------------------------------------------------
......@@ -118,7 +118,7 @@ int DLNASTransport::Encode(uint8_t* buf, int len) {
} else {
if (int size = ie_payload_container->Encode(
buf + encoded_size, len - encoded_size,
ie_payload_container_type->getValue())) {
ie_payload_container_type->GetValue())) {
encoded_size += size;
} else {
Logger::nas_mm().error("Encoding ie_payload_container error");
......@@ -178,10 +178,11 @@ int DLNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) {
Logger::nas_mm().debug("Decoding DLNASTransport message");
int decoded_size = 3;
plain_header = header;
ie_payload_container_type = new Payload_Container_Type();
ie_payload_container_type = new PayloadContainerType();
decoded_size += ie_payload_container_type->Decode(
buf + decoded_size, len - decoded_size, false);
ie_payload_container = new Payload_Container();
decoded_size++; // 1/2 octet for PayloadContainerType, 1/2 octet for spare
decoded_size += ie_payload_container->Decode(
buf + decoded_size, len - decoded_size, false,
N1_SM_INFORMATION); // TODO: verified Typeb of Payload Container
......
......@@ -50,7 +50,7 @@ class DLNASTransport {
public:
NasMmPlainHeader* plain_header;
Payload_Container_Type* ie_payload_container_type;
PayloadContainerType* ie_payload_container_type;
Payload_Container* ie_payload_container;
PDU_Session_Identity_2* ie_pdu_session_identity_2;
Additional_Information* ie_additional_information;
......
......@@ -426,14 +426,14 @@ bool RegistrationRequest::getLadnIndication(std::vector<bstring>& ladnValue) {
//------------------------------------------------------------------------------
void RegistrationRequest::setPayload_Container_Type(uint8_t value) {
ie_payload_container_type = std::make_optional<Payload_Container_Type>(
kIeiPayloadContainerType, value);
ie_payload_container_type =
std::make_optional<PayloadContainerType>(kIeiPayloadContainerType, value);
}
//------------------------------------------------------------------------------
uint8_t RegistrationRequest::getPayloadContainerType() {
if (ie_payload_container_type.has_value()) {
return ie_payload_container_type.value().getValue();
return ie_payload_container_type.value().GetValue();
} else {
return 0;
}
......@@ -770,7 +770,7 @@ int RegistrationRequest::Encode(uint8_t* buf, int len) {
} else {
if (int size = ie_payload_container->Encode(
buf + encoded_size, len - encoded_size,
ie_payload_container_type.value().getValue())) {
ie_payload_container_type.value().GetValue())) {
encoded_size += size;
} else {
Logger::nas_mm().error("encoding ie_payload_container error");
......@@ -872,11 +872,11 @@ int RegistrationRequest::Decode(uint8_t* buf, int len) {
} break;
case kIeiPayloadContainerType: {
Logger::nas_mm().debug("Decoding IEI 0x8: Payload Container Type");
Payload_Container_Type ie_payload_container_type_tmp = {};
PayloadContainerType ie_payload_container_type_tmp = {};
decoded_size += ie_payload_container_type_tmp.Decode(
buf + decoded_size, len - decoded_size, true);
ie_payload_container_type = std::optional<Payload_Container_Type>(
ie_payload_container_type_tmp);
ie_payload_container_type =
std::optional<PayloadContainerType>(ie_payload_container_type_tmp);
octet = *(buf + decoded_size);
Logger::nas_mm().debug("Next IEI 0x%x", octet);
} break;
......
......@@ -167,10 +167,10 @@ class RegistrationRequest : public NasMmPlainHeader {
std::optional<UEUsageSetting> ie_ues_usage_setting; // Optional
std::optional<_5GS_DRX_Parameters> ie_5gs_drx_parameters; // Optional
std::optional<EPS_NAS_Message_Container>
ie_eps_nas_message_container; // Optional
std::optional<LadnIndication> ie_ladn_indication; // Optional
std::optional<Payload_Container_Type> ie_payload_container_type; // Optional
std::optional<Payload_Container> ie_payload_container; // Optional
ie_eps_nas_message_container; // Optional
std::optional<LadnIndication> ie_ladn_indication; // Optional
std::optional<PayloadContainerType> ie_payload_container_type; // Optional
std::optional<Payload_Container> ie_payload_container; // Optional
std::optional<NetworkSlicingIndication>
ie_network_slicing_indication; // Optional
std::optional<_5GS_Update_Type> ie_5gs_update_type; // Optional
......
......@@ -53,13 +53,13 @@ void ULNASTransport::setHeader(uint8_t security_header_type) {
//------------------------------------------------------------------------------
void ULNASTransport::setPayload_Container_Type(uint8_t value) {
ie_payload_container_type = new Payload_Container_Type(0x00, value);
ie_payload_container_type = new PayloadContainerType(0x00, value);
}
//------------------------------------------------------------------------------
uint8_t ULNASTransport::getPayloadContainerType() {
if (ie_payload_container_type) {
return ie_payload_container_type->getValue();
return ie_payload_container_type->GetValue();
} else {
return -1;
}
......@@ -200,7 +200,7 @@ int ULNASTransport::Encode(uint8_t* buf, int len) {
} else {
if (int size = ie_payload_container->Encode(
buf + encoded_size, len - encoded_size,
ie_payload_container_type->getValue())) {
ie_payload_container_type->GetValue())) {
encoded_size += size;
} else {
Logger::nas_mm().error("encoding ie_payload_container error");
......@@ -307,13 +307,14 @@ int ULNASTransport::Decode(NasMmPlainHeader* header, uint8_t* buf, int len) {
Logger::nas_mm().debug("Decoding ULNASTransport message");
int decoded_size = 3;
plain_header = header;
ie_payload_container_type = new Payload_Container_Type();
ie_payload_container_type = new PayloadContainerType();
decoded_size += ie_payload_container_type->Decode(
buf + decoded_size, len - decoded_size, false);
decoded_size++; // 1/2 octet for PayloadContainerType, 1/2 octet for spare
ie_payload_container = new Payload_Container();
decoded_size += ie_payload_container->Decode(
buf + decoded_size, len - decoded_size, false,
ie_payload_container_type->getValue());
ie_payload_container_type->GetValue());
Logger::nas_mm().debug("Decoded_size (%d)", decoded_size);
uint8_t octet = *(buf + decoded_size);
Logger::nas_mm().debug("First option IEI (0x%x)", octet);
......
......@@ -62,7 +62,7 @@ class ULNASTransport {
public:
NasMmPlainHeader* plain_header;
Payload_Container_Type* ie_payload_container_type;
PayloadContainerType* ie_payload_container_type;
Payload_Container* ie_payload_container;
PDU_Session_Identity_2* ie_pdu_session_identity_2;
PDU_Session_Identity_2* ie_old_pdu_session_identity_2;
......
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