Commit 0388dabc authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'ngap_ies_code_refactoring' into 'develop'

Ngap ies code refactoring

See merge request oai/cn5g/oai-cn5g-amf!150
parents e96a9e2a ed4e1638
...@@ -34,13 +34,14 @@ ARG BASE_IMAGE=ubuntu:bionic ...@@ -34,13 +34,14 @@ ARG BASE_IMAGE=ubuntu:bionic
FROM oai-amf-base:latest as oai-amf-builder FROM oai-amf-base:latest as oai-amf-builder
# Copying source code # Copying source code
RUN rm -Rf /openair-amf/
WORKDIR /openair-amf/ WORKDIR /openair-amf/
COPY . /openair-amf COPY . /openair-amf
RUN cp -Rf /openair-amf-ext-ref /openair-amf/build/ext
# Building AMF # Building AMF
WORKDIR /openair-amf/build/scripts WORKDIR /openair-amf/build/scripts
RUN ldconfig && \ RUN ldconfig && \
cp -Rf /openair-amf-ext-ref /openair-amf/build/ext && \
./build_amf --clean --Verbose --build-type Release --jobs && \ ./build_amf --clean --Verbose --build-type Release --jobs && \
ldd /openair-amf/build/amf/build/amf && \ ldd /openair-amf/build/amf/build/amf && \
mv /openair-amf/build/amf/build/amf /openair-amf/build/amf/build/oai_amf mv /openair-amf/build/amf/build/amf /openair-amf/build/amf/build/oai_amf
......
...@@ -3241,8 +3241,8 @@ void amf_n1::ul_nas_transport_handle( ...@@ -3241,8 +3241,8 @@ void amf_n1::ul_nas_transport_handle(
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id; itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->req_type = request_type; itti_msg->req_type = request_type;
itti_msg->pdu_sess_id = pdu_session_id; itti_msg->pdu_sess_id = pdu_session_id;
itti_msg->dnn = dnn; itti_msg->dnn = bstrcpy(dnn);
itti_msg->sm_msg = sm_msg; itti_msg->sm_msg = bstrcpy(sm_msg);
itti_msg->snssai.sST = snssai.sst; itti_msg->snssai.sST = snssai.sst;
itti_msg->snssai.sD = std::to_string(snssai.sd); itti_msg->snssai.sD = std::to_string(snssai.sd);
itti_msg->plmn.mnc = plmn.mnc; itti_msg->plmn.mnc = plmn.mnc;
......
This diff is collapsed.
...@@ -56,7 +56,8 @@ class amf_n2 : public ngap::ngap_app { ...@@ -56,7 +56,8 @@ class amf_n2 : public ngap::ngap_app {
* @param [std::shared_ptr<itti_ng_setup_request>]: ITTI message * @param [std::shared_ptr<itti_ng_setup_request>]: ITTI message
* @return void * @return void
*/ */
void handle_itti_message(std::shared_ptr<itti_ng_setup_request> ng_setup_req); void handle_itti_message(
std::shared_ptr<itti_ng_setup_request>& ng_setup_req);
/* /*
* Handle ITTI message (NG Reset) * Handle ITTI message (NG Reset)
......
...@@ -803,7 +803,7 @@ void amf_sbi::handle_post_sm_context_response_error( ...@@ -803,7 +803,7 @@ void amf_sbi::handle_post_sm_context_response_error(
"amf_sbi", "n1 sm", (uint8_t*) bdata(n1sm), blength(n1sm)); "amf_sbi", "n1 sm", (uint8_t*) bdata(n1sm), blength(n1sm));
itti_n1n2_message_transfer_request* itti_msg = itti_n1n2_message_transfer_request* itti_msg =
new itti_n1n2_message_transfer_request(TASK_AMF_SBI, TASK_AMF_APP); new itti_n1n2_message_transfer_request(TASK_AMF_SBI, TASK_AMF_APP);
itti_msg->n1sm = n1sm; itti_msg->n1sm = bstrcpy(n1sm);
itti_msg->is_n2sm_set = false; itti_msg->is_n2sm_set = false;
itti_msg->supi = supi; itti_msg->supi = supi;
itti_msg->pdu_session_id = pdu_session_id; itti_msg->pdu_session_id = pdu_session_id;
......
This diff is collapsed.
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
extern "C" { extern "C" {
#include "OCTET_STRING.h" #include "OCTET_STRING.h"
#include "BIT_STRING.h"
#include "dynamic_memory_check.h" #include "dynamic_memory_check.h"
} }
...@@ -48,7 +49,6 @@ extern "C" { ...@@ -48,7 +49,6 @@ extern "C" {
class conv { class conv {
public: public:
static void hexa_to_ascii(uint8_t* from, char* to, size_t length);
static int ascii_to_hex(uint8_t* dst, const char* h); static int ascii_to_hex(uint8_t* dst, const char* h);
static struct in_addr fromString(const std::string addr4); static struct in_addr fromString(const std::string addr4);
static std::string toString(const struct in_addr& inaddr); static std::string toString(const struct in_addr& inaddr);
...@@ -64,9 +64,32 @@ class conv { ...@@ -64,9 +64,32 @@ class conv {
static unsigned char* format_string_as_hex(std::string str); static unsigned char* format_string_as_hex(std::string str);
static void convert_string_2_hex( static void convert_string_2_hex(
std::string& input_str, std::string& output_str); std::string& input_str, std::string& output_str);
static void octet_string_2_bstring( static bool octet_string_2_bstring(
const OCTET_STRING_t& octet_str, bstring& b_str); const OCTET_STRING_t& octet_str, bstring& b_str);
static void bstring_2_octet_string(bstring& b_str, OCTET_STRING_t& octet_str); static bool bstring_2_octet_string(
static void sd_string_to_int(const std::string& sd_str, uint32_t& sd); const bstring& b_str, OCTET_STRING_t& octet_str);
static bool octet_string_2_bit_string(
const OCTET_STRING_t& octet_str, BIT_STRING_t& bit_str,
const uint8_t& bits_unused);
static bool bstring_2_bit_string(const bstring& b_str, BIT_STRING_t& bit_str);
static bool sd_string_to_int(const std::string& sd_str, uint32_t& sd);
static bool string_to_int(
const std::string& str, uint32_t& value, const uint8_t& base);
static bool string_to_int8(const std::string& str, uint8_t& value);
static bool string_to_int32(const std::string& str, uint32_t& value);
static void bstring_2_string(const bstring& b_str, std::string& str);
static void string_2_bstring(const std::string& str, bstring& b_str);
static void octet_string_2_string(
const OCTET_STRING_t& octet_str, std::string& str);
static void string_2_octet_string(
const std::string& str, OCTET_STRING_t& o_str);
static bool int8_2_octet_string(const uint8_t& value, OCTET_STRING_t& o_str);
static bool octet_string_2_int8(const OCTET_STRING_t& o_str, uint8_t& value);
// TODO: bitstring_2_int32
static bool octet_string_copy(
OCTET_STRING_t& destination, const OCTET_STRING_t& source);
static bool check_bstring(const bstring& b_str);
static bool check_octet_string(const OCTET_STRING_t& octet_str);
}; };
#endif /* FILE_CONVERSIONS_HPP_SEEN */ #endif /* FILE_CONVERSIONS_HPP_SEEN */
...@@ -21,38 +21,38 @@ ...@@ -21,38 +21,38 @@
#include "AMF-UE-NGAP-ID.hpp" #include "AMF-UE-NGAP-ID.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AMF_UE_NGAP_ID::AMF_UE_NGAP_ID() { AMF_UE_NGAP_ID::AMF_UE_NGAP_ID() {
amfUeNgapId = 0; id_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AMF_UE_NGAP_ID::~AMF_UE_NGAP_ID() {} AMF_UE_NGAP_ID::~AMF_UE_NGAP_ID() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMF_UE_NGAP_ID::setAMF_UE_NGAP_ID(unsigned long m_amfUeNgapId) { bool AMF_UE_NGAP_ID::set(const uint64_t& id) {
amfUeNgapId = m_amfUeNgapId; if (id > AMF_UE_NGAP_ID_MAX_VALUE) return false;
id_ = id;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
unsigned long AMF_UE_NGAP_ID::getAMF_UE_NGAP_ID() { uint64_t AMF_UE_NGAP_ID::get() {
return amfUeNgapId; return id_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMF_UE_NGAP_ID::encode2AMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t& amfuengapid) { bool AMF_UE_NGAP_ID::encode2AMF_UE_NGAP_ID(
amfuengapid.size = 5; Ngap_AMF_UE_NGAP_ID_t& amf_ue_ngap_id) {
amfuengapid.buf = (uint8_t*) calloc(1, amfuengapid.size); amf_ue_ngap_id.size = 5;
if (!amfuengapid.buf) return false; amf_ue_ngap_id.buf = (uint8_t*) calloc(1, amf_ue_ngap_id.size);
if (!amf_ue_ngap_id.buf) return false;
for (int i = 0; i < amfuengapid.size; i++) { for (int i = 0; i < amf_ue_ngap_id.size; i++) {
amfuengapid.buf[i] = (amfUeNgapId & (0xff00000000 >> i * 8)) >> amf_ue_ngap_id.buf[i] =
((amfuengapid.size - i - 1) * 8); (id_ & (0xff00000000 >> i * 8)) >> ((amf_ue_ngap_id.size - i - 1) * 8);
} }
return true; return true;
...@@ -60,13 +60,13 @@ bool AMF_UE_NGAP_ID::encode2AMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t& amfuengapid) { ...@@ -60,13 +60,13 @@ bool AMF_UE_NGAP_ID::encode2AMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t& amfuengapid) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMF_UE_NGAP_ID::decodefromAMF_UE_NGAP_ID( bool AMF_UE_NGAP_ID::decodefromAMF_UE_NGAP_ID(
Ngap_AMF_UE_NGAP_ID_t& amfuengapid) { Ngap_AMF_UE_NGAP_ID_t& amf_ue_ngap_id) {
if (!amfuengapid.buf) return false; if (!amf_ue_ngap_id.buf) return false;
amfUeNgapId = 0; id_ = 0;
for (int i = 0; i < amfuengapid.size; i++) { for (int i = 0; i < amf_ue_ngap_id.size; i++) {
amfUeNgapId = amfUeNgapId << 8; id_ = id_ << 8;
amfUeNgapId |= amfuengapid.buf[i]; id_ |= amf_ue_ngap_id.buf[i];
} }
return true; return true;
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#ifndef _AMF_UE_NGAP_ID_H_ #ifndef _AMF_UE_NGAP_ID_H_
#define _AMF_UE_NGAP_ID_H_ #define _AMF_UE_NGAP_ID_H_
#include <cstdint>
constexpr uint64_t AMF_UE_NGAP_ID_MAX_VALUE = 1099511627775; // 2^40 -1
extern "C" { extern "C" {
#include "Ngap_AMF-UE-NGAP-ID.h" #include "Ngap_AMF-UE-NGAP-ID.h"
...@@ -33,14 +36,14 @@ class AMF_UE_NGAP_ID { ...@@ -33,14 +36,14 @@ class AMF_UE_NGAP_ID {
AMF_UE_NGAP_ID(); AMF_UE_NGAP_ID();
virtual ~AMF_UE_NGAP_ID(); virtual ~AMF_UE_NGAP_ID();
void setAMF_UE_NGAP_ID(unsigned long); bool set(const uint64_t&);
unsigned long getAMF_UE_NGAP_ID(); uint64_t get();
bool encode2AMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t&); bool encode2AMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t&);
bool decodefromAMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t&); bool decodefromAMF_UE_NGAP_ID(Ngap_AMF_UE_NGAP_ID_t&);
private: private:
unsigned long amfUeNgapId; uint64_t id_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -21,54 +21,38 @@ ...@@ -21,54 +21,38 @@
#include "AMFName.hpp" #include "AMFName.hpp"
extern "C" { #include "conversions.hpp"
#include "OCTET_STRING.h"
}
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AmfName::AmfName() { AmfName::AmfName() {}
amfname = nullptr;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AmfName::~AmfName() { AmfName::~AmfName() {}
free(amfname);
amfname = nullptr;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AmfName::setValue(const std::string m_amfName) { bool AmfName::setValue(const std::string& amf_name) {
if (amfname) { if (amf_name.size() > AMF_NAME_SIZE_MAX) return false;
free(amfname); amf_name_ = amf_name;
amfname = nullptr; return true;
}
amfname = (char*) calloc(1, m_amfName.size() + 1);
memcpy(amfname, m_amfName.c_str(), m_amfName.size());
amfname[m_amfName.size()] = '\0';
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AmfName::getValue(std::string& m_amfName) { void AmfName::getValue(std::string& amf_name) const {
if (amfname) m_amfName = amfname; amf_name = amf_name_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AmfName::encode2AmfName(Ngap_AMFName_t* amfNameIe) { bool AmfName::encode(Ngap_AMFName_t* amf_name_ie) {
if (amfname) conv::string_2_octet_string(amf_name_, *amf_name_ie);
if (OCTET_STRING_fromBuf(amfNameIe, amfname, strlen(amfname)) < 0)
return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AmfName::decodefromAmfName(Ngap_AMFName_t* pdu) { bool AmfName::decode(const Ngap_AMFName_t* amf_name_ie) {
if (!pdu->buf) return false; if (!amf_name_ie->buf) return false;
amfname = (char*) pdu->buf; conv::octet_string_2_string(*amf_name_ie, amf_name_);
return true; return true;
} }
......
...@@ -28,6 +28,7 @@ extern "C" { ...@@ -28,6 +28,7 @@ extern "C" {
#include "Ngap_AMFName.h" #include "Ngap_AMFName.h"
} }
constexpr uint8_t AMF_NAME_SIZE_MAX = 150;
namespace ngap { namespace ngap {
class AmfName { class AmfName {
...@@ -35,13 +36,13 @@ class AmfName { ...@@ -35,13 +36,13 @@ class AmfName {
AmfName(); AmfName();
virtual ~AmfName(); virtual ~AmfName();
bool encode2AmfName(Ngap_AMFName_t*); bool encode(Ngap_AMFName_t*);
bool decodefromAmfName(Ngap_AMFName_t*); bool decode(const Ngap_AMFName_t*);
void setValue(const std::string m_amfName); bool setValue(const std::string& amf_name);
void getValue(std::string&); void getValue(std::string& amf_name) const;
private: private:
char* amfname; std::string amf_name_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -21,52 +21,54 @@ ...@@ -21,52 +21,54 @@
#include "AMFPointer.hpp" #include "AMFPointer.hpp"
#include <iostream>
#include "String2Value.hpp" #include "String2Value.hpp"
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AMFPointer::AMFPointer() { AMFPointer::AMFPointer() {
pointer = 0; pointer_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AMFPointer::~AMFPointer() {} AMFPointer::~AMFPointer() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFPointer::setAMFPointer(const std::string charPointer) { bool AMFPointer::set(const std::string& pointer) {
pointer = fromString<int>(charPointer); uint8_t tmp = fromString<int>(pointer);
if (tmp > kAmfPointerMaxValue) return false;
pointer_ = tmp;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFPointer::setAMFPointer(const uint8_t& p) { bool AMFPointer::set(const uint8_t& pointer) {
pointer = p; if (pointer > kAmfPointerMaxValue) return false;
pointer_ = pointer;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFPointer::getAMFPointer(std::string& charPointer) { void AMFPointer::get(std::string& pointer) {
charPointer = to_string(pointer); pointer = std::to_string(pointer_);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFPointer::encode2bitstring(Ngap_AMFPointer_t& amfpointer) { bool AMFPointer::encode(Ngap_AMFPointer_t& amf_pointer) {
amfpointer.size = 1; amf_pointer.size = 1;
uint8_t* buffer = (uint8_t*) calloc(1, sizeof(uint8_t)); uint8_t* buffer = (uint8_t*) calloc(1, sizeof(uint8_t));
if (!buffer) return false; if (!buffer) return false;
*buffer = ((pointer & 0x3f) << 2); *buffer = ((pointer_ & 0x3f) << 2);
amfpointer.buf = buffer; amf_pointer.buf = buffer;
amfpointer.bits_unused = 2; amf_pointer.bits_unused = 2;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFPointer::decodefrombitstring(Ngap_AMFPointer_t& amfpointer) { bool AMFPointer::decode(Ngap_AMFPointer_t& amf_pointer) {
if (!amfpointer.buf) return false; if (!amf_pointer.buf) return false;
pointer = (amfpointer.buf[0] & 0xfc) >> 2; // 1111 1100 pointer_ = (amf_pointer.buf[0] & 0xfc) >> 2; // 1111 1100
return true; return true;
} }
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#define _AMFPOINTER_H_ #define _AMFPOINTER_H_
#include <string> #include <string>
constexpr uint8_t kAmfPointerMaxValue = 63; // 6 bits
extern "C" { extern "C" {
#include "Ngap_AMFPointer.h" #include "Ngap_AMFPointer.h"
} }
...@@ -35,15 +35,15 @@ class AMFPointer { ...@@ -35,15 +35,15 @@ class AMFPointer {
AMFPointer(); AMFPointer();
virtual ~AMFPointer(); virtual ~AMFPointer();
void setAMFPointer(const std::string); bool set(const std::string&);
void getAMFPointer(std::string&); void get(std::string&);
void setAMFPointer(const uint8_t&); bool set(const uint8_t&);
bool encode2bitstring(Ngap_AMFPointer_t&); bool encode(Ngap_AMFPointer_t&);
bool decodefrombitstring(Ngap_AMFPointer_t&); bool decode(Ngap_AMFPointer_t&);
private: private:
uint8_t pointer; uint8_t pointer_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -52,7 +52,7 @@ void AMFRegionID::getAMFRegionID(std::string& charid) { ...@@ -52,7 +52,7 @@ void AMFRegionID::getAMFRegionID(std::string& charid) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFRegionID::encode2bitstring(Ngap_AMFRegionID_t& amfregionid) { bool AMFRegionID::encode(Ngap_AMFRegionID_t& amfregionid) {
amfregionid.size = 1; amfregionid.size = 1;
uint8_t* buffer = (uint8_t*) calloc(1, sizeof(uint8_t)); uint8_t* buffer = (uint8_t*) calloc(1, sizeof(uint8_t));
if (!buffer) return false; if (!buffer) return false;
...@@ -64,7 +64,7 @@ bool AMFRegionID::encode2bitstring(Ngap_AMFRegionID_t& amfregionid) { ...@@ -64,7 +64,7 @@ bool AMFRegionID::encode2bitstring(Ngap_AMFRegionID_t& amfregionid) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFRegionID::decodefrombitstring(Ngap_AMFRegionID_t& amfregionid) { bool AMFRegionID::decode(Ngap_AMFRegionID_t& amfregionid) {
if (!amfregionid.buf) return false; if (!amfregionid.buf) return false;
regionid = *amfregionid.buf; regionid = *amfregionid.buf;
......
...@@ -40,8 +40,8 @@ class AMFRegionID { ...@@ -40,8 +40,8 @@ class AMFRegionID {
void setAMFRegionID(const uint8_t&); void setAMFRegionID(const uint8_t&);
bool encode2bitstring(Ngap_AMFRegionID_t&); bool encode(Ngap_AMFRegionID_t&);
bool decodefrombitstring(Ngap_AMFRegionID_t&); bool decode(Ngap_AMFRegionID_t&);
private: private:
uint8_t regionid; uint8_t regionid;
......
...@@ -29,51 +29,62 @@ namespace ngap { ...@@ -29,51 +29,62 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AMFSetID::AMFSetID() { AMFSetID::AMFSetID() {
setId = 0; id_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
AMFSetID::~AMFSetID() {} AMFSetID::~AMFSetID() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFSetID::setAMFSetID(const std::string& charid) { bool AMFSetID::set(const std::string& id) {
setId = fromString<uint16_t>(charid); uint16_t tmp = fromString<uint16_t>(id);
if (tmp > kAmfSetIdMaxValue) return false;
id_ = tmp;
return true;
}
//------------------------------------------------------------------------------
bool AMFSetID::set(const uint16_t& id) {
if (id > kAmfSetIdMaxValue) return false;
id_ = id;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFSetID::setAMFSetID(const uint16_t& set_id) { void AMFSetID::get(std::string& id) {
setId = set_id; id = std::to_string(id_);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AMFSetID::getAMFSetID(std::string& charid) { void AMFSetID::get(uint16_t& id) {
charid = std::to_string(setId); id = id_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFSetID::encode2bitstring(Ngap_AMFSetID_t& amfSetId) { bool AMFSetID::encode(Ngap_AMFSetID_t& amf_set_id) const {
amfSetId.size = 2; amf_set_id.size = 2;
uint8_t* buffer = (uint8_t*) calloc(1, sizeof(uint16_t)); uint8_t* buffer = (uint8_t*) calloc(1, sizeof(uint16_t));
if (!buffer) return false; if (!buffer) return false;
//*(uint16_t *)buffer = setId & 0x3ff; //*(uint16_t *)buffer = id_ & 0x3ff;
buffer[0] = ((setId & 0x03fc) >> 2); buffer[0] = ((id_ & 0x03fc) >> 2);
buffer[1] = ((setId & 0x0003) << 6); buffer[1] = ((id_ & 0x0003) << 6);
amfSetId.buf = buffer; amf_set_id.buf = buffer;
amfSetId.bits_unused = 6; amf_set_id.bits_unused = 6;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AMFSetID::decodefrombitstring(Ngap_AMFSetID_t& amfSetId) { bool AMFSetID::decode(const Ngap_AMFSetID_t& amf_set_id) {
if (!amfSetId.buf) return false; if (!amf_set_id.buf) return false;
for (int i = 0; i < amfSetId.size; i++) { for (int i = 0; i < amf_set_id.size; i++) {
printf("%x ", amfSetId.buf[i]); printf("%x ", amf_set_id.buf[i]);
} }
printf("\n"); printf("\n");
uint16_t temp = 0; uint16_t temp = 0;
temp |= amfSetId.buf[0] << 8; temp |= amf_set_id.buf[0] << 8;
temp |= amfSetId.buf[1]; temp |= amf_set_id.buf[1];
setId = (temp & 0xffc0) >> 6; // 1111 1111 11 00 0000 id_ = (temp & 0xffc0) >> 6; // 1111 1111 11 00 0000
return true; return true;
} }
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define _AMF_SET_ID_H_ #define _AMF_SET_ID_H_
#include <string> #include <string>
constexpr uint16_t kAmfSetIdMaxValue = 1023;
extern "C" { extern "C" {
#include "Ngap_AMFSetID.h" #include "Ngap_AMFSetID.h"
...@@ -34,15 +35,16 @@ class AMFSetID { ...@@ -34,15 +35,16 @@ class AMFSetID {
AMFSetID(); AMFSetID();
virtual ~AMFSetID(); virtual ~AMFSetID();
void setAMFSetID(const std::string&); bool set(const std::string&);
void setAMFSetID(const uint16_t& set_id); bool set(const uint16_t&);
void getAMFSetID(std::string&); void get(std::string&);
void get(uint16_t&);
bool encode2bitstring(Ngap_AMFSetID_t&); bool encode(Ngap_AMFSetID_t&) const;
bool decodefrombitstring(Ngap_AMFSetID_t&); bool decode(const Ngap_AMFSetID_t&);
private: private:
uint16_t setId; uint16_t id_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -34,36 +34,42 @@ AllowedNSSAI::AllowedNSSAI() {} ...@@ -34,36 +34,42 @@ AllowedNSSAI::AllowedNSSAI() {}
AllowedNSSAI::~AllowedNSSAI() {} AllowedNSSAI::~AllowedNSSAI() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AllowedNSSAI::setAllowedNSSAI(const std::vector<S_NSSAI>& list) { void AllowedNSSAI::set(const std::vector<S_NSSAI>& list) {
allowedSnssaiList = list; // Get maximum 8 items
uint8_t number_items = (list.size() > kAllowedSNSSAIMaxItems) ?
kAllowedSNSSAIMaxItems :
list.size();
list_.insert(list_.begin(), list.begin(), list.begin() + number_items);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void AllowedNSSAI::getAllowedNSSAI(std::vector<S_NSSAI>& list) { void AllowedNSSAI::get(std::vector<S_NSSAI>& list) {
list = allowedSnssaiList; list = list_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AllowedNSSAI::encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList) { bool AllowedNSSAI::encode(Ngap_AllowedNSSAI_t* list) {
for (std::vector<S_NSSAI>::iterator it = std::begin(allowedSnssaiList); for (std::vector<S_NSSAI>::iterator it = std::begin(list_);
it < std::end(allowedSnssaiList); ++it) { it < std::end(list_); ++it) {
Ngap_AllowedNSSAI_Item_t* allowednssaiitem = Ngap_AllowedNSSAI_Item_t* item =
(Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t)); (Ngap_AllowedNSSAI_Item_t*) calloc(1, sizeof(Ngap_AllowedNSSAI_Item_t));
if (!allowednssaiitem) return false; if (!item) return false;
if (!it->encode2S_NSSAI(&allowednssaiitem->s_NSSAI)) return false; if (!it->encode(&item->s_NSSAI)) return false;
if (ASN_SEQUENCE_ADD(&allowedNssaiList->list, allowednssaiitem) != 0) if (ASN_SEQUENCE_ADD(&list->list, item) != 0) return false;
return false;
} }
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool AllowedNSSAI::decodefromAllowedNSSAI( bool AllowedNSSAI::decode(Ngap_AllowedNSSAI_t* list) {
Ngap_AllowedNSSAI_t* allowedNssaiList) { list_.clear();
for (int i = 0; i < allowedNssaiList->list.count; i++) { // Get maximum 8 items
uint8_t number_items = (list->list.count > kAllowedSNSSAIMaxItems) ?
kAllowedSNSSAIMaxItems :
list->list.count;
for (int i = 0; i < number_items; i++) {
S_NSSAI snssai = {}; S_NSSAI snssai = {};
if (!snssai.decodefromS_NSSAI(&allowedNssaiList->list.array[i]->s_NSSAI)) if (!snssai.decode(&list->list.array[i]->s_NSSAI)) return false;
return false; list_.push_back(snssai);
allowedSnssaiList.push_back(snssai);
} }
return true; return true;
} }
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "S-NSSAI.hpp" #include "S-NSSAI.hpp"
#include <vector> #include <vector>
constexpr uint8_t kAllowedSNSSAIMaxItems = 8;
extern "C" { extern "C" {
#include "Ngap_AllowedNSSAI.h" #include "Ngap_AllowedNSSAI.h"
...@@ -36,14 +37,14 @@ class AllowedNSSAI { ...@@ -36,14 +37,14 @@ class AllowedNSSAI {
AllowedNSSAI(); AllowedNSSAI();
virtual ~AllowedNSSAI(); virtual ~AllowedNSSAI();
void setAllowedNSSAI(const std::vector<S_NSSAI>& list); void set(const std::vector<S_NSSAI>& list);
void getAllowedNSSAI(std::vector<S_NSSAI>& list); void get(std::vector<S_NSSAI>& list);
bool encode2AllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList); bool encode(Ngap_AllowedNSSAI_t* allowedNssaiList);
bool decodefromAllowedNSSAI(Ngap_AllowedNSSAI_t* allowedNssaiList); bool decode(Ngap_AllowedNSSAI_t* allowedNssaiList);
private: private:
std::vector<S_NSSAI> allowedSnssaiList; std::vector<S_NSSAI> list_;
}; };
} // namespace ngap } // namespace ngap
#endif #endif
...@@ -57,14 +57,14 @@ void BroadcastPLMNItem::getPlmnSliceSupportList( ...@@ -57,14 +57,14 @@ void BroadcastPLMNItem::getPlmnSliceSupportList(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool BroadcastPLMNItem::encode2BroadcastPLMNItem( bool BroadcastPLMNItem::encode2BroadcastPLMNItem(
Ngap_BroadcastPLMNItem_t* plmnItem) { Ngap_BroadcastPLMNItem_t* plmnItem) {
if (!plmn.encode2octetstring(plmnItem->pLMNIdentity)) return false; if (!plmn.encode(plmnItem->pLMNIdentity)) return false;
for (std::vector<S_NSSAI>::iterator it = std::begin(supportedSliceList); for (std::vector<S_NSSAI>::iterator it = std::begin(supportedSliceList);
it < std::end(supportedSliceList); ++it) { it < std::end(supportedSliceList); ++it) {
Ngap_SliceSupportItem_t* slice = Ngap_SliceSupportItem_t* slice =
(Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t)); (Ngap_SliceSupportItem_t*) calloc(1, sizeof(Ngap_SliceSupportItem_t));
if (!slice) return false; if (!slice) return false;
if (!it->encode2S_NSSAI(&slice->s_NSSAI)) return false; if (!it->encode(&slice->s_NSSAI)) return false;
if (ASN_SEQUENCE_ADD(&plmnItem->tAISliceSupportList.list, slice) != 0) if (ASN_SEQUENCE_ADD(&plmnItem->tAISliceSupportList.list, slice) != 0)
return false; return false;
} }
...@@ -74,11 +74,10 @@ bool BroadcastPLMNItem::encode2BroadcastPLMNItem( ...@@ -74,11 +74,10 @@ bool BroadcastPLMNItem::encode2BroadcastPLMNItem(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool BroadcastPLMNItem::decodefromBroadcastPLMNItem( bool BroadcastPLMNItem::decodefromBroadcastPLMNItem(
Ngap_BroadcastPLMNItem_t* pdu) { Ngap_BroadcastPLMNItem_t* pdu) {
if (!plmn.decodefromoctetstring(pdu->pLMNIdentity)) return false; if (!plmn.decode(pdu->pLMNIdentity)) return false;
for (int i = 0; i < pdu->tAISliceSupportList.list.count; i++) { for (int i = 0; i < pdu->tAISliceSupportList.list.count; i++) {
S_NSSAI snssai = {}; S_NSSAI snssai = {};
if (!snssai.decodefromS_NSSAI( if (!snssai.decode(&pdu->tAISliceSupportList.list.array[i]->s_NSSAI))
&pdu->tAISliceSupportList.list.array[i]->s_NSSAI))
return false; return false;
supportedSliceList.push_back(snssai); supportedSliceList.push_back(snssai);
} }
......
...@@ -20,56 +20,55 @@ ...@@ -20,56 +20,55 @@
*/ */
#include "Cause.hpp" #include "Cause.hpp"
#include "logger.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Cause::Cause() { Cause::Cause() {
causeValue = -1; cause_present_ = Ngap_Cause_PR_NOTHING;
cause_value_ = -1;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Cause::~Cause() {} Cause::~Cause() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void Cause::setChoiceOfCause(Ngap_Cause_PR m_causePresent) { void Cause::setChoiceOfCause(const Ngap_Cause_PR& cause_present) {
causePresent = m_causePresent; cause_present_ = cause_present;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void Cause::setValue(long m_causeValue) { void Cause::setValue(const long& cause_value) {
causeValue = m_causeValue; cause_value_ = cause_value;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool Cause::encode2Cause(Ngap_Cause_t* cause) { bool Cause::encode(Ngap_Cause_t& cause) const {
cause->present = causePresent; cause.present = cause_present_;
switch (causePresent) { switch (cause_present_) {
case Ngap_Cause_PR_radioNetwork: { case Ngap_Cause_PR_radioNetwork: {
cause->choice.radioNetwork = causeValue; cause.choice.radioNetwork = cause_value_;
break; break;
} }
case Ngap_Cause_PR_transport: { case Ngap_Cause_PR_transport: {
cause->choice.transport = causeValue; cause.choice.transport = cause_value_;
break; break;
} }
case Ngap_Cause_PR_nas: { case Ngap_Cause_PR_nas: {
cause->choice.nas = causeValue; cause.choice.nas = cause_value_;
break; break;
} }
case Ngap_Cause_PR_protocol: { case Ngap_Cause_PR_protocol: {
cause->choice.protocol = causeValue; cause.choice.protocol = cause_value_;
break; break;
} }
case Ngap_Cause_PR_misc: { case Ngap_Cause_PR_misc: {
cause->choice.misc = causeValue; cause.choice.misc = cause_value_;
break; break;
} }
default: { default: {
cout << "[Warning] Cause Present error!" << endl; Logger::ngap().warn("Cause Present error!");
return false; return false;
break; break;
} }
...@@ -78,26 +77,26 @@ bool Cause::encode2Cause(Ngap_Cause_t* cause) { ...@@ -78,26 +77,26 @@ bool Cause::encode2Cause(Ngap_Cause_t* cause) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool Cause::decodefromCause(Ngap_Cause_t* pdu) { bool Cause::decode(const Ngap_Cause_t& cause) {
causePresent = pdu->present; cause_present_ = cause.present;
switch (causePresent) { switch (cause_present_) {
case Ngap_Cause_PR_radioNetwork: { case Ngap_Cause_PR_radioNetwork: {
causeValue = pdu->choice.radioNetwork; cause_value_ = cause.choice.radioNetwork;
} break; } break;
case Ngap_Cause_PR_transport: { case Ngap_Cause_PR_transport: {
causeValue = pdu->choice.transport; cause_value_ = cause.choice.transport;
} break; } break;
case Ngap_Cause_PR_nas: { case Ngap_Cause_PR_nas: {
causeValue = pdu->choice.nas; cause_value_ = cause.choice.nas;
} break; } break;
case Ngap_Cause_PR_protocol: { case Ngap_Cause_PR_protocol: {
causeValue = pdu->choice.protocol; cause_value_ = cause.choice.protocol;
} break; } break;
case Ngap_Cause_PR_misc: { case Ngap_Cause_PR_misc: {
causeValue = pdu->choice.misc; cause_value_ = cause.choice.misc;
} break; } break;
default: { default: {
cout << "[Warning] Cause Present error!" << endl; Logger::ngap().warn("Cause Present error!");
return false; return false;
} }
} }
...@@ -105,12 +104,18 @@ bool Cause::decodefromCause(Ngap_Cause_t* pdu) { ...@@ -105,12 +104,18 @@ bool Cause::decodefromCause(Ngap_Cause_t* pdu) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Ngap_Cause_PR Cause::getChoiceOfCause() { Ngap_Cause_PR Cause::getChoiceOfCause() const {
return causePresent; return cause_present_;
}
//------------------------------------------------------------------------------
long Cause::getValue() const {
return cause_value_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
long Cause::getValue() { void Cause::set(const long& value, const Ngap_Cause_PR& cause_present) {
return causeValue; cause_value_ = value;
cause_present_ = cause_present;
} }
} // namespace ngap } // namespace ngap
...@@ -33,16 +33,17 @@ class Cause { ...@@ -33,16 +33,17 @@ class Cause {
Cause(); Cause();
virtual ~Cause(); virtual ~Cause();
bool encode2Cause(Ngap_Cause_t* cause); bool encode(Ngap_Cause_t& cause) const;
bool decodefromCause(Ngap_Cause_t* pdu); bool decode(const Ngap_Cause_t& cause);
void setChoiceOfCause(Ngap_Cause_PR m_causePresent); void setChoiceOfCause(const Ngap_Cause_PR& cause_present);
Ngap_Cause_PR getChoiceOfCause(); Ngap_Cause_PR getChoiceOfCause() const;
void setValue(long); void setValue(const long& value);
long getValue(); long getValue() const;
void set(const long& value, const Ngap_Cause_PR& cause_present);
private: private:
long causeValue; long cause_value_;
Ngap_Cause_PR causePresent; Ngap_Cause_PR cause_present_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -25,44 +25,41 @@ extern "C" { ...@@ -25,44 +25,41 @@ extern "C" {
#include "Ngap_TAIListForInactiveItem.h" #include "Ngap_TAIListForInactiveItem.h"
} }
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
CoreNetworkAssistanceInfo::CoreNetworkAssistanceInfo() { CoreNetworkAssistanceInfo::CoreNetworkAssistanceInfo() {
pagingDRX = nullptr; pagingDRX = std::nullopt;
micoModeInd = nullptr; micoModeInd = std::nullopt;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
CoreNetworkAssistanceInfo::~CoreNetworkAssistanceInfo() {} CoreNetworkAssistanceInfo::~CoreNetworkAssistanceInfo() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void CoreNetworkAssistanceInfo::setCoreNetworkAssistanceInfo( void CoreNetworkAssistanceInfo::set(
const UEIdentityIndexValue& m_ueIdentityIndexValue, const UEIdentityIndexValue& ue_identity_index_value,
DefaultPagingDRX* m_pagingDRX, const DefaultPagingDRX& paging_drx,
const PeriodicRegistrationUpdateTimer& m_periodicRegUpdateTimer, const PeriodicRegistrationUpdateTimer& m_periodicRegUpdateTimer,
const bool& m_micoModeInd, const std::vector<TAI>& m_tai) { const bool& m_micoModeInd, const std::vector<TAI>& m_tai) {
ueIdentityIndexValue = m_ueIdentityIndexValue; ueIdentityIndexValue = ue_identity_index_value;
pagingDRX = m_pagingDRX; pagingDRX = std::optional<DefaultPagingDRX>(paging_drx);
periodicRegUpdateTimer = m_periodicRegUpdateTimer; periodicRegUpdateTimer = m_periodicRegUpdateTimer;
if (m_micoModeInd) { if (m_micoModeInd) {
micoModeInd = new MICOModeIndication(); micoModeInd = std::make_optional<MICOModeIndication>();
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void CoreNetworkAssistanceInfo::getCoreNetworkAssistanceInfo( void CoreNetworkAssistanceInfo::get(
UEIdentityIndexValue& m_ueIdentityIndexValue, UEIdentityIndexValue& ue_identity_index_value,
DefaultPagingDRX*& m_pagingDRX, std::optional<DefaultPagingDRX>& paging_drx,
PeriodicRegistrationUpdateTimer& m_periodicRegUpdateTimer, PeriodicRegistrationUpdateTimer& m_periodicRegUpdateTimer,
bool& m_micoModeInd, std::vector<TAI>& m_tai) { bool& m_micoModeInd, std::vector<TAI>& m_tai) {
m_ueIdentityIndexValue = ueIdentityIndexValue; ue_identity_index_value = ueIdentityIndexValue;
m_pagingDRX = pagingDRX; paging_drx = pagingDRX;
m_periodicRegUpdateTimer = periodicRegUpdateTimer; m_periodicRegUpdateTimer = periodicRegUpdateTimer;
if (micoModeInd) if (micoModeInd.has_value())
m_micoModeInd = true; m_micoModeInd = true;
else else
m_micoModeInd = false; m_micoModeInd = false;
...@@ -70,14 +67,14 @@ void CoreNetworkAssistanceInfo::getCoreNetworkAssistanceInfo( ...@@ -70,14 +67,14 @@ void CoreNetworkAssistanceInfo::getCoreNetworkAssistanceInfo(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo( bool CoreNetworkAssistanceInfo::encode(
Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) { Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) {
if (!ueIdentityIndexValue.encode2UEIdentityIndexValue( if (!ueIdentityIndexValue.encode(
&coreNetworkAssistanceInformation->uEIdentityIndexValue)) coreNetworkAssistanceInformation->uEIdentityIndexValue))
return false; return false;
if (!periodicRegUpdateTimer.encode2PeriodicRegistrationUpdateTimer( if (!periodicRegUpdateTimer.encode(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer)) coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false; return false;
for (std::vector<TAI>::iterator it = std::begin(taiList); for (std::vector<TAI>::iterator it = std::begin(taiList);
...@@ -86,28 +83,27 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo( ...@@ -86,28 +83,27 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
(Ngap_TAIListForInactiveItem_t*) calloc( (Ngap_TAIListForInactiveItem_t*) calloc(
1, sizeof(Ngap_TAIListForInactiveItem_t)); 1, sizeof(Ngap_TAIListForInactiveItem_t));
if (!taiListForInactiveItem) return false; if (!taiListForInactiveItem) return false;
if (!it->encode2TAI(&taiListForInactiveItem->tAI)) return false; if (!it->encode(&taiListForInactiveItem->tAI)) return false;
if (ASN_SEQUENCE_ADD( if (ASN_SEQUENCE_ADD(
&coreNetworkAssistanceInformation->tAIListForInactive.list, &coreNetworkAssistanceInformation->tAIListForInactive.list,
taiListForInactiveItem) != 0) taiListForInactiveItem) != 0)
return false; return false;
} }
if (pagingDRX) { if (pagingDRX.has_value()) {
Ngap_PagingDRX_t* pagingdrx = Ngap_PagingDRX_t* paging_drx =
(Ngap_PagingDRX_t*) calloc(1, sizeof(Ngap_PagingDRX_t)); (Ngap_PagingDRX_t*) calloc(1, sizeof(Ngap_PagingDRX_t));
if (!pagingdrx) return false; if (!paging_drx) return false;
if (!pagingDRX->encode2DefaultPagingDRX(*pagingdrx)) return false; if (!pagingDRX.value().encode(*paging_drx)) return false;
coreNetworkAssistanceInformation->uESpecificDRX = pagingdrx; coreNetworkAssistanceInformation->uESpecificDRX = paging_drx;
} }
if (micoModeInd) { if (micoModeInd.has_value()) {
Ngap_MICOModeIndication_t* micomodeindication = Ngap_MICOModeIndication_t* micomodeindication =
(Ngap_MICOModeIndication_t*) calloc( (Ngap_MICOModeIndication_t*) calloc(
1, sizeof(Ngap_MICOModeIndication_t)); 1, sizeof(Ngap_MICOModeIndication_t));
if (!micomodeindication) return false; if (!micomodeindication) return false;
if (!micoModeInd->encode2MICOModeIndication(micomodeindication)) if (!micoModeInd.value().encode(micomodeindication)) return false;
return false;
coreNetworkAssistanceInformation->mICOModeIndication = micomodeindication; coreNetworkAssistanceInformation->mICOModeIndication = micomodeindication;
} }
...@@ -115,21 +111,21 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo( ...@@ -115,21 +111,21 @@ bool CoreNetworkAssistanceInfo::encode2CoreNetworkAssistanceInfo(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo( bool CoreNetworkAssistanceInfo::decode(
Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) { Ngap_CoreNetworkAssistanceInformation_t* coreNetworkAssistanceInformation) {
if (!ueIdentityIndexValue.decodefromUEIdentityIndexValue( if (!ueIdentityIndexValue.decode(
&coreNetworkAssistanceInformation->uEIdentityIndexValue)) coreNetworkAssistanceInformation->uEIdentityIndexValue))
return false; return false;
if (!periodicRegUpdateTimer.decodefromPeriodicRegistrationUpdateTimer( if (!periodicRegUpdateTimer.decode(
&coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer)) coreNetworkAssistanceInformation->periodicRegistrationUpdateTimer))
return false; return false;
for (int i = 0; for (int i = 0;
i < coreNetworkAssistanceInformation->tAIListForInactive.list.count; i < coreNetworkAssistanceInformation->tAIListForInactive.list.count;
i++) { i++) {
TAI tai_item = {}; TAI tai_item = {};
if (!tai_item.decodefromTAI( if (!tai_item.decode(
&coreNetworkAssistanceInformation->tAIListForInactive.list.array[i] &coreNetworkAssistanceInformation->tAIListForInactive.list.array[i]
->tAI)) ->tAI))
return false; return false;
...@@ -137,17 +133,17 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo( ...@@ -137,17 +133,17 @@ bool CoreNetworkAssistanceInfo::decodefromCoreNetworkAssistanceInfo(
} }
if (coreNetworkAssistanceInformation->uESpecificDRX) { if (coreNetworkAssistanceInformation->uESpecificDRX) {
if (pagingDRX == nullptr) pagingDRX = new DefaultPagingDRX(); DefaultPagingDRX tmp = {};
if (!pagingDRX->decodefromDefaultPagingDRX( if (!tmp.decode(*(coreNetworkAssistanceInformation->uESpecificDRX)))
*(coreNetworkAssistanceInformation->uESpecificDRX)))
return false; return false;
pagingDRX = std::optional<DefaultPagingDRX>(tmp);
} }
if (coreNetworkAssistanceInformation->mICOModeIndication) { if (coreNetworkAssistanceInformation->mICOModeIndication) {
if (micoModeInd == nullptr) micoModeInd = new MICOModeIndication(); MICOModeIndication tmp = {};
if (!micoModeInd->decodefromMICOModeIndication( if (!tmp.decode(coreNetworkAssistanceInformation->mICOModeIndication))
coreNetworkAssistanceInformation->mICOModeIndication))
return false; return false;
micoModeInd = std::optional<MICOModeIndication>(tmp);
} }
return true; return true;
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "TAI.hpp" #include "TAI.hpp"
#include "UEIdentityIndexValue.hpp" #include "UEIdentityIndexValue.hpp"
#include <optional>
extern "C" { extern "C" {
#include "Ngap_CoreNetworkAssistanceInformation.h" #include "Ngap_CoreNetworkAssistanceInformation.h"
} }
...@@ -39,31 +41,29 @@ class CoreNetworkAssistanceInfo { ...@@ -39,31 +41,29 @@ class CoreNetworkAssistanceInfo {
CoreNetworkAssistanceInfo(); CoreNetworkAssistanceInfo();
virtual ~CoreNetworkAssistanceInfo(); virtual ~CoreNetworkAssistanceInfo();
void setCoreNetworkAssistanceInfo( void set(
const UEIdentityIndexValue& m_ueIdentityIndexValue, const UEIdentityIndexValue& ue_identity_index_value,
DefaultPagingDRX* m_pagingDRX, const DefaultPagingDRX& paging_drx,
const PeriodicRegistrationUpdateTimer& m_periodicRegUpdateTimer, const PeriodicRegistrationUpdateTimer& periodic_reg_update_timer,
const bool& m_micoModeInd, const std::vector<TAI>& m_tai); const bool& mico_mode_ind, const std::vector<TAI>& tai);
void getCoreNetworkAssistanceInfo( void get(
UEIdentityIndexValue& m_ueIdentityIndexValue, UEIdentityIndexValue& ue_identity_index_value,
DefaultPagingDRX*& m_pagingDRX, std::optional<DefaultPagingDRX>& paging_drx,
PeriodicRegistrationUpdateTimer& m_periodicRegUpdateTimer, PeriodicRegistrationUpdateTimer& periodic_reg_update_timer,
bool& m_micoModeInd, std::vector<TAI>& m_tai); bool& mico_mode_ind, std::vector<TAI>& tai);
bool encode2CoreNetworkAssistanceInfo(Ngap_CoreNetworkAssistanceInformation_t* bool encode(Ngap_CoreNetworkAssistanceInformation_t*
coreNetworkAssistanceInformation); core_network_assistance_information);
bool decodefromCoreNetworkAssistanceInfo( bool decode(Ngap_CoreNetworkAssistanceInformation_t*
Ngap_CoreNetworkAssistanceInformation_t* core_network_assistance_information);
coreNetworkAssistanceInformation);
private: private:
UEIdentityIndexValue ueIdentityIndexValue; // Mandatory UEIdentityIndexValue ueIdentityIndexValue; // Mandatory
DefaultPagingDRX* pagingDRX; // UE Specific DRX, Optional std::optional<DefaultPagingDRX> pagingDRX; // UE Specific DRX, Optional
PeriodicRegistrationUpdateTimer periodicRegUpdateTimer; // Mandatory PeriodicRegistrationUpdateTimer periodicRegUpdateTimer; // Mandatory
MICOModeIndication* micoModeInd; // Optional std::optional<MICOModeIndication> micoModeInd; // Optional
std::vector<TAI> taiList; // Mandatory std::vector<TAI> taiList; // TAI List for RRC Inactive, Mandatory
// int numoftai;
// TODO: Expected UE Behaviour (Optional) // TODO: Expected UE Behaviour (Optional)
}; };
......
...@@ -121,7 +121,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) { ...@@ -121,7 +121,7 @@ int CriticalityDiagnostics::encode2pdu(Ngap_NGSetupFailure_t* ngSetupFailure) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool CriticalityDiagnostics::decodefrompdu(Ngap_CriticalityDiagnostics_t* pdu) { bool CriticalityDiagnostics::decodeFromPdu(Ngap_CriticalityDiagnostics_t* pdu) {
// timeValue = *pdu; // timeValue = *pdu;
if (pdu->procedureCode) { if (pdu->procedureCode) {
procedureCodeIsSet = true; procedureCodeIsSet = true;
...@@ -141,7 +141,7 @@ bool CriticalityDiagnostics::decodefrompdu(Ngap_CriticalityDiagnostics_t* pdu) { ...@@ -141,7 +141,7 @@ bool CriticalityDiagnostics::decodefrompdu(Ngap_CriticalityDiagnostics_t* pdu) {
iEsCriticalityDiagnostics = iEsCriticalityDiagnostics =
new IEsCriticalityDiagnostics[numberOfIEsCriticalityDiagnostics](); new IEsCriticalityDiagnostics[numberOfIEsCriticalityDiagnostics]();
for (int i = 0; i < numberOfIEsCriticalityDiagnostics; i++) { for (int i = 0; i < numberOfIEsCriticalityDiagnostics; i++) {
iEsCriticalityDiagnostics[i].decodefrompdu( iEsCriticalityDiagnostics[i].decodeFromPdu(
pdu->iEsCriticalityDiagnostics->list.array[i]); pdu->iEsCriticalityDiagnostics->list.array[i]);
} }
} }
......
...@@ -39,7 +39,7 @@ class CriticalityDiagnostics { ...@@ -39,7 +39,7 @@ class CriticalityDiagnostics {
virtual ~CriticalityDiagnostics(); virtual ~CriticalityDiagnostics();
int encode2pdu(Ngap_NGSetupFailure_t*); int encode2pdu(Ngap_NGSetupFailure_t*);
bool decodefrompdu(Ngap_CriticalityDiagnostics_t*); bool decodeFromPdu(Ngap_CriticalityDiagnostics_t*);
void setProcedureCodeValue(Ngap_ProcedureCode_t); void setProcedureCodeValue(Ngap_ProcedureCode_t);
void setTriggeringMessageValue(Ngap_TriggeringMessage_t); void setTriggeringMessageValue(Ngap_TriggeringMessage_t);
void setCriticalityValue(Ngap_Criticality_t); void setCriticalityValue(Ngap_Criticality_t);
......
...@@ -28,32 +28,32 @@ namespace ngap { ...@@ -28,32 +28,32 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DefaultPagingDRX::DefaultPagingDRX() { DefaultPagingDRX::DefaultPagingDRX() {
pagingDrx = 0; paging_drx_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
DefaultPagingDRX::~DefaultPagingDRX() {} DefaultPagingDRX::~DefaultPagingDRX() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DefaultPagingDRX::setValue(e_Ngap_PagingDRX m_pagingDrx) { void DefaultPagingDRX::setValue(const e_Ngap_PagingDRX& paging_drx) {
pagingDrx = m_pagingDrx; paging_drx_ = paging_drx;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool DefaultPagingDRX::encode2DefaultPagingDRX(Ngap_PagingDRX_t& pagingdrx) { int DefaultPagingDRX::getValue() const {
pagingdrx = pagingDrx; return paging_drx_;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool DefaultPagingDRX::decodefromDefaultPagingDRX(Ngap_PagingDRX_t& pagingdrx) { bool DefaultPagingDRX::encode(Ngap_PagingDRX_t& paging_drx) {
pagingDrx = pagingdrx; paging_drx = paging_drx_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int DefaultPagingDRX::getValue() { bool DefaultPagingDRX::decode(const Ngap_PagingDRX_t& paging_drx) {
return pagingDrx; paging_drx_ = paging_drx;
return true;
} }
} // namespace ngap } // namespace ngap
...@@ -33,13 +33,13 @@ class DefaultPagingDRX { ...@@ -33,13 +33,13 @@ class DefaultPagingDRX {
DefaultPagingDRX(); DefaultPagingDRX();
virtual ~DefaultPagingDRX(); virtual ~DefaultPagingDRX();
void setValue(e_Ngap_PagingDRX m_pagingDrx); void setValue(const e_Ngap_PagingDRX& paging_drx);
int getValue(); int getValue() const;
bool encode2DefaultPagingDRX(Ngap_PagingDRX_t&); bool encode(Ngap_PagingDRX_t&);
bool decodefromDefaultPagingDRX(Ngap_PagingDRX_t&); bool decode(const Ngap_PagingDRX_t&);
private: private:
int pagingDrx; int paging_drx_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -21,51 +21,39 @@ ...@@ -21,51 +21,39 @@
#include "EUTRA-CGI.hpp" #include "EUTRA-CGI.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRA_CGI::EUTRA_CGI() { EUTRA_CGI::EUTRA_CGI() {}
plmnId = NULL;
eUTRACellIdentity = NULL;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRA_CGI::~EUTRA_CGI() {} EUTRA_CGI::~EUTRA_CGI() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void EUTRA_CGI::setEUTRA_CGI( void EUTRA_CGI::set(
PlmnId* m_plmnId, EUTRACellIdentity* m_eUTRACellIdentity) { const PlmnId& plmn_id, const EUTRACellIdentity& eUTRA_cell_identity) {
plmnId = m_plmnId; plmn_id_ = plmn_id;
eUTRACellIdentity = m_eUTRACellIdentity; eUTRA_cell_identity_ = eUTRA_cell_identity;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRA_CGI::encode2EUTRA_CGI(Ngap_EUTRA_CGI_t* eutra_cgi) { bool EUTRA_CGI::encode(Ngap_EUTRA_CGI_t& eutra_cgi) {
if (!plmnId->encode2octetstring(eutra_cgi->pLMNIdentity)) return false; if (!plmn_id_.encode(eutra_cgi.pLMNIdentity)) return false;
if (!eUTRACellIdentity->encode2bitstring(eutra_cgi->eUTRACellIdentity)) if (!eUTRA_cell_identity_.encode(eutra_cgi.eUTRACellIdentity)) return false;
return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRA_CGI::decodefromEUTRA_CGI(Ngap_EUTRA_CGI_t* eutra_cgi) { bool EUTRA_CGI::decode(Ngap_EUTRA_CGI_t& eutra_cgi) {
if (plmnId == nullptr) plmnId = new PlmnId(); if (!plmn_id_.decode(eutra_cgi.pLMNIdentity)) return false;
if (eUTRACellIdentity == nullptr) eUTRACellIdentity = new EUTRACellIdentity(); if (!eUTRA_cell_identity_.decode(eutra_cgi.eUTRACellIdentity)) return false;
if (!plmnId->decodefromoctetstring(eutra_cgi->pLMNIdentity)) return false;
if (!eUTRACellIdentity->decodefrombitstring(eutra_cgi->eUTRACellIdentity))
return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void EUTRA_CGI::getEUTRA_CGI( void EUTRA_CGI::get(PlmnId& plmn_id, EUTRACellIdentity& eUTRA_cell_identity) {
PlmnId*& m_plmnId, EUTRACellIdentity*& m_eUTRACellIdentity) { plmn_id = plmn_id_;
m_plmnId = plmnId; eUTRA_cell_identity = eUTRA_cell_identity_;
m_eUTRACellIdentity = eUTRACellIdentity;
} }
} // namespace ngap } // namespace ngap
...@@ -36,14 +36,15 @@ class EUTRA_CGI { ...@@ -36,14 +36,15 @@ class EUTRA_CGI {
EUTRA_CGI(); EUTRA_CGI();
virtual ~EUTRA_CGI(); virtual ~EUTRA_CGI();
void setEUTRA_CGI(PlmnId*, EUTRACellIdentity*); void set(const PlmnId&, const EUTRACellIdentity&);
bool encode2EUTRA_CGI(Ngap_EUTRA_CGI_t*); void get(PlmnId&, EUTRACellIdentity&);
bool decodefromEUTRA_CGI(Ngap_EUTRA_CGI_t*);
void getEUTRA_CGI(PlmnId*&, EUTRACellIdentity*&); bool encode(Ngap_EUTRA_CGI_t&);
bool decode(Ngap_EUTRA_CGI_t&);
private: private:
PlmnId* plmnId; PlmnId plmn_id_; // Mandatory
EUTRACellIdentity* eUTRACellIdentity; EUTRACellIdentity eUTRA_cell_identity_; // Mandatory
}; };
} // namespace ngap } // namespace ngap
......
...@@ -28,47 +28,47 @@ namespace ngap { ...@@ -28,47 +28,47 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRACellIdentity::EUTRACellIdentity() { EUTRACellIdentity::EUTRACellIdentity() {
eutracellidentity = 0; id_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
EUTRACellIdentity::~EUTRACellIdentity() {} EUTRACellIdentity::~EUTRACellIdentity() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void EUTRACellIdentity::setEUTRACellIdentity(uint32_t m_eutracellidentity) { bool EUTRACellIdentity::set(const uint32_t& id) {
eutracellidentity = m_eutracellidentity; if (id > kEUTRACellIdentityMaxValue) return false;
id_ = id;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRACellIdentity::encode2bitstring( uint32_t EUTRACellIdentity::get() {
Ngap_EUTRACellIdentity_t& eUTRACellIdentity) { return id_;
eUTRACellIdentity.bits_unused = 4;
eUTRACellIdentity.size = 4;
eUTRACellIdentity.buf = (uint8_t*) calloc(1, sizeof(uint32_t));
if (!eUTRACellIdentity.buf) return false;
eUTRACellIdentity.buf[3] = eutracellidentity & 0x000000ff;
eUTRACellIdentity.buf[2] = (eutracellidentity & 0x0000ff00) >> 8;
eUTRACellIdentity.buf[1] = (eutracellidentity & 0x00ff0000) >> 16;
eUTRACellIdentity.buf[0] = (eutracellidentity & 0xff000000) >> 24;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool EUTRACellIdentity::decodefrombitstring( bool EUTRACellIdentity::encode(Ngap_EUTRACellIdentity_t& eUTRA_cell_identity) {
Ngap_EUTRACellIdentity_t& eUTRACellIdentity) { eUTRA_cell_identity.bits_unused = 4; // 28 = 4*8 - 4 bits
if (!eUTRACellIdentity.buf) return false; eUTRA_cell_identity.size = 4;
eUTRA_cell_identity.buf = (uint8_t*) calloc(1, sizeof(uint32_t));
eutracellidentity = eUTRACellIdentity.buf[0] << 24; if (!eUTRA_cell_identity.buf) return false;
eutracellidentity |= eUTRACellIdentity.buf[1] << 16; eUTRA_cell_identity.buf[3] = id_ & 0x000000ff;
eutracellidentity |= eUTRACellIdentity.buf[2] << 8; eUTRA_cell_identity.buf[2] = (id_ & 0x0000ff00) >> 8;
eutracellidentity |= eUTRACellIdentity.buf[3]; eUTRA_cell_identity.buf[1] = (id_ & 0x00ff0000) >> 16;
eUTRA_cell_identity.buf[0] = (id_ & 0xff000000) >> 24;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t EUTRACellIdentity::getEUTRACellIdentity() { bool EUTRACellIdentity::decode(Ngap_EUTRACellIdentity_t& eUTRA_cell_identity) {
return eutracellidentity; if (!eUTRA_cell_identity.buf) return false;
id_ = eUTRA_cell_identity.buf[0] << 24;
id_ |= eUTRA_cell_identity.buf[1] << 16;
id_ |= eUTRA_cell_identity.buf[2] << 8;
id_ |= eUTRA_cell_identity.buf[3];
return true;
} }
} // namespace ngap } // namespace ngap
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#ifndef _EUTRACellIdentity_H_ #ifndef _EUTRACellIdentity_H_
#define _EUTRACellIdentity_H_ #define _EUTRACellIdentity_H_
#include <cstdint>
constexpr uint32_t kEUTRACellIdentityMaxValue = 268435455; // 2^28-1
extern "C" { extern "C" {
#include "Ngap_EUTRACellIdentity.h" #include "Ngap_EUTRACellIdentity.h"
...@@ -33,13 +36,13 @@ class EUTRACellIdentity { ...@@ -33,13 +36,13 @@ class EUTRACellIdentity {
EUTRACellIdentity(); EUTRACellIdentity();
virtual ~EUTRACellIdentity(); virtual ~EUTRACellIdentity();
bool encode2bitstring(Ngap_EUTRACellIdentity_t& eUTRACellIdentity); bool encode(Ngap_EUTRACellIdentity_t& eUTRACellIdentity);
bool decodefrombitstring(Ngap_EUTRACellIdentity_t& eUTRACellIdentity); bool decode(Ngap_EUTRACellIdentity_t& eUTRACellIdentity);
uint32_t getEUTRACellIdentity(); uint32_t get();
void setEUTRACellIdentity(uint32_t m_eutracellidentity); bool set(const uint32_t& m_eutracellidentity);
private: private:
uint32_t eutracellidentity; uint32_t id_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -31,47 +31,48 @@ FiveGSTmsi::FiveGSTmsi() {} ...@@ -31,47 +31,48 @@ FiveGSTmsi::FiveGSTmsi() {}
FiveGSTmsi::~FiveGSTmsi() {} FiveGSTmsi::~FiveGSTmsi() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool FiveGSTmsi::decodefrompdu(Ngap_FiveG_S_TMSI_t pdu) { bool FiveGSTmsi::decodeFromPdu(Ngap_FiveG_S_TMSI_t pdu) {
amfSetid.decodefrombitstring(pdu.aMFSetID); amf_set_id_.decode(pdu.aMFSetID);
amfPointer.decodefrombitstring(pdu.aMFPointer); amf_pointer_.decode(pdu.aMFPointer);
uint32_t tmsi = ntohl(*(uint32_t*) pdu.fiveG_TMSI.buf); uint32_t tmsi = ntohl(*(uint32_t*) pdu.fiveG_TMSI.buf);
int size = pdu.fiveG_TMSI.size; int size = pdu.fiveG_TMSI.size;
std::string setId, pointer; std::string setId, pointer;
amfSetid.getAMFSetID(setId); amf_set_id_.get(setId);
amfPointer.getAMFPointer(pointer); amf_pointer_.get(pointer);
_5g_s_tmsi = setId + pointer + conv::tmsi_to_string(tmsi); _5g_s_tmsi_ = setId + pointer + conv::tmsi_to_string(tmsi);
tmsi_value = conv::tmsi_to_string(tmsi); tmsi_value_ = conv::tmsi_to_string(tmsi);
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void FiveGSTmsi::getValue(std::string& tmsi) { void FiveGSTmsi::getTmsi(std::string& tmsi) {
tmsi = _5g_s_tmsi; tmsi = _5g_s_tmsi_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void FiveGSTmsi::getValue( void FiveGSTmsi::get(
std::string& setid, std::string& pointer, std::string& tmsi) { std::string& set_id, std::string& pointer, std::string& tmsi) {
amfSetid.getAMFSetID(setid); amf_set_id_.get(set_id);
amfPointer.getAMFPointer(pointer); amf_pointer_.get(pointer);
tmsi = tmsi_value; tmsi = tmsi_value_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void FiveGSTmsi::setValue( bool FiveGSTmsi::set(
const std::string& setId, const std::string& pointer, const std::string& set_id, const std::string& pointer,
const std::string& tmsi) { const std::string& tmsi) {
amfSetid.setAMFSetID(setId); if (!amf_set_id_.set(set_id)) return false;
amfPointer.setAMFPointer(pointer); if (!amf_pointer_.set(pointer)) return false;
_5g_s_tmsi = tmsi; _5g_s_tmsi_ = tmsi;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool FiveGSTmsi::encode2pdu(Ngap_FiveG_S_TMSI_t* pdu) { bool FiveGSTmsi::encode2pdu(Ngap_FiveG_S_TMSI_t* pdu) {
amfSetid.encode2bitstring(pdu->aMFSetID); amf_set_id_.encode(pdu->aMFSetID);
amfPointer.encode2bitstring(pdu->aMFPointer); amf_pointer_.encode(pdu->aMFPointer);
uint32_t tmsi = (uint32_t) std::stol(_5g_s_tmsi); uint32_t tmsi = (uint32_t) std::stol(_5g_s_tmsi_);
uint8_t* buf = (uint8_t*) malloc(sizeof(uint32_t)); uint8_t* buf = (uint8_t*) malloc(sizeof(uint32_t));
*(uint32_t*) buf = htonl(tmsi); *(uint32_t*) buf = htonl(tmsi);
pdu->fiveG_TMSI.buf = buf; pdu->fiveG_TMSI.buf = buf;
......
...@@ -38,20 +38,20 @@ class FiveGSTmsi { ...@@ -38,20 +38,20 @@ class FiveGSTmsi {
~FiveGSTmsi(); ~FiveGSTmsi();
public: public:
bool decodefrompdu(Ngap_FiveG_S_TMSI_t pdu); bool decodeFromPdu(Ngap_FiveG_S_TMSI_t pdu);
void getValue(std::string& value); void getTmsi(std::string& value);
void getValue(std::string& setId, std::string& pointer, std::string& tmsi); void get(std::string& setId, std::string& pointer, std::string& tmsi);
void setValue( bool set(
const std::string& setId, const std::string& pointer, const std::string& setId, const std::string& pointer,
const std::string& tmsi); const std::string& tmsi);
bool encode2pdu(Ngap_FiveG_S_TMSI_t* pdu); bool encode2pdu(Ngap_FiveG_S_TMSI_t* pdu);
private: private:
std::string _5g_s_tmsi; std::string _5g_s_tmsi_;
std::string tmsi_value; std::string tmsi_value_;
AMFSetID amfSetid; AMFSetID amf_set_id_;
AMFPointer amfPointer; AMFPointer amf_pointer_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -21,77 +21,96 @@ ...@@ -21,77 +21,96 @@
#include "GNB-ID.hpp" #include "GNB-ID.hpp"
#include <iostream> #include "logger.hpp"
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GNB_ID::GNB_ID() { GNB_ID::GNB_ID() {
gNBId = {}; gnb_id_ = std::nullopt;
present_ = Ngap_GNB_ID_PR_NOTHING;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GNB_ID::~GNB_ID() {} GNB_ID::~GNB_ID() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GNB_ID::setValue(uint32_t gnbId) { void GNB_ID::setValue(const gNBId_t& gnb_id) {
gNBId.id = gnbId; gnb_id_ = std::optional<gNBId_t>(gnb_id);
uint8_t len = 0; present_ = Ngap_GNB_ID_PR_gNB_ID;
for (uint32_t i = 0x00000001; i <= 0x00000400; i = i << 1, len++) { }
if ((i & gnbId)) {
gNBId.bit_length = 32 - len; //------------------------------------------------------------------------------
break; bool GNB_ID::setValue(const uint32_t& id, const uint8_t& bit_length) {
} if (!((bit_length >= NGAP_GNB_ID_SIZE_MIN) &&
} (bit_length <= NGAP_GNB_ID_SIZE_MAX))) {
if (!((gNBId.bit_length >= 22) && (gNBId.bit_length <= 32))) { Logger::ngap().warn("gNBID length out of range!");
cout << "[warning][gNBID length out of range]" << endl; return false;
} }
gNBId_t tmp = {};
tmp.id = id;
tmp.bit_length = bit_length;
gnb_id_ = std::optional<gNBId_t>(tmp);
present_ = Ngap_GNB_ID_PR_gNB_ID;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GNB_ID::setValue(uint32_t id, uint8_t bit_length) { bool GNB_ID::get(gNBId_t& gnb_id) const {
gNBId.id = id; if (gnb_id_.has_value()) {
gNBId.bit_length = bit_length; gnb_id = gnb_id_.value();
return true;
}
return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GNB_ID::encode2bitstring(Ngap_GNB_ID_t& gnbid) { bool GNB_ID::get(uint32_t& id) const {
gnbid.present = Ngap_GNB_ID_PR_gNB_ID; if (gnb_id_.has_value()) {
id = gnb_id_.value().id;
return true;
}
return false;
}
if (!(gNBId.bit_length % 8)) //------------------------------------------------------------------------------
gnbid.choice.gNB_ID.size = gNBId.bit_length / 8; bool GNB_ID::encode(Ngap_GNB_ID_t& gnbid) {
else if (!gnb_id_.has_value()) {
gnbid.choice.gNB_ID.size = gNBId.bit_length / 8 + 1; gnbid.present = Ngap_GNB_ID_PR_NOTHING;
return true;
}
// printf("m_gNBId.size(%d)\n",m_gNBId.size); gnbid.present = Ngap_GNB_ID_PR_gNB_ID;
gnbid.choice.gNB_ID.bits_unused = 32 - gNBId.bit_length; gnbid.choice.gNB_ID.size = 4; // TODO: to be vefified
gnbid.choice.gNB_ID.bits_unused = 32 - gnb_id_.value().bit_length;
gnbid.choice.gNB_ID.buf = (uint8_t*) calloc(1, 4 * sizeof(uint8_t)); gnbid.choice.gNB_ID.buf = (uint8_t*) calloc(1, 4 * sizeof(uint8_t));
if (!gnbid.choice.gNB_ID.buf) return false; if (!gnbid.choice.gNB_ID.buf) return false;
gnbid.choice.gNB_ID.buf[3] = gNBId.id & 0x000000ff; gnbid.choice.gNB_ID.buf[3] = gnb_id_.value().id & 0x000000ff;
gnbid.choice.gNB_ID.buf[2] = (gNBId.id & 0x0000ff00) >> 8; gnbid.choice.gNB_ID.buf[2] = (gnb_id_.value().id & 0x0000ff00) >> 8;
gnbid.choice.gNB_ID.buf[1] = (gNBId.id & 0x00ff0000) >> 16; gnbid.choice.gNB_ID.buf[1] = (gnb_id_.value().id & 0x00ff0000) >> 16;
gnbid.choice.gNB_ID.buf[0] = (gNBId.id & 0xff000000) >> 24; gnbid.choice.gNB_ID.buf[0] = (gnb_id_.value().id & 0xff000000) >> 24;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GNB_ID::decodefrombitstring(Ngap_GNB_ID_t& gnbid) { bool GNB_ID::decode(Ngap_GNB_ID_t& gnbid) {
if (gnbid.present != Ngap_GNB_ID_PR_gNB_ID) return false; if (gnbid.present != Ngap_GNB_ID_PR_gNB_ID) return false;
if (!gnbid.choice.gNB_ID.buf) return false; if (!gnbid.choice.gNB_ID.buf) return false;
gNBId.id = gnbid.choice.gNB_ID.buf[0] << 24; gNBId_t tmp = {};
gNBId.id |= gnbid.choice.gNB_ID.buf[1] << 16; tmp.id = gnbid.choice.gNB_ID.buf[0] << 24;
gNBId.id |= gnbid.choice.gNB_ID.buf[2] << 8; tmp.id |= gnbid.choice.gNB_ID.buf[1] << 16;
gNBId.id |= gnbid.choice.gNB_ID.buf[3]; tmp.id |= gnbid.choice.gNB_ID.buf[2] << 8;
tmp.id |= gnbid.choice.gNB_ID.buf[3];
tmp.bit_length = 32 - gnbid.choice.gNB_ID.bits_unused;
return true; gnb_id_ = std::optional<gNBId_t>(tmp);
} present_ = Ngap_GNB_ID_PR_gNB_ID;
//------------------------------------------------------------------------------ return true;
long GNB_ID::getValue() {
return gNBId.id;
} }
} // namespace ngap } // namespace ngap
...@@ -22,29 +22,34 @@ ...@@ -22,29 +22,34 @@
#ifndef _GNB_ID_H_ #ifndef _GNB_ID_H_
#define _GNB_ID_H_ #define _GNB_ID_H_
#include "NgapIEsStruct.hpp"
#include <optional>
extern "C" { extern "C" {
#include "Ngap_GNB-ID.h" #include "Ngap_GNB-ID.h"
} }
namespace ngap { namespace ngap {
constexpr uint8_t NGAP_GNB_ID_SIZE_MAX = 32;
constexpr uint8_t NGAP_GNB_ID_SIZE_MIN = 22;
class GNB_ID { class GNB_ID {
public: public:
GNB_ID(); GNB_ID();
virtual ~GNB_ID(); virtual ~GNB_ID();
bool encode2bitstring(Ngap_GNB_ID_t&); bool encode(Ngap_GNB_ID_t&);
bool decodefrombitstring(Ngap_GNB_ID_t&); bool decode(Ngap_GNB_ID_t&);
void setValue(uint32_t gnbId); void setValue(const gNBId_t& gnb_id);
long getValue(); bool setValue(const uint32_t& id, const uint8_t& bit_length);
// long getValue() const;
void setValue(uint32_t id, uint8_t bit_length); bool get(gNBId_t& gnb_id) const;
bool get(uint32_t& id) const;
private: private:
struct gNBId_s { std::optional<gNBId_t> gnb_id_; // 22bits to 32bits
uint32_t id; Ngap_GNB_ID_PR present_;
uint8_t bit_length;
} gNBId; // 22bits to 32bits
}; };
} // namespace ngap } // namespace ngap
......
...@@ -43,41 +43,43 @@ void GUAMI::setGUAMI( ...@@ -43,41 +43,43 @@ void GUAMI::setGUAMI(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GUAMI::setGUAMI( bool GUAMI::setGUAMI(
const std::string& mcc, const std::string& mnc, const uint8_t& regionId, const std::string& mcc, const std::string& mnc, const uint8_t& regionId,
const uint16_t& setId, const uint8_t& pointer) { const uint16_t& setId, const uint8_t& pointer) {
plmnId.setMccMnc(mcc, mnc); plmnId.set(mcc, mnc);
aMFRegionID.setAMFRegionID(regionId); aMFRegionID.setAMFRegionID(regionId);
aMFSetID.setAMFSetID(setId); if (!aMFSetID.set(setId)) return false;
aMFPointer.setAMFPointer(pointer); if (!aMFPointer.set(pointer)) return false;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GUAMI::setGUAMI( bool GUAMI::setGUAMI(
const std::string& mcc, const std::string& mnc, const std::string& regionId, const std::string& mcc, const std::string& mnc, const std::string& regionId,
const std::string& setId, const std::string& pointer) { const std::string& setId, const std::string& pointer) {
plmnId.setMccMnc(mcc, mnc); plmnId.set(mcc, mnc);
aMFRegionID.setAMFRegionID(regionId); aMFRegionID.setAMFRegionID(regionId);
aMFSetID.setAMFSetID(setId); if (!aMFSetID.set(setId)) return false;
aMFPointer.setAMFPointer(pointer); if (!aMFPointer.set(pointer)) return false;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GUAMI::encode2GUAMI(Ngap_GUAMI_t* guami) { bool GUAMI::encode2GUAMI(Ngap_GUAMI_t* guami) {
if (!plmnId.encode2octetstring(guami->pLMNIdentity)) return false; if (!plmnId.encode(guami->pLMNIdentity)) return false;
if (!aMFRegionID.encode2bitstring(guami->aMFRegionID)) return false; if (!aMFRegionID.encode(guami->aMFRegionID)) return false;
if (!aMFSetID.encode2bitstring(guami->aMFSetID)) return false; if (!aMFSetID.encode(guami->aMFSetID)) return false;
if (!aMFPointer.encode2bitstring(guami->aMFPointer)) return false; if (!aMFPointer.encode(guami->aMFPointer)) return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GUAMI::decodefromGUAMI(Ngap_GUAMI_t* pdu) { bool GUAMI::decodefromGUAMI(Ngap_GUAMI_t* pdu) {
if (!plmnId.decodefromoctetstring(pdu->pLMNIdentity)) return false; if (!plmnId.decode(pdu->pLMNIdentity)) return false;
if (!aMFRegionID.decodefrombitstring(pdu->aMFRegionID)) return false; if (!aMFRegionID.decode(pdu->aMFRegionID)) return false;
if (!aMFSetID.decodefrombitstring(pdu->aMFSetID)) return false; if (!aMFSetID.decode(pdu->aMFSetID)) return false;
if (!aMFPointer.decodefrombitstring(pdu->aMFPointer)) return false; if (!aMFPointer.decode(pdu->aMFPointer)) return false;
return true; return true;
} }
...@@ -98,8 +100,8 @@ void GUAMI::getGUAMI( ...@@ -98,8 +100,8 @@ void GUAMI::getGUAMI(
plmnId.getMcc(mcc); plmnId.getMcc(mcc);
plmnId.getMnc(mnc); plmnId.getMnc(mnc);
aMFRegionID.getAMFRegionID(regionId); aMFRegionID.getAMFRegionID(regionId);
aMFSetID.getAMFSetID(setId); aMFSetID.get(setId);
aMFPointer.getAMFPointer(pointer); aMFPointer.get(pointer);
} }
} // namespace ngap } // namespace ngap
...@@ -41,11 +41,11 @@ class GUAMI { ...@@ -41,11 +41,11 @@ class GUAMI {
void setGUAMI( void setGUAMI(
const PlmnId& m_plmnId, const AMFRegionID& m_aMFRegionID, const PlmnId& m_plmnId, const AMFRegionID& m_aMFRegionID,
const AMFSetID& m_aMFSetID, const AMFPointer& m_aMFPointer); const AMFSetID& m_aMFSetID, const AMFPointer& m_aMFPointer);
void setGUAMI( bool setGUAMI(
const std::string& mcc, const std::string& mnc, const uint8_t& regionId, const std::string& mcc, const std::string& mnc, const uint8_t& regionId,
const uint16_t& setId, const uint8_t& pointer); const uint16_t& setId, const uint8_t& pointer);
void setGUAMI( bool setGUAMI(
const std::string& mcc, const std::string& mnc, const std::string& mcc, const std::string& mnc,
const std::string& regionId, const std::string& setId, const std::string& regionId, const std::string& setId,
const std::string& pointer); const std::string& pointer);
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "GlobalNgENBId.hpp"
namespace ngap {
//------------------------------------------------------------------------------
GlobalNgENBId::GlobalNgENBId() {}
//------------------------------------------------------------------------------
GlobalNgENBId::~GlobalNgENBId() {}
//------------------------------------------------------------------------------
void GlobalNgENBId::set(const PlmnId& plmn_id, const NgENB_ID& ng_enb_id) {
plmn_id_ = plmn_id;
ng_enb_id_ = ng_enb_id;
}
//------------------------------------------------------------------------------
void GlobalNgENBId::get(PlmnId& plmn_id, NgENB_ID& ng_enb_id) const {
plmn_id = plmn_id_;
ng_enb_id = ng_enb_id_;
}
//------------------------------------------------------------------------------
bool GlobalNgENBId::encode(Ngap_GlobalNgENB_ID_t& global_ng_enb_id) {
if (!plmn_id_.encode(global_ng_enb_id.pLMNIdentity)) return false;
if (!ng_enb_id_.encode(global_ng_enb_id.ngENB_ID)) return false;
return true;
}
//------------------------------------------------------------------------------
bool GlobalNgENBId::decode(Ngap_GlobalNgENB_ID_t& global_ng_enb_id) {
if (!plmn_id_.decode(global_ng_enb_id.pLMNIdentity)) return false;
if (!ng_enb_id_.decode(global_ng_enb_id.ngENB_ID)) return false;
return true;
}
} // namespace ngap
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _GLOBAL_NG_ENB_ID_H
#define _GLOBAL_NG_ENB_ID_H
#include "NgENBId.hpp"
#include "PlmnId.hpp"
extern "C" {
#include "Ngap_GlobalNgENB-ID.h"
}
namespace ngap {
class GlobalNgENBId {
public:
GlobalNgENBId();
virtual ~GlobalNgENBId();
bool encode(Ngap_GlobalNgENB_ID_t&);
bool decode(Ngap_GlobalNgENB_ID_t&);
void set(const PlmnId& plmn, const NgENB_ID& ng_enb_id);
void get(PlmnId& plmn, NgENB_ID& ng_enb_id) const;
private:
PlmnId plmn_id_; // Mandatory
NgENB_ID ng_enb_id_; // Mandatory
};
} // namespace ngap
#endif
...@@ -25,50 +25,75 @@ ...@@ -25,50 +25,75 @@
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GlobalRanNodeId::GlobalRanNodeId() {} GlobalRanNodeId::GlobalRanNodeId() {
global_gnb_id_ = std::nullopt;
global_ng_enb_id_ = std::nullopt;
id_present_ = Ngap_GlobalRANNodeID_PR_NOTHING;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GlobalRanNodeId::~GlobalRanNodeId() {} GlobalRanNodeId::~GlobalRanNodeId() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GlobalRanNodeId::setChoiceOfRanNodeId( void GlobalRanNodeId::setChoiceOfRanNodeId(
const Ngap_GlobalRANNodeID_PR& m_idPresent) { const Ngap_GlobalRANNodeID_PR& id_present) {
idPresent = m_idPresent; id_present_ = id_present;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
Ngap_GlobalRANNodeID_PR GlobalRanNodeId::getChoiceOfRanNodeId() { Ngap_GlobalRANNodeID_PR GlobalRanNodeId::getChoiceOfRanNodeId() {
return idPresent; return id_present_;
}
//------------------------------------------------------------------------------
void GlobalRanNodeId::set(const GlobalgNBId& global_gnb_id) {
global_gnb_id_ = std::optional<GlobalgNBId>{global_gnb_id};
id_present_ = Ngap_GlobalRANNodeID_PR_globalGNB_ID;
}
//------------------------------------------------------------------------------
void GlobalRanNodeId::set(const GlobalNgENBId& global_ng_enb_id) {
global_ng_enb_id_ = std::optional<GlobalNgENBId>{global_ng_enb_id};
id_present_ = Ngap_GlobalRANNodeID_PR_globalNgENB_ID;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GlobalRanNodeId::setGlobalgNBID(const GlobalgNBId& m_globalgNBId) { bool GlobalRanNodeId::get(GlobalgNBId& global_gnb_id) const {
globalgNBId = m_globalgNBId; if (global_gnb_id_.has_value()) {
global_gnb_id = global_gnb_id_.value();
return true;
}
return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GlobalRanNodeId::getGlobalgNBID(GlobalgNBId& id) { bool GlobalRanNodeId::get(GlobalNgENBId& global_ng_enb_id) const {
id = globalgNBId; if (global_ng_enb_id_.has_value()) {
global_ng_enb_id = global_ng_enb_id_.value();
return true;
}
return false;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GlobalRanNodeId::encode2GlobalRANNodeID( bool GlobalRanNodeId::encode(Ngap_GlobalRANNodeID_t* globalRANNodeID) {
Ngap_GlobalRANNodeID_t* globalRANNodeID) { globalRANNodeID->present = id_present_;
globalRANNodeID->present = idPresent;
switch (idPresent) { switch (id_present_) {
case Ngap_GlobalRANNodeID_PR_globalGNB_ID: { case Ngap_GlobalRANNodeID_PR_globalGNB_ID: {
Ngap_GlobalGNB_ID_t* globalGNB_ID = globalRANNodeID->choice.globalGNB_ID =
(Ngap_GlobalGNB_ID_t*) calloc(1, sizeof(struct Ngap_GlobalGNB_ID)); (Ngap_GlobalGNB_ID_t*) calloc(1, sizeof(struct Ngap_GlobalGNB_ID));
if (!globalGNB_ID) return false; if (!globalRANNodeID->choice.globalGNB_ID) return false;
if (!globalgNBId.encode2GlobalgNBId(globalGNB_ID)) return false; if (!global_gnb_id_.value().encode(globalRANNodeID->choice.globalGNB_ID))
globalRANNodeID->choice.globalGNB_ID = globalGNB_ID; return false;
break; break;
} }
case Ngap_GlobalRANNodeID_PR_globalNgENB_ID: { case Ngap_GlobalRANNodeID_PR_globalNgENB_ID: {
// TODO:
break; break;
} }
case Ngap_GlobalRANNodeID_PR_globalN3IWF_ID: { case Ngap_GlobalRANNodeID_PR_globalN3IWF_ID: {
// TODO:
break; break;
} }
default: default:
...@@ -79,21 +104,23 @@ bool GlobalRanNodeId::encode2GlobalRANNodeID( ...@@ -79,21 +104,23 @@ bool GlobalRanNodeId::encode2GlobalRANNodeID(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GlobalRanNodeId::decodefromGlobalRANNodeID( bool GlobalRanNodeId::decode(Ngap_GlobalRANNodeID_t* globalRANNodeID) {
Ngap_GlobalRANNodeID_t* globalRANNodeID) { id_present_ = globalRANNodeID->present;
idPresent = globalRANNodeID->present;
switch (idPresent) { switch (id_present_) {
case Ngap_GlobalRANNodeID_PR_globalGNB_ID: { case Ngap_GlobalRANNodeID_PR_globalGNB_ID: {
if (!globalgNBId.decodefromGlobalgNBId( GlobalgNBId tmp = {};
globalRANNodeID->choice.globalGNB_ID)) if (!tmp.decode(globalRANNodeID->choice.globalGNB_ID)) return false;
return false; global_gnb_id_ = std::optional<GlobalgNBId>(tmp);
break; break;
} }
case Ngap_GlobalRANNodeID_PR_globalNgENB_ID: { case Ngap_GlobalRANNodeID_PR_globalNgENB_ID: {
// TODO:
Logger::ngap().warn("GlobalRANNodeID Present is globalNgENB!"); Logger::ngap().warn("GlobalRANNodeID Present is globalNgENB!");
break; break;
} }
case Ngap_GlobalRANNodeID_PR_globalN3IWF_ID: { case Ngap_GlobalRANNodeID_PR_globalN3IWF_ID: {
// TODO:
Logger::ngap().warn("GlobalRANNodeID Present is globalN3IWF!"); Logger::ngap().warn("GlobalRANNodeID Present is globalN3IWF!");
break; break;
} }
......
...@@ -27,6 +27,9 @@ extern "C" { ...@@ -27,6 +27,9 @@ extern "C" {
} }
#include "GlobalgNBId.hpp" #include "GlobalgNBId.hpp"
#include "GlobalNgENBId.hpp"
#include <optional>
namespace ngap { namespace ngap {
...@@ -35,18 +38,23 @@ class GlobalRanNodeId { ...@@ -35,18 +38,23 @@ class GlobalRanNodeId {
GlobalRanNodeId(); GlobalRanNodeId();
virtual ~GlobalRanNodeId(); virtual ~GlobalRanNodeId();
void setChoiceOfRanNodeId(const Ngap_GlobalRANNodeID_PR& m_idPresent); void set(const GlobalgNBId& global_gnb_id);
Ngap_GlobalRANNodeID_PR getChoiceOfRanNodeId(); void set(const GlobalNgENBId& global_ng_enb_id);
void setGlobalgNBID(const GlobalgNBId&); bool get(GlobalgNBId& global_gnb_id) const;
void getGlobalgNBID(GlobalgNBId&); bool get(GlobalNgENBId& global_ng_enb_id) const;
void setChoiceOfRanNodeId(const Ngap_GlobalRANNodeID_PR& id_present);
Ngap_GlobalRANNodeID_PR getChoiceOfRanNodeId();
bool encode2GlobalRANNodeID(Ngap_GlobalRANNodeID_t*); bool encode(Ngap_GlobalRANNodeID_t*);
bool decodefromGlobalRANNodeID(Ngap_GlobalRANNodeID_t*); bool decode(Ngap_GlobalRANNodeID_t*);
private: private:
GlobalgNBId globalgNBId; // Mandatory std::optional<GlobalgNBId> global_gnb_id_;
Ngap_GlobalRANNodeID_PR idPresent; std::optional<GlobalNgENBId> global_ng_enb_id_;
// TODO: Global N3IWF ID
Ngap_GlobalRANNodeID_PR id_present_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -24,36 +24,39 @@ ...@@ -24,36 +24,39 @@
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GlobalgNBId::GlobalgNBId() {} GlobalgNBId::GlobalgNBId() {
plmnId = {};
gNB_ID = {};
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
GlobalgNBId::~GlobalgNBId() {} GlobalgNBId::~GlobalgNBId() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GlobalgNBId::setGlobalgNBId(const PlmnId& plmn, const GNB_ID& gnbid) { void GlobalgNBId::set(const PlmnId& plmn, const GNB_ID& gnbid) {
plmnId = plmn; plmnId = plmn;
gNB_ID = gnbid; gNB_ID = gnbid;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GlobalgNBId::encode2GlobalgNBId(Ngap_GlobalGNB_ID_t* globalgnbid) { void GlobalgNBId::get(PlmnId& plmn, GNB_ID& gnbid) {
if (!plmnId.encode2octetstring(globalgnbid->pLMNIdentity)) return false; plmn = plmnId;
if (!gNB_ID.encode2bitstring(globalgnbid->gNB_ID)) return false; gnbid = gNB_ID;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool GlobalgNBId::decodefromGlobalgNBId(Ngap_GlobalGNB_ID_t* globalgnbid) { bool GlobalgNBId::encode(Ngap_GlobalGNB_ID_t* globalgnbid) {
if (!plmnId.decodefromoctetstring(globalgnbid->pLMNIdentity)) return false; if (!plmnId.encode(globalgnbid->pLMNIdentity)) return false;
if (!gNB_ID.decodefrombitstring(globalgnbid->gNB_ID)) return false; if (!gNB_ID.encode(globalgnbid->gNB_ID)) return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void GlobalgNBId::getGlobalgNBId(PlmnId& plmn, GNB_ID& gnbid) { bool GlobalgNBId::decode(Ngap_GlobalGNB_ID_t* globalgnbid) {
plmn = plmnId; if (!plmnId.decode(globalgnbid->pLMNIdentity)) return false;
gnbid = gNB_ID; if (!gNB_ID.decode(globalgnbid->gNB_ID)) return false;
return true;
} }
} // namespace ngap } // namespace ngap
...@@ -36,11 +36,11 @@ class GlobalgNBId { ...@@ -36,11 +36,11 @@ class GlobalgNBId {
GlobalgNBId(); GlobalgNBId();
virtual ~GlobalgNBId(); virtual ~GlobalgNBId();
bool encode2GlobalgNBId(Ngap_GlobalGNB_ID_t*); bool encode(Ngap_GlobalGNB_ID_t*);
bool decodefromGlobalgNBId(Ngap_GlobalGNB_ID_t*); bool decode(Ngap_GlobalGNB_ID_t*);
void setGlobalgNBId(const PlmnId& plmn, const GNB_ID& gnbid); void set(const PlmnId& plmn, const GNB_ID& gnbid);
void getGlobalgNBId(PlmnId& plmn, GNB_ID& gnbid); void get(PlmnId& plmn, GNB_ID& gnbid);
private: private:
PlmnId plmnId; // Mandatory PlmnId plmnId; // Mandatory
......
...@@ -58,7 +58,7 @@ void IEsCriticalityDiagnostics::encode2pdu( ...@@ -58,7 +58,7 @@ void IEsCriticalityDiagnostics::encode2pdu(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IEsCriticalityDiagnostics::decodefrompdu( void IEsCriticalityDiagnostics::decodeFromPdu(
Ngap_CriticalityDiagnostics_IE_Item_t* pdu) { Ngap_CriticalityDiagnostics_IE_Item_t* pdu) {
criticality = pdu->iECriticality; criticality = pdu->iECriticality;
protocolIE_ID = pdu->iE_ID; protocolIE_ID = pdu->iE_ID;
......
...@@ -34,7 +34,7 @@ class IEsCriticalityDiagnostics { ...@@ -34,7 +34,7 @@ class IEsCriticalityDiagnostics {
virtual ~IEsCriticalityDiagnostics(); virtual ~IEsCriticalityDiagnostics();
void encode2pdu(Ngap_CriticalityDiagnostics_IE_Item_t*); void encode2pdu(Ngap_CriticalityDiagnostics_IE_Item_t*);
void decodefrompdu(Ngap_CriticalityDiagnostics_IE_Item_t*); void decodeFromPdu(Ngap_CriticalityDiagnostics_IE_Item_t*);
void setIeCriticality(Ngap_Criticality_t); void setIeCriticality(Ngap_Criticality_t);
void setIeId(Ngap_ProtocolIE_ID_t); void setIeId(Ngap_ProtocolIE_ID_t);
void setTypeOfError(Ngap_TypeOfError_t); void setTypeOfError(Ngap_TypeOfError_t);
......
...@@ -28,31 +28,32 @@ namespace ngap { ...@@ -28,31 +28,32 @@ namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
IndexToRFSP::IndexToRFSP() { IndexToRFSP::IndexToRFSP() {
indexToRFSP = 0; index_ = 0;
} }
//------------------------------------------------------------------------------
IndexToRFSP::IndexToRFSP(const uint32_t& index) : index_(index) {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
IndexToRFSP::~IndexToRFSP() {} IndexToRFSP::~IndexToRFSP() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void IndexToRFSP::setIndexToRFSP(uint8_t m_indexToRFSP) { void IndexToRFSP::set(const uint32_t& index) {
indexToRFSP = m_indexToRFSP; index_ = index;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint8_t IndexToRFSP::getIndexToRFSP() { uint32_t IndexToRFSP::get() const {
return indexToRFSP; return index_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool IndexToRFSP::encode2IndexToRFSP(Ngap_IndexToRFSP_t& indextorfsp) { bool IndexToRFSP::encode(Ngap_IndexToRFSP_t& index) {
indextorfsp = indexToRFSP; index = index_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool IndexToRFSP::decodefromIndexToRFSP(Ngap_IndexToRFSP_t& indextorfsp) { bool IndexToRFSP::decode(Ngap_IndexToRFSP_t& index) {
indexToRFSP = indextorfsp; index_ = index;
return true; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -31,16 +31,17 @@ namespace ngap { ...@@ -31,16 +31,17 @@ namespace ngap {
class IndexToRFSP { class IndexToRFSP {
public: public:
IndexToRFSP(); IndexToRFSP();
IndexToRFSP(const uint32_t&);
virtual ~IndexToRFSP(); virtual ~IndexToRFSP();
void setIndexToRFSP(uint8_t); void set(const uint32_t&);
uint8_t getIndexToRFSP(); uint32_t get() const;
bool encode2IndexToRFSP(Ngap_IndexToRFSP_t&); bool encode(Ngap_IndexToRFSP_t&);
bool decodefromIndexToRFSP(Ngap_IndexToRFSP_t&); bool decode(Ngap_IndexToRFSP_t&);
private: private:
uint8_t indexToRFSP; uint32_t index_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -21,31 +21,39 @@ ...@@ -21,31 +21,39 @@
#include "MICOModeIndication.hpp" #include "MICOModeIndication.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
MICOModeIndication::MICOModeIndication() {} MICOModeIndication::MICOModeIndication()
: mico_mode_indication_(Ngap_MICOModeIndication_true) {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
MICOModeIndication::~MICOModeIndication() {} MICOModeIndication::~MICOModeIndication() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool MICOModeIndication::encode2MICOModeIndication( void MICOModeIndication::set(const long& mico_mode_indication) {
Ngap_MICOModeIndication_t* micoModeIndication) { mico_mode_indication_ = mico_mode_indication;
if (!micoModeIndication) return false; }
*micoModeIndication = Ngap_MICOModeIndication_true;
//------------------------------------------------------------------------------
void MICOModeIndication::get(long& mico_mode_indication) {
mico_mode_indication = mico_mode_indication_;
}
//------------------------------------------------------------------------------
bool MICOModeIndication::encode(
Ngap_MICOModeIndication_t* mico_mode_indication) {
if (!mico_mode_indication) return false;
*mico_mode_indication = mico_mode_indication_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool MICOModeIndication::decodefromMICOModeIndication( bool MICOModeIndication::decode(
Ngap_MICOModeIndication_t* micoModeIndication) { Ngap_MICOModeIndication_t* mico_mode_indication) {
if (!micoModeIndication) return false; if (!mico_mode_indication) return false;
if (*micoModeIndication != Ngap_MICOModeIndication_true) return false; mico_mode_indication_ = *mico_mode_indication;
return true; return true;
} }
......
...@@ -33,12 +33,14 @@ class MICOModeIndication { ...@@ -33,12 +33,14 @@ class MICOModeIndication {
MICOModeIndication(); MICOModeIndication();
virtual ~MICOModeIndication(); virtual ~MICOModeIndication();
// void setMICOModeIndication(); void set(const long& mico_mode_indication);
// bool getMICOModeIndication(); void get(long& mico_mode_indication);
bool encode2MICOModeIndication(Ngap_MICOModeIndication_t* micoModeIndication); bool encode(Ngap_MICOModeIndication_t* micoModeIndication);
bool decodefromMICOModeIndication( bool decode(Ngap_MICOModeIndication_t* micoModeIndication);
Ngap_MICOModeIndication_t* micoModeIndication);
private:
long mico_mode_indication_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -48,7 +48,7 @@ class MessageType { ...@@ -48,7 +48,7 @@ class MessageType {
void setValuePresent(Ngap_SuccessfulOutcome__value_PR m_valuePresent); void setValuePresent(Ngap_SuccessfulOutcome__value_PR m_valuePresent);
void setValuePresent(Ngap_UnsuccessfulOutcome__value_PR m_valuePresent); void setValuePresent(Ngap_UnsuccessfulOutcome__value_PR m_valuePresent);
// void decodefrompdu(Ngap_NGAP_PDU_t*); // void decodeFromPdu(Ngap_NGAP_PDU_t*);
Ngap_ProcedureCode_t getProcedureCode(); Ngap_ProcedureCode_t getProcedureCode();
Ngap_NGAP_PDU_PR getTypeOfMessage(); Ngap_NGAP_PDU_PR getTypeOfMessage();
Ngap_Criticality getCriticality(); Ngap_Criticality getCriticality();
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#include "MobilityRestrictionList.hpp" #include "MobilityRestrictionList.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
MobilityRestrictionList::MobilityRestrictionList() {} MobilityRestrictionList::MobilityRestrictionList() {}
...@@ -31,19 +28,28 @@ MobilityRestrictionList::MobilityRestrictionList() {} ...@@ -31,19 +28,28 @@ MobilityRestrictionList::MobilityRestrictionList() {}
MobilityRestrictionList::~MobilityRestrictionList() {} MobilityRestrictionList::~MobilityRestrictionList() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void MobilityRestrictionList::setMobilityRestrictionList(const PlmnId& sPLMN) { void MobilityRestrictionList::setPLMN(const PlmnId& sPLMN) {
servingPLMN = sPLMN; servingPLMN = sPLMN;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void MobilityRestrictionList::getMobilityRestrictionList(PlmnId& sPLMN) { void MobilityRestrictionList::getPLMN(PlmnId& sPLMN) {
sPLMN = servingPLMN; sPLMN = servingPLMN;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool MobilityRestrictionList::encodeMobilityRestrictionList( bool MobilityRestrictionList::encode(
Ngap_MobilityRestrictionList_t* mobilityrestrictionlist) { Ngap_MobilityRestrictionList_t* mobility_restriction_list) {
if (!servingPLMN.encode2octetstring(mobilityrestrictionlist->servingPLMN)) { if (!servingPLMN.encode(mobility_restriction_list->servingPLMN)) {
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool MobilityRestrictionList::decode(
Ngap_MobilityRestrictionList_t* mobility_restriction_list) {
if (!servingPLMN.decode(mobility_restriction_list->servingPLMN)) {
return false; return false;
} }
return true; return true;
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
*/ */
#ifndef _MOBILITY_RESTRICTION_LIST_H_ #ifndef _MOBILITY_RESTRICTION_LIST_H_
#define _MOBILITYRESTRICTION_LIST_H_ #define _MOBILITY_RESTRICTION_LIST_H_
#include "PlmnId.hpp" #include "PlmnId.hpp"
extern "C" { extern "C" {
...@@ -32,11 +32,11 @@ class MobilityRestrictionList { ...@@ -32,11 +32,11 @@ class MobilityRestrictionList {
MobilityRestrictionList(); MobilityRestrictionList();
virtual ~MobilityRestrictionList(); virtual ~MobilityRestrictionList();
void setMobilityRestrictionList(const PlmnId& sPlmn); void setPLMN(const PlmnId& sPlmn);
void getMobilityRestrictionList(PlmnId& sPlmn); void getPLMN(PlmnId& sPlmn);
bool encodeMobilityRestrictionList( bool encode(Ngap_MobilityRestrictionList_t* mobility_restriction_list);
Ngap_MobilityRestrictionList_t* mobilityrestrictionlist); bool decode(Ngap_MobilityRestrictionList_t* mobility_restriction_list);
private: private:
PlmnId servingPLMN; // Mandatory PlmnId servingPLMN; // Mandatory
......
...@@ -20,46 +20,77 @@ ...@@ -20,46 +20,77 @@
*/ */
#include "NAS-PDU.hpp" #include "NAS-PDU.hpp"
#include "conversions.hpp"
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NAS_PDU::NAS_PDU() { NAS_PDU::NAS_PDU() {}
naspdubuffer = NULL;
buffersize = -1;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
NAS_PDU::~NAS_PDU() {} NAS_PDU::~NAS_PDU() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NAS_PDU::encode2octetstring(Ngap_NAS_PDU_t& m_naspdu) { bool NAS_PDU::encode(Ngap_NAS_PDU_t& nas_pdu) {
int ret; return conv::bstring_2_octet_string(pdu_bstring, nas_pdu);
ret = OCTET_STRING_fromBuf(&m_naspdu, naspdubuffer, buffersize); }
if (ret != 0) return false;
//------------------------------------------------------------------------------
bool NAS_PDU::decode(Ngap_NAS_PDU_t& nas_pdu) {
if (!nas_pdu.buf) return false;
return conv::octet_string_2_bstring(nas_pdu, pdu_bstring);
}
/*
//------------------------------------------------------------------------------
bool NAS_PDU::get(uint8_t*& buffer, size_t& size) const {
if (!pdu_.buf) return false;
if (pdu_.size < 0) return false;
memcpy(buffer, pdu_.buf, pdu_.size);
size = pdu_.size;
return true;
}
*/
//------------------------------------------------------------------------------
void NAS_PDU::set(uint8_t* buffer, size_t size) {
if (!buffer) return;
pdu_bstring = blk2bstr(buffer, size);
return;
}
//------------------------------------------------------------------------------
bool NAS_PDU::get(OCTET_STRING_t& pdu) const {
conv::bstring_2_octet_string(pdu_bstring, pdu);
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NAS_PDU::decodefromoctetstring(Ngap_NAS_PDU_t& m_naspdu) { bool NAS_PDU::set(const OCTET_STRING_t& pdu) {
naspdubuffer = (char*) m_naspdu.buf; conv::octet_string_2_bstring(pdu, pdu_bstring);
buffersize = m_naspdu.size;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NAS_PDU::getNasPdu(uint8_t*& buffer, size_t& size) const { bool NAS_PDU::get(NAS_PDU& nas_pdu) const {
buffer = (uint8_t*) naspdubuffer; return nas_pdu.set(pdu_bstring);
size = buffersize; }
if (!naspdubuffer) return false;
if (buffersize < 0) return false; //------------------------------------------------------------------------------
bool NAS_PDU::set(const NAS_PDU& nas_pdu) {
bstring pdu = {};
if (!nas_pdu.get(pdu)) return false;
return set(pdu);
}
//------------------------------------------------------------------------------
bool NAS_PDU::get(bstring& pdu) const {
pdu = bstrcpy(pdu_bstring);
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NAS_PDU::setNasPdu(uint8_t* buffer, size_t size) { bool NAS_PDU::set(const bstring& pdu) {
naspdubuffer = (char*) buffer; pdu_bstring = bstrcpy(pdu);
buffersize = size; return true;
} }
} // namespace ngap } // namespace ngap
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#ifndef _NAS_PDU_H_ #ifndef _NAS_PDU_H_
#define _NAS_PDU_H_ #define _NAS_PDU_H_
#include "bstrlib.h"
extern "C" { extern "C" {
#include "Ngap_NAS-PDU.h" #include "Ngap_NAS-PDU.h"
} }
...@@ -33,14 +35,22 @@ class NAS_PDU { ...@@ -33,14 +35,22 @@ class NAS_PDU {
NAS_PDU(); NAS_PDU();
virtual ~NAS_PDU(); virtual ~NAS_PDU();
bool encode2octetstring(Ngap_NAS_PDU_t&); bool encode(Ngap_NAS_PDU_t&);
bool decodefromoctetstring(Ngap_NAS_PDU_t&); bool decode(Ngap_NAS_PDU_t&);
bool getNasPdu(uint8_t*& buffer, size_t& size) const; // bool get(uint8_t*& buffer, size_t& size) const;
void setNasPdu(uint8_t* buffer, size_t size); void set(uint8_t* buffer, size_t size);
bool get(OCTET_STRING_t& pdu) const;
bool set(const OCTET_STRING_t& pdu);
bool get(bstring& pdu) const;
bool set(const bstring& pdu);
bool get(NAS_PDU& nas_pdu) const;
bool set(const NAS_PDU& nas_pdu);
private: private:
char* naspdubuffer; bstring pdu_bstring;
size_t buffersize;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -43,13 +43,13 @@ void NR_CGI::setNR_CGI( ...@@ -43,13 +43,13 @@ void NR_CGI::setNR_CGI(
void NR_CGI::setNR_CGI( void NR_CGI::setNR_CGI(
const std::string& mcc, const std::string& mnc, const std::string& mcc, const std::string& mnc,
const unsigned long& nrcellidentity) { const unsigned long& nrcellidentity) {
plmnId.setMccMnc(mcc, mnc); plmnId.set(mcc, mnc);
nRCellIdentity.setNRCellIdentity(nrcellidentity); nRCellIdentity.setNRCellIdentity(nrcellidentity);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NR_CGI::setNR_CGI(const struct NrCgi_s& cig) { void NR_CGI::setNR_CGI(const struct NrCgi_s& cig) {
plmnId.setMccMnc(cig.mcc, cig.mnc); plmnId.set(cig.mcc, cig.mnc);
nRCellIdentity.setNRCellIdentity(cig.nrCellID); nRCellIdentity.setNRCellIdentity(cig.nrCellID);
} }
...@@ -62,16 +62,16 @@ void NR_CGI::getNR_CGI(struct NrCgi_s& cig) { ...@@ -62,16 +62,16 @@ void NR_CGI::getNR_CGI(struct NrCgi_s& cig) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NR_CGI::encode2NR_CGI(Ngap_NR_CGI_t* nr_cgi) { bool NR_CGI::encode2NR_CGI(Ngap_NR_CGI_t* nr_cgi) {
if (!plmnId.encode2octetstring(nr_cgi->pLMNIdentity)) return false; if (!plmnId.encode(nr_cgi->pLMNIdentity)) return false;
if (!nRCellIdentity.encode2bitstring(nr_cgi->nRCellIdentity)) return false; if (!nRCellIdentity.encode(nr_cgi->nRCellIdentity)) return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NR_CGI::decodefromNR_CGI(Ngap_NR_CGI_t* nr_cgi) { bool NR_CGI::decodefromNR_CGI(Ngap_NR_CGI_t* nr_cgi) {
if (!plmnId.decodefromoctetstring(nr_cgi->pLMNIdentity)) return false; if (!plmnId.decode(nr_cgi->pLMNIdentity)) return false;
if (!nRCellIdentity.decodefrombitstring(nr_cgi->nRCellIdentity)) return false; if (!nRCellIdentity.decode(nr_cgi->nRCellIdentity)) return false;
return true; return true;
} }
......
...@@ -40,7 +40,7 @@ void NRCellIdentity::setNRCellIdentity(unsigned long m_nrcellidentity) { ...@@ -40,7 +40,7 @@ void NRCellIdentity::setNRCellIdentity(unsigned long m_nrcellidentity) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NRCellIdentity::encode2bitstring(Ngap_NRCellIdentity_t& nRCellIdentity) { bool NRCellIdentity::encode(Ngap_NRCellIdentity_t& nRCellIdentity) {
nRCellIdentity.bits_unused = 4; nRCellIdentity.bits_unused = 4;
nRCellIdentity.size = 5; nRCellIdentity.size = 5;
nRCellIdentity.buf = (uint8_t*) calloc(1, sizeof(uint32_t) + sizeof(uint8_t)); nRCellIdentity.buf = (uint8_t*) calloc(1, sizeof(uint32_t) + sizeof(uint8_t));
...@@ -55,8 +55,7 @@ bool NRCellIdentity::encode2bitstring(Ngap_NRCellIdentity_t& nRCellIdentity) { ...@@ -55,8 +55,7 @@ bool NRCellIdentity::encode2bitstring(Ngap_NRCellIdentity_t& nRCellIdentity) {
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool NRCellIdentity::decodefrombitstring( bool NRCellIdentity::decode(Ngap_NRCellIdentity_t& nRCellIdentity) {
Ngap_NRCellIdentity_t& nRCellIdentity) {
if (!nRCellIdentity.buf) return false; if (!nRCellIdentity.buf) return false;
nrcellidentity = nRCellIdentity.buf[0]; nrcellidentity = nRCellIdentity.buf[0];
......
...@@ -33,8 +33,8 @@ class NRCellIdentity { ...@@ -33,8 +33,8 @@ class NRCellIdentity {
NRCellIdentity(); NRCellIdentity();
virtual ~NRCellIdentity(); virtual ~NRCellIdentity();
bool encode2bitstring(Ngap_NRCellIdentity_t& nRCellIdentity); bool encode(Ngap_NRCellIdentity_t& nRCellIdentity);
bool decodefrombitstring(Ngap_NRCellIdentity_t& nRCellIdentity); bool decode(Ngap_NRCellIdentity_t& nRCellIdentity);
unsigned long getNRCellIdentity(); unsigned long getNRCellIdentity();
void setNRCellIdentity(unsigned long m_nrcellidentity); void setNRCellIdentity(unsigned long m_nrcellidentity);
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "NgENBId.hpp"
extern "C" {
#include "conversions.h"
}
namespace ngap {
NgENB_ID::NgENB_ID() {
present_ = Ngap_NgENB_ID_PR_NOTHING;
}
//------------------------------------------------------------------------------
NgENB_ID::~NgENB_ID() {
present_ = Ngap_NgENB_ID_PR_NOTHING;
}
//------------------------------------------------------------------------------
void NgENB_ID::get(uint32_t& id, Ngap_NgENB_ID_PR& present) const {
present = present_;
switch (present_) {
case Ngap_NgENB_ID_PR_macroNgENB_ID: {
id = id_.macro_ngenb_id;
} break;
case Ngap_NgENB_ID_PR_shortMacroNgENB_ID: {
id = id_.short_macro_ngENB_id;
} break;
case Ngap_NgENB_ID_PR_longMacroNgENB_ID: {
id = id_.short_macro_ngENB_id;
} break;
default: {
present = Ngap_NgENB_ID_PR_NOTHING;
}
}
}
//------------------------------------------------------------------------------
void NgENB_ID::set(const uint32_t& id, const Ngap_NgENB_ID_PR& present) {
present_ = present;
switch (present) {
case Ngap_NgENB_ID_PR_macroNgENB_ID: {
id_.macro_ngenb_id = id;
} break;
case Ngap_NgENB_ID_PR_shortMacroNgENB_ID: {
id_.short_macro_ngENB_id = id;
} break;
case Ngap_NgENB_ID_PR_longMacroNgENB_ID: {
id_.short_macro_ngENB_id = id;
} break;
default: {
present_ = Ngap_NgENB_ID_PR_NOTHING;
}
}
}
//------------------------------------------------------------------------------
bool NgENB_ID::encode(Ngap_NgENB_ID_t& ng_enb_id) {
ng_enb_id.present = present_;
switch (present_) {
case Ngap_NgENB_ID_PR_macroNgENB_ID: {
INT24_TO_BIT_STRING(
id_.macro_ngenb_id && 0x00ffffff, &ng_enb_id.choice.macroNgENB_ID,
20);
} break;
case Ngap_NgENB_ID_PR_shortMacroNgENB_ID: {
INT24_TO_BIT_STRING(
id_.short_macro_ngENB_id && 0x00ffffff,
&ng_enb_id.choice.shortMacroNgENB_ID, 18);
} break;
case Ngap_NgENB_ID_PR_longMacroNgENB_ID: {
INT24_TO_BIT_STRING(
id_.long_macro_ngENB_id && 0x00ffffff,
&ng_enb_id.choice.longMacroNgENB_ID, 21);
} break;
default: {
present_ = Ngap_NgENB_ID_PR_NOTHING;
}
}
return true;
}
//------------------------------------------------------------------------------
bool NgENB_ID::decode(Ngap_NgENB_ID_t& ng_enb_id) {
present_ = ng_enb_id.present;
switch (present_) {
case Ngap_NgENB_ID_PR_macroNgENB_ID: {
BIT_STRING_TO_INT24(&ng_enb_id.choice.macroNgENB_ID, id_.macro_ngenb_id);
} break;
case Ngap_NgENB_ID_PR_shortMacroNgENB_ID: {
BIT_STRING_TO_INT24(
&ng_enb_id.choice.shortMacroNgENB_ID, id_.short_macro_ngENB_id);
} break;
case Ngap_NgENB_ID_PR_longMacroNgENB_ID: {
BIT_STRING_TO_INT24(
&ng_enb_id.choice.shortMacroNgENB_ID, id_.long_macro_ngENB_id);
} break;
default: {
present_ = Ngap_NgENB_ID_PR_NOTHING;
}
}
return true;
}
} // namespace ngap
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _NG_ENB_ID_H_
#define _NG_ENB_ID_H_
#include "PlmnId.hpp"
extern "C" {
#include "Ngap_NgENB-ID.h"
}
namespace ngap {
class NgENB_ID {
public:
NgENB_ID();
virtual ~NgENB_ID();
bool encode(Ngap_NgENB_ID_t&);
bool decode(Ngap_NgENB_ID_t&);
void get(uint32_t& id, Ngap_NgENB_ID_PR& present) const;
void set(const uint32_t& id, const Ngap_NgENB_ID_PR& present);
private:
PlmnId plmnId; // Mandatory
union {
uint32_t macro_ngenb_id;
uint32_t short_macro_ngENB_id;
uint32_t long_macro_ngENB_id;
} id_; // Mandatory
Ngap_NgENB_ID_PR present_;
};
} // namespace ngap
#endif
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#ifndef _NGAPIESSTRUCT_H_ #ifndef _NGAPIESSTRUCT_H_
#define _NGAPIESSTRUCT_H_ #define _NGAPIESSTRUCT_H_
#include "bstrlib.h"
#include <optional>
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -107,17 +109,15 @@ typedef struct Guami_s { ...@@ -107,17 +109,15 @@ typedef struct Guami_s {
typedef struct { typedef struct {
uint8_t pduSessionId; uint8_t pduSessionId;
uint8_t* pduSessionNAS_PDU; bstring nas_pdu;
size_t sizeofpduSessionNAS_PDU;
S_Nssai s_nssai; S_Nssai s_nssai;
OCTET_STRING_t pduSessionResourceSetupRequestTransfer; OCTET_STRING_t pduSessionResourceSetupRequestTransfer;
} PDUSessionResourceSetupRequestItem_t; } PDUSessionResourceSetupRequestItem_t;
typedef struct { typedef struct {
uint8_t pduSessionId; uint8_t pduSessionId;
uint8_t* pduSessionNAS_PDU; bstring nas_pdu;
size_t sizeofpduSessionNAS_PDU; std::optional<S_Nssai> s_nssai;
S_Nssai s_nssai;
OCTET_STRING_t pduSessionResourceModifyRequestTransfer; OCTET_STRING_t pduSessionResourceModifyRequestTransfer;
} PDUSessionResourceModifyRequestItem_t; } PDUSessionResourceModifyRequestItem_t;
...@@ -247,6 +247,17 @@ typedef struct { ...@@ -247,6 +247,17 @@ typedef struct {
typedef struct { typedef struct {
long QFI; long QFI;
} QosFlowToBeForwardedItem_t; } QosFlowToBeForwardedItem_t;
typedef struct gNBId_s {
uint32_t id;
uint8_t bit_length;
} gNBId_t; // 22bits to 32bits
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t HandoverCommandTransfer;
} PDUSessionResourceHandoverItem_t;
} // namespace ngap } // namespace ngap
#endif #endif
...@@ -21,42 +21,35 @@ ...@@ -21,42 +21,35 @@
#include "PDUSessionID.hpp" #include "PDUSessionID.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PDUSessionID::PDUSessionID() { PDUSessionID::PDUSessionID() {
pdusessionid = 0; id_ = 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
PDUSessionID::~PDUSessionID() {} PDUSessionID::~PDUSessionID() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionID::setPDUSessionID(uint8_t m_pdusessionid) { void PDUSessionID::set(const uint8_t& id) {
pdusessionid = m_pdusessionid; id_ = id;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionID::getPDUSessionID(uint8_t& m_pdusessionid) { void PDUSessionID::get(uint8_t& id) const {
m_pdusessionid = pdusessionid; id = id_;
return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionID::encode2PDUSessionID(Ngap_PDUSessionID_t& pduSessionId) { bool PDUSessionID::encode(Ngap_PDUSessionID_t& pdu_session_id) const {
pduSessionId = pdusessionid; pdu_session_id = id_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionID::decodefromPDUSessionID(Ngap_PDUSessionID_t pduSessionId) { bool PDUSessionID::decode(const Ngap_PDUSessionID_t& pdu_session_id) {
pdusessionid = pduSessionId; id_ = pdu_session_id;
return true; return true;
} }
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef _PDUSESSIONID_H_ #ifndef _PDU_SESSION_ID_H_
#define _PDUSESSIONID_H_ #define _PDU_SESSION_ID_H_
extern "C" { extern "C" {
#include "Ngap_PDUSessionID.h" #include "Ngap_PDUSessionID.h"
...@@ -33,14 +33,14 @@ class PDUSessionID { ...@@ -33,14 +33,14 @@ class PDUSessionID {
PDUSessionID(); PDUSessionID();
virtual ~PDUSessionID(); virtual ~PDUSessionID();
void setPDUSessionID(uint8_t m_pdusessionid); void set(const uint8_t& id);
bool getPDUSessionID(uint8_t& m_pdusessionid); void get(uint8_t& id) const;
bool encode2PDUSessionID(Ngap_PDUSessionID_t& pduSessionId); bool encode(Ngap_PDUSessionID_t& pdu_session_id) const;
bool decodefromPDUSessionID(Ngap_PDUSessionID_t pduSessionId); bool decode(const Ngap_PDUSessionID_t& pdu_session_id);
private: private:
uint8_t pdusessionid; uint8_t id_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -47,8 +47,7 @@ void PDUSessionResourceAdmittedItem::getPDUSessionResourceAdmittedItem( ...@@ -47,8 +47,7 @@ void PDUSessionResourceAdmittedItem::getPDUSessionResourceAdmittedItem(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceAdmittedItem::encode2PDUSessionResourceAdmittedItem( bool PDUSessionResourceAdmittedItem::encode2PDUSessionResourceAdmittedItem(
Ngap_PDUSessionResourceAdmittedItem_t* pdUSessionResourceAdmittedItem) { Ngap_PDUSessionResourceAdmittedItem_t* pdUSessionResourceAdmittedItem) {
if (!pDUSessionID.encode2PDUSessionID( if (!pDUSessionID.encode(pdUSessionResourceAdmittedItem->pDUSessionID))
pdUSessionResourceAdmittedItem->pDUSessionID))
return false; return false;
pdUSessionResourceAdmittedItem->handoverRequestAcknowledgeTransfer = pdUSessionResourceAdmittedItem->handoverRequestAcknowledgeTransfer =
handoverRequestAckTransfer; handoverRequestAckTransfer;
...@@ -59,8 +58,7 @@ bool PDUSessionResourceAdmittedItem::encode2PDUSessionResourceAdmittedItem( ...@@ -59,8 +58,7 @@ bool PDUSessionResourceAdmittedItem::encode2PDUSessionResourceAdmittedItem(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceAdmittedItem::decodefromPDUSessionResourceAdmittedItem( bool PDUSessionResourceAdmittedItem::decodefromPDUSessionResourceAdmittedItem(
Ngap_PDUSessionResourceAdmittedItem_t* pdUSessionResourceAdmittedItem) { Ngap_PDUSessionResourceAdmittedItem_t* pdUSessionResourceAdmittedItem) {
if (!pDUSessionID.decodefromPDUSessionID( if (!pDUSessionID.decode(pdUSessionResourceAdmittedItem->pDUSessionID))
pdUSessionResourceAdmittedItem->pDUSessionID))
return false; return false;
handoverRequestAckTransfer = handoverRequestAckTransfer =
pdUSessionResourceAdmittedItem->handoverRequestAcknowledgeTransfer; pdUSessionResourceAdmittedItem->handoverRequestAcknowledgeTransfer;
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef _PDUSESSIONRESOURCEADMITTEDITEM_H_ #ifndef PDU_SESSION_RESOURCE_ADMITTED_ITEM_H_
#define _PDUSESSIONRESOURCEADMITTEDITEM_H_ #define PDU_SESSION_RESOURCE_ADMITTED_ITEM_H_
#include "PDUSessionID.hpp" #include "PDUSessionID.hpp"
#include "PDUSessionResourceHandoverRequestAckTransfer.hpp" #include "PDUSessionResourceHandoverRequestAckTransfer.hpp"
......
...@@ -30,42 +30,39 @@ PDUSessionResourceAdmittedList::PDUSessionResourceAdmittedList() {} ...@@ -30,42 +30,39 @@ PDUSessionResourceAdmittedList::PDUSessionResourceAdmittedList() {}
PDUSessionResourceAdmittedList::~PDUSessionResourceAdmittedList() {} PDUSessionResourceAdmittedList::~PDUSessionResourceAdmittedList() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceAdmittedList::setPDUSessionResourceAdmittedList( void PDUSessionResourceAdmittedList::set(
const std::vector<PDUSessionResourceAdmittedItem>& list) { const std::vector<PDUSessionResourceItem>& list) {
admittedItemList = list; item_list_ = list;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceAdmittedList::getPDUSessionResourceAdmittedList( void PDUSessionResourceAdmittedList::get(
std::vector<PDUSessionResourceAdmittedItem>& item) { std::vector<PDUSessionResourceItem>& list) {
item = admittedItemList; list = item_list_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceAdmittedList::encode2PDUSessionResourceAdmittedList( bool PDUSessionResourceAdmittedList::encode(
Ngap_PDUSessionResourceAdmittedList_t* pduSessionResourceAdmittedList) { Ngap_PDUSessionResourceAdmittedList_t* list) {
for (auto& item : admittedItemList) { for (auto& item : item_list_) {
Ngap_PDUSessionResourceAdmittedItem_t* response = Ngap_PDUSessionResourceAdmittedItem_t* response =
(Ngap_PDUSessionResourceAdmittedItem_t*) calloc( (Ngap_PDUSessionResourceAdmittedItem_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceAdmittedItem_t)); 1, sizeof(Ngap_PDUSessionResourceAdmittedItem_t));
if (!response) return false; if (!response) return false;
if (!item.encode2PDUSessionResourceAdmittedItem(response)) return false; if (!item.encode(response)) return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceAdmittedList->list, response) != 0) if (ASN_SEQUENCE_ADD(&list->list, response) != 0) return false;
return false;
} }
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceAdmittedList::decodefromPDUSessionResourceAdmittedList( bool PDUSessionResourceAdmittedList::decode(
Ngap_PDUSessionResourceAdmittedList_t* pduSessionResourceAdmittedList) { Ngap_PDUSessionResourceAdmittedList_t* list) {
for (int i = 0; i < pduSessionResourceAdmittedList->list.count; i++) { for (int i = 0; i < list->list.count; i++) {
PDUSessionResourceAdmittedItem item = {}; PDUSessionResourceItem item = {};
if (!item.decodefromPDUSessionResourceAdmittedItem( if (!item.decode(list->list.array[i])) return false;
pduSessionResourceAdmittedList->list.array[i])) item_list_.push_back(item);
return false;
admittedItemList.push_back(item);
} }
return true; return true;
......
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef _PDUSESSIONRESOURCEADMITTEDLIST_H_ #ifndef PDU_SESSION_RESOURCE_ADMITTED_LIST_H_
#define _PDUSESSIONRESOURCEADMITTEDLIST_H_ #define PDU_SESSION_RESOURCE_ADMITTED_LIST_H_
#include "PDUSessionResourceAdmittedItem.hpp" #include "PDUSessionResourceItem.hpp"
#include <vector>
extern "C" { extern "C" {
#include "Ngap_PDUSessionResourceAdmittedList.h" #include "Ngap_PDUSessionResourceAdmittedList.h"
...@@ -35,18 +37,14 @@ class PDUSessionResourceAdmittedList { ...@@ -35,18 +37,14 @@ class PDUSessionResourceAdmittedList {
PDUSessionResourceAdmittedList(); PDUSessionResourceAdmittedList();
virtual ~PDUSessionResourceAdmittedList(); virtual ~PDUSessionResourceAdmittedList();
void setPDUSessionResourceAdmittedList( void set(const std::vector<PDUSessionResourceItem>& list);
const std::vector<PDUSessionResourceAdmittedItem>& list); void get(std::vector<PDUSessionResourceItem>& list);
void getPDUSessionResourceAdmittedList(
std::vector<PDUSessionResourceAdmittedItem>& list);
bool encode2PDUSessionResourceAdmittedList( bool encode(Ngap_PDUSessionResourceAdmittedList_t* list);
Ngap_PDUSessionResourceAdmittedList_t* pduSessionResourceAdmittedList); bool decode(Ngap_PDUSessionResourceAdmittedList_t* List);
bool decodefromPDUSessionResourceAdmittedList(
Ngap_PDUSessionResourceAdmittedList_t* pduSessionResourceAdmittedList);
private: private:
std::vector<PDUSessionResourceAdmittedItem> admittedItemList; std::vector<PDUSessionResourceItem> item_list_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -32,50 +32,46 @@ PDUSessionResourceFailedToSetupItemCxtFail:: ...@@ -32,50 +32,46 @@ PDUSessionResourceFailedToSetupItemCxtFail::
~PDUSessionResourceFailedToSetupItemCxtFail() {} ~PDUSessionResourceFailedToSetupItemCxtFail() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupItemCxtFail:: void PDUSessionResourceFailedToSetupItemCxtFail::set(
setPDUSessionResourceFailedToSetupItemCxtFail( const PDUSessionID& pdu_session_id,
const PDUSessionID& m_pDUSessionID, const OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) {
const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer) { pdu_session_id_ = pdu_session_id;
pDUSessionID = m_pDUSessionID; pdu_session_resource_setup_unsuccessful_transfer_ =
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer;
m_pDUSessionResourceSetupUnsuccessfulTransfer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupItemCxtFail:: void PDUSessionResourceFailedToSetupItemCxtFail::get(
getPDUSessionResourceFailedToSetupItemCxtFail( PDUSessionID& pdu_session_id,
PDUSessionID& m_pDUSessionID, OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) const {
OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer) { pdu_session_id = pdu_session_id_;
m_pDUSessionID = pDUSessionID; pdu_session_resource_setup_unsuccessful_transfer =
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer_;
pDUSessionResourceSetupUnsuccessfulTransfer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupItemCxtFail:: bool PDUSessionResourceFailedToSetupItemCxtFail::encode(
encode2PDUSessionResourceFailedToSetupItemCxtFail( Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*
Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t* pdu_session_resource_failed_to_setup_item_cxt_fail) {
pduSessionResourceFailedToSetupItemCxtFail) { if (!pdu_session_id_.encode(
if (!pDUSessionID.encode2PDUSessionID( pdu_session_resource_failed_to_setup_item_cxt_fail->pDUSessionID))
pduSessionResourceFailedToSetupItemCxtFail->pDUSessionID))
return false; return false;
pduSessionResourceFailedToSetupItemCxtFail pdu_session_resource_failed_to_setup_item_cxt_fail
->pDUSessionResourceSetupUnsuccessfulTransfer = ->pDUSessionResourceSetupUnsuccessfulTransfer =
pDUSessionResourceSetupUnsuccessfulTransfer; pdu_session_resource_setup_unsuccessful_transfer_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupItemCxtFail:: bool PDUSessionResourceFailedToSetupItemCxtFail::decode(
decodefromPDUSessionResourceFailedToSetupItemCxtFail( Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*
Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t* pdu_session_resource_failed_to_setup_item_cxt_fail) {
pduSessionResourceFailedToSetupItemCxtFail) { if (!pdu_session_id_.decode(
if (!pDUSessionID.decodefromPDUSessionID( pdu_session_resource_failed_to_setup_item_cxt_fail->pDUSessionID))
pduSessionResourceFailedToSetupItemCxtFail->pDUSessionID))
return false; return false;
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer_ =
pduSessionResourceFailedToSetupItemCxtFail pdu_session_resource_failed_to_setup_item_cxt_fail
->pDUSessionResourceSetupUnsuccessfulTransfer; ->pDUSessionResourceSetupUnsuccessfulTransfer;
return true; return true;
......
...@@ -35,23 +35,22 @@ class PDUSessionResourceFailedToSetupItemCxtFail { ...@@ -35,23 +35,22 @@ class PDUSessionResourceFailedToSetupItemCxtFail {
PDUSessionResourceFailedToSetupItemCxtFail(); PDUSessionResourceFailedToSetupItemCxtFail();
virtual ~PDUSessionResourceFailedToSetupItemCxtFail(); virtual ~PDUSessionResourceFailedToSetupItemCxtFail();
void setPDUSessionResourceFailedToSetupItemCxtFail( void set(
const PDUSessionID& m_pDUSessionID, const PDUSessionID& pdu_session_id,
const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer); const OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer);
void getPDUSessionResourceFailedToSetupItemCxtFail( void get(
PDUSessionID& m_pDUSessionID, PDUSessionID& pdu_session_id,
OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer); OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) const;
bool encode2PDUSessionResourceFailedToSetupItemCxtFail( bool encode(Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*
Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t* pdu_session_resource_failed_to_setup_item_cxt_fail);
pduSessionResourceFailedToSetupItemCxtFail); bool decode(Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*
bool decodefromPDUSessionResourceFailedToSetupItemCxtFail( pdu_session_resource_failed_to_setup_item_cxt_fail);
Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*
pduSessionResourceFailedToSetupItemCxtFail);
private: private:
PDUSessionID pDUSessionID; // Mandatory PDUSessionID pdu_session_id_; // Mandatory
OCTET_STRING_t pDUSessionResourceSetupUnsuccessfulTransfer; OCTET_STRING_t
pdu_session_resource_setup_unsuccessful_transfer_; // Mandatory
}; };
} // namespace ngap } // namespace ngap
......
...@@ -21,9 +21,6 @@ ...@@ -21,9 +21,6 @@
#include "PDUSessionResourceFailedToSetupItemCxtRes.hpp" #include "PDUSessionResourceFailedToSetupItemCxtRes.hpp"
#include <iostream>
using namespace std;
namespace ngap { namespace ngap {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -35,49 +32,45 @@ PDUSessionResourceFailedToSetupItemCxtRes:: ...@@ -35,49 +32,45 @@ PDUSessionResourceFailedToSetupItemCxtRes::
~PDUSessionResourceFailedToSetupItemCxtRes() {} ~PDUSessionResourceFailedToSetupItemCxtRes() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupItemCxtRes:: void PDUSessionResourceFailedToSetupItemCxtRes::set(
setPDUSessionResourceFailedToSetupItemCxtRes( const PDUSessionID& pdu_session_id,
const PDUSessionID& m_pDUSessionID, const OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) {
const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer) { pdu_session_id_ = pdu_session_id;
pDUSessionID = m_pDUSessionID; pdu_session_resource_setup_unsuccessful_transfer_ =
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer;
m_pDUSessionResourceSetupUnsuccessfulTransfer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupItemCxtRes:: void PDUSessionResourceFailedToSetupItemCxtRes::get(
getPDUSessionResourceFailedToSetupItemCxtRes( PDUSessionID& pdu_session_id,
PDUSessionID& m_pDUSessionID, OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) {
OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer) { pdu_session_id = pdu_session_id_;
m_pDUSessionID = pDUSessionID; pdu_session_resource_setup_unsuccessful_transfer =
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer_;
pDUSessionResourceSetupUnsuccessfulTransfer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupItemCxtRes:: bool PDUSessionResourceFailedToSetupItemCxtRes::encode(
encode2PDUSessionResourceFailedToSetupItemCxtRes( Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*
Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t* pduSessionResourceFailedToSetupItemCxtRes) {
pduSessionResourceFailedToSetupItemCxtRes) { if (!pdu_session_id_.encode(
if (!pDUSessionID.encode2PDUSessionID(
pduSessionResourceFailedToSetupItemCxtRes->pDUSessionID)) pduSessionResourceFailedToSetupItemCxtRes->pDUSessionID))
return false; return false;
pduSessionResourceFailedToSetupItemCxtRes pduSessionResourceFailedToSetupItemCxtRes
->pDUSessionResourceSetupUnsuccessfulTransfer = ->pDUSessionResourceSetupUnsuccessfulTransfer =
pDUSessionResourceSetupUnsuccessfulTransfer; pdu_session_resource_setup_unsuccessful_transfer_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupItemCxtRes:: bool PDUSessionResourceFailedToSetupItemCxtRes::decode(
decodefromPDUSessionResourceFailedToSetupItemCxtRes( Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*
Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t* pduSessionResourceFailedToSetupItemCxtRes) {
pduSessionResourceFailedToSetupItemCxtRes) { if (!pdu_session_id_.decode(
if (!pDUSessionID.decodefromPDUSessionID(
pduSessionResourceFailedToSetupItemCxtRes->pDUSessionID)) pduSessionResourceFailedToSetupItemCxtRes->pDUSessionID))
return false; return false;
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer_ =
pduSessionResourceFailedToSetupItemCxtRes pduSessionResourceFailedToSetupItemCxtRes
->pDUSessionResourceSetupUnsuccessfulTransfer; ->pDUSessionResourceSetupUnsuccessfulTransfer;
......
...@@ -35,23 +35,22 @@ class PDUSessionResourceFailedToSetupItemCxtRes { ...@@ -35,23 +35,22 @@ class PDUSessionResourceFailedToSetupItemCxtRes {
PDUSessionResourceFailedToSetupItemCxtRes(); PDUSessionResourceFailedToSetupItemCxtRes();
virtual ~PDUSessionResourceFailedToSetupItemCxtRes(); virtual ~PDUSessionResourceFailedToSetupItemCxtRes();
void setPDUSessionResourceFailedToSetupItemCxtRes( void set(
const PDUSessionID& m_pDUSessionID, const PDUSessionID& m_pDUSessionID,
const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer); const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer);
void getPDUSessionResourceFailedToSetupItemCxtRes( void get(
PDUSessionID& m_pDUSessionID, PDUSessionID& m_pDUSessionID,
OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer); OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer);
bool encode2PDUSessionResourceFailedToSetupItemCxtRes( bool encode(Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*
Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t* pduSessionResourceFailedToSetupItemCxtRes);
pduSessionResourceFailedToSetupItemCxtRes); bool decode(Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*
bool decodefromPDUSessionResourceFailedToSetupItemCxtRes( pduSessionResourceFailedToSetupItemCxtRes);
Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*
pduSessionResourceFailedToSetupItemCxtRes);
private: private:
PDUSessionID pDUSessionID; // Mandatory PDUSessionID pdu_session_id_; // Mandatory
OCTET_STRING_t pDUSessionResourceSetupUnsuccessfulTransfer; // Mandatory OCTET_STRING_t
pdu_session_resource_setup_unsuccessful_transfer_; // Mandatory
}; };
} // namespace ngap } // namespace ngap
......
...@@ -32,50 +32,46 @@ PDUSessionResourceFailedToSetupItemSURes:: ...@@ -32,50 +32,46 @@ PDUSessionResourceFailedToSetupItemSURes::
~PDUSessionResourceFailedToSetupItemSURes() {} ~PDUSessionResourceFailedToSetupItemSURes() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupItemSURes:: void PDUSessionResourceFailedToSetupItemSURes::set(
setPDUSessionResourceFailedToSetupItemSURes( const PDUSessionID& pdu_session_id,
const PDUSessionID& m_pDUSessionID, const OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) {
const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer) { pdu_session_id_ = pdu_session_id;
pDUSessionID = m_pDUSessionID; pdu_session_resource_setup_unsuccessful_transfer_ =
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer;
m_pDUSessionResourceSetupUnsuccessfulTransfer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupItemSURes:: void PDUSessionResourceFailedToSetupItemSURes::get(
getPDUSessionResourceFailedToSetupItemSURes( PDUSessionID& pdu_session_id,
PDUSessionID& m_pDUSessionID, OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer) {
OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer) { pdu_session_id = pdu_session_id_;
m_pDUSessionID = pDUSessionID; pdu_session_resource_setup_unsuccessful_transfer =
m_pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer_;
pDUSessionResourceSetupUnsuccessfulTransfer;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupItemSURes:: bool PDUSessionResourceFailedToSetupItemSURes::encode(
encode2PDUSessionResourceFailedToSetupItemSURes( Ngap_PDUSessionResourceFailedToSetupItemSURes_t*
Ngap_PDUSessionResourceFailedToSetupItemSURes_t* pdu_session_resource_failed_to_setup_item_su_res) {
pduSessionResourceFailedToSetupItemSURes) { if (!pdu_session_id_.encode(
if (!pDUSessionID.encode2PDUSessionID( pdu_session_resource_failed_to_setup_item_su_res->pDUSessionID))
pduSessionResourceFailedToSetupItemSURes->pDUSessionID))
return false; return false;
pduSessionResourceFailedToSetupItemSURes pdu_session_resource_failed_to_setup_item_su_res
->pDUSessionResourceSetupUnsuccessfulTransfer = ->pDUSessionResourceSetupUnsuccessfulTransfer =
pDUSessionResourceSetupUnsuccessfulTransfer; pdu_session_resource_setup_unsuccessful_transfer_;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupItemSURes:: bool PDUSessionResourceFailedToSetupItemSURes::decode(
decodefromPDUSessionResourceFailedToSetupItemSURes( Ngap_PDUSessionResourceFailedToSetupItemSURes_t*
Ngap_PDUSessionResourceFailedToSetupItemSURes_t* pdu_session_resource_failed_to_setup_item_su_res) {
pduSessionResourceFailedToSetupItemSURes) { if (!pdu_session_id_.decode(
if (!pDUSessionID.decodefromPDUSessionID( pdu_session_resource_failed_to_setup_item_su_res->pDUSessionID))
pduSessionResourceFailedToSetupItemSURes->pDUSessionID))
return false; return false;
pDUSessionResourceSetupUnsuccessfulTransfer = pdu_session_resource_setup_unsuccessful_transfer_ =
pduSessionResourceFailedToSetupItemSURes pdu_session_resource_failed_to_setup_item_su_res
->pDUSessionResourceSetupUnsuccessfulTransfer; ->pDUSessionResourceSetupUnsuccessfulTransfer;
return true; return true;
......
...@@ -35,23 +35,21 @@ class PDUSessionResourceFailedToSetupItemSURes { ...@@ -35,23 +35,21 @@ class PDUSessionResourceFailedToSetupItemSURes {
PDUSessionResourceFailedToSetupItemSURes(); PDUSessionResourceFailedToSetupItemSURes();
virtual ~PDUSessionResourceFailedToSetupItemSURes(); virtual ~PDUSessionResourceFailedToSetupItemSURes();
void setPDUSessionResourceFailedToSetupItemSURes( void set(
const PDUSessionID& m_pDUSessionID, const PDUSessionID& pdu_session_id,
const OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer); const OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer);
void getPDUSessionResourceFailedToSetupItemSURes( void get(
PDUSessionID& m_pDUSessionID, PDUSessionID& pdu_session_id,
OCTET_STRING_t& m_pDUSessionResourceSetupUnsuccessfulTransfer); OCTET_STRING_t& pdu_session_resource_setup_unsuccessful_transfer);
bool encode2PDUSessionResourceFailedToSetupItemSURes( bool encode(Ngap_PDUSessionResourceFailedToSetupItemSURes_t*
Ngap_PDUSessionResourceFailedToSetupItemSURes_t* pdu_session_resource_failed_to_setup_item_su_res);
pduSessionResourceFailedToSetupItemSURes); bool decode(Ngap_PDUSessionResourceFailedToSetupItemSURes_t*
bool decodefromPDUSessionResourceFailedToSetupItemSURes( pdu_session_resource_failed_to_setup_item_su_res);
Ngap_PDUSessionResourceFailedToSetupItemSURes_t*
pduSessionResourceFailedToSetupItemSURes);
private: private:
PDUSessionID pDUSessionID; PDUSessionID pdu_session_id_;
OCTET_STRING_t pDUSessionResourceSetupUnsuccessfulTransfer; OCTET_STRING_t pdu_session_resource_setup_unsuccessful_transfer_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -32,24 +32,21 @@ PDUSessionResourceFailedToSetupListCxtFail:: ...@@ -32,24 +32,21 @@ PDUSessionResourceFailedToSetupListCxtFail::
~PDUSessionResourceFailedToSetupListCxtFail() {} ~PDUSessionResourceFailedToSetupListCxtFail() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListCxtFail:: void PDUSessionResourceFailedToSetupListCxtFail::set(
setPDUSessionResourceFailedToSetupListCxtFail( const std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list) {
const std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list) {
itemList = list; itemList = list;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListCxtFail:: void PDUSessionResourceFailedToSetupListCxtFail::get(
getPDUSessionResourceFailedToSetupListCxtFail( std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list) {
std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list) {
list = itemList; list = itemList;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListCxtFail:: bool PDUSessionResourceFailedToSetupListCxtFail::encode(
encode2PDUSessionResourceFailedToSetupListCxtFail( Ngap_PDUSessionResourceFailedToSetupListCxtFail_t*
Ngap_PDUSessionResourceFailedToSetupListCxtFail_t* pduSessionResourceFailedToSetupListCxtFail) {
pduSessionResourceFailedToSetupListCxtFail) {
for (std::vector<PDUSessionResourceFailedToSetupItemCxtFail>::iterator it = for (std::vector<PDUSessionResourceFailedToSetupItemCxtFail>::iterator it =
std::begin(itemList); std::begin(itemList);
it < std::end(itemList); ++it) { it < std::end(itemList); ++it) {
...@@ -57,8 +54,7 @@ bool PDUSessionResourceFailedToSetupListCxtFail:: ...@@ -57,8 +54,7 @@ bool PDUSessionResourceFailedToSetupListCxtFail::
(Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*) calloc( (Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t)); 1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemCxtFail_t));
if (!failedToFailure) return false; if (!failedToFailure) return false;
if (!it->encode2PDUSessionResourceFailedToSetupItemCxtFail(failedToFailure)) if (!it->encode(failedToFailure)) return false;
return false;
if (ASN_SEQUENCE_ADD( if (ASN_SEQUENCE_ADD(
&pduSessionResourceFailedToSetupListCxtFail->list, &pduSessionResourceFailedToSetupListCxtFail->list,
failedToFailure) != 0) failedToFailure) != 0)
...@@ -69,16 +65,15 @@ bool PDUSessionResourceFailedToSetupListCxtFail:: ...@@ -69,16 +65,15 @@ bool PDUSessionResourceFailedToSetupListCxtFail::
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListCxtFail:: bool PDUSessionResourceFailedToSetupListCxtFail::decode(
decodefromPDUSessionResourceFailedToSetupListCxtFail( Ngap_PDUSessionResourceFailedToSetupListCxtFail_t*
Ngap_PDUSessionResourceFailedToSetupListCxtFail_t* pduSessionResourceFailedToSetupListCxtFail) {
pduSessionResourceFailedToSetupListCxtFail) {
itemList.reserve(pduSessionResourceFailedToSetupListCxtFail->list.count); itemList.reserve(pduSessionResourceFailedToSetupListCxtFail->list.count);
for (int i = 0; i < pduSessionResourceFailedToSetupListCxtFail->list.count; for (int i = 0; i < pduSessionResourceFailedToSetupListCxtFail->list.count;
i++) { i++) {
PDUSessionResourceFailedToSetupItemCxtFail itemCxtFail = {}; PDUSessionResourceFailedToSetupItemCxtFail itemCxtFail = {};
if (!itemCxtFail.decodefromPDUSessionResourceFailedToSetupItemCxtFail( if (!itemCxtFail.decode(
pduSessionResourceFailedToSetupListCxtFail->list.array[i])) pduSessionResourceFailedToSetupListCxtFail->list.array[i]))
return false; return false;
itemList.push_back(itemCxtFail); itemList.push_back(itemCxtFail);
......
...@@ -36,17 +36,13 @@ class PDUSessionResourceFailedToSetupListCxtFail { ...@@ -36,17 +36,13 @@ class PDUSessionResourceFailedToSetupListCxtFail {
PDUSessionResourceFailedToSetupListCxtFail(); PDUSessionResourceFailedToSetupListCxtFail();
virtual ~PDUSessionResourceFailedToSetupListCxtFail(); virtual ~PDUSessionResourceFailedToSetupListCxtFail();
void setPDUSessionResourceFailedToSetupListCxtFail( void set(const std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list);
const std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list); void get(std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list);
void getPDUSessionResourceFailedToSetupListCxtFail(
std::vector<PDUSessionResourceFailedToSetupItemCxtFail>& list); bool encode(Ngap_PDUSessionResourceFailedToSetupListCxtFail_t*
pduSessionResourceFailedToSetupListCxtFail);
bool encode2PDUSessionResourceFailedToSetupListCxtFail( bool decode(Ngap_PDUSessionResourceFailedToSetupListCxtFail_t*
Ngap_PDUSessionResourceFailedToSetupListCxtFail_t* pduSessionResourceFailedToSetupListCxtFail);
pduSessionResourceFailedToSetupListCxtFail);
bool decodefromPDUSessionResourceFailedToSetupListCxtFail(
Ngap_PDUSessionResourceFailedToSetupListCxtFail_t*
pduSessionResourceFailedToSetupListCxtFail);
private: private:
std::vector<PDUSessionResourceFailedToSetupItemCxtFail> itemList; std::vector<PDUSessionResourceFailedToSetupItemCxtFail> itemList;
......
...@@ -35,34 +35,30 @@ PDUSessionResourceFailedToSetupListCxtRes:: ...@@ -35,34 +35,30 @@ PDUSessionResourceFailedToSetupListCxtRes::
~PDUSessionResourceFailedToSetupListCxtRes() {} ~PDUSessionResourceFailedToSetupListCxtRes() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListCxtRes:: void PDUSessionResourceFailedToSetupListCxtRes::set(
setPDUSessionResourceFailedToSetupListCxtRes( const std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list) {
const std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list) { item_list_ = list;
itemList = list;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListCxtRes:: void PDUSessionResourceFailedToSetupListCxtRes::get(
getPDUSessionResourceFailedToSetupListCxtRes( std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list) {
std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list) { list = item_list_;
list = itemList;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListCxtRes:: bool PDUSessionResourceFailedToSetupListCxtRes::encode(
encode2PDUSessionResourceFailedToSetupListCxtRes( Ngap_PDUSessionResourceFailedToSetupListCxtRes_t*
Ngap_PDUSessionResourceFailedToSetupListCxtRes_t* pduSessionResourceFailedToSetupListCxtRes) {
pduSessionResourceFailedToSetupListCxtRes) {
for (std::vector<PDUSessionResourceFailedToSetupItemCxtRes>::iterator it = for (std::vector<PDUSessionResourceFailedToSetupItemCxtRes>::iterator it =
std::begin(itemList); std::begin(item_list_);
it < std::end(itemList); ++it) { it < std::end(item_list_); ++it) {
Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t* failedToResponse = Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t* failedToResponse =
(Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*) calloc( (Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t)); 1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemCxtRes_t));
if (!failedToResponse) return false; if (!failedToResponse) return false;
if (!it->encode2PDUSessionResourceFailedToSetupItemCxtRes(failedToResponse)) if (!it->encode(failedToResponse)) return false;
return false;
if (ASN_SEQUENCE_ADD( if (ASN_SEQUENCE_ADD(
&pduSessionResourceFailedToSetupListCxtRes->list, &pduSessionResourceFailedToSetupListCxtRes->list,
failedToResponse) != 0) failedToResponse) != 0)
...@@ -73,18 +69,16 @@ bool PDUSessionResourceFailedToSetupListCxtRes:: ...@@ -73,18 +69,16 @@ bool PDUSessionResourceFailedToSetupListCxtRes::
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListCxtRes:: bool PDUSessionResourceFailedToSetupListCxtRes::decode(
decodefromPDUSessionResourceFailedToSetupListCxtRes( Ngap_PDUSessionResourceFailedToSetupListCxtRes_t*
Ngap_PDUSessionResourceFailedToSetupListCxtRes_t* pduSessionResourceFailedToSetupListCxtRes) {
pduSessionResourceFailedToSetupListCxtRes) { item_list_.reserve(pduSessionResourceFailedToSetupListCxtRes->list.count);
itemList.reserve(pduSessionResourceFailedToSetupListCxtRes->list.count);
for (int i = 0; i < pduSessionResourceFailedToSetupListCxtRes->list.count; for (int i = 0; i < pduSessionResourceFailedToSetupListCxtRes->list.count;
i++) { i++) {
PDUSessionResourceFailedToSetupItemCxtRes item = {}; PDUSessionResourceFailedToSetupItemCxtRes item = {};
if (!item.decodefromPDUSessionResourceFailedToSetupItemCxtRes( if (!item.decode(pduSessionResourceFailedToSetupListCxtRes->list.array[i]))
pduSessionResourceFailedToSetupListCxtRes->list.array[i]))
return false; return false;
itemList.push_back(item); item_list_.push_back(item);
} }
return true; return true;
......
...@@ -36,20 +36,16 @@ class PDUSessionResourceFailedToSetupListCxtRes { ...@@ -36,20 +36,16 @@ class PDUSessionResourceFailedToSetupListCxtRes {
PDUSessionResourceFailedToSetupListCxtRes(); PDUSessionResourceFailedToSetupListCxtRes();
virtual ~PDUSessionResourceFailedToSetupListCxtRes(); virtual ~PDUSessionResourceFailedToSetupListCxtRes();
void setPDUSessionResourceFailedToSetupListCxtRes( void set(const std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list);
const std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list); void get(std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list);
void getPDUSessionResourceFailedToSetupListCxtRes(
std::vector<PDUSessionResourceFailedToSetupItemCxtRes>& list); bool encode(Ngap_PDUSessionResourceFailedToSetupListCxtRes_t*
pduSessionResourceFailedToSetupListCxtRes);
bool encode2PDUSessionResourceFailedToSetupListCxtRes( bool decode(Ngap_PDUSessionResourceFailedToSetupListCxtRes_t*
Ngap_PDUSessionResourceFailedToSetupListCxtRes_t* pduSessionResourceFailedToSetupListCxtRes);
pduSessionResourceFailedToSetupListCxtRes);
bool decodefromPDUSessionResourceFailedToSetupListCxtRes(
Ngap_PDUSessionResourceFailedToSetupListCxtRes_t*
pduSessionResourceFailedToSetupListCxtRes);
private: private:
std::vector<PDUSessionResourceFailedToSetupItemCxtRes> itemList; std::vector<PDUSessionResourceFailedToSetupItemCxtRes> item_list_;
}; };
} // namespace ngap } // namespace ngap
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PDUSessionResourceFailedToSetupListHOAck.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceFailedToSetupListHOAck::
PDUSessionResourceFailedToSetupListHOAck() {}
//------------------------------------------------------------------------------
PDUSessionResourceFailedToSetupListHOAck::
~PDUSessionResourceFailedToSetupListHOAck() {}
//------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListHOAck::set(
const std::vector<PDUSessionResourceItem>& list) {
item_list_ = list;
}
//------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListHOAck::get(
std::vector<PDUSessionResourceItem>& list) {
list = item_list_;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListHOAck::encode(
Ngap_PDUSessionResourceFailedToSetupListHOAck_t* list) {
for (auto& item : item_list_) {
Ngap_PDUSessionResourceFailedToSetupItemHOAck_t* response =
(Ngap_PDUSessionResourceFailedToSetupItemHOAck_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemHOAck_t));
if (!response) return false;
if (!item.encode(response)) return false;
if (ASN_SEQUENCE_ADD(&list->list, response) != 0) return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListHOAck::decode(
Ngap_PDUSessionResourceFailedToSetupListHOAck_t* list) {
for (int i = 0; i < list->list.count; i++) {
PDUSessionResourceItem item = {};
if (!item.decode(list->list.array[i])) return false;
item_list_.push_back(item);
}
return true;
}
} // namespace ngap
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef PDU_SESSION_RESOURCE_FAILED_TO_SETUP_LIST_HO_ACK_H_
#define PDU_SESSION_RESOURCE_FAILED_TO_SETUP_LIST_HO_ACK_H_
#include "PDUSessionResourceItem.hpp"
#include <vector>
extern "C" {
#include "Ngap_PDUSessionResourceFailedToSetupListHOAck.h"
}
namespace ngap {
class PDUSessionResourceFailedToSetupListHOAck {
public:
PDUSessionResourceFailedToSetupListHOAck();
virtual ~PDUSessionResourceFailedToSetupListHOAck();
void set(const std::vector<PDUSessionResourceItem>& list);
void get(std::vector<PDUSessionResourceItem>& list);
bool encode(Ngap_PDUSessionResourceFailedToSetupListHOAck_t* list);
bool decode(Ngap_PDUSessionResourceFailedToSetupListHOAck_t* List);
private:
std::vector<PDUSessionResourceItem> item_list_;
};
} // namespace ngap
#endif
...@@ -32,33 +32,29 @@ PDUSessionResourceFailedToSetupListSURes:: ...@@ -32,33 +32,29 @@ PDUSessionResourceFailedToSetupListSURes::
~PDUSessionResourceFailedToSetupListSURes() {} ~PDUSessionResourceFailedToSetupListSURes() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListSURes:: void PDUSessionResourceFailedToSetupListSURes::set(
setPDUSessionResourceFailedToSetupListSURes( const std::vector<PDUSessionResourceFailedToSetupItemSURes>& list) {
const std::vector<PDUSessionResourceFailedToSetupItemSURes>& list) { item_list_ = list;
itemSUResList = list;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceFailedToSetupListSURes:: void PDUSessionResourceFailedToSetupListSURes::get(
getPDUSessionResourceFailedToSetupListSURes( std::vector<PDUSessionResourceFailedToSetupItemSURes>& list) {
std::vector<PDUSessionResourceFailedToSetupItemSURes>& list) { list = item_list_;
list = itemSUResList;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListSURes:: bool PDUSessionResourceFailedToSetupListSURes::encode(
encode2PDUSessionResourceFailedToSetupListSURes( Ngap_PDUSessionResourceFailedToSetupListSURes_t*
Ngap_PDUSessionResourceFailedToSetupListSURes_t* pdu_session_resource_failed_to_setup_list_su_res) {
pduSessionResourceFailedToSetupListSURes) { for (auto& item : item_list_) {
for (auto& item : itemSUResList) { Ngap_PDUSessionResourceFailedToSetupItemSURes_t* item_su_res =
Ngap_PDUSessionResourceFailedToSetupItemSURes_t* failedToResponse =
(Ngap_PDUSessionResourceFailedToSetupItemSURes_t*) calloc( (Ngap_PDUSessionResourceFailedToSetupItemSURes_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemSURes_t)); 1, sizeof(Ngap_PDUSessionResourceFailedToSetupItemSURes_t));
if (!failedToResponse) return false; if (!item_su_res) return false;
if (!item.encode2PDUSessionResourceFailedToSetupItemSURes(failedToResponse)) if (!item.encode(item_su_res)) return false;
return false;
if (ASN_SEQUENCE_ADD( if (ASN_SEQUENCE_ADD(
&pduSessionResourceFailedToSetupListSURes->list, &pdu_session_resource_failed_to_setup_list_su_res->list,
failedToResponse) != 0) item_su_res) != 0)
return false; return false;
} }
...@@ -66,17 +62,16 @@ bool PDUSessionResourceFailedToSetupListSURes:: ...@@ -66,17 +62,16 @@ bool PDUSessionResourceFailedToSetupListSURes::
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceFailedToSetupListSURes:: bool PDUSessionResourceFailedToSetupListSURes::decode(
decodefromPDUSessionResourceFailedToSetupListSURes( Ngap_PDUSessionResourceFailedToSetupListSURes_t*
Ngap_PDUSessionResourceFailedToSetupListSURes_t* pdu_session_resource_failed_to_setup_list_su_res) {
pduSessionResourceFailedToSetupListSURes) { for (int i = 0;
for (int i = 0; i < pduSessionResourceFailedToSetupListSURes->list.count; i < pdu_session_resource_failed_to_setup_list_su_res->list.count; i++) {
i++) {
PDUSessionResourceFailedToSetupItemSURes item = {}; PDUSessionResourceFailedToSetupItemSURes item = {};
if (!item.decodefromPDUSessionResourceFailedToSetupItemSURes( if (!item.decode(
pduSessionResourceFailedToSetupListSURes->list.array[i])) pdu_session_resource_failed_to_setup_list_su_res->list.array[i]))
return false; return false;
itemSUResList.push_back(item); item_list_.push_back(item);
} }
return true; return true;
......
...@@ -36,20 +36,16 @@ class PDUSessionResourceFailedToSetupListSURes { ...@@ -36,20 +36,16 @@ class PDUSessionResourceFailedToSetupListSURes {
PDUSessionResourceFailedToSetupListSURes(); PDUSessionResourceFailedToSetupListSURes();
virtual ~PDUSessionResourceFailedToSetupListSURes(); virtual ~PDUSessionResourceFailedToSetupListSURes();
void setPDUSessionResourceFailedToSetupListSURes( void set(const std::vector<PDUSessionResourceFailedToSetupItemSURes>& item);
const std::vector<PDUSessionResourceFailedToSetupItemSURes>& item); void get(std::vector<PDUSessionResourceFailedToSetupItemSURes>& item);
void getPDUSessionResourceFailedToSetupListSURes(
std::vector<PDUSessionResourceFailedToSetupItemSURes>& item); bool encode(Ngap_PDUSessionResourceFailedToSetupListSURes_t*
pdu_session_resource_failed_to_setup_list_su_res);
bool encode2PDUSessionResourceFailedToSetupListSURes( bool decode(Ngap_PDUSessionResourceFailedToSetupListSURes_t*
Ngap_PDUSessionResourceFailedToSetupListSURes_t* pdu_session_resource_failed_to_setup_list_su_res);
pduSessionResourceFailedToSetupListSURes);
bool decodefromPDUSessionResourceFailedToSetupListSURes(
Ngap_PDUSessionResourceFailedToSetupListSURes_t*
pduSessionResourceFailedToSetupListSURes);
private: private:
std::vector<PDUSessionResourceFailedToSetupItemSURes> itemSUResList; std::vector<PDUSessionResourceFailedToSetupItemSURes> item_list_;
}; };
} // namespace ngap } // namespace ngap
......
...@@ -46,7 +46,7 @@ void PDUSessionResourceHandoverItem::getPDUSessionResourceHandoverItem( ...@@ -46,7 +46,7 @@ void PDUSessionResourceHandoverItem::getPDUSessionResourceHandoverItem(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceHandoverItem::encode( bool PDUSessionResourceHandoverItem::encode(
Ngap_PDUSessionResourceHandoverItem_t& item) { Ngap_PDUSessionResourceHandoverItem_t& item) {
if (!pDUSessionID.encode2PDUSessionID(item.pDUSessionID)) return false; if (!pDUSessionID.encode(item.pDUSessionID)) return false;
item.handoverCommandTransfer = handoverCommandTransfer; item.handoverCommandTransfer = handoverCommandTransfer;
return true; return true;
} }
...@@ -54,7 +54,7 @@ bool PDUSessionResourceHandoverItem::encode( ...@@ -54,7 +54,7 @@ bool PDUSessionResourceHandoverItem::encode(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceHandoverItem::decode( bool PDUSessionResourceHandoverItem::decode(
const Ngap_PDUSessionResourceHandoverItem_t& item) { const Ngap_PDUSessionResourceHandoverItem_t& item) {
if (!pDUSessionID.decodefromPDUSessionID(item.pDUSessionID)) return false; if (!pDUSessionID.decode(item.pDUSessionID)) return false;
handoverCommandTransfer = item.handoverCommandTransfer; handoverCommandTransfer = item.handoverCommandTransfer;
return true; return true;
} }
......
...@@ -30,30 +30,28 @@ PDUSessionResourceHandoverList::PDUSessionResourceHandoverList() {} ...@@ -30,30 +30,28 @@ PDUSessionResourceHandoverList::PDUSessionResourceHandoverList() {}
PDUSessionResourceHandoverList::~PDUSessionResourceHandoverList() {} PDUSessionResourceHandoverList::~PDUSessionResourceHandoverList() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceHandoverList::setPDUSessionResourceHandoverList( void PDUSessionResourceHandoverList::set(
const std::vector<PDUSessionResourceHandoverItem>& list) { const std::vector<PDUSessionResourceItem>& list) {
handoverItemList = list; item_list_ = list;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceHandoverList::getPDUSessionResourceHandoverList( void PDUSessionResourceHandoverList::get(
std::vector<PDUSessionResourceHandoverItem>& list) { std::vector<PDUSessionResourceItem>& list) {
list = handoverItemList; list = item_list_;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceHandoverList::encode( bool PDUSessionResourceHandoverList::encode(
Ngap_PDUSessionResourceHandoverList_t& pduSessionResourceHandoverList) { Ngap_PDUSessionResourceHandoverList_t& list) {
for (auto& item : handoverItemList) { for (auto& item : item_list_) {
Ngap_PDUSessionResourceHandoverItem_t* handoverItem = Ngap_PDUSessionResourceHandoverItem_t* handoverItem =
(Ngap_PDUSessionResourceHandoverItem_t*) calloc( (Ngap_PDUSessionResourceHandoverItem_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceHandoverItem_t)); 1, sizeof(Ngap_PDUSessionResourceHandoverItem_t));
if (!handoverItem) return false; if (!handoverItem) return false;
if (!item.encode(*handoverItem)) return false; if (!item.encode(handoverItem)) return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceHandoverList.list, handoverItem) != if (ASN_SEQUENCE_ADD(&list.list, handoverItem) != 0) return false;
0)
return false;
} }
return true; return true;
...@@ -61,14 +59,12 @@ bool PDUSessionResourceHandoverList::encode( ...@@ -61,14 +59,12 @@ bool PDUSessionResourceHandoverList::encode(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceHandoverList::decode( bool PDUSessionResourceHandoverList::decode(
const Ngap_PDUSessionResourceHandoverList_t& const Ngap_PDUSessionResourceHandoverList_t& list) {
pduSessionResourceHandoverList) { for (int i = 0; i < list.list.count; i++) {
for (int i = 0; i < pduSessionResourceHandoverList.list.count; i++) { PDUSessionResourceItem item = {};
PDUSessionResourceHandoverItem item = {};
if (!item.decode(*pduSessionResourceHandoverList.list.array[i])) if (!item.decode(list.list.array[i])) return false;
return false; item_list_.push_back(item);
handoverItemList.push_back(item);
} }
return true; return true;
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#ifndef _PDU_SESSION_RESOURCE_HANDOVER_LIST_H_ #ifndef _PDU_SESSION_RESOURCE_HANDOVER_LIST_H_
#define _PDU_SESSION_RESOURCE_HANDOVER_LIST_H_ #define _PDU_SESSION_RESOURCE_HANDOVER_LIST_H_
#include "PDUSessionResourceHandoverItem.hpp" #include "PDUSessionResourceItem.hpp"
#include "vector" #include "vector"
extern "C" { extern "C" {
...@@ -36,18 +36,14 @@ class PDUSessionResourceHandoverList { ...@@ -36,18 +36,14 @@ class PDUSessionResourceHandoverList {
PDUSessionResourceHandoverList(); PDUSessionResourceHandoverList();
virtual ~PDUSessionResourceHandoverList(); virtual ~PDUSessionResourceHandoverList();
void setPDUSessionResourceHandoverList( void set(const std::vector<PDUSessionResourceItem>& list);
const std::vector<PDUSessionResourceHandoverItem>& list); void get(std::vector<PDUSessionResourceItem>& list);
void getPDUSessionResourceHandoverList(
std::vector<PDUSessionResourceHandoverItem>& list);
bool encode( bool encode(Ngap_PDUSessionResourceHandoverList_t& list);
Ngap_PDUSessionResourceHandoverList_t& pduSessionResourceHandoverList); bool decode(const Ngap_PDUSessionResourceHandoverList_t& list);
bool decode(const Ngap_PDUSessionResourceHandoverList_t&
pduSessionResourceHandoverList);
private: private:
std::vector<PDUSessionResourceHandoverItem> handoverItemList; std::vector<PDUSessionResourceItem> item_list_;
}; };
} // namespace ngap } // namespace ngap
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "PDUSessionResourceItem.hpp"
#include "conversions.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceItem::PDUSessionResourceItem() {}
//------------------------------------------------------------------------------
PDUSessionResourceItem::~PDUSessionResourceItem() {}
//------------------------------------------------------------------------------
void PDUSessionResourceItem::set(
const PDUSessionID& pdu_session_id, const OCTET_STRING_t& resource) {
pdu_session_id_ = pdu_session_id;
// resource_ = resource;
conv::octet_string_copy(resource_, resource);
}
//------------------------------------------------------------------------------
void PDUSessionResourceItem::get(
PDUSessionID& pdu_session_id, OCTET_STRING_t& resource) const {
pdu_session_id = pdu_session_id_;
// resource = resource_;
conv::octet_string_copy(resource, resource_);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionID_t& pdu_session_id, OCTET_STRING_t& resource) const {
if (!pdu_session_id_.encode(pdu_session_id)) return false;
return conv::octet_string_copy(resource, resource_);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionID_t& pdu_session_id, const OCTET_STRING_t& resource) {
if (!pdu_session_id_.decode(pdu_session_id)) return false;
return conv::octet_string_copy(resource_, resource);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionResourceSetupItemCxtRes_t* item) const {
return encode(
item->pDUSessionID, item->pDUSessionResourceSetupResponseTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionResourceSetupItemCxtRes_t* const item) {
return decode(
item->pDUSessionID, item->pDUSessionResourceSetupResponseTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionResourceItemHORqd_t* item) const {
return encode(item->pDUSessionID, item->handoverRequiredTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionResourceItemHORqd_t* const item) {
return decode(item->pDUSessionID, item->handoverRequiredTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionResourceHandoverItem_t* item) const {
return encode(item->pDUSessionID, item->handoverCommandTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionResourceHandoverItem_t* const item) {
return decode(item->pDUSessionID, item->handoverCommandTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionResourceToReleaseItemHOCmd_t* item) const {
return encode(
item->pDUSessionID, item->handoverPreparationUnsuccessfulTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionResourceToReleaseItemHOCmd_t* const item) {
return decode(
item->pDUSessionID, item->handoverPreparationUnsuccessfulTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionResourceAdmittedItem_t* item) const {
return encode(item->pDUSessionID, item->handoverRequestAcknowledgeTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionResourceAdmittedItem_t* const item) {
return decode(item->pDUSessionID, item->handoverRequestAcknowledgeTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::encode(
Ngap_PDUSessionResourceFailedToSetupItemHOAck_t* item) const {
return encode(
item->pDUSessionID, item->handoverResourceAllocationUnsuccessfulTransfer);
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItem::decode(
const Ngap_PDUSessionResourceFailedToSetupItemHOAck_t* const item) {
return decode(
item->pDUSessionID, item->handoverResourceAllocationUnsuccessfulTransfer);
}
} // namespace ngap
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_ITEM_H_
#define _PDU_SESSION_RESOURCE_ITEM_H_
#include "PDUSessionID.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceSetupItemCxtRes.h"
#include "Ngap_PDUSessionResourceToReleaseItemHOCmd.h"
#include "Ngap_PDUSessionResourceHandoverItem.h"
#include "Ngap_PDUSessionResourceAdmittedItem.h"
#include "Ngap_PDUSessionResourceFailedToSetupItemHOAck.h"
#include "Ngap_PDUSessionResourceItemHORqd.h"
}
namespace ngap {
class PDUSessionResourceItem {
public:
PDUSessionResourceItem();
virtual ~PDUSessionResourceItem();
void set(const PDUSessionID& pdu_session_id, const OCTET_STRING_t& resource);
void get(PDUSessionID& pdu_session_id, OCTET_STRING_t& resource) const;
bool encode(
Ngap_PDUSessionID_t& pdu_session_id, OCTET_STRING_t& resource) const;
bool decode(
const Ngap_PDUSessionID_t& pdu_session_id,
const OCTET_STRING_t& resource);
// PDU SESSION RESOURCE SETUP REQUEST
// For PDU Session Resource Setup Request Item (in child class)
// PDU SESSION RESOURCE SETUP RESPONSE
// For PDU Session Resource Setup Response Item
bool encode(Ngap_PDUSessionResourceSetupItemCxtRes_t*
pdu_session_resource_setup_item_cxt_res) const;
bool decode(const Ngap_PDUSessionResourceSetupItemCxtRes_t*
pdu_session_resource_setup_item_cxt_res);
// TODO: For PDU Session Resource Failed to Setup Item
// PDU SESSION RESOURCE RELEASE COMMAND
// TODO: For PDU Session Resource to Release Item
// PDU SESSION RESOURCE RELEASE RESPONSE
// TODO: For PDU Session Resource Released Item
// PDU SESSION RESOURCE MODIFY REQUEST
// For PDU Session Resource Modify Request Item (in child class)
// PDU SESSION RESOURCE MODIFY RESPONSE
// TODO: For PDU Session Resource Modify Response Item
// TODO: For PDU Session Resource Failed to Modify Item
// PDU SESSION RESOURCE NOTIFY
// TODO: For PDU Session Resource Notify Item
// TODO: For PDU Session Resource Released Item
// PDU SESSION RESOURCE MODIFY INDICATION
// TODO: PDU Session Resource Modify Indication Item
// PDU SESSION RESOURCE MODIFY CONFIRM
// TODO: PDU Session Resource Modify Confirm Item
// TODO: PDU Session Resource Failed to Modify Item
// INITIAL CONTEXT SETUP REQUEST
// PDU Session Resource Setup Request Item (in child class)
// INITIAL CONTEXT SETUP RESPONSE
// TODO: PDU Session Resource Setup Response Item
// TODO: PDU Session Resource Failed to Setup Item
// INITIAL CONTEXT SETUP FAILURE
// TODO: PDU Session Resource Failed to Setup Item
// UE CONTEXT RELEASE REQUEST
// TODO: PDU Session Resource Item
// UE CONTEXT RELEASE COMPLETE
// TODO: PDU Session Resource Item
// HANDOVER REQUIRED
// PDU Session Resource Item
bool encode(Ngap_PDUSessionResourceItemHORqd_t* item) const;
bool decode(const Ngap_PDUSessionResourceItemHORqd_t* const item);
// HANDOVER COMMAND
// PDU Session Resource Handover Item
bool encode(Ngap_PDUSessionResourceHandoverItem_t* item) const;
bool decode(const Ngap_PDUSessionResourceHandoverItem_t* const item);
// PDU Session Resource to Release Item
bool encode(Ngap_PDUSessionResourceToReleaseItemHOCmd_t* item) const;
bool decode(const Ngap_PDUSessionResourceToReleaseItemHOCmd_t* const item);
// HANDOVER REQUEST
// PDU Session Resource Setup Item (in child class)
// HANDOVER REQUEST ACKNOWLEDGE
// TODO: PDU Session Resource Admitted Item
bool encode(Ngap_PDUSessionResourceAdmittedItem_t* item) const;
bool decode(const Ngap_PDUSessionResourceAdmittedItem_t* const item);
// TODO: PDU Session Resource Failed to Setup Item
bool encode(Ngap_PDUSessionResourceFailedToSetupItemHOAck_t* item) const;
bool decode(
const Ngap_PDUSessionResourceFailedToSetupItemHOAck_t* const item);
// PATH SWITCH REQUEST
// TODO: PDU Session Resource to be Switched in Downlink Item
// TODO: PDU Session Resource Failed to Setup Item
// PATH SWITCH REQUEST ACKNOWLEDGE
// TODO: PDU Session Resource Switched Item
// TODO: PDU Session Resource Released Item
// PATH SWITCH REQUEST FAILURE
// TODO: PDU Session Resource Released Item
// SECONDARY RAT DATA USAGE REPORT
// TODO: PDU Session Resource Secondary RAT Usage Item
private:
PDUSessionID pdu_session_id_; // Mandatory
OCTET_STRING_t resource_;
};
} // namespace ngap
#endif
...@@ -30,32 +30,30 @@ PDUSessionResourceItemCxtRelCpl::PDUSessionResourceItemCxtRelCpl() {} ...@@ -30,32 +30,30 @@ PDUSessionResourceItemCxtRelCpl::PDUSessionResourceItemCxtRelCpl() {}
PDUSessionResourceItemCxtRelCpl::~PDUSessionResourceItemCxtRelCpl() {} PDUSessionResourceItemCxtRelCpl::~PDUSessionResourceItemCxtRelCpl() {}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::setPDUSessionResourceItemCxtRelCpl( void PDUSessionResourceItemCxtRelCpl::set(const PDUSessionID& pdu_session_id) {
const PDUSessionID& m_pDUSessionID) { pdu_session_id_ = pdu_session_id;
pDUSessionID = m_pDUSessionID;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::getPDUSessionResourceItemCxtRelCpl( void PDUSessionResourceItemCxtRelCpl::get(PDUSessionID& pdu_session_id) {
PDUSessionID& m_pDUSessionID) { pdu_session_id = pdu_session_id_;
m_pDUSessionID = pDUSessionID;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::encode2PDUSessionResourceItemCxtRelCpl( bool PDUSessionResourceItemCxtRelCpl::encode(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) { Ngap_PDUSessionResourceItemCxtRelCpl_t*
if (!pDUSessionID.encode2PDUSessionID( pdu_session_resource_item_cxt_rel_cpl) {
pduSessionResourceItemCxtRelCpl->pDUSessionID)) if (!pdu_session_id_.encode(
pdu_session_resource_item_cxt_rel_cpl->pDUSessionID))
return false; return false;
return true; return true;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::decodefromPDUSessionResourceItemCxtRelCpl( bool PDUSessionResourceItemCxtRelCpl::decode(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) { const Ngap_PDUSessionResourceItemCxtRelCpl_t* const
pDUSessionID.setPDUSessionID(pduSessionResourceItemCxtRelCpl->pDUSessionID); pdu_session_resource_item_cxt_rel_cpl) {
pdu_session_id_.set(pdu_session_resource_item_cxt_rel_cpl->pDUSessionID);
return true; return true;
} }
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_ #ifndef _PDU_SESSION_RESOURCE_ITEM_CXT_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_ #define _PDU_SESSION_RESOURCE_ITEM_CXT_REL_CPL_H_
#include "PDUSessionID.hpp" #include "PDUSessionID.hpp"
...@@ -35,18 +35,18 @@ class PDUSessionResourceItemCxtRelCpl { ...@@ -35,18 +35,18 @@ class PDUSessionResourceItemCxtRelCpl {
PDUSessionResourceItemCxtRelCpl(); PDUSessionResourceItemCxtRelCpl();
virtual ~PDUSessionResourceItemCxtRelCpl(); virtual ~PDUSessionResourceItemCxtRelCpl();
void setPDUSessionResourceItemCxtRelCpl(const PDUSessionID& m_pDUSessionID); void set(const PDUSessionID& pdu_session_id);
void get(PDUSessionID& pdu_session_id);
void getPDUSessionResourceItemCxtRelCpl(PDUSessionID& m_pDUSessionID); bool encode(Ngap_PDUSessionResourceItemCxtRelCpl_t*
pdu_session_resource_item_cxt_rel_cpl);
bool encode2PDUSessionResourceItemCxtRelCpl( bool decode(const Ngap_PDUSessionResourceItemCxtRelCpl_t* const
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl); pdu_session_resource_item_cxt_rel_cpl);
bool decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
private: private:
PDUSessionID pDUSessionID; PDUSessionID pdu_session_id_; // Mandatory
// OCTET_STRING_t pDUSessionResourceReleaseResponseTransfer; // TODO (not defined in ASN1C) OCTET_STRING_t
// pdu_session_resource_release_response_transfer_; //Optional
}; };
} // namespace ngap } // namespace ngap
......
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_ITEM_CXT_REL_REQ_H_
#define _PDU_SESSION_RESOURCE_ITEM_CXT_REL_REQ_H_
#include "PDUSessionID.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceItemCxtRelReq.h"
}
namespace ngap {
class PDUSessionResourceItemCxtRelReq {
public:
PDUSessionResourceItemCxtRelReq();
virtual ~PDUSessionResourceItemCxtRelReq();
void set(const PDUSessionID& pdu_session_id);
void get(PDUSessionID& pdu_session_id);
bool encode(Ngap_PDUSessionResourceItemCxtRelReq_t*
pdu_session_resource_item_cxt_rel_req);
bool decode(Ngap_PDUSessionResourceItemCxtRelReq_t*
pdu_session_resource_item_cxt_rel_req);
private:
PDUSessionID pdu_session_id_; // Mandatory
};
} // namespace ngap
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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