Commit 210cc695 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup/format

parent 3279fc64
#
# Copyright (c) 2015, EURECOM (www.eurecom.fr)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
#
# see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for explanation
# of style options
BasedOnStyle: Google
Language: Cpp
IndentWidth: 2
ColumnLimit: 80
IncludeBlocks: Preserve
SortIncludes: false
# alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
DerivePointerAlignment: false
PointerAlignment: Left
# function style
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterReturnType: None
IndentWrappedFunctionNames: false
# template style
AlwaysBreakTemplateDeclarations: Yes
# preprocessor style
IndentPPDirectives: None
# block style
AllowShortBlocksOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
# break style
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakStringLiterals: true
CompactNamespaces: false
ContinuationIndentWidth: 4
MaxEmptyLinesToKeep: 1
ReflowComments: true
# spacing style
UseTab: Never
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
# class style
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
# case statements
IndentCaseLabels: true
# cpp
Cpp11BracedListStyle: true
FixNamespaceComments: true
NamespaceIndentation: None
SortUsingDeclarations: true
# todo
# AlwaysBreakBeforeMultilineStrings: bool
# PenaltyBreakAssignment (unsigned)
# PenaltyBreakBeforeFirstCallParameter (unsigned)
# PenaltyBreakComment (unsigned)
# PenaltyBreakFirstLessLess (unsigned)
# PenaltyBreakString (unsigned)
# PenaltyBreakTemplateDeclaration (unsigned)
# PenaltyExcessCharacter (unsigned)
# PenaltyReturnTypeOnItsOwnLine (unsigned)
......@@ -203,7 +203,9 @@ void amf_app::handle_itti_message(
itti_downlink_nas_transfer *dl_msg = new itti_downlink_nas_transfer(
TASK_AMF_APP, TASK_AMF_N1);
dl_msg->dl_nas = dl_nas;
if (itti_msg.is_n2sm_set) {
if (!itti_msg.is_n2sm_set) {
dl_msg->is_n2sm_set = false;
} else {
dl_msg->n2sm = itti_msg.n2sm;
dl_msg->pdu_session_id = itti_msg.pdu_session_id;
dl_msg->is_n2sm_set = true;
......@@ -211,7 +213,7 @@ void amf_app::handle_itti_message(
}
dl_msg->amf_ue_ngap_id = amf_n1_inst->supi2amfId.at(itti_msg.supi);
dl_msg->ran_ue_ngap_id = amf_n1_inst->supi2ranId.at(itti_msg.supi);
std::shared_ptr<itti_downlink_nas_transfer> i = std::shared_ptr
std::shared_ptr < itti_downlink_nas_transfer > i = std::shared_ptr
< itti_downlink_nas_transfer > (dl_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
......@@ -229,7 +231,7 @@ void amf_app::handle_itti_message(
//3. store ue-reated core information
//4. send nas-pdu to task_amf_n1
long amf_ue_ngap_id = 0;
std::shared_ptr<ue_context> uc;
std::shared_ptr < ue_context > uc;
//check ue context with 5g-s-tmsi
if ((amf_ue_ngap_id = itti_msg.amf_ue_ngap_id) == -1) {
......@@ -283,7 +285,7 @@ void amf_app::handle_itti_message(
if (is_guti_valid) {
itti_n1_msg->guti = guti;
}
std::shared_ptr<itti_uplink_nas_data_ind> i = std::shared_ptr
std::shared_ptr < itti_uplink_nas_data_ind > i = std::shared_ptr
< itti_uplink_nas_data_ind > (itti_n1_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
......@@ -309,7 +311,7 @@ bool amf_app::generate_5g_guti(uint32_t ranid, long amfid, string &mcc,
ue_context_key.c_str());
return false;
}
std::shared_ptr<ue_context> uc;
std::shared_ptr < ue_context > uc;
uc = ran_amf_id_2_ue_context(ue_context_key);
mcc = uc.get()->tai.mcc;
mnc = uc.get()->tai.mnc;
......
......@@ -429,7 +429,8 @@ int amf_config::load_thread_sched_params(const Setting &thread_sched_params_cfg,
try {
std::string thread_rd_sched_policy;
thread_sched_params_cfg.lookupValue(
AMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY, thread_rd_sched_policy);
AMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY,
thread_rd_sched_policy);
util::trim(thread_rd_sched_policy);
if (boost::iequals(thread_rd_sched_policy, "SCHED_OTHER")) {
cfg.sched_policy = SCHED_OTHER;
......@@ -454,7 +455,8 @@ int amf_config::load_thread_sched_params(const Setting &thread_sched_params_cfg,
try {
thread_sched_params_cfg.lookupValue(
AMF_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY, cfg.sched_priority);
AMF_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY,
cfg.sched_priority);
if ((cfg.sched_priority > 99) || (cfg.sched_priority < 1)) {
Logger::amf_app().error(
"thread_rd_sched_priority: %d, must be in interval [1..99] in config file",
......
This diff is collapsed.
......@@ -175,7 +175,8 @@ class amf_n1 {
void service_request_handle(bool isNasSig, std::shared_ptr<nas_context> nc,
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
bstring nas);
void identity_response_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring plain_msg);
void identity_response_handle(uint32_t ran_ue_ngap_id, long amf_ue_ngap_id,
bstring plain_msg);
//authentication vector
bool generate_authentication_vector();
......
......@@ -105,26 +105,31 @@ void amf_n11_task(void*) {
auto *msg = shared_msg.get();
switch (msg->msg_type) {
case SMF_SERVICES_CONSUMER: {
Logger::amf_n1().info("Running SMF_SERVICES_CONSUMER");
itti_smf_services_consumer *m = dynamic_cast<itti_smf_services_consumer *>(msg);
Logger::amf_n11().info("Running SMF_SERVICES_CONSUMER");
itti_smf_services_consumer *m =
dynamic_cast<itti_smf_services_consumer*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
}
break;
case NSMF_PDU_SESSION_UPDATE_SM_CTX: {
Logger::amf_n1().info("Receive Nsmf_PDUSessionUpdateSMContext, handling ...");
itti_nsmf_pdusession_update_sm_context *m = dynamic_cast<itti_nsmf_pdusession_update_sm_context *>(msg);
Logger::amf_n11().info(
"Receive Nsmf_PDUSessionUpdateSMContext, handling ...");
itti_nsmf_pdusession_update_sm_context *m =
dynamic_cast<itti_nsmf_pdusession_update_sm_context*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
}
break;
case PDU_SESS_RES_SET_RESP: {
Logger::amf_n1().info("Receive PDU Session Resource Setup Response, handling ...");
itti_pdu_session_resource_setup_response *m = dynamic_cast<itti_pdu_session_resource_setup_response *>(msg);
Logger::amf_n11().info(
"Receive PDU Session Resource Setup Response, handling ...");
itti_pdu_session_resource_setup_response *m =
dynamic_cast<itti_pdu_session_resource_setup_response*>(msg);
amf_n11_inst->handle_itti_message(ref(*m));
}
break;
default: {
Logger::amf_n11().info(
"Receive unknown message type %d", msg->msg_type);
Logger::amf_n11().info("Receive unknown message type %d",
msg->msg_type);
}
}
} while (true);
......@@ -146,13 +151,13 @@ amf_n11::~amf_n11() {
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_pdu_session_resource_setup_response &itti_msg)
{
void amf_n11::handle_itti_message(
itti_pdu_session_resource_setup_response &itti_msg) {
}
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_msg)
{
void amf_n11::handle_itti_message(
itti_nsmf_pdusession_update_sm_context &itti_msg) {
std::string supi = pduid2supi.at(itti_msg.pdu_session_id);
Logger::amf_n11().debug(
"Send PDU Session Update SM Context Request to SMF (SUPI %s, PDU Session ID %d)",
......@@ -208,7 +213,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_m
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
Logger::amf_n11().debug("Handle ITTI_SMF_SERVICES_CONSUMER");
std::shared_ptr<nas_context> nc;
std::shared_ptr < nas_context > nc;
nc = amf_n1_inst->amf_ue_id_2_nas_context(smf.amf_ue_ngap_id);
std::string supi = "imsi-" + nc.get()->imsi;
......@@ -251,21 +256,21 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
smf_selection_from_context(smf_addr);
}
switch (smf.req_type & 0x07)
{
case PDU_SESSION_INITIAL_REQUEST:
{
switch (smf.req_type & 0x07) {
case PDU_SESSION_INITIAL_REQUEST: {
//get pti
uint8_t *sm_msg = (uint8_t*)bdata(smf.sm_msg);
uint8_t *sm_msg = (uint8_t*) bdata(smf.sm_msg);
uint8_t pti = sm_msg[2];
Logger::amf_n1().debug("decoded PTI for PDUSessionEstablishmentRequest(0x%x)", pti);
if(psc.get()->isn1sm_avaliable && psc.get()->isn2sm_avaliable){
itti_n1n2_message_transfer_request * itti_msg = new itti_n1n2_message_transfer_request(TASK_AMF_N11, TASK_AMF_APP);
Logger::amf_n11().debug(
"Decoded PTI for PDUSessionEstablishmentRequest(0x%x)", pti);
if (psc.get()->isn1sm_avaliable && psc.get()->isn2sm_avaliable) {
itti_n1n2_message_transfer_request *itti_msg =
new itti_n1n2_message_transfer_request(TASK_AMF_N11, TASK_AMF_APP);
itti_msg->supi = supi;
uint8_t accept_len = blength(psc.get()->n1sm);
uint8_t *accept = (uint8_t*)calloc(1, accept_len);
memcpy(accept, (uint8_t*)bdata(psc.get()->n1sm), accept_len);
uint8_t *accept = (uint8_t*) calloc(1, accept_len);
memcpy(accept, (uint8_t*) bdata(psc.get()->n1sm), accept_len);
accept[2] = pti;
itti_msg->n1sm = blk2bstr(accept, accept_len);
free(accept);
......@@ -273,24 +278,26 @@ void amf_n11::handle_itti_message(itti_smf_services_consumer &smf) {
itti_msg->n2sm = psc.get()->n2sm;
itti_msg->is_n2sm_set = true;
itti_msg->pdu_session_id = psc.get()->pdu_session_id;
std::shared_ptr<itti_n1n2_message_transfer_request> i = std::shared_ptr<itti_n1n2_message_transfer_request>(itti_msg);
std::shared_ptr < itti_n1n2_message_transfer_request > i =
std::shared_ptr < itti_n1n2_message_transfer_request > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_server().error( "Could not send ITTI message %s to task TASK_AMF_APP", i->get_msg_name());
Logger::amf_n11().error(
"Could not send ITTI message %s to task TASK_AMF_APP",
i->get_msg_name());
}
}else{
} else {
psc.get()->isn2sm_avaliable = false;
handle_pdu_session_initial_request(supi, psc, smf_addr, smf.sm_msg, dnn);
handle_pdu_session_initial_request(supi, psc, smf_addr, smf.sm_msg,
dnn);
}
}
break;
case EXISTING_PDU_SESSION:
{
case EXISTING_PDU_SESSION: {
//TODO:
}
break;
case PDU_SESSION_TYPE_MODIFICATION_REQUEST:
{
case PDU_SESSION_TYPE_MODIFICATION_REQUEST: {
//TODO:
}
break;
......@@ -377,20 +384,16 @@ void amf_n11::handle_pdu_session_initial_request(
}
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(itti_nsmf_pdusession_release_sm_context &itti_msg)
{
void amf_n11::handle_itti_message(
itti_nsmf_pdusession_release_sm_context &itti_msg) {
std::shared_ptr<pdu_session_context> psc = supi_to_pdu_ctx(itti_msg.supi);
string smf_addr;
if (!psc.get()->smf_available)
{
if (!smf_selection_from_configuration(smf_addr))
{
if (!psc.get()->smf_available) {
if (!smf_selection_from_configuration(smf_addr)) {
Logger::amf_n11().error("No candidate smf is avaliable");
return;
}
}
else
{
} else {
smf_selection_from_context(smf_addr);
}
string remote_uri = psc.get()->location + "release";
......@@ -403,7 +406,8 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_release_sm_context &itti_
pdu_session_release_request["cause"] = "REL_DUE_TO_REACTIVATION";
pdu_session_release_request["ngApCause"] = "radioNetwork";
std::string json_part = pdu_session_release_request.dump();
curl_http_client(remote_uri, json_part, "", "", itti_msg.supi, psc.get()->pdu_session_id);
curl_http_client(remote_uri, json_part, "", "", itti_msg.supi,
psc.get()->pdu_session_id);
}
//Context management functions
......@@ -462,7 +466,7 @@ void amf_n11::handle_post_sm_context_response_error(long code,
itti_msg->is_n2sm_set = false;
itti_msg->supi = supi;
itti_msg->pdu_session_id = pdu_session_id;
std::shared_ptr<itti_n1n2_message_transfer_request> i = std::shared_ptr
std::shared_ptr < itti_n1n2_message_transfer_request > i = std::shared_ptr
< itti_n1n2_message_transfer_request > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
......@@ -604,9 +608,8 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
"Call Network Function services failure (with cause %s)",
cause.c_str());
if (!cause.compare("DNN_DENIED"))
handle_post_sm_context_response_error(httpCode,
cause,
n1sm_hex, supi, pdu_session_id);
handle_post_sm_context_response_error(httpCode, cause, n1sm_hex, supi,
pdu_session_id);
} else { //Response with success code
//Store location of the created context in case of PDU Session Establishment
std::string header_response = *httpHeaderData.get();
......@@ -656,8 +659,8 @@ void amf_n11::curl_http_client(std::string remoteUri, std::string jsonData,
itti_msg->supi = supi;
itti_msg->pdu_session_id = pdu_session_id;
std::shared_ptr<itti_n1n2_message_transfer_request> i = std::shared_ptr
< itti_n1n2_message_transfer_request > (itti_msg);
std::shared_ptr < itti_n1n2_message_transfer_request > i =
std::shared_ptr < itti_n1n2_message_transfer_request > (itti_msg);
int ret = itti_inst->send_msg(i);
if (0 != ret) {
Logger::amf_n11().error(
......
......@@ -49,7 +49,7 @@ class amf_n11 {
std::string smf_addr, bstring sm_msg, std::string dnn);
void handle_itti_message(itti_nsmf_pdusession_update_sm_context &itti_msg);
void handle_itti_message(itti_nsmf_pdusession_release_sm_context &itti_msg);
void handle_itti_message(itti_pdu_session_resource_setup_response &itti_msg);
void handle_itti_message(itti_pdu_session_resource_setup_response &itti_msg);
void send_pdu_session_update_sm_context_request(
std::string supi, std::shared_ptr<pdu_session_context> psc,
std::string smf_addr, bstring sm_msg, std::string dnn);
......
This diff is collapsed.
......@@ -76,7 +76,6 @@ class amf_n2 : public ngap::ngap_app {
std::map<uint32_t, std::shared_ptr<ue_ngap_context>> ranid2uecontext; // ran ue ngap id
mutable std::shared_mutex m_ranid2uecontext;
};
}
......
......@@ -32,16 +32,19 @@
using namespace nas;
//------------------------------------------------------------------------------
ServiceAccept::ServiceAccept(){
ServiceAccept::ServiceAccept() {
plain_header = NULL;
ie_PDU_session_status = NULL;
ie_session_reactivation_result = NULL;
}
ServiceAccept::~ServiceAccept(){
if (plain_header) delete plain_header;
if (ie_PDU_session_status) delete ie_PDU_session_status;
if (ie_session_reactivation_result) delete ie_session_reactivation_result;
ServiceAccept::~ServiceAccept() {
if (plain_header)
delete plain_header;
if (ie_PDU_session_status)
delete ie_PDU_session_status;
if (ie_session_reactivation_result)
delete ie_session_reactivation_result;
}
//------------------------------------------------------------------------------
void ServiceAccept::setHeader(uint8_t security_header_type) {
......
......@@ -113,28 +113,24 @@ typedef struct {
OCTET_STRING_t pduSessionResourceReleaseResponseTransfer;
} PDUSessionResourceReleasedItem_t;
typedef struct
{
typedef struct {
std::string ip_address;
uint32_t gtp_teid;
} GtpTunnel_t;
} GtpTunnel_t;
typedef struct
{
typedef struct {
long _5QI;
long *priorityLevelQos;
long *averagingWindow;
long *maximumDataBurstVolume;
} NonDynamic5QI_t;
} NonDynamic5QI_t;
typedef struct
{
typedef struct {
long pERScalar;
long pERExponent;
} PacketErrorRate_t;
} PacketErrorRate_t;
typedef struct
{
typedef struct {
long priorityLevelQos;
long packetDelayBudget;
PacketErrorRate_t packetErrorRate;
......@@ -142,23 +138,20 @@ typedef struct
e_Ngap_DelayCritical *delayCritical;
long *averagingWindow;
long *maximumDataBurstVolume;
} Dynamic5QI_t;
} Dynamic5QI_t;
typedef struct
{
typedef struct {
NonDynamic5QI_t *nonDy;
Dynamic5QI_t *dy;
} QosCharacteristics_t;
} QosCharacteristics_t;
typedef struct
{
typedef struct {
long priorityLevelARP;
e_Ngap_Pre_emptionCapability pre_emptionCapability;
e_Ngap_Pre_emptionVulnerability pre_emptionVulnerability;
} AllocationAndRetentionPriority_t;
} AllocationAndRetentionPriority_t;
typedef struct
{
typedef struct {
long maximumFlowBitRateDL;
long maximumFlowBitRateUL;
long guaranteedFlowBitRateDL;
......@@ -166,74 +159,62 @@ typedef struct
e_Ngap_NotificationControl *notificationControl;
long *maximumPacketLossRateDL;
long *maximumPacketLossRateUL;
} GBR_QosInformation_t;
} GBR_QosInformation_t;
typedef struct
{
typedef struct {
QosCharacteristics_t qosc;
AllocationAndRetentionPriority_t arp;
GBR_QosInformation_t *gbr_qos_info;
e_Ngap_ReflectiveQosAttribute *reflectiveQosAttribute;
e_Ngap_AdditionalQosFlowInformation *additionalQosFlowInformation;
} QosFlowLevelQosParameters_t;
} QosFlowLevelQosParameters_t;
typedef struct
{
typedef struct {
long qos_flow_id;
QosFlowLevelQosParameters_t qflqp;
} QosFlowSetupReq_t;
} QosFlowSetupReq_t;
typedef struct
{
typedef struct {
long qosFlowIdentifier;
e_Ngap_AssociatedQosFlowItem__qosFlowMappingIndication *qosFlowMappingIndication;
} AssociatedQosFlow_t;
} AssociatedQosFlow_t;
typedef struct
{
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t pduSessionResourceSetupResponseTransfer;
} PDUSessionResourceSetupResponseItem_t;
} PDUSessionResourceSetupResponseItem_t;
typedef struct
{
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t pduSessionResourceSetupUnsuccessfulTransfer;
} PDUSessionResourceFailedToSetupItem_t;
} PDUSessionResourceFailedToSetupItem_t;
typedef struct
{
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t pduSessionResourceReleaseCommandTransfer;
} PDUSessionResourceReleaseCommandItem_t;
} PDUSessionResourceReleaseCommandItem_t;
typedef struct
{
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t HandoverRequiredTransfer;
} PDUSessionResourceItem_t;
} PDUSessionResourceItem_t;
typedef struct
{
typedef struct {
uint8_t pduSessionId;
S_Nssai s_nssai;
OCTET_STRING_t pduSessionResourceSetupRequestTransfer;
} PDUSessionResourceSetupItem_t;
typedef struct
{
} PDUSessionResourceSetupItem_t;
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t handoverRequestAcknowledgeTransfer;
} PDUSessionResourceAdmittedItem_t;
} PDUSessionResourceAdmittedItem_t;
typedef struct
{
typedef struct {
Ngap_QosFlowIdentifier_t qosFlowIdentifier;
} QosFlowLItemWithDataForwarding_t;
typedef struct
{
} QosFlowLItemWithDataForwarding_t;
typedef struct {
long QFI;
} QosFlowToBeForwardedItem_t;
} QosFlowToBeForwardedItem_t;
} // namespace ngap
#endif
......@@ -48,11 +48,15 @@ UEContextReleaseCommandMsg::UEContextReleaseCommandMsg() {
causeValue = NULL;
}
UEContextReleaseCommandMsg::~UEContextReleaseCommandMsg(){
if(pdu) ASN_STRUCT_FREE(asn_DEF_Ngap_NGAP_PDU,pdu);
if (amfUeNgapId) delete amfUeNgapId;
if (ranUeNgapId) delete ranUeNgapId;
if (causeValue) delete causeValue;
UEContextReleaseCommandMsg::~UEContextReleaseCommandMsg() {
if (pdu)
ASN_STRUCT_FREE(asn_DEF_Ngap_NGAP_PDU, pdu);
if (amfUeNgapId)
delete amfUeNgapId;
if (ranUeNgapId)
delete ranUeNgapId;
if (causeValue)
delete causeValue;
}
//------------------------------------------------------------------------------
......@@ -138,7 +142,8 @@ void UEContextReleaseCommandMsg::setCauseRadioNetwork(
}
void UEContextReleaseCommandMsg::setCauseNas(e_Ngap_CauseNas cause_value) {
if (!causeValue) causeValue = new Cause();
if (!causeValue)
causeValue = new Cause();
causeValue->setChoiceOfCause(Ngap_Cause_PR_nas);
causeValue->setValue(cause_value);
addCauseIE();
......
......@@ -39,14 +39,13 @@ extern "C" {
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
namespace ngap{
class UEContextReleaseCommandMsg{
public:
class UEContextReleaseCommandMsg {
public:
UEContextReleaseCommandMsg();
~UEContextReleaseCommandMsg();
public:
public:
void setMessageType();
void setAmfUeNgapId(unsigned long id);
void setUeNgapIdPair(unsigned long amfId, uint32_t ranId);
......@@ -54,9 +53,9 @@ public:
void setCauseRadioNetwork(e_Ngap_CauseRadioNetwork cause_value);
void setCauseNas(e_Ngap_CauseNas cause_value);
int encode2buffer(uint8_t *buf, int buf_size);
public:
public:
bool decodefrompdu(Ngap_NGAP_PDU_t *ngap_msg_pdu);
private:
private:
Ngap_NGAP_PDU_t *pdu;
Ngap_UEContextReleaseCommand_t *ies;
......
......@@ -84,7 +84,7 @@ void ngap_app::handle_sctp_new_association(sctp_assoc_id_t assoc_id,
sctp_stream_id_t outstreams) {
Logger::ngap().debug(
"Ready to handle new NGAP SCTP association (id: %d) request", assoc_id);
std::shared_ptr<gnb_context> gc;
std::shared_ptr < gnb_context > gc;
if (!is_assoc_id_2_gnb_context(assoc_id)) {
Logger::ngap().debug("Create a new gNB context with assoc_id (%d)",
assoc_id);
......@@ -143,12 +143,12 @@ void ngap_app::set_assoc_id_2_gnb_context(const sctp_assoc_id_t &assoc_id,
//------------------------------------------------------------------------------
bool ngap_app::is_gnb_id_2_gnb_context(const long &gnb_id) const {
std::shared_lock lock(m_gnbid2gnbContext);
return bool{gnbid2gnbContext.count(gnb_id) > 0};
return bool { gnbid2gnbContext.count(gnb_id) > 0 };
}
//------------------------------------------------------------------------------
std::shared_ptr<gnb_context>
ngap_app::gnb_id_2_gnb_context(const long &gnb_id) const {
std::shared_ptr<gnb_context> ngap_app::gnb_id_2_gnb_context(
const long &gnb_id) const {
std::shared_lock lock(m_gnbid2gnbContext);
return gnbid2gnbContext.at(gnb_id);
}
......
......@@ -65,7 +65,7 @@ class ngap_app : public sctp_application {
std::shared_ptr<gnb_context> gc);
std::shared_ptr<gnb_context> gnb_id_2_gnb_context(const long &gnb_id) const;
protected:
protected:
sctp_server sctp_s_38412;
uint32_t ppid_;
std::map<sctp_assoc_id_t, std::shared_ptr<gnb_context>> assoc2gnbContext;
......
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