Commit ef36a432 authored by Tien Thinh NGUYEN's avatar Tien Thinh NGUYEN

Code refactor for UEContextReleaseCommand and UEContextReleaseRequest

parent 4041c841
......@@ -30,31 +30,30 @@ PDUSessionResourceItemCxtRelCpl::PDUSessionResourceItemCxtRelCpl() {}
PDUSessionResourceItemCxtRelCpl::~PDUSessionResourceItemCxtRelCpl() {}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::setPDUSessionResourceItemCxtRelCpl(
const PDUSessionID& m_pDUSessionID) {
pDUSessionID = m_pDUSessionID;
void PDUSessionResourceItemCxtRelCpl::set(const PDUSessionID& pdu_session_id) {
pdu_session_id_ = pdu_session_id;
}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelCpl::getPDUSessionResourceItemCxtRelCpl(
PDUSessionID& m_pDUSessionID) {
m_pDUSessionID = pDUSessionID;
void PDUSessionResourceItemCxtRelCpl::get(PDUSessionID& pdu_session_id) {
pdu_session_id = pdu_session_id_;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::encode2PDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) {
if (!pDUSessionID.encode(pduSessionResourceItemCxtRelCpl->pDUSessionID))
bool PDUSessionResourceItemCxtRelCpl::encode(
Ngap_PDUSessionResourceItemCxtRelCpl_t*
pdu_session_resource_item_cxt_rel_cpl) {
if (!pdu_session_id_.encode(
pdu_session_resource_item_cxt_rel_cpl->pDUSessionID))
return false;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelCpl::decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl) {
pDUSessionID.set(pduSessionResourceItemCxtRelCpl->pDUSessionID);
bool PDUSessionResourceItemCxtRelCpl::decode(
Ngap_PDUSessionResourceItemCxtRelCpl_t*
pdu_session_resource_item_cxt_rel_cpl) {
pdu_session_id_.set(pdu_session_resource_item_cxt_rel_cpl->pDUSessionID);
return true;
}
......
......@@ -19,8 +19,8 @@
* contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_ITEM_REL_CPL_H_
#ifndef _PDU_SESSION_RESOURCE_ITEM_CXT_REL_CPL_H_
#define _PDU_SESSION_RESOURCE_ITEM_CXT_REL_CPL_H_
#include "PDUSessionID.hpp"
......@@ -35,18 +35,18 @@ class PDUSessionResourceItemCxtRelCpl {
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 encode2PDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
bool decodefromPDUSessionResourceItemCxtRelCpl(
Ngap_PDUSessionResourceItemCxtRelCpl_t* pduSessionResourceItemCxtRelCpl);
bool encode(Ngap_PDUSessionResourceItemCxtRelCpl_t*
pdu_session_resource_item_cxt_rel_cpl);
bool decode(Ngap_PDUSessionResourceItemCxtRelCpl_t*
pdu_session_resource_item_cxt_rel_cpl);
private:
PDUSessionID pDUSessionID;
// OCTET_STRING_t pDUSessionResourceReleaseResponseTransfer;
PDUSessionID pdu_session_id_; // Mandatory
// TODO (not defined in ASN1C) OCTET_STRING_t
// pdu_session_resource_release_response_transfer_; //Optional
};
} // 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 "PDUSessionResourceItemCxtRelReq.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceItemCxtRelReq::PDUSessionResourceItemCxtRelReq() {}
//------------------------------------------------------------------------------
PDUSessionResourceItemCxtRelReq::~PDUSessionResourceItemCxtRelReq() {}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelReq::set(const PDUSessionID& pdu_session_id) {
pdu_session_id_ = pdu_session_id;
}
//------------------------------------------------------------------------------
void PDUSessionResourceItemCxtRelReq::get(PDUSessionID& pdu_session_id) {
pdu_session_id = pdu_session_id_;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelReq::encode(
Ngap_PDUSessionResourceItemCxtRelReq_t*
pdu_session_resource_item_cxt_rel_req) {
if (!pdu_session_id_.encode(
pdu_session_resource_item_cxt_rel_req->pDUSessionID))
return false;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceItemCxtRelReq::decode(
Ngap_PDUSessionResourceItemCxtRelReq_t*
pdu_session_resource_item_cxt_rel_req) {
pdu_session_id_.set(pdu_session_resource_item_cxt_rel_req->pDUSessionID);
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_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
......@@ -55,7 +55,7 @@ bool PDUSessionResourceListCxtRelCpl::encode2PDUSessionResourceListCxtRelCpl(
(Ngap_PDUSessionResourceItemCxtRelCpl_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceItemCxtRelCpl_t));
if (!item) return false;
if (!cxtRelCpl.encode2PDUSessionResourceItemCxtRelCpl(item)) return false;
if (!cxtRelCpl.encode(item)) return false;
if (ASN_SEQUENCE_ADD(&pduSessionResourceListCxtRelCpl.list, item) != 0)
return false;
}
......@@ -68,8 +68,7 @@ bool PDUSessionResourceListCxtRelCpl::decodefromPDUSessionResourceListCxtRelCpl(
pduSessionResourceListCxtRelCpl) {
for (int i = 0; i < pduSessionResourceListCxtRelCpl.list.count; i++) {
PDUSessionResourceItemCxtRelCpl item = {};
if (!item.decodefromPDUSessionResourceItemCxtRelCpl(
pduSessionResourceListCxtRelCpl.list.array[i]))
if (!item.decode(pduSessionResourceListCxtRelCpl.list.array[i]))
return false;
cxtRelCplList.push_back(item);
}
......
/*
* 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 "PDUSessionResourceListCxtRelReq.hpp"
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceListCxtRelReq::PDUSessionResourceListCxtRelReq() {}
//------------------------------------------------------------------------------
PDUSessionResourceListCxtRelReq::~PDUSessionResourceListCxtRelReq() {}
//------------------------------------------------------------------------------
void PDUSessionResourceListCxtRelReq::set(
const std::vector<PDUSessionResourceItemCxtRelReq>& list) {
item_list_.clear();
for (auto i : list) {
item_list_.push_back(i);
}
}
//------------------------------------------------------------------------------
void PDUSessionResourceListCxtRelReq::get(
std::vector<PDUSessionResourceItemCxtRelReq>& list) {
list.clear();
for (auto i : item_list_) {
list.push_back(i);
}
}
//------------------------------------------------------------------------------
bool PDUSessionResourceListCxtRelReq::encode(
Ngap_PDUSessionResourceListCxtRelReq_t&
pdu_session_resource_list_cxt_rel_req) {
for (auto& cxt_rel_req : item_list_) {
Ngap_PDUSessionResourceItemCxtRelReq_t* item =
(Ngap_PDUSessionResourceItemCxtRelReq_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceItemCxtRelReq_t));
if (!item) return false;
if (!cxt_rel_req.encode(item)) return false;
if (ASN_SEQUENCE_ADD(&pdu_session_resource_list_cxt_rel_req.list, item) !=
0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceListCxtRelReq::decode(
const Ngap_PDUSessionResourceListCxtRelReq_t&
pdu_session_resource_list_cxt_rel_req) {
for (int i = 0; i < pdu_session_resource_list_cxt_rel_req.list.count; i++) {
PDUSessionResourceItemCxtRelReq item = {};
if (!item.decode(pdu_session_resource_list_cxt_rel_req.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_LIST_CXT_REL_REQ_H_
#define _PDU_SESSION_RESOURCE_LIST_CXT_REL_REQ_H_
#include "PDUSessionResourceItemCxtRelReq.hpp"
#include <vector>
extern "C" {
#include "Ngap_PDUSessionResourceListCxtRelReq.h"
}
namespace ngap {
class PDUSessionResourceListCxtRelReq {
public:
PDUSessionResourceListCxtRelReq();
virtual ~PDUSessionResourceListCxtRelReq();
void set(const std::vector<PDUSessionResourceItemCxtRelReq>& list);
void get(std::vector<PDUSessionResourceItemCxtRelReq>& list);
bool encode(Ngap_PDUSessionResourceListCxtRelReq_t&
pdu_session_resource_list_cxt_rel_req);
bool decode(const Ngap_PDUSessionResourceListCxtRelReq_t&
pdu_session_resource_list_cxt_rel_req);
private:
std::vector<PDUSessionResourceItemCxtRelReq> item_list_;
};
} // namespace ngap
#endif
......@@ -32,8 +32,9 @@ using namespace ngap;
//------------------------------------------------------------------------------
UEContextReleaseCommandMsg::UEContextReleaseCommandMsg() : NgapMessage() {
ies = nullptr;
ueNgapIdPairIsSet = false;
ies = nullptr;
ranUeNgapId = std::nullopt;
setMessageType(NgapMessageType::UE_CONTEXT_RELEASE_COMMAND);
initialize();
}
......@@ -48,7 +49,6 @@ void UEContextReleaseCommandMsg::initialize() {
//------------------------------------------------------------------------------
void UEContextReleaseCommandMsg::setAmfUeNgapId(const unsigned long& id) {
ueNgapIdPairIsSet = false;
amfUeNgapId.set(id);
Ngap_UEContextReleaseCommand_IEs_t* ie =
(Ngap_UEContextReleaseCommand_IEs_t*) calloc(
......@@ -71,7 +71,7 @@ void UEContextReleaseCommandMsg::setAmfUeNgapId(const unsigned long& id) {
//------------------------------------------------------------------------------
bool UEContextReleaseCommandMsg::getAmfUeNgapId(unsigned long& id) {
if (!ueNgapIdPairIsSet) {
if (!ranUeNgapId.has_value()) {
id = amfUeNgapId.get();
return true;
}
......@@ -81,9 +81,10 @@ bool UEContextReleaseCommandMsg::getAmfUeNgapId(unsigned long& id) {
//------------------------------------------------------------------------------
void UEContextReleaseCommandMsg::setUeNgapIdPair(
const unsigned long& amfId, const uint32_t& ranId) {
ueNgapIdPairIsSet = true;
amfUeNgapId.set(amfId);
ranUeNgapId.set(ranId);
RAN_UE_NGAP_ID tmp = {};
tmp.set(ranId);
ranUeNgapId = std::optional<RAN_UE_NGAP_ID>(tmp);
Ngap_UEContextReleaseCommand_IEs_t* ie =
(Ngap_UEContextReleaseCommand_IEs_t*) calloc(
1, sizeof(Ngap_UEContextReleaseCommand_IEs_t));
......@@ -100,7 +101,7 @@ void UEContextReleaseCommandMsg::setUeNgapIdPair(
free_wrapper((void**) &ie);
return;
}
ret = ranUeNgapId.encode(
ret = ranUeNgapId.value().encode(
ie->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair->rAN_UE_NGAP_ID);
if (!ret) {
Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
......@@ -114,9 +115,9 @@ void UEContextReleaseCommandMsg::setUeNgapIdPair(
//------------------------------------------------------------------------------
bool UEContextReleaseCommandMsg::getUeNgapIdPair(
unsigned long& amfId, uint32_t& ranId) {
if (ueNgapIdPairIsSet) {
if (ranUeNgapId.has_value()) {
amfId = amfUeNgapId.get();
ranId = ranUeNgapId.get();
ranId = ranUeNgapId.value().get();
return true;
}
return false;
......@@ -199,13 +200,14 @@ bool UEContextReleaseCommandMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
Logger::ngap().error("Decoded NGAP AMF_UE_NGAP_ID IE error");
return false;
}
if (!ranUeNgapId.decode(ies->protocolIEs.list.array[i]
->value.choice.UE_NGAP_IDs.choice
.uE_NGAP_ID_pair->rAN_UE_NGAP_ID)) {
RAN_UE_NGAP_ID tmp = {};
if (!tmp.decode(ies->protocolIEs.list.array[i]
->value.choice.UE_NGAP_IDs.choice.uE_NGAP_ID_pair
->rAN_UE_NGAP_ID)) {
Logger::ngap().error("Decoded NGAP RAN_UE_NGAP_ID IE error");
return false;
}
ranUeNgapId = std::optional<RAN_UE_NGAP_ID>(tmp);
} break;
case Ngap_ProtocolIE_ID_id_Cause: {
......
......@@ -55,8 +55,9 @@ class UEContextReleaseCommandMsg : public NgapMessage {
private:
Ngap_UEContextReleaseCommand_t* ies;
AMF_UE_NGAP_ID amfUeNgapId;
RAN_UE_NGAP_ID ranUeNgapId;
bool ueNgapIdPairIsSet;
std::optional<RAN_UE_NGAP_ID>
ranUeNgapId; // CHOICE UE NGAP IDs: AMF UE NGAP ID
Cause causeValue; // Mandatory
};
......
......@@ -94,12 +94,12 @@ void UEContextReleaseCompleteMsg::setUserLocationInfoNR(
userLocationInformation = new UserLocationInformation();
UserLocationInformationNR information_nr = {};
NR_CGI nR_CGI = {};
nR_CGI.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID);
NR_CGI nr_cgi = {};
nr_cgi.setNR_CGI(cig.mcc, cig.mnc, cig.nrCellID);
TAI tai_nr = {};
tai_nr.setTAI(tai);
information_nr.set(nR_CGI, tai_nr);
information_nr.set(nr_cgi, tai_nr);
userLocationInformation->setInformation(information_nr);
Ngap_UEContextReleaseComplete_IEs* ie =
......@@ -129,13 +129,13 @@ void UEContextReleaseCompleteMsg::getUserLocationInfoNR(
UserLocationInformationNR information_nr = {};
if (!userLocationInformation->getInformation(information_nr)) return;
NR_CGI nR_CGI = {};
NR_CGI nr_cgi = {};
TAI tai_nr = {};
information_nr.get(nR_CGI, tai_nr);
information_nr.get(nr_cgi, tai_nr);
PlmnId plmnId_cgi = {};
NRCellIdentity nRCellIdentity = {};
nR_CGI.getNR_CGI(plmnId_cgi, nRCellIdentity);
nr_cgi.getNR_CGI(plmnId_cgi, nRCellIdentity);
cig.nrCellID = nRCellIdentity.getNRCellIdentity();
plmnId_cgi.getMcc(cig.mcc);
plmnId_cgi.getMnc(cig.mnc);
......@@ -155,19 +155,19 @@ void UEContextReleaseCompleteMsg::setPduSessionResourceCxtRelCplList(
const std::vector<PDUSessionResourceCxtRelCplItem_t>& list) {
PDUSessionResourceListCxtRelCpl m_pduSessionResourceListCxtRelCpl = {};
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
std::vector<PDUSessionResourceItemCxtRelCpl> cxt_rel_cpl_list;
for (int i = 0; i < list.size(); i++) {
PDUSessionResourceItemCxtRelCpl item = {};
PDUSessionID pDUSessionID = {};
pDUSessionID.set(list[i].pduSessionId);
PDUSessionID pdu_session_id = {};
pdu_session_id.set(list[i].pduSessionId);
item.setPDUSessionResourceItemCxtRelCpl(pDUSessionID);
cxtRelCplList.push_back(item);
item.set(pdu_session_id);
cxt_rel_cpl_list.push_back(item);
}
m_pduSessionResourceListCxtRelCpl.setPDUSessionResourceListCxtRelCpl(
cxtRelCplList);
cxt_rel_cpl_list);
Ngap_UEContextReleaseComplete_IEs* ie =
(Ngap_UEContextReleaseComplete_IEs*) calloc(
......@@ -201,20 +201,20 @@ void UEContextReleaseCompleteMsg::setPduSessionResourceCxtRelCplList(
//------------------------------------------------------------------------------
bool UEContextReleaseCompleteMsg::getPduSessionResourceCxtRelCplList(
std::vector<PDUSessionResourceCxtRelCplItem_t>& list) {
std::vector<PDUSessionResourceItemCxtRelCpl> cxtRelCplList;
std::vector<PDUSessionResourceItemCxtRelCpl> cxt_rel_cpl_list;
if (pduSessionResourceListCxtRelCpl.has_value()) {
pduSessionResourceListCxtRelCpl.value().getPDUSessionResourceListCxtRelCpl(
cxtRelCplList);
cxt_rel_cpl_list);
} else {
return false;
}
for (auto& item : cxtRelCplList) {
for (auto& item : cxt_rel_cpl_list) {
PDUSessionResourceCxtRelCplItem_t rel = {};
PDUSessionID pDUSessionID = {};
item.getPDUSessionResourceItemCxtRelCpl(pDUSessionID);
pDUSessionID.get(rel.pduSessionId);
PDUSessionID pdu_session_id = {};
item.get(pdu_session_id);
pdu_session_id.get(rel.pduSessionId);
list.push_back(rel);
}
return true;
......
......@@ -30,7 +30,9 @@ using namespace ngap;
//------------------------------------------------------------------------------
UEContextReleaseRequestMsg::UEContextReleaseRequestMsg() : NgapUEMessage() {
ies = nullptr;
ies = nullptr;
pdu_session_resource_list_cxt_rel_req_ = std::nullopt;
setMessageType(NgapMessageType::UE_CONTEXT_RELEASE_REQUEST);
initialize();
}
......@@ -83,6 +85,44 @@ void UEContextReleaseRequestMsg::setRanUeNgapId(
if (ret != 0) Logger::ngap().error("Encode NGAP RAN_UE_NGAP_ID IE error");
}
//------------------------------------------------------------------------------
void UEContextReleaseRequestMsg::setPDUSessionResourceList(
const PDUSessionResourceListCxtRelReq&
pdu_session_resource_list_cxt_rel_req) {
pdu_session_resource_list_cxt_rel_req_ =
std::optional<PDUSessionResourceListCxtRelReq>(
pdu_session_resource_list_cxt_rel_req);
Ngap_UEContextReleaseRequest_IEs* ie =
(Ngap_UEContextReleaseRequest_IEs*) calloc(
1, sizeof(Ngap_UEContextReleaseRequest_IEs));
ie->id = Ngap_ProtocolIE_ID_id_PDUSessionResourceListCxtRelReq;
ie->criticality = Ngap_Criticality_reject;
ie->value.present =
Ngap_UEContextReleaseRequest_IEs__value_PR_PDUSessionResourceListCxtRelReq;
int ret = pdu_session_resource_list_cxt_rel_req_.value().encode(
ie->value.choice.PDUSessionResourceListCxtRelReq);
if (!ret) {
Logger::ngap().error(
"Encode NGAP PDUSessionResourceListCxtRelReq IE error");
free_wrapper((void**) &ie);
return;
}
ret = ASN_SEQUENCE_ADD(&ies->protocolIEs.list, ie);
if (ret != 0)
Logger::ngap().error(
"Encode NGAP PDUSessionResourceListCxtRelReq IE error");
}
//------------------------------------------------------------------------------
bool UEContextReleaseRequestMsg::getPDUSessionResourceList(
PDUSessionResourceListCxtRelReq& pdu_session_resource_list_cxt_rel_req) {
if (!pdu_session_resource_list_cxt_rel_req_.has_value()) return false;
pdu_session_resource_list_cxt_rel_req =
pdu_session_resource_list_cxt_rel_req_.value();
return true;
}
//------------------------------------------------------------------------------
void UEContextReleaseRequestMsg::setCauseRadioNetwork(
const e_Ngap_CauseRadioNetwork& cause) {
......@@ -170,6 +210,26 @@ bool UEContextReleaseRequestMsg::decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) {
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_PDUSessionResourceListCxtRelReq: {
if (ies->protocolIEs.list.array[i]->criticality ==
Ngap_Criticality_reject &&
ies->protocolIEs.list.array[i]->value.present ==
Ngap_UEContextReleaseRequest_IEs__value_PR_PDUSessionResourceListCxtRelReq) {
PDUSessionResourceListCxtRelReq tmp = {};
if (!tmp.decode(ies->protocolIEs.list.array[i]
->value.choice.PDUSessionResourceListCxtRelReq)) {
Logger::ngap().error(
"Decode NGAP PDUSessionResourceListCxtRelReq IE error");
return false;
}
pdu_session_resource_list_cxt_rel_req_ =
std::optional<PDUSessionResourceListCxtRelReq>(tmp);
} else {
Logger::ngap().error(
"Decode NGAP PDUSessionResourceListCxtRelReq IE error");
return false;
}
} break;
case Ngap_ProtocolIE_ID_id_Cause: {
if (ies->protocolIEs.list.array[i]->criticality ==
Ngap_Criticality_ignore &&
......
......@@ -24,6 +24,7 @@
#include "Cause.hpp"
#include "NgapUEMessage.hpp"
#include "PDUSessionResourceListCxtRelReq.hpp"
extern "C" {
#include "Ngap_UEContextReleaseRequest.h"
......@@ -42,6 +43,11 @@ class UEContextReleaseRequestMsg : public NgapUEMessage {
void setRanUeNgapId(const uint32_t& id) override;
bool decodeFromPdu(Ngap_NGAP_PDU_t* ngapMsgPdu) override;
void setPDUSessionResourceList(const PDUSessionResourceListCxtRelReq&
pdu_session_resource_list_cxt_rel_req);
bool getPDUSessionResourceList(
PDUSessionResourceListCxtRelReq& pdu_session_resource_list_cxt_rel_req);
void addCauseIE();
void setCauseRadioNetwork(const e_Ngap_CauseRadioNetwork& cause);
bool getCauseRadioNetwork(e_Ngap_CauseRadioNetwork& cause);
......@@ -51,8 +57,9 @@ class UEContextReleaseRequestMsg : public NgapUEMessage {
// AMF_UE_NGAP_ID //Mandatory
// RAN_UE_NGAP_ID //Mandatory
// TODO: PDU Session Resource List (Optional)
Cause causeValue; // Mandatory
std::optional<PDUSessionResourceListCxtRelReq>
pdu_session_resource_list_cxt_rel_req_; // Optional
Cause causeValue; // Mandatory
};
} // namespace ngap
......
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