Commit 58be070c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

apply google style format

parent 53cbf6ec
......@@ -48,7 +48,6 @@ smf_config smf_cfg;
SMFApiServer *smf_api_server_1 = nullptr;
smf_http2_server *smf_api_server_2 = nullptr;
void send_heartbeat_to_tasks(const uint32_t sequence);
//------------------------------------------------------------------------------
......
......@@ -55,7 +55,6 @@ bool Options::validateOptions(){
(options & libconfigcfg)
);
}
bool Options::parseInputOptions( int argc, char **argv )
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -31,9 +31,9 @@
#define FILE_SMF_CONFIG_HPP_SEEN
#include <arpa/inet.h>
#include <libconfig.h++>
#include <netinet/in.h>
#include <sys/socket.h>
#include <libconfig.h++>
#include <mutex>
#include <vector>
......@@ -44,86 +44,93 @@
#include "pfcp.hpp"
#include "smf.h"
#define SMF_CONFIG_STRING_SMF_CONFIG "SMF"
#define SMF_CONFIG_STRING_PID_DIRECTORY "PID_DIRECTORY"
#define SMF_CONFIG_STRING_INSTANCE "INSTANCE"
#define SMF_CONFIG_STRING_INTERFACES "INTERFACES"
#define SMF_CONFIG_STRING_INTERFACE_NAME "INTERFACE_NAME"
#define SMF_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_PORT "PORT"
#define SMF_CONFIG_STRING_INTERFACE_N4 "N4"
#define SMF_CONFIG_STRING_INTERFACE_SBI "SBI"
#define SMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define SMF_CONFIG_STRING_API_VERSION "API_VERSION"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO "FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
#define SMF_CONFIG_STRING_IP_ADDRESS_POOL "IP_ADDRESS_POOL"
#define SMF_CONFIG_STRING_ARP_UE "ARP_UE"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_NO "NO"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_LINUX "LINUX"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_OAI "OAI"
#define SMF_CONFIG_STRING_IPV4_ADDRESS_LIST "IPV4_LIST"
#define SMF_CONFIG_STRING_IPV6_ADDRESS_LIST "IPV6_LIST"
#define SMF_CONFIG_STRING_RANGE "RANGE"
#define SMF_CONFIG_STRING_PREFIX "PREFIX"
#define SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER "-"
#define SMF_CONFIG_STRING_IPV6_ADDRESS_PREFIX_DELIMITER "/"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS "DEFAULT_DNS_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS "DEFAULT_DNS_SEC_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS "DEFAULT_DNS_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV6_ADDRESS "DEFAULT_DNS_SEC_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_UE_MTU "UE_MTU"
#define SMF_CONFIG_STRING_INTERFACE_DISABLED "none"
#define SMF_CONFIG_STRING_DNN_LIST "DNN_LIST"
#define SMF_CONFIG_STRING_DNN_NI "DNN_NI"
#define SMF_CONFIG_STRING_PDU_SESSION_TYPE "PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_IPV4_POOL "IPV4_POOL"
#define SMF_CONFIG_STRING_IPV6_POOL "IPV6_POOL"
#define SMF_CONFIG_STRING_SMF_CONFIG "SMF"
#define SMF_CONFIG_STRING_PID_DIRECTORY "PID_DIRECTORY"
#define SMF_CONFIG_STRING_INSTANCE "INSTANCE"
#define SMF_CONFIG_STRING_INTERFACES "INTERFACES"
#define SMF_CONFIG_STRING_INTERFACE_NAME "INTERFACE_NAME"
#define SMF_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_PORT "PORT"
#define SMF_CONFIG_STRING_INTERFACE_N4 "N4"
#define SMF_CONFIG_STRING_INTERFACE_SBI "SBI"
#define SMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define SMF_CONFIG_STRING_API_VERSION "API_VERSION"
#define SMF_CONFIG_STRING_NAS_FORCE_PUSH_PCO \
"FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS"
#define SMF_CONFIG_STRING_IP_ADDRESS_POOL "IP_ADDRESS_POOL"
#define SMF_CONFIG_STRING_ARP_UE "ARP_UE"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_NO "NO"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_LINUX "LINUX"
#define SMF_CONFIG_STRING_ARP_UE_CHOICE_OAI "OAI"
#define SMF_CONFIG_STRING_IPV4_ADDRESS_LIST "IPV4_LIST"
#define SMF_CONFIG_STRING_IPV6_ADDRESS_LIST "IPV6_LIST"
#define SMF_CONFIG_STRING_RANGE "RANGE"
#define SMF_CONFIG_STRING_PREFIX "PREFIX"
#define SMF_CONFIG_STRING_IPV4_ADDRESS_RANGE_DELIMITER "-"
#define SMF_CONFIG_STRING_IPV6_ADDRESS_PREFIX_DELIMITER "/"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV4_ADDRESS "DEFAULT_DNS_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV4_ADDRESS \
"DEFAULT_DNS_SEC_IPV4_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_IPV6_ADDRESS "DEFAULT_DNS_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_DEFAULT_DNS_SEC_IPV6_ADDRESS \
"DEFAULT_DNS_SEC_IPV6_ADDRESS"
#define SMF_CONFIG_STRING_UE_MTU "UE_MTU"
#define SMF_CONFIG_STRING_INTERFACE_DISABLED "none"
#define SMF_CONFIG_STRING_DNN_LIST "DNN_LIST"
#define SMF_CONFIG_STRING_DNN_NI "DNN_NI"
#define SMF_CONFIG_STRING_PDU_SESSION_TYPE "PDU_SESSION_TYPE"
#define SMF_CONFIG_STRING_IPV4_POOL "IPV4_POOL"
#define SMF_CONFIG_STRING_IPV6_POOL "IPV6_POOL"
#define SMF_ABORT_ON_ERROR true
#define SMF_WARN_ON_ERROR false
#define SMF_CONFIG_STRING_SCHED_PARAMS "SCHED_PARAMS"
#define SMF_CONFIG_STRING_THREAD_RD_CPU_ID "CPU_ID"
#define SMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY "SCHED_POLICY"
#define SMF_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY "SCHED_PRIORITY"
#define SMF_CONFIG_STRING_ITTI_TASKS "ITTI_TASKS"
#define SMF_CONFIG_STRING_ITTI_TIMER_SCHED_PARAMS "ITTI_TIMER_SCHED_PARAMS"
#define SMF_CONFIG_STRING_S11_SCHED_PARAMS "S11_SCHED_PARAMS"
#define SMF_CONFIG_STRING_N4_SCHED_PARAMS "N4_SCHED_PARAMS"
#define SMF_CONFIG_STRING_SMF_APP_SCHED_PARAMS "SMF_APP_SCHED_PARAMS"
#define SMF_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS "ASYNC_CMD_SCHED_PARAMS"
#define SMF_CONFIG_STRING_AMF "AMF"
#define SMF_CONFIG_STRING_AMF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_AMF_PORT "PORT"
#define SMF_CONFIG_STRING_UDM "UDM"
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UDM_PORT "PORT"
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_LOCAL_CONFIGURATION "LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_USE_LOCAL_CONFIGURATION "USE_LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST "SESSION_MANAGEMENT_SUBSCRIPTION_LIST"
#define SMF_CONFIG_STRING_NSSAI_SST "NSSAI_SST"
#define SMF_CONFIG_STRING_NSSAI_SD "NSSAI_SD"
#define SMF_CONFIG_STRING_DNN "DNN"
#define SMF_CONFIG_STRING_DEFAULT_SESSION_TYPE "DEFAULT_SESSION_TYPE"
#define SMF_CONFIG_STRING_DEFAULT_SSC_MODE "DEFAULT_SSC_MODE"
#define SMF_CONFIG_STRING_QOS_PROFILE_5QI "QOS_PROFILE_5QI"
#define SMF_CONFIG_STRING_QOS_PROFILE_PRIORITY_LEVEL "QOS_PROFILE_PRIORITY_LEVEL"
#define SMF_CONFIG_STRING_QOS_PROFILE_ARP_PRIORITY_LEVEL "QOS_PROFILE_ARP_PRIORITY_LEVEL"
#define SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTCAP "QOS_PROFILE_ARP_PREEMPTCAP"
#define SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTVULN "QOS_PROFILE_ARP_PREEMPTVULN"
#define SMF_CONFIG_STRING_SESSION_AMBR_UL "SESSION_AMBR_UL"
#define SMF_CONFIG_STRING_SESSION_AMBR_DL "SESSION_AMBR_DL"
#define SMF_WARN_ON_ERROR false
#define SMF_CONFIG_STRING_SCHED_PARAMS "SCHED_PARAMS"
#define SMF_CONFIG_STRING_THREAD_RD_CPU_ID "CPU_ID"
#define SMF_CONFIG_STRING_THREAD_RD_SCHED_POLICY "SCHED_POLICY"
#define SMF_CONFIG_STRING_THREAD_RD_SCHED_PRIORITY "SCHED_PRIORITY"
#define SMF_CONFIG_STRING_ITTI_TASKS "ITTI_TASKS"
#define SMF_CONFIG_STRING_ITTI_TIMER_SCHED_PARAMS "ITTI_TIMER_SCHED_PARAMS"
#define SMF_CONFIG_STRING_S11_SCHED_PARAMS "S11_SCHED_PARAMS"
#define SMF_CONFIG_STRING_N4_SCHED_PARAMS "N4_SCHED_PARAMS"
#define SMF_CONFIG_STRING_SMF_APP_SCHED_PARAMS "SMF_APP_SCHED_PARAMS"
#define SMF_CONFIG_STRING_ASYNC_CMD_SCHED_PARAMS "ASYNC_CMD_SCHED_PARAMS"
#define SMF_CONFIG_STRING_AMF "AMF"
#define SMF_CONFIG_STRING_AMF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_AMF_PORT "PORT"
#define SMF_CONFIG_STRING_UDM "UDM"
#define SMF_CONFIG_STRING_UDM_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_UDM_PORT "PORT"
#define SMF_CONFIG_STRING_UPF_LIST "UPF_LIST"
#define SMF_CONFIG_STRING_UPF_IPV4_ADDRESS "IPV4_ADDRESS"
#define SMF_CONFIG_STRING_LOCAL_CONFIGURATION "LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_USE_LOCAL_CONFIGURATION "USE_LOCAL_CONFIGURATION"
#define SMF_CONFIG_STRING_SESSION_MANAGEMENT_SUBSCRIPTION_LIST \
"SESSION_MANAGEMENT_SUBSCRIPTION_LIST"
#define SMF_CONFIG_STRING_NSSAI_SST "NSSAI_SST"
#define SMF_CONFIG_STRING_NSSAI_SD "NSSAI_SD"
#define SMF_CONFIG_STRING_DNN "DNN"
#define SMF_CONFIG_STRING_DEFAULT_SESSION_TYPE "DEFAULT_SESSION_TYPE"
#define SMF_CONFIG_STRING_DEFAULT_SSC_MODE "DEFAULT_SSC_MODE"
#define SMF_CONFIG_STRING_QOS_PROFILE_5QI "QOS_PROFILE_5QI"
#define SMF_CONFIG_STRING_QOS_PROFILE_PRIORITY_LEVEL \
"QOS_PROFILE_PRIORITY_LEVEL"
#define SMF_CONFIG_STRING_QOS_PROFILE_ARP_PRIORITY_LEVEL \
"QOS_PROFILE_ARP_PRIORITY_LEVEL"
#define SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTCAP \
"QOS_PROFILE_ARP_PREEMPTCAP"
#define SMF_CONFIG_STRING_QOS_PROFILE_ARP_PREEMPTVULN \
"QOS_PROFILE_ARP_PREEMPTVULN"
#define SMF_CONFIG_STRING_SESSION_AMBR_UL "SESSION_AMBR_UL"
#define SMF_CONFIG_STRING_SESSION_AMBR_DL "SESSION_AMBR_DL"
#define SMF_MAX_ALLOCATED_PDN_ADDRESSES 1024
......@@ -187,8 +194,11 @@ class smf_config {
struct in_addr ue_pool_range_high[SMF_NUM_UE_POOL_MAX];
struct in_addr ue_pool_network[SMF_NUM_UE_POOL_MAX];
struct in_addr ue_pool_netmask[SMF_NUM_UE_POOL_MAX];
//computed from config, UE IP adresses that matches ue_pool_network[]/ue_pool_netmask[] but do not match ue_pool_range_low[] - ue_pool_range_high[]
// The problem here is that OpenFlow do not deal with ip ranges but with netmasks
// computed from config, UE IP adresses that matches
// ue_pool_network[]/ue_pool_netmask[] but do not match ue_pool_range_low[] -
// ue_pool_range_high[]
// The problem here is that OpenFlow do not deal with ip ranges but with
// netmasks
std::vector<struct in_addr> ue_pool_excluded[SMF_NUM_UE_POOL_MAX];
int num_paa6_pool;
......@@ -212,9 +222,9 @@ class smf_config {
std::vector<pfcp::node_id_t> upfs;
//Local configuration
// Local configuration
bool local_configuration;
#define SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX 5
#define SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX 5
struct {
snssai_t single_nssai;
std::string session_type;
......@@ -222,21 +232,21 @@ class smf_config {
uint8_t ssc_mode;
subscribed_default_qos_t default_qos;
session_ambr_t session_ambr;
} session_management_subscription[SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX];
} session_management_subscription
[SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX];
uint8_t num_session_management_subscription;
smf_config()
:
m_rw_lock(),
num_dnn(0),
pid_dir(),
instance(0),
n4(),
sbi(),
itti(),
upfs() {
: m_rw_lock(),
num_dnn(0),
pid_dir(),
instance(0),
n4(),
sbi(),
itti(),
upfs() {
for (int i = 0; i < SMF_NUM_DNN_MAX; i++) {
dnn[i] = { };
dnn[i] = {};
}
default_dnsv4.s_addr = INADDR_ANY;
default_dns_secv4.s_addr = INADDR_ANY;
......@@ -246,13 +256,13 @@ class smf_config {
num_ue_pool = 0;
num_paa6_pool = 0;
for (int i = 0; i < SMF_NUM_UE_POOL_MAX; i++) {
ue_pool_range_low[i] = { };
ue_pool_range_high[i] = { };
ue_pool_network[i] = { };
ue_pool_netmask[i] = { };
paa_pool6_prefix[i] = { };
paa_pool6_prefix_len[i] = { };
ue_pool_excluded[i] = { };
ue_pool_range_low[i] = {};
ue_pool_range_high[i] = {};
ue_pool_network[i] = {};
ue_pool_netmask[i] = {};
paa_pool6_prefix[i] = {};
paa_pool6_prefix_len[i] = {};
ue_pool_excluded[i] = {};
}
force_push_pco = true;
ue_mtu = 1500;
......@@ -283,18 +293,10 @@ class smf_config {
}
sbi_http2_port = 8080;
sbi_api_version = "v1";
}
;
};
~smf_config();
void lock() {
m_rw_lock.lock();
}
;
void unlock() {
m_rw_lock.unlock();
}
;
void lock() { m_rw_lock.lock(); };
void unlock() { m_rw_lock.unlock(); };
int load(const std::string &config_file);
int finalize();
void display();
......
This diff is collapsed.
......@@ -3,9 +3,9 @@
* 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
* 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
*
......@@ -32,54 +32,51 @@
#include <map>
//#include <mutex>
#include <shared_mutex>
#include <memory>
#include <shared_mutex>
#include <utility>
#include <vector>
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#include "3gpp_24.008.h"
#include "3gpp_29.274.h"
#include "3gpp_29.244.h"
#include "3gpp_29.503.h"
#include "3gpp_29.274.h"
#include "3gpp_29.502.h"
#include "3gpp_29.503.h"
#include "SmContextCreateData.h"
#include "SmContextCreateError.h"
#include "common_root_types.h"
#include "itti.hpp"
#include "msg_pfcp.hpp"
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#include "smf_event.hpp"
#include "smf_procedure.hpp"
#include "uint_generator.hpp"
#include "SmContextCreateData.h"
#include "SmContextCreateError.h"
#include "smf_event.hpp"
extern "C" {
#include "QOSRules.h"
#include "QOSFlowDescriptions.h"
#include "PDUSessionEstablishmentAccept.h"
#include "Ngap_PDUSessionAggregateMaximumBitRate.h"
#include "PDUSessionEstablishmentAccept.h"
#include "QOSFlowDescriptions.h"
#include "QOSRules.h"
}
namespace smf {
class smf_qos_flow {
public:
smf_qos_flow() {
clear();
}
smf_qos_flow() { clear(); }
void clear() {
ul_fteid = { };
dl_fteid = { };
pdr_id_ul = { };
pdr_id_dl = { };
precedence = { };
far_id_ul = { };
far_id_dl = { };
ul_fteid = {};
dl_fteid = {};
pdr_id_ul = {};
pdr_id_dl = {};
precedence = {};
far_id_ul = {};
far_id_dl = {};
released = false;
qos_profile = { };
qos_profile = {};
cause_value = 0;
}
......@@ -104,36 +101,32 @@ class smf_qos_flow {
*/
std::string toString() const;
pfcp::qfi_t qfi; //QoS Flow Identifier
pfcp::fteid_t ul_fteid; //fteid of UPF
pfcp::fteid_t dl_fteid; //fteid of AN
pfcp::pdr_id_t pdr_id_ul; // Packet Detection Rule ID, UL
pfcp::pdr_id_t pdr_id_dl; // Packet Detection Rule ID, DL
pfcp::qfi_t qfi; // QoS Flow Identifier
pfcp::fteid_t ul_fteid; // fteid of UPF
pfcp::fteid_t dl_fteid; // fteid of AN
pfcp::pdr_id_t pdr_id_ul; // Packet Detection Rule ID, UL
pfcp::pdr_id_t pdr_id_dl; // Packet Detection Rule ID, DL
pfcp::precedence_t precedence;
std::pair<bool, pfcp::far_id_t> far_id_ul; //FAR ID, UL
std::pair<bool, pfcp::far_id_t> far_id_dl; //FAR ID, DL
std::pair<bool, pfcp::far_id_t> far_id_ul; // FAR ID, UL
std::pair<bool, pfcp::far_id_t> far_id_dl; // FAR ID, DL
bool released; // finally seems necessary, TODO try to find heuristic ?
pdu_session_id_t pdu_session_id;
qos_profile_t qos_profile; //QoS profile
uint8_t cause_value; //cause
qos_profile_t qos_profile; // QoS profile
uint8_t cause_value; // cause
};
class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
public:
smf_pdu_session()
:
m_pdu_session_mutex() {
clear();
}
smf_pdu_session() : m_pdu_session_mutex() { clear(); }
void clear() {
ipv4 = false;
ipv6 = false;
ipv4_address.s_addr = INADDR_ANY;
ipv6_address = in6addr_any;
pdu_session_type = { };
pdu_session_type = {};
seid = 0;
up_fseid = { };
up_fseid = {};
qos_flows.clear();
released = false;
default_qfi.qfi = NO_QOS_FLOW_IDENTIFIER_ASSIGNED;
......@@ -141,7 +134,6 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
timer_T3590 = ITTI_INVALID_TIMER_ID;
timer_T3591 = ITTI_INVALID_TIMER_ID;
timer_T3592 = ITTI_INVALID_TIMER_ID;
}
smf_pdu_session(smf_pdu_session &b) = delete;
......@@ -193,7 +185,8 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
/*
* Get all QoS Flows associated with this PDU Session
* @param [std::vector<smf_qos_flow> &] flows: list of Flows associated with this session
* @param [std::vector<smf_qos_flow> &] flows: list of Flows associated with
* this session
* @return void
*/
void get_qos_flows(std::vector<smf_qos_flow> &flows);
......@@ -269,9 +262,11 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
upCnx_state_e get_upCnx_state() const;
// Called by GTPV2-C DELETE_SESSION_REQUEST
// deallocate_ressources is for releasing related-resources prior to the deletion of objects
// since shared_ptr is actually heavy used for handling objects, deletion of object instances cannot be always guaranteed
// when removing them from a collection, so that is why actually the deallocation of resources is not done in the destructor of objects.
// deallocate_ressources is for releasing related-resources prior to the
// deletion of objects since shared_ptr is actually heavy used for handling
// objects, deletion of object instances cannot be always guaranteed when
// removing them from a collection, so that is why actually the deallocation
// of resources is not done in the destructor of objects.
void deallocate_ressources(const std::string &dnn);
/*
......@@ -346,7 +341,8 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
/*
* Get all QoS Rules to be synchronised with UE
* @param [std::vector<QOSRulesIE> &]: qos_rules: List of QoS Rules to be synchronised with UE
* @param [std::vector<QOSRulesIE> &]: qos_rules: List of QoS Rules to be
* synchronised with UE
* @return void
*/
void get_qos_rules_to_be_synchronised(
......@@ -397,11 +393,13 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
*/
pdu_session_type_t get_pdu_session_type() const;
bool ipv4; // IP Address(es): IPv4 address and/or IPv6 prefix
bool ipv6; // IP Address(es): IPv4 address and/or IPv6 prefix
struct in_addr ipv4_address; // IP Address(es): IPv4 address and/or IPv6 prefix
struct in6_addr ipv6_address; // IP Address(es): IPv4 address and/or IPv6 prefix
pdu_session_type_t pdu_session_type; // IPv4, IPv6, IPv4v6 or Non-IP
bool ipv4; // IP Address(es): IPv4 address and/or IPv6 prefix
bool ipv6; // IP Address(es): IPv4 address and/or IPv6 prefix
struct in_addr
ipv4_address; // IP Address(es): IPv4 address and/or IPv6 prefix
struct in6_addr
ipv6_address; // IP Address(es): IPv4 address and/or IPv6 prefix
pdu_session_type_t pdu_session_type; // IPv4, IPv6, IPv4v6 or Non-IP
bool released; //(release access bearers request)
......@@ -418,36 +416,34 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
uint32_t pdu_session_id;
std::string amf_id;
pdu_session_status_e pdu_session_status;
upCnx_state_e upCnx_state; //N3 tunnel status (ACTIVATED, DEACTIVATED, ACTIVATING)
upCnx_state_e
upCnx_state; // N3 tunnel status (ACTIVATED, DEACTIVATED, ACTIVATING)
timer_id_t timer_T3590;
timer_id_t timer_T3591;
timer_id_t timer_T3592;
pfcp::qfi_t default_qfi; //Default QFI for this session
std::map<uint8_t, smf_qos_flow> qos_flows; // QFI <-> QoS Flow
std::map<uint8_t, QOSRulesIE> qos_rules; // QRI <-> QoS Rules
pfcp::qfi_t default_qfi; // Default QFI for this session
std::map<uint8_t, smf_qos_flow> qos_flows; // QFI <-> QoS Flow
std::map<uint8_t, QOSRulesIE> qos_rules; // QRI <-> QoS Rules
std::vector<uint8_t> qos_rules_to_be_synchronised;
std::vector<uint8_t> qos_rules_to_be_removed;
//5GSM parameters and capabilities
// 5GSM parameters and capabilities
uint8_t maximum_number_of_supported_packet_filters;
//TODO: 5GSM Capability (section 9.11.4.1@3GPP TS 24.501 V16.1.0)
//TODO: Integrity protection maximum data rate (section 9.11.4.7@@3GPP TS 24.501 V16.1.0)
uint8_t number_of_supported_packet_filters; //number_of_supported_packet_filters
// TODO: 5GSM Capability (section 9.11.4.1@3GPP TS 24.501 V16.1.0)
// TODO: Integrity protection maximum data rate (section 9.11.4.7@@3GPP
// TS 24.501 V16.1.0)
uint8_t
number_of_supported_packet_filters; // number_of_supported_packet_filters
util::uint_generator<uint32_t> qos_rule_id_generator;
// Shared lock
mutable std::shared_mutex m_pdu_session_mutex;
};
class session_management_subscription {
public:
session_management_subscription(snssai_t snssai)
:
single_nssai(snssai),
dnn_configurations(),
m_mutex() {
}
: single_nssai(snssai), dnn_configurations(), m_mutex() {}
/*
* Insert a DNN configuration into the subscription
......@@ -472,13 +468,15 @@ class session_management_subscription {
/*
* Verify whether DNN configuration with a given DNN exist
* @param [std::string &] dnn
* @return bool: return true if the configuration exist, otherwise return false
* @return bool: return true if the configuration exist, otherwise return
* false
*/
bool dnn_configuration(const std::string &dnn) const;
private:
snssai_t single_nssai;
std::map<std::string, std::shared_ptr<dnn_configuration_t>> dnn_configurations; //dnn <->dnn_configuration
std::map<std::string, std::shared_ptr<dnn_configuration_t>>
dnn_configurations; // dnn <->dnn_configuration
// Shared lock
mutable std::shared_mutex m_mutex;
......@@ -488,24 +486,11 @@ class session_management_subscription {
* Manage the DNN context
*/
class dnn_context {
public:
dnn_context()
:
m_context(),
in_use(false),
pdu_sessions(),
nssai() {
}
dnn_context() : m_context(), in_use(false), pdu_sessions(), nssai() {}
dnn_context(std::string dnn)
:
m_context(),
in_use(false),
pdu_sessions(),
nssai(),
dnn_in_use(dnn) {
}
: m_context(), in_use(false), pdu_sessions(), nssai(), dnn_in_use(dnn) {}
dnn_context(dnn_context &b) = delete;
/*
......@@ -519,7 +504,8 @@ class dnn_context {
/*
* Insert a PDU Session into the DNN context
* @param [std::shared_ptr<smf_pdu_session> &] sp: shared pointer to a PDU Session
* @param [std::shared_ptr<smf_pdu_session> &] sp: shared pointer to a PDU
* Session
* @return void
*/
void insert_pdu_session(std::shared_ptr<smf_pdu_session> &sp);
......@@ -527,11 +513,11 @@ class dnn_context {
/*
* Delete a PDU Session identified by its ID
* @param [const uint32_t] pdu_session_id
* @return bool: return true if the pdu session is deleted, otherwise, return false
* @return bool: return true if the pdu session is deleted, otherwise, return
* false
*/
bool remove_pdu_session(const uint32_t pdu_session_id);
/*
* Get number of pdu sessions associated with this context (dnn and Nssai)
* @param void
......@@ -547,24 +533,24 @@ class dnn_context {
std::string toString() const;
bool in_use;