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

Merge branch 'multiple_upf' into 'develop'

Multiple UPFs

See merge request !42
parents 6eecd52d 7d8b9f2d
......@@ -49,27 +49,21 @@ install_fb_folly_from_source(){
then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \
boost-devel \
libevent-devel \
double-conversion-devel \
glog-devel \
gflags-devel \
snappy-devel \
make \
lz4-devel \
zlib-devel \
binutils-devel \
jemalloc-devel \
openssl-devel \
pkg-config
openssl-devel
ret=$?;[[ $ret -ne 0 ]] && return $ret
elif [[ $OS_DISTRO == "ubuntu" ]]; then
$SUDO $INSTALLER install $OPTION \
g++ \
cmake \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
......@@ -78,12 +72,10 @@ install_fb_folly_from_source(){
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
wget \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
pkg-config
libjemalloc-dev
ret=$?;[[ $ret -ne 0 ]] && return $ret
fi
......@@ -101,7 +93,7 @@ install_fb_folly_from_source(){
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
$CMAKE . && \
$CMAKE . -DBUILD_GMOCK=OFF && \
make && \
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -149,4 +141,3 @@ install_fb_folly_from_source(){
echo_success "End of folly installation"
return 0
}
......@@ -67,6 +67,7 @@ install_fmt() {
fi
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -140,7 +141,11 @@ install_pistache_from_git() {
cd pistache && git checkout e18ed9baeb2145af6f9ea41246cf48054ffd9907
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \
-DPISTACHE_BUILD_EXAMPLES=false \
-DPISTACHE_BUILD_TESTS=false \
-DPISTACHE_BUILD_DOCS=false \
..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -151,9 +156,6 @@ install_pistache_from_git() {
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -274,7 +276,7 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
autoconf
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./configure --enable-asio-lib
./configure --enable-asio-lib --enable-lib-only
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -349,7 +351,6 @@ check_install_smf_deps() {
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Libraries
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
......@@ -378,7 +379,8 @@ check_install_smf_deps() {
nettle-dev \
libcurl4 \
net-tools \
pkg-config"
pkg-config \
libasan2"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
guile-devel \
......@@ -397,7 +399,8 @@ check_install_smf_deps() {
nettle-devel \
libcurl-devel \
python2 \
pkgconfig"
pkgconfig \
libasan"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
......
......@@ -103,6 +103,17 @@ esac
done
# If the repo workspace is shallow, unshallow it
NB_COMMITS=`git log --oneline | wc -l`
if [ $NB_COMMITS -eq 1 ]
then
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" > /dev/null 2>&1
echo "git remote update"
git remote update > /dev/null 2>&1
echo "git fetch --prune --unshallow"
git fetch --prune --unshallow > /dev/null 2>&1
fi
if [[ $TARGET_COMMIT_ID == "latest" ]]
then
TARGET_COMMIT_ID=`git log -n1 --pretty=format:%H origin/$TARGET_BRANCH`
......
......@@ -54,9 +54,8 @@ SMF =
IPV4_LIST = (
{RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.169.0.2 - 192.169.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.170.0.2 - 192.170.255.253";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "192.171.0.2 - 192.171.255.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
{RANGE = "10.10.10.2 - 10.10.10.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE.
);
IPV6_LIST = (
{PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE.
......@@ -69,9 +68,7 @@ SMF =
# IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6}
{DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1},
{DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1},
{DNN_NI = "apn2"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1},
{DNN_NI = "apn3"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 3; IPV6_POOL = -1},
{DNN_NI = "apn4"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 4; IPV6_POOL = -1}
{DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1}
);
# DNS address communicated to UEs
......@@ -117,12 +114,11 @@ SMF =
LOCAL_CONFIGURATION :
{
USE_LOCAL_CONFIGURATION = "yes";
SESSION_MANAGEMENT_SUBSCRIPTION_LIST = (
{ NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"},
{ NSSAI_SST = 222; NSSAI_SD = "123", DNN = "carrier.com", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
{ NSSAI_SST = 111; NSSAI_SD = "321", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1,
QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT",
QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "10Mbps", SESSION_AMBR_DL = "11Mbps"}
);
......
......@@ -118,7 +118,7 @@ void SMContextsCollectionApi::post_sm_contexts_handler(
} catch (nlohmann::detail::exception& e) {
Logger::smf_api_server().warn(
"Can not parse the json data (error: %s)!", e.what());
"Cannot parse the json data (error: %s)!", e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception& e) {
......
......@@ -80,7 +80,7 @@ void IndividualSMContextApiImpl::release_sm_context(
// Handle the itti_n11_release_sm_context_request message in smf_app
std::shared_ptr<itti_n11_release_sm_context_request> itti_msg =
std::make_shared<itti_n11_release_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smContextRef);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_release_sm_context_request(itti_msg);
......@@ -133,7 +133,7 @@ void IndividualSMContextApiImpl::update_sm_context(
// Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg =
std::make_shared<itti_n11_update_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smContextRef);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
......
......@@ -65,7 +65,7 @@ void NFStatusNotifyApiImpl::receive_nf_status_notification(
// Handle the message in smf_app
std::shared_ptr<itti_sbi_notification_data> itti_msg =
std::make_shared<itti_sbi_notification_data>(TASK_SMF_N11, TASK_SMF_APP);
std::make_shared<itti_sbi_notification_data>(TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->notification_msg = notification_msg;
itti_msg->http_version = 1;
......
......@@ -92,7 +92,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
// Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg =
std::make_shared<itti_n11_create_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id);
TASK_SMF_SBI, TASK_SMF_APP, promise_id);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 1;
m_smf_app->handle_pdu_session_create_sm_context_request(itti_msg);
......
......@@ -74,7 +74,7 @@ void SubscriptionsCollectionApiImpl::create_individual_subcription(
// Handle the message in smf_app
std::shared_ptr<itti_sbi_event_exposure_request> itti_msg =
std::make_shared<itti_sbi_event_exposure_request>(
TASK_SMF_N11, TASK_SMF_APP);
TASK_SMF_SBI, TASK_SMF_APP);
itti_msg->event_exposure = event_exposure;
itti_msg->http_version = 1;
......
......@@ -345,7 +345,7 @@ void smf_http2_server::create_sm_contexts_handler(
// Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg =
std::make_shared<itti_n11_create_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id);
TASK_SMF_SBI, TASK_SMF_APP, promise_id);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 2;
m_smf_app->handle_pdu_session_create_sm_context_request(itti_msg);
......@@ -410,7 +410,7 @@ void smf_http2_server::update_sm_context_handler(
// Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg =
std::make_shared<itti_n11_update_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smf_ref);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smf_ref);
itti_msg->req = sm_context_req_msg;
itti_msg->http_version = 2;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
......@@ -495,7 +495,7 @@ void smf_http2_server::release_sm_context_handler(
"request from AMF.");
std::shared_ptr<itti_n11_release_sm_context_request> itti_msg =
std::make_shared<itti_n11_release_sm_context_request>(
TASK_SMF_N11, TASK_SMF_APP, promise_id, smf_ref);
TASK_SMF_SBI, TASK_SMF_APP, promise_id, smf_ref);
itti_msg->req = sm_context_req_msg;
itti_msg->scid = smf_ref;
itti_msg->http_version = 2;
......
......@@ -34,23 +34,6 @@
#include <string>
#include <vector>
//------------------------------------------------------------------------------
// 10.5.1.3 Location Area Identification
//------------------------------------------------------------------------------
#define LOCATION_AREA_IDENTIFICATION_IE_TYPE 3
#define LOCATION_AREA_IDENTIFICATION_IE_MIN_LENGTH 6
#define LOCATION_AREA_IDENTIFICATION_IE_MAX_LENGTH 6
#define INVALID_LAC_0000 \
(uint16_t) 0x0000 /*!< \brief This LAC can be coded using a full \
hexadecimal representation except for the following \
reserved hexadecimal values: 0000, and FFFE. */
#define INVALID_LAC_FFFE \
(uint16_t) 0xFFFE /*!< \brief This LAC can be coded using a full \
hexadecimal representation except for the following \
reserved hexadecimal values: 0000, and FFFE. */
//------------------------------------------------------------------------------
// 10.5.6.3 Protocol configuration options
//------------------------------------------------------------------------------
......
......@@ -142,146 +142,6 @@ struct imsi_s {
};
typedef struct imsi_s imsi_t;
//-------------------------------------
// 8.4 Cause
enum cause_value_e {
/* Request / Initial message */
UNKNOWN_ERROR = -1,
LOCAL_DETACH = 2,
COMPLETE_DETACH = 3,
RAT_CHANGE_3GPP_TO_NON_3GPP = 4, ///< RAT changed from 3GPP to Non-3GPP
ISR_DEACTIVATION = 5,
ERROR_IND_FROM_RNC_ENB_SGSN = 6,
IMSI_DETACH_ONLY = 7,
REACTIVATION_REQUESTED = 8,
PDN_RECONNECTION_TO_THIS_APN_DISALLOWED = 9,
ACCESS_CHANGED_FROM_NON_3GPP_TO_3GPP = 10,
PDN_CONNECTION_INACTIVITY_TIMER_EXPIRES = 11,
PGW_NOT_RESPONDING = 12,
NETWORK_FAILURE = 13,
QOS_PARAMETER_MISMATCH = 14,
/* Acceptance in a Response/Triggered message */
REQUEST_ACCEPTED = 16,
REQUEST_ACCEPTED_PARTIALLY = 17,
NEW_PDN_TYPE_DUE_TO_NETWORK_PREFERENCE =
18, ///< New PDN type due to network preference
NEW_PDN_TYPE_DUE_TO_SINGLE_ADDRESS_BEARER_ONLY =
19, ///< New PDN type due to single address bearer only
/* Rejection in a Response triggered message. */
CONTEXT_NOT_FOUND = 64,
INVALID_MESSAGE_FORMAT = 65,
VERSION_NOT_SUPPORTED_BY_NEXT_PEER = 66,
INVALID_LENGTH = 67,
SERVICE_NOT_SUPPORTED = 68,
MANDATORY_IE_INCORRECT = 69,
MANDATORY_IE_MISSING = 70,
SYSTEM_FAILURE = 72,
NO_RESOURCES_AVAILABLE = 73,
SEMANTIC_ERROR_IN_THE_TFT_OPERATION = 74,
SYNTACTIC_ERROR_IN_THE_TFT_OPERATION = 75,
SEMANTIC_ERRORS_IN_PACKET_FILTER = 76,
SYNTACTIC_ERRORS_IN_PACKET_FILTER = 77,
MISSING_OR_UNKNOWN_APN = 78,
GRE_KEY_NOT_FOUND = 80,
RELOCATION_FAILURE = 81,
DENIED_IN_RAT = 82,
PREFERRED_PDN_TYPE_NOT_SUPPORTED = 83,
ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED = 84,
UE_CONTEXT_WITHOUT_TFT_ALREADY_ACTIVATED = 85,
PROTOCOL_TYPE_NOT_SUPPORTED = 86,
UE_NOT_RESPONDING = 87,
UE_REFUSES = 88,
SERVICE_DENIED = 89,
UNABLE_TO_PAGE_UE = 90,
NO_MEMORY_AVAILABLE = 91,
USER_AUTHENTICATION_FAILED = 92,
APN_ACCESS_DENIED_NO_SUBSCRIPTION = 93,
REQUEST_REJECTED = 94,
P_TMSI_SIGNATURE_MISMATCH = 95,
IMSI_IMEI_NOT_KNOWN = 96,
SEMANTIC_ERROR_IN_THE_TAD_OPERATION = 97,
SYNTACTIC_ERROR_IN_THE_TAD_OPERATION = 98,
REMOTE_PEER_NOT_RESPONDING = 100,
COLLISION_WITH_NETWORK_INITIATED_REQUEST = 101,
UNABLE_TO_PAGE_UE_DUE_TO_SUSPENSION = 102,
CONDITIONAL_IE_MISSING = 103,
APN_RESTRICTION_TYPE_INCOMPATIBLE_WITH_CURRENTLY_ACTIVE_PDN_CONNECTION = 104,
INVALID_OVERALL_LENGTH_OF_THE_TRIGGERED_RESPONSE_MESSAGE_AND_A_PIGGYBACKED_INITIAL_MESSAGE =
105,
DATA_FORWARDING_NOT_SUPPORTED = 106,
INVALID_REPLY_FROM_REMOTE_PEER = 107,
FALLBACK_TO_GTPV1 = 108,
INVALID_PEER = 109,
TEMPORARILY_REJECTED_DUE_TO_TAU_HO_PROCEDURE_IN_PROGRESS = 110,
MODIFICATIONS_NOT_LIMITED_TO_S1_U_BEARERS = 111,
REQUEST_REJECTED_FOR_PMIPv6_REASON = 112,
APN_CONGESTION = 113,
BEARER_HANDLING_NOT_SUPPORTED = 114,
UE_ALREADY_RE_ATTACHED = 115,
MULTIPLE_PDN_CONNECTIONS_FOR_A_GIVEN_APN_NOT_ALLOWED = 116,
TARGET_ACCESS_RESTRICTED_FOR_THE_SUBSCRIBER = 117,
MME_SGSN_REFUSES_DUE_TO_VPLMN_POLICY = 119,
GTP_C_ENTITY_CONGESTION = 120,
LATE_OVERLAPPING_REQUEST = 121,
TIMED_OUT_REQUEST = 122,
UE_IS_TEMPORARILY_NOT_REACHABLE_DUE_TO_POWER_SAVING = 123,
RELOCATION_FAILURE_DUE_TO_NAS_MESSAGE_REDIRECTION = 124,
UE_NOT_AUTHORISED_BY_OCS_OR_EXTERNAL_AAA_SERVER = 125,
MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED = 126,
REQUEST_REJECTED_DUE_TO_UE_CAPABILITY = 127,
S1_U_PATH_FAILURE = 128
};
typedef struct cause_s {
uint8_t cause_value;
uint8_t pce : 1;
uint8_t bce : 1;
uint8_t cs : 1;
uint8_t offending_ie_instance : 4;
uint8_t filler : 1;
uint8_t offending_ie_type;
uint16_t offending_ie_length;
} cause_t;
//------------------------------------------------------------------------------
// 8.5 recovery
// typedef struct recovery_s {
// uint8_t recovery;
//} recovery_t;
//------------------------------------------------------------------------------
// 8.6 Access Point Name
typedef struct apn_s {
std::string access_point_name;
} apn_t;
//------------------------------------------------------------------------------
// 8.7 Aggregate Maximum Bit Rate (AMBR)
typedef struct ambr_s {
uint32_t br_ul;
uint32_t br_dl;
} ambr_t;
//------------------------------------------------------------------------------
// 8.8 EPS Bearer ID (EBI)
#define EPS_BEARER_IDENTITY_UNASSIGNED (uint8_t) 0
#define EPS_BEARER_IDENTITY_RESERVED1 (uint8_t) 1
#define EPS_BEARER_IDENTITY_RESERVED2 (uint8_t) 2
#define EPS_BEARER_IDENTITY_RESERVED3 (uint8_t) 3
#define EPS_BEARER_IDENTITY_RESERVED4 (uint8_t) 4
#define EPS_BEARER_IDENTITY_FIRST (uint8_t) 5
#define EPS_BEARER_IDENTITY_LAST (uint8_t) 15
typedef struct ebi_s {
uint8_t ebi;
ebi_s() : ebi(EPS_BEARER_IDENTITY_UNASSIGNED) {}
ebi_s(const uint8_t& e) : ebi(e) {}
ebi_s(const struct ebi_s& e) : ebi(e.ebi) {}
inline bool operator==(const struct ebi_s& rhs) const {
return ebi == rhs.ebi;
}
inline bool operator!=(const struct ebi_s& rhs) const {
return !(ebi == rhs.ebi);
}
} ebi_t;
//-------------------------------------
// 8.9 IP Address
typedef struct ip_address_s {
......@@ -464,684 +324,12 @@ struct msisdn_s {
typedef struct msisdn_s msisdn_t;
//-------------------------------------
// 8.12 Indication
typedef struct indication_s {
uint8_t daf : 1;
uint8_t dtf : 1;
uint8_t hi : 1;
uint8_t dfi : 1;
uint8_t oi : 1;
uint8_t isrsi : 1;
uint8_t israi : 1;
uint8_t sgwci : 1;
uint8_t sqci : 1;
uint8_t uimsi : 1;
uint8_t cfsi : 1;
uint8_t crsi : 1;
uint8_t p : 1;
uint8_t pt : 1;
uint8_t si : 1;
uint8_t msv : 1;
uint8_t retloc : 1;
uint8_t pbic : 1;
uint8_t srni : 1;
uint8_t s6af : 1;
uint8_t s4af : 1;
uint8_t mbmdt : 1;
uint8_t israu : 1;
uint8_t ccrsi : 1;
uint8_t cprai : 1;
uint8_t arrl : 1;
uint8_t ppof : 1;
uint8_t ppon : 1;
uint8_t ppsi : 1;
uint8_t csfbi : 1;
uint8_t clii : 1;
uint8_t cpsr : 1;
uint8_t nsi : 1;
uint8_t uasi : 1;
uint8_t dtci : 1;
uint8_t bdwi : 1;
uint8_t psci : 1;
uint8_t pcri : 1;
uint8_t aosi : 1;
uint8_t aopi : 1;
uint8_t roaai : 1;
uint8_t epcosi : 1;
uint8_t cpopci : 1;
uint8_t pmtsmi : 1;
uint8_t s11tf : 1;
uint8_t pnsi : 1;
uint8_t unaccsi : 1;
uint8_t wpmsi : 1;
uint8_t spare1 : 1;
uint8_t spare2 : 1;
uint8_t spare3 : 1;
uint8_t eevrsi : 1;
uint8_t ltemui : 1;
uint8_t ltempi : 1;
uint8_t enbcpi : 1;
uint8_t tspcmi : 1;
} indication_t;
//-------------------------------------
// 8.13 Protocol Configuration Options (PCO)
//-------------------------------------
// 8.34 PDN Type
enum pdn_type_e {
PDN_TYPE_E_IPV4 = 1,
PDN_TYPE_E_IPV6 = 2,
PDN_TYPE_E_IPV4V6 = 3,
PDN_TYPE_E_NON_IP = 4,
};
static const std::vector<std::string> pdn_type_e2str = {"Error", "IPV4", "IPV6",
"IPV4V6", "NON_IP"};
typedef struct pdn_type_s {
uint8_t pdn_type;
pdn_type_s() : pdn_type(PDN_TYPE_E_IPV4) {}
pdn_type_s(const uint8_t& p) : pdn_type(p) {}
pdn_type_s(const struct pdn_type_s& p) : pdn_type(p.pdn_type) {}
bool operator==(const struct pdn_type_s& p) const {
return (p.pdn_type == pdn_type);
}
//------------------------------------------------------------------------------
bool operator==(const pdn_type_e& p) const { return (p == pdn_type); }
//------------------------------------------------------------------------------
const std::string& toString() const { return pdn_type_e2str.at(pdn_type); }
} pdn_type_t;
/*
//-------------------------------------
// 8.14 PDN Address Allocation (PAA)
struct paa_s {
pdn_type_t pdn_type;
uint8_t ipv6_prefix_length;
struct in6_addr ipv6_address;
struct in_addr ipv4_address;
//------------------------------------------------------------------------------
bool is_ip_assigned() {
switch (pdn_type.pdn_type) {
case PDN_TYPE_E_IPV4:
if (ipv4_address.s_addr)
return true;
return false;
break;
case PDN_TYPE_E_IPV6:
if (ipv6_address.s6_addr32[0] | ipv6_address.s6_addr32[1]
| ipv6_address.s6_addr32[2] | ipv6_address.s6_addr32[3])
return true;
return false;
break;
case PDN_TYPE_E_IPV4V6:
// TODO
if (ipv4_address.s_addr)
return true;
if (ipv6_address.s6_addr32[0] | ipv6_address.s6_addr32[1]
| ipv6_address.s6_addr32[2] | ipv6_address.s6_addr32[3])
return true;
return false;
break;
case PDN_TYPE_E_NON_IP:
default:
return false;
}
}
};
typedef struct paa_s paa_t;
*/
//-------------------------------------
// 8.15 Bearer Quality of Service (Bearer QoS)
#define PRE_EMPTION_CAPABILITY_ENABLED (0x0)
#define PRE_EMPTION_CAPABILITY_DISABLED (0x1)
#define PRE_EMPTION_VULNERABILITY_ENABLED (0x0)
#define PRE_EMPTION_VULNERABILITY_DISABLED (0x1)
typedef struct bearer_qos_s {
uint8_t spare1 : 1;
uint8_t pci : 1;
uint8_t pl : 4;
uint8_t spare2 : 1;
uint8_t pvi : 1;
uint8_t label_qci;
uint64_t maximum_bit_rate_for_uplink;
uint64_t maximum_bit_rate_for_downlink;
uint64_t guaranted_bit_rate_for_uplink;
uint64_t guaranted_bit_rate_for_downlink;
bool operator==(const struct bearer_qos_s& q) const {
return (
(q.label_qci == label_qci) && (q.pl == pl) && (q.pvi == pvi) &&
(q.pci == pci));
}
//------------------------------------------------------------------------------
std::string toString() const {
std::string s = {};
s.append("MBR UL=").append(std::to_string(maximum_bit_rate_for_uplink));
s.append(", MBR DL=").append(std::to_string(maximum_bit_rate_for_downlink));
s.append(", GBR UL=").append(std::to_string(guaranted_bit_rate_for_uplink));
s.append(", GBR DL=")
.append(std::to_string(guaranted_bit_rate_for_downlink));
s.append(", PCI=").append(std::to_string(pci));
s.append(", PL=").append(std::to_string(pl));
s.append(", PVI=").append(std::to_string(pvi));
s.append(", QCI=").append(std::to_string(label_qci));
return s;
}
} bearer_qos_t;
//-------------------------------------
// 8.16 Flow Quality of Service (Flow QoS)
typedef struct flow_qos_s {
uint8_t label_qci;
uint64_t maximum_bit_rate_for_uplink;
uint64_t maximum_bit_rate_for_downlink;
uint64_t guaranted_bit_rate_for_uplink;
uint64_t guaranted_bit_rate_for_downlink;