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