Commit 3861205e authored by Raphael Defosseux's avatar Raphael Defosseux

Merge remote-tracking branch 'origin/develop' into prepare_sep_2021_release

parents d1d79e94 188ad56d
......@@ -254,6 +254,98 @@ install_nlohmann_from_git() {
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_nghttp2_from_git() {
echo "Starting to install nghttp2"
if [ $1 -eq 0 ]; then
read -p "Do you want to install nghttp2 ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
g++ \
cmake \
binutils \
autoconf \
automake \
autotools-dev \
libtool \
pkg-config \
zlib1g-dev \
libcunit1-dev \
libssl-dev \
libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \
libjemalloc-dev libsystemd-dev cython python3-dev python-setuptools"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gcc-c++ \
binutils-devel \
autoconf \
automake \
$CMAKE \
make \
libtool \
pkg-config \
zlib-devel \
CUnit-devel \
openssl-devel \
libxml2-devel libev-devel libevent-devel jansson-devel c-ares-devel \
jemalloc-devel systemd-devel python3-Cython python3-devel python3-setuptools"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
GIT_URL=https://github.com/nghttp2/nghttp2.git
echo "Install nghttp2 from $GIT_URL"
pushd $OPENAIRCN_DIR/build/ext
echo "Downloading nghttp2"
if [[ $OPTION =~ [yY](es)* ]]
then
$SUDO rm -rf nghttp2
fi
git clone $GIT_URL
cd nghttp2
git checkout 43ba3125932c1d56addaeded2b7f62637af255cd
git submodule update --init
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
autoreconf -i
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
automake
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
autoconf
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./configure --enable-asio-lib --enable-lib-only
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO ldconfig
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "nghttp2 installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -387,6 +479,7 @@ check_install_amf_deps(){
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
libnghttp2 \
libtool \
libxml2 \
libxml2-devel \
......@@ -424,6 +517,9 @@ check_install_amf_deps(){
install_nlohmann_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nghttp2_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO ldconfig
return 0
......
......@@ -37,6 +37,10 @@ AMF_CONF[@SD_1@]='12'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_NGAP@]='wlo1'
AMF_CONF[@AMF_INTERFACE_NAME_FOR_N11@]='wlo1'
AMF_CONF[@EXTERNAL_AUSF@]='no'
AMF_CONF[@EXTERNAL_UDM@]='no'
AMF_CONF[@USE_FQDN_DNS@]='no'
AMF_CONF[@NF_REGISTRATION@]='no'
AMF_CONF[@SMF_SELECTION@]='no'
......
......@@ -74,6 +74,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/local/lib/libnghttp2_asio.so.1 .
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_chrono.so.1.67.0 .
......
......@@ -648,6 +648,8 @@ class HtmlReport():
logFileName = 'amf_' + variant + '_image_build.log'
nb_errors = 0
nb_warnings = 0
added_separator = False
if os.path.isfile(cwd + '/archives/' + logFileName):
if nfType == 'AMF':
section_start_pattern = 'build_amf --clean --Verbose --build-type Release --jobs'
......@@ -666,6 +668,9 @@ class HtmlReport():
if result is not None:
nb_errors += 1
result = re.search('warning:', line)
if result is not None:
nb_warnings += 1
result = re.search('error:|warning:', line)
if result is not None:
correctLine = re.sub("^.*/openair-amf","/openair-amf",line.strip())
wordsList = correctLine.split(None,2)
......@@ -675,11 +680,12 @@ class HtmlReport():
error_warning_status = re.sub(':',"", wordsList[1])
error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine)
if nb_warnings == 0 and variant == 'docker':
if not added_separator and variant == 'docker':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>Ubuntu 18</b></td></tr>\n'
if nb_warnings == 0 and variant == 'podman':
added_separator = True
if not added_separator and variant == 'podman':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>RHEL 8</b></td></tr>\n'
nb_warnings += 1
added_separator = True
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n'
logfile.close()
if nb_warnings == 0 and nb_errors == 0:
......
......@@ -94,6 +94,8 @@ COPY --from=oai-amf-builder /openair-amf/build/amf/build/amf oai_amf
COPY --from=oai-amf-builder /usr/lib64/libconfig++.so.9 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libboost_system.so.1.66.0 /usr/lib64/
COPY --from=oai-amf-builder /usr/local/lib64/libpistache.so.0 /usr/lib64/
COPY --from=oai-amf-builder /usr/local/lib/libnghttp2_asio.so /usr/lib64/
COPY --from=oai-amf-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/mysql/libmysqlclient.so.21 /usr/lib64/
COPY --from=oai-amf-builder /usr/lib64/libsctp.so.1 /usr/lib64/
COPY --from=oai-amf-builder /usr/local/lib64/libcpprest.so.2.10 /usr/lib64/
......
......@@ -95,6 +95,7 @@ COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/librtmp.so.1 .
COPY --from=oai-amf-builder /usr/lib/x86_64-linux-gnu/libpsl.so.5 .
WORKDIR /usr/local/lib
COPY --from=oai-amf-builder /usr/local/lib/libnghttp2_asio.so.1 .
COPY --from=oai-amf-builder /usr/lib/libboost_system.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_thread.so.1.67.0 .
COPY --from=oai-amf-builder /usr/lib/libboost_chrono.so.1.67.0 .
......
......@@ -72,11 +72,12 @@ AMF =
INTERFACE_NAME = "@AMF_INTERFACE_NAME_FOR_N11@"; # YOUR NETWORK CONFIG HERE
IPV4_ADDRESS = "read";
PORT = 80; # YOUR NETWORK CONFIG HERE
API_VERSION = "v1"; # YOUR AMF API VERSION CONFIG HERE
API_VERSION = "v1"; # YOUR AMF API VERSION CONFIG HERE
HTTP2_PORT = 8080; # YOUR NETWORK CONFIG HERE
SMF_INSTANCES_POOL = (
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_0@"; FQDN = "@SMF_FQDN_0@", SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; VERSION = "@SMF_HTTP_VERSION_1@"; FQDN = "@SMF_FQDN_1@", SELECTED = "false"} # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_0@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_0@"; PORT = "80"; HTTP2_PORT = 8080, VERSION = "@SMF_HTTP_VERSION_0@"; FQDN = "@SMF_FQDN_0@", SELECTED = "true"}, # YOUR SMF CONFIG HERE
{SMF_INSTANCE_ID = @SMF_INSTANCE_ID_1@; IPV4_ADDRESS = "@SMF_IPV4_ADDR_1@"; PORT = "80"; HTTP2_PORT = 8080, VERSION = "@SMF_HTTP_VERSION_1@"; FQDN = "@SMF_FQDN_1@", SELECTED = "false"} # YOUR SMF CONFIG HERE
);
};
......@@ -103,10 +104,11 @@ AMF =
# STRING, {"yes", "no"},
NF_REGISTRATION = "@NF_REGISTRATION@"; # Set to yes if AMF resgisters to an NRF
SMF_SELECTION = "@SMF_SELECTION@"; # Set to yes to enable SMF discovery and selection
EXTERNAL_AUSF = "@EXTERNAL_AUSF@"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "@EXTERNAL_UDM@"; # Set to yes if AMF works with an external UDM
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN
}
EXTERNAL_AUSF = "@EXTERNAL_AUSF@"; # Set to yes if AMF works with an external AUSF
EXTERNAL_UDM = "@EXTERNAL_UDM@"; # Set to yes if AMF works with an external UDM
USE_FQDN_DNS = "@USE_FQDN_DNS@"; # Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN
USE_HTTP2 = "no"; # Set to yes to enable HTTP2 for AMF server
}
AUTHENTICATION:
{
......
......@@ -55,9 +55,13 @@ file(GLOB AMF_src_files
${CMAKE_CURRENT_SOURCE_DIR}/amf_n1.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_n2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_n11.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_profile.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_statistics.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_statistics.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mysql_db.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_msg.cpp
${CMAKE_CURRENT_SOURCE_DIR}/amf_subscription.cpp
${SRC_TOP_DIR}/nas/msgs/*.cpp
${SRC_TOP_DIR}/nas/ies/*.cpp
${SRC_TOP_DIR}/nas/utils/*.c
......
......@@ -42,14 +42,13 @@
#include "amf_statistics.hpp"
#include "itti.hpp"
#include "ngap_app.hpp"
#include "comUt.hpp"
using namespace ngap;
using namespace nas;
using namespace amf_application;
using namespace config;
extern void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len);
extern amf_app* amf_app_inst;
extern itti_mw* itti_inst;
amf_n2* amf_n2_inst = nullptr;
......@@ -88,7 +87,7 @@ amf_app::amf_app(const amf_config& amf_cfg)
}
// Register to NRF
if (amf_cfg.enable_nf_registration) register_to_nrf();
if (amf_cfg.support_features.enable_nf_registration) register_to_nrf();
timer_id_t tid = itti_inst->timer_setup(
amf_cfg.statistics_interval, 0, TASK_AMF_APP,
......@@ -124,7 +123,7 @@ void amf_app_task(void*) {
amf_app_inst->handle_itti_message(ref(*m));
} break;
case TIME_OUT:
case TIME_OUT: {
if (itti_msg_timeout* to = dynamic_cast<itti_msg_timeout*>(msg)) {
switch (to->arg1_user) {
case TASK_AMF_APP_PERIODIC_STATISTICS:
......@@ -139,7 +138,14 @@ void amf_app_task(void*) {
to->arg1_user);
}
}
break;
} break;
case TERMINATE: {
if (itti_msg_terminate* terminate =
dynamic_cast<itti_msg_terminate*>(msg)) {
Logger::amf_n2().info("Received terminate message");
return;
}
} break;
default:
Logger::amf_app().info("no handler for msg type %d", msg->msg_type);
}
......@@ -235,6 +241,11 @@ bool amf_app::get_pdu_sessions_context(
return true;
}
//------------------------------------------------------------------------------
evsub_id_t amf_app::generate_ev_subscription_id() {
return evsub_id_generator.get_uid();
}
//------------------------------------------------------------------------------
void amf_app::handle_itti_message(
itti_n1n2_message_transfer_request& itti_msg) {
......@@ -264,7 +275,7 @@ void amf_app::handle_itti_message(
uint8_t nas[BUFFER_SIZE_1024];
int encoded_size = dl->encode2buffer(nas, BUFFER_SIZE_1024);
print_buffer("amf_app", "n1n2 transfer", nas, encoded_size);
comUt::print_buffer("amf_app", "n1n2 transfer", nas, encoded_size);
bstring dl_nas = blk2bstr(nas, encoded_size);
itti_downlink_nas_transfer* dl_msg =
......@@ -402,11 +413,139 @@ bool amf_app::generate_5g_guti(
return true;
}
//------------------------------------------------------------------------------
evsub_id_t amf_app::handle_event_exposure_subscription(
std::shared_ptr<itti_sbi_event_exposure_request> msg) {
Logger::amf_app().info(
"Handle an Event Exposure Subscription Request from a NF (HTTP version "
"%d)",
msg->http_version);
// Generate a subscription ID Id and store the corresponding information in a
// map (subscription id, info)
evsub_id_t evsub_id = generate_ev_subscription_id();
std::vector<amf_event_t> event_subscriptions =
msg->event_exposure.get_event_subs();
// store subscription
for (auto i : event_subscriptions) {
std::shared_ptr<amf_subscription> ss = std::make_shared<amf_subscription>();
ss.get()->sub_id = evsub_id;
// TODO:
if (msg->event_exposure.is_supi_is_set()) {
ss.get()->supi = msg->event_exposure.get_supi();
ss.get()->supi_is_set = true;
}
ss.get()->notify_correlation_id =
msg->event_exposure.get_notify_correlation_id();
ss.get()->notify_uri = msg->event_exposure.get_notify_uri();
ss.get()->nf_id = msg->event_exposure.get_nf_id();
ss.get()->ev_type = i.type;
add_event_subscription(evsub_id, i.type, ss);
ss.get()->display();
}
return evsub_id;
}
bool amf_app::handle_event_exposure_delete(const std::string& subscription_id) {
// verify Subscription ID
evsub_id_t sub_id = {};
try {
sub_id = std::stoi(subscription_id);
} catch (const std::exception& err) {
Logger::amf_app().warn(
"Received a Unsubscribe Request, couldn't find the corresponding "
"subscription");
return false;
}
return remove_event_subscription(sub_id);
}
//------------------------------------------------------------------------------
bool amf_app::handle_nf_status_notification(
std::shared_ptr<itti_sbi_notification_data>& msg,
oai::amf::model::ProblemDetails& problem_details, uint8_t& http_code) {
Logger::amf_app().info(
"Handle a NF status notification from NRF (HTTP version "
"%d)",
msg->http_version);
// TODO
return true;
}
//------------------------------------------------------------------------------
void amf_app::generate_uuid() {
amf_instance_id = to_string(boost::uuids::random_generator()());
}
//---------------------------------------------------------------------------------------------
void amf_app::add_event_subscription(
evsub_id_t sub_id, amf_event_type_t ev,
std::shared_ptr<amf_subscription> ss) {
Logger::amf_app().debug(
"Add an Event subscription (Sub ID %d, Event %d)", sub_id, (uint8_t) ev);
std::unique_lock lock(m_amf_event_subscriptions);
amf_event_subscriptions.emplace(std::make_pair(sub_id, ev), ss);
}
//---------------------------------------------------------------------------------------------
bool amf_app::remove_event_subscription(evsub_id_t sub_id) {
Logger::amf_app().debug("Remove an Event subscription (Sub ID %d)", sub_id);
std::unique_lock lock(m_amf_event_subscriptions);
for (auto it = amf_event_subscriptions.cbegin();
it != amf_event_subscriptions.cend();) {
if ((uint8_t) std::get<0>(it->first) == (uint32_t) sub_id) {
Logger::amf_app().debug(
"Found an event subscription (Event ID %d)",
(uint8_t) std::get<0>(it->first));
amf_event_subscriptions.erase(it++);
// it = amf_event_subscriptions.erase(it)
return true;
} else {
++it;
}
}
return false;
}
//---------------------------------------------------------------------------------------------
void amf_app::get_ee_subscriptions(
amf_event_type_t ev,
std::vector<std::shared_ptr<amf_subscription>>& subscriptions) {
for (auto const& i : amf_event_subscriptions) {
if ((uint8_t) std::get<1>(i.first) == (uint8_t) ev) {
Logger::amf_app().debug(
"Found an event subscription (Event ID %d, Event %d)",
(uint8_t) std::get<0>(i.first), (uint8_t) ev);
subscriptions.push_back(i.second);
}
}
}
//---------------------------------------------------------------------------------------------
void amf_app::get_ee_subscriptions(
evsub_id_t sub_id,
std::vector<std::shared_ptr<amf_subscription>>& subscriptions) {
for (auto const& i : amf_event_subscriptions) {
if (i.first.first == sub_id) {
subscriptions.push_back(i.second);
}
}
}
//---------------------------------------------------------------------------------------------
void amf_app::get_ee_subscriptions(
amf_event_type_t ev, std::string& supi,
std::vector<std::shared_ptr<amf_subscription>>& subscriptions) {
for (auto const& i : amf_event_subscriptions) {
if ((i.first.second == ev) && (i.second->supi == supi)) {
subscriptions.push_back(i.second);
}
}
}
//---------------------------------------------------------------------------------------------
void amf_app::generate_amf_profile() {
// generate UUID
......
This diff is collapsed.
This diff is collapsed.
......@@ -51,6 +51,7 @@
#define AMF_CONFIG_STRING_IPV4_ADDRESS "IPV4_ADDRESS"
#define AMF_CONFIG_STRING_PORT "PORT"
#define AMF_CONFIG_STRING_PPID "PPID"
#define AMF_CONFIG_STRING_SBI_HTTP2_PORT "HTTP2_PORT"
#define AMF_CONFIG_STRING_INTERFACE_N11 "N11"
#define AMF_CONFIG_STRING_SMF_INSTANCES_POOL "SMF_INSTANCES_POOL"
......@@ -105,6 +106,8 @@
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF "EXTERNAL_AUSF"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM "EXTERNAL_UDM"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS "USE_FQDN_DNS"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_HTTP2 "USE_HTTP2"
#define AMF_CONFIG_STRING_FQDN_DNS "FQDN"
using namespace libconfig;
......@@ -166,6 +169,7 @@ typedef struct {
int id;
std::string ipv4;
std::string port;
uint32_t http2_port;
std::string version;
bool selected;
std::string fqdn;
......@@ -185,6 +189,8 @@ class amf_config {
interface_cfg_t n11;
itti_cfg_t itti;
std::string sbi_api_version;
unsigned int sbi_http2_port;
unsigned int statistics_interval;
std::string AMF_Name;
guami_t guami;
......@@ -195,11 +201,15 @@ class amf_config {
auth_conf auth_para;
nas_conf_t nas_cfg;
std::vector<smf_inst_t> smf_pool;
bool enable_nf_registration;
bool enable_smf_selection;
bool enable_external_ausf;
bool enable_external_udm;
bool use_fqdn_dns;
struct {
bool enable_nf_registration;
bool enable_smf_selection;
bool enable_external_ausf;
bool enable_external_udm;
bool use_fqdn_dns;
bool use_http2;
} support_features;
struct {
struct in_addr ipv4_addr;
......
/*
* 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
*/
/*! \file amf_event.cpp
\brief
\author Shivam Gandhi
\company KCL
\date 2021
\email: shivam.gandhi@kcl.ac.uk
*/
#include "amf_event.hpp"
using namespace amf_application;
//------------------------------------------------------------------------------
bs2::connection amf_event::subscribe_ue_reachability_status(
const ue_reachability_status_sig_t::slot_type& sig) {
return ue_reachability_status.connect(sig);
}
/*
* 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
*/
/*! \file amf_event.hpp
\brief
\author Shivam Gandhi
\company KCL
\date 2021
\email: shivam.gandhi@kcl.ac.uk
*/
#include <boost/signals2.hpp>
namespace bs2 = boost::signals2;
#include "amf.hpp"
#include "amf_event_sig.hpp"
namespace amf_application {
class amf_event {
public:
amf_event(){};
amf_event(amf_event const&) = delete;
void operator=(amf_event const&) = delete;
static amf_event& get_instance() {
static amf_event instance;
return instance;
}
// class register/handle event
friend class amf_app;
friend class amf_n1;
friend class amf_profile;
/*
* Subscribe to UE Reachability Status Notification signal
* @param [const ue_reachability_status_sig_t::slot_type&] sig: slot_type
* parameter
* @return boost::signals2::connection: the connection between the signal and
* the slot
*/
bs2::connection subscribe_ue_reachability_status(
const ue_reachability_status_sig_t::slot_type& sig);
private:
ue_reachability_status_sig_t
ue_reachability_status; // Signal for UE Reachability Report
};
} // namespace amf_application
/*
* 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
*/
/*! \file amf_event_sig.hpp
\brief
\author Shivam Gandhi
\company KCL
\date 2021
\email: shivam.gandhi@kcl.ac.uk
*/
#ifndef FILE_SMF_EVENT_SIG_HPP_SEEN
#define FILE_SMF_EVENT_SIG_HPP_SEEN
#include <boost/signals2.hpp>
#include <string>
namespace bs2 = boost::signals2;
namespace amf_application {
// Signal for UE Reachability Report
// SUPI, HTTP version
typedef bs2::signal_type<
void(std::string, uint8_t),
bs2::keywords::mutex_type<bs2::dummy_mutex>>::type
ue_reachability_status_sig_t;
} // namespace amf_application
#endif
/*
* 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
*/
/*! \file amf_msg.cpp
\brief
\author Shivam Gandhi
\company KCL
\date 2021
\email: shivam.gandhi@kcl.ac.uk
*/
#include "amf_msg.hpp"
using namespace amf_application;
/*
* class: Event Exposure
*/
//-----------------------------------------------------------------------------
std::string event_exposure_msg::get_supi() const {
return m_supi;
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_supi(const std::string& value) {
m_supi = value;
m_supi_is_set = true;
}
//-----------------------------------------------------------------------------
bool event_exposure_msg::is_supi_is_set() const {
return m_supi_is_set;
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_sub_id(std::string const& value) {
m_sub_id = value;
m_sub_id_is_set = true;
}
//-----------------------------------------------------------------------------
std::string event_exposure_msg::get_sub_id() const {
return m_sub_id;
}
//-----------------------------------------------------------------------------
bool event_exposure_msg::is_sub_id_is_set() const {
return m_sub_id_is_set;
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_notify_uri(std::string const& value) {
m_notify_uri = value;
}
//-----------------------------------------------------------------------------
std::string event_exposure_msg::get_notify_uri() const {
return m_notify_uri;
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_notify_correlation_id(std::string const& value) {
m_notify_correlation_id = value;
}
//-----------------------------------------------------------------------------
std::string event_exposure_msg::get_notify_correlation_id() const {
return m_notify_correlation_id;
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_nf_id(std::string const& value) {
m_nf_id = value;
}
//-----------------------------------------------------------------------------
std::string event_exposure_msg::get_nf_id() const {
return m_nf_id;
}
//-----------------------------------------------------------------------------
std::vector<amf_event_t> event_exposure_msg::get_event_subs() const {
return m_event_list;
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_event_subs(std::vector<amf_event_t> const& value) {
m_event_list.clear();
for (auto it : value) {
m_event_list.push_back(it);
}
}
//-----------------------------------------------------------------------------
void event_exposure_msg::add_event_sub(amf_event_t const& value) {
m_event_list.push_back(value);
}
//-----------------------------------------------------------------------------
void event_exposure_msg::set_any_ue(bool value) {
m_any_ue = value;
}
/*
* class: Event Notification
*/
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void event_notification::set_notify_correlation_id(std::string const& value) {
m_notify_correlation_id = value;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_notify_correlation_id() const {
return m_notify_correlation_id;
}
//-----------------------------------------------------------------------------
void event_notification::set_subs_change_notify_correlation_id(
std::string const& value) {
m_subs_change_notify_correlation_id = value;
}
//-----------------------------------------------------------------------------
std::string event_notification::get_subs_change_notify_correlation_id() const {
return m_subs_change_notify_correlation_id;
}
//-----------------------------------------------------------------------------
void event_notification::add_report(const amf_event_report_t& report) {
m_report_list.push_back(report);
}
//-----------------------------------------------------------------------------
std::vector<amf_event_report_t> event_notification::get_reports() const {
return m_report_list;
}
//-----------------------------------------------------------------------------
void data_notification_msg::set_notification_event_type(
const std::string& type) {
notification_event_type = type;
}
//-----------------------------------------------------------------------------
void data_notification_msg::get_notification_event_type(
std::string& type) const {
type = notification_event_type;
}
//-----------------------------------------------------------------------------
void data_notification_msg::set_nf_instance_uri(const std::string& uri) {
nf_instance_uri = uri;
}
//-----------------------------------------------------------------------------
void data_notification_msg::get_nf_instance_uri(std::string& uri) const {
uri = nf_instance_uri;
}
//-----------------------------------------------------------------------------
void data_notification_msg::set_profile(const std::shared_ptr<nf_profile>& p) {
// profile = p;
}
//-----------------------------------------------------------------------------
void data_notification_msg::get_profile(std::shared_ptr<nf_profile>& p) const {
// p = profile;
}
/*
* 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
*/
/*! \file amf_msg.hpp
\brief
\author
\company
\date 2021
\email:
*/
#ifndef FILE_AMF_MSG_HPP_SEEN
#define FILE_AMF_MSG_HPP_SEEN
#include "amf.hpp"
#include "3gpp_29.518.h"
#include "amf_profile.hpp"
namespace amf_application {
class event_exposure_msg {
public:
std::string get_supi() const;
void set_supi(const std::string& value);
bool is_supi_is_set() const;
void set_sub_id(std::string const& value);
std::string get_sub_id() const;
bool is_sub_id_is_set() const;
void set_notify_uri(std::string const& value);
std::string get_notify_uri() const;
void set_notify_correlation_id(std::string const& value);
std::string get_notify_correlation_id() const;
void set_nf_id(std::string const& value);
std::string get_nf_id() const;
std::vector<amf_event_t> get_event_subs() const;
void set_event_subs(std::vector<amf_event_t> const& value);
void add_event_sub(amf_event_t const& value);
void set_any_ue(bool value);
private:
std::string m_sub_id; // m_SubId;
bool m_sub_id_is_set;
std::vector<amf_event_t> m_event_list; // eventList, Mandatory
std::string m_notify_uri; // eventNotifyUri, Mandatory
std::string m_notify_correlation_id; // notifyCorrelationId, Mandatory
std::string m_nf_id; // nfId, Mandatory
// supi_t m_supi; // Supi, Conditional
std::string m_supi;
bool m_supi_is_set;
bool m_any_ue; // anyUE, Conditional
// subsChangeNotifyUri:
// subsChangeNotifyCorrelationId:
// groupId:
// gpsi:
// pei:
// options: AmfEventMode
};
class event_notification {
public:
void set_notify_correlation_id(std::string const& value);
std::string get_notify_correlation_id() const;
void set_subs_change_notify_correlation_id(std::string const& value);
std::string get_subs_change_notify_correlation_id() const;
void add_report(const amf_event_report_t& report);
std::vector<amf_event_report_t> get_reports() const;
private:
std::string m_notify_correlation_id; // notifyCorrelationId
bool m_notify_correlation_is_set;
std::string
m_subs_change_notify_correlation_id; // SubsChangeNotifyCorrelationId;
bool m_subs_change_notify_correlation_id_is_set;
std::vector<amf_event_report_t> m_report_list; // Report List
bool m_report_list_is_set;
};
class data_notification_msg {
public:
void set_notification_event_type(const std::string& type);
void get_notification_event_type(std::string& type) const;
void set_nf_instance_uri(const std::string& uri);
void get_nf_instance_uri(std::string& uri) const;
void set_profile(const std::shared_ptr<amf_application::nf_profile>& p);
void get_profile(std::shared_ptr<amf_application::nf_profile>& p) const;
private:
std::string notification_event_type;
std::string nf_instance_uri;
// bool m_NfProfileIsSet;
// std::vector<ChangeItem> m_ProfileChanges;
// bool m_ProfileChangesIsSet;
};
} // namespace amf_application
#endif
This diff is collapsed.
......@@ -44,6 +44,7 @@
#include "mysql_db.hpp"
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
#include "amf_event.hpp"
namespace amf_application {
......@@ -160,7 +161,10 @@ class amf_n1 {
void set_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t state);
void get_5gmm_state(std::shared_ptr<nas_context> nc, _5gmm_state_t& state);
private: // nas message handlers
void handle_ue_reachability_status_change(
std::string supi, uint8_t http_version);
private:
void ue_initiate_de_registration_handle(
uint32_t ran_ue_ngap_id, long amf_ue_ngap_id, bstring nas);
void registration_request_handle(
......@@ -194,6 +198,10 @@ class amf_n1 {
// response message
void response_registration_reject_msg(
uint8_t cause_value, uint32_t ran_ue_ngap_id, long amf_ue_ngap_id);
// for Event Handling
amf_event event_sub;
bs2::connection ee_ue_reachability_status_connection;
};
} // namespace amf_application
......
This diff is collapsed.
......@@ -36,6 +36,7 @@
#include "AuthenticationInfo.h"
#include "UEAuthenticationCtx.h"
#include "itti_msg_n11.hpp"
#include "itti_msg_sbi.hpp"
#include "pdu_session_context.hpp"
namespace amf_application {
......@@ -53,6 +54,8 @@ class amf_n11 {
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_sbi_notify_subscribed_event& 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);
......@@ -67,11 +70,11 @@ class amf_n11 {
void curl_http_client(
std::string remoteUri, std::string jsonData, std::string n1SmMsg,
std::string n2SmMsg, std::string supi, uint8_t pdu_session_id,
uint32_t promise_id = 0);
uint8_t http_version = 1, uint32_t promise_id = 0);
void curl_http_client(
std::string remoteUri, std::string Method, std::string msgBody,
std::string& response);
std::string& response, uint8_t http_version = 1);
bool discover_smf(
std::string& smf_addr, std::string& smf_api_version,
......
......@@ -40,6 +40,7 @@
#include "PDUSessionResourceHandoverCommandTransfer.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "PduSessionResourceSetupRequest.hpp"
#include "PduSessionResourceModifyRequest.hpp"
#include "UEContextReleaseCommand.hpp"
#include "HandoverPreparationFailure.hpp"
#include "Paging.hpp"
......@@ -132,6 +133,13 @@ void amf_n2_task(void* args_p) {
dynamic_cast<itti_pdu_session_resource_setup_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case PDU_SESSION_RESOURCE_MODIFY_REQUEST: {
Logger::amf_n2().info(
"Received PDU_SESSION_RESOURCE_MODIFY_REQUEST message, handling");
itti_pdu_session_resource_modify_request* m =
dynamic_cast<itti_pdu_session_resource_modify_request*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case INITIAL_CONTEXT_SETUP_REQUEST: {
Logger::amf_n2().info(
"Encoding INITIAL CONTEXT SETUP REQUEST message, sending");
......@@ -205,6 +213,13 @@ void amf_n2_task(void* args_p) {
itti_paging* m = dynamic_cast<itti_paging*>(msg);
amf_n2_inst->handle_itti_message(ref(*m));
} break;
case TERMINATE: {
if (itti_msg_terminate* terminate =
dynamic_cast<itti_msg_terminate*>(msg)) {
Logger::amf_n2().info("Received terminate message");
return;
}
} break;
default:
Logger::amf_n2().info("No handler for msg type %d", msg->msg_type);
}
......@@ -1028,6 +1043,81 @@ void amf_n2::handle_itti_message(
free_wrapper((void**) &buffer);
}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(
itti_pdu_session_resource_modify_request& itti_msg) {
Logger::amf_n2().debug("Handle PDU Session Resource Modify Request ...");
if (!amf_n2_inst->is_ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id)) {
Logger::amf_n2().error(
"No UE NGAP context with ran_ue_ngap_id (%d)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<ue_ngap_context> unc = {};
unc = ran_ue_id_2_ue_ngap_context(itti_msg.ran_ue_ngap_id);
if (unc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal UE with ran_ue_ngap_id (0x%x)", itti_msg.ran_ue_ngap_id);
return;
}
std::shared_ptr<gnb_context> gc = {};
if (!is_assoc_id_2_gnb_context(unc.get()->gnb_assoc_id)) {
Logger::amf_n2().error(
"No existing gNG context with assoc_id (%d)", unc.get()->gnb_assoc_id);
return;
}
gc = assoc_id_2_gnb_context(unc.get()->gnb_assoc_id);
if (gc.get() == nullptr) {
Logger::amf_n2().error(
"Illegal gNB with assoc id (0x%x)", unc.get()->gnb_assoc_id);
return;
}
std::unique_ptr<PduSessionResourceModifyRequestMsg> modify_request_msg =
std::make_unique<PduSessionResourceModifyRequestMsg>();
modify_request_msg->setAmfUeNgapId(itti_msg.amf_ue_ngap_id);
modify_request_msg->setRanUeNgapId(itti_msg.ran_ue_ngap_id);
std::vector<PDUSessionResourceModifyRequestItem_t> list;
PDUSessionResourceModifyRequestItem_t item = {};
item.pduSessionId = itti_msg.pdu_session_id;
item.pduSessionResourceModifyRequestTransfer.buf =
(uint8_t*) bdata(itti_msg.n2sm);
item.pduSessionResourceModifyRequestTransfer.size = blength(itti_msg.n2sm);
item.s_nssai.sd = itti_msg.s_NSSAI.getSd();
item.s_nssai.sst = itti_msg.s_NSSAI.getSst();
uint8_t* nas_pdu = (uint8_t*) calloc(1, blength(itti_msg.nas) + 1);
memcpy(nas_pdu, (uint8_t*) bdata(itti_msg.nas), blength(itti_msg.nas));
nas_pdu[blength(itti_msg.nas)] = '\0';
item.pduSessionNAS_PDU = nas_pdu;
item.sizeofpduSessionNAS_PDU = blength(itti_msg.nas);
list.push_back(item);
modify_request_msg->setPduSessionResourceModifyRequestList(list);
size_t buffer_size = BUFFER_SIZE_512;
char* buffer = (char*) calloc(1, buffer_size);
int encoded_size = 0;
modify_request_msg->encode2buffer_new(buffer, encoded_size);
#if DEBUG_IS_ON
Logger::amf_n2().debug("N2 SM buffer data: ");
for (int i = 0; i < encoded_size; i++) printf("%02x ", (char) buffer[i]);
#endif
Logger::amf_n2().debug(" (%d bytes) \n", encoded_size);
bstring b = blk2bstr(buffer, encoded_size);
sctp_s_38412.sctp_send_msg(
gc.get()->sctp_assoc_id, unc.get()->sctp_stream_send, &b);
// free memory
free_wrapper((void**) &nas_pdu);
free_wrapper((void**) &buffer);
}
//------------------------------------------------------------------------------
void amf_n2::handle_itti_message(
itti_pdu_session_resource_release_command& itti_msg) {
......
......@@ -32,7 +32,6 @@
#include "DownlinkRANStatusTransfer.hpp"
#include "HandoverCommandMsg.hpp"
#include "HandoverRequest.hpp"
#include "PduSessionResourceReleaseCommand.hpp"
#include "amf.hpp"
#include "itti_msg_n2.hpp"
#include "ngap_app.hpp"
......@@ -53,11 +52,12 @@ class amf_n2 : public ngap::ngap_app {
void handle_itti_message(itti_dl_nas_transport& dl_nas_transport);
void handle_itti_message(itti_initial_context_setup_request& itti_msg);
void handle_itti_message(itti_pdu_session_resource_setup_request& itti_msg);
void handle_itti_message(itti_pdu_session_resource_modify_request& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
void handle_itti_message(itti_ue_context_release_request& itti_msg);
void handle_itti_message(itti_ue_context_release_complete& itti_msg);
void handle_itti_message(itti_ue_radio_capability_indication& itti_msg);
void handle_itti_message(itti_ue_context_release_command& itti_msg);
void handle_itti_message(itti_pdu_session_resource_release_command& itti_msg);
bool handle_itti_message(itti_handover_required& itti_msg);
void handle_itti_message(itti_handover_request_Ack& itti_msg);
void handle_itti_message(itti_handover_notify& itti_msg);
......
/*
* 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
*/
/*! \file amf_subscription.cpp
\brief
\author
\company
\date 2021
\email:
*/
#include "amf_subscription.hpp"
#include "logger.hpp"
#include "3gpp_conversions.hpp"
using namespace amf_application;
void amf_subscription::display() {
Logger::amf_app().debug("Subscription info");
Logger::amf_app().debug("\tSubscription ID: %d", (uint32_t) sub_id);
Logger::amf_app().debug(
"\tEvent type: %s", xgpp_conv::amf_event_type_to_string(ev_type).c_str());
if (supi_is_set) Logger::amf_app().debug("\tSUPI: %s", supi.c_str());
Logger::amf_app().debug(
"\tNotify Correlation ID: %s", notify_correlation_id.c_str());
Logger::amf_app().debug("\tNF ID: %s", nf_id.c_str());
};
/*
* 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
*/
/*! \file amf_subscription.hpp
\brief
\author Shivam Gandhi
\company KCL
\date 2021
\email: shivam.gandhi@kcl.ac.uk
*/
#include "3gpp_29.518.h"
#include "amf.hpp"
namespace amf_application {
/*
* Manage the Subscription Info
*/
class amf_subscription {
public:
amf_subscription()
: sub_id(),
ev_type(),
supi(),
notify_correlation_id(),
notify_uri(),
nf_id() {
supi_is_set = false;
}
void display();
evsub_id_t sub_id;
amf_event_type_t ev_type;
bool supi_is_set;
std::string supi;
std::string notify_correlation_id;
std::string notify_uri; // subsChangeNotifyUri ?
std::string nf_id;
};
} // namespace amf_application
/*
* 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 FILE_3GPP_29_500_SEEN
#define FILE_3GPP_29_500_SEEN
// SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e {
HTTP_RESPONSE_CODE_0 = 0,
HTTP_RESPONSE_CODE_200_OK = 200,
HTTP_RESPONSE_CODE_201_CREATED = 201,
HTTP_RESPONSE_CODE_202_ACCEPTED = 202,
HTTP_RESPONSE_CODE_204_UPDATED = 204,
HTTP_RESPONSE_CODE_BAD_REQUEST = 400,
HTTP_RESPONSE_CODE_UNAUTHORIZED = 401,
HTTP_RESPONSE_CODE_FORBIDDEN = 403,
HTTP_RESPONSE_CODE_NOT_FOUND = 404,
HTTP_RESPONSE_CODE_METHOD_NOT_ALLOWED = 405,
HTTP_RESPONSE_CODE_REQUEST_TIMEOUT = 408,
HTTP_RESPONSE_CODE_406_NOT_ACCEPTED = 406,
HTTP_RESPONSE_CODE_CONFLICT = 409,
HTTP_RESPONSE_CODE_GONE = 410,
HTTP_RESPONSE_CODE_LENGTH_REQUIRED = 411,
HTTP_RESPONSE_CODE_PRECONDITION_FAILED = 412,
HTTP_RESPONSE_CODE_PAYLOAD_TOO_LARGE = 413,
HTTP_RESPONSE_CODE_URI_TOO_LONG = 414,
HTTP_RESPONSE_CODE_UNSUPPORTED_MEDIA_TYPE = 415,
HTTP_RESPONSE_CODE_TOO_MANY_REQUESTS = 429,
HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR = 500,
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504
};
#endif
......@@ -4,8 +4,8 @@
* 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
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -22,8 +22,114 @@
#ifndef FILE_3GPP_29_518_SEEN
#define FILE_3GPP_29_518_SEEN
#include "amf.hpp"
#include <vector>
typedef enum amf_event_type_e {
AMF_EVENT_UNKNOWN = 0,
LOCATION_REPORT = 1,
PRESENCE_IN_AOI_REPORT = 2,
TIMEZONE_REPORT = 3,
ACCESS_TYPE_REPORT = 4,
REGISTRATION_STATE_REPORT = 5,
CONNECTIVITY_STATE_REPORT = 6,
REACHABILITY_REPORT = 7,
COMMUNICATION_FAILURE_REPORT = 8,
UES_IN_AREA_REPORT = 9,
SUBSCRIPTION_ID_CHANGE = 10,
SUBSCRIPTION_ID_ADDITION = 11,
LOSS_OF_CONNECTIVITY = 12
} amf_event_type_t;
static const std::vector<std::string> amf_event_type_e2str = {
"AMF_EVENT_UNKNOWN",
"LOCATION_REPORT",
"PRESENCE_IN_AOI_REPORT",
"TIMEZONE_REPORT",
"ACCESS_TYPE_REPORT",
"REGISTRATION_STATE_REPORT",
"CONNECTIVITY_STATE_REPORT",
"REACHABILITY_REPORT",
"COMMUNICATION_FAILURE_REPORT",
"UES_IN_AREA_REPORT",
"SUBSCRIPTION_ID_CHANGE",
"SUBSCRIPTION_ID_ADDITION",
"LOSS_OF_CONNECTIVITY"};
enum class notification_method_e {
PERIODIC = 1,
ONE_TIME = 2,
ON_EVENT_DETECTION = 3
};
static const std::vector<std::string> notification_method_e2str = {
"NOTIFICATION_METHOD_UNKNOWN", "PERIODIC", "ONE_TIME",
"ON_EVENT_DETECTION"};
typedef struct amf_event_s {
amf_event_type_t type;
// immediateFlag:
// areaList:
// locationFilterList:
// refId:
} amf_event_t;
typedef struct amf_event_state_s {
bool m_active;
int32_t m_remain_reports;
bool m_remain_reports_is_set;
int32_t m_remain_duration;
bool m_remain_duration_is_set;
} amf_event_state_t;
typedef enum ue_reachability_e {
UNREACHABLE = 1,
REACHABLE = 2,
REGULATORY_ONLY = 3
} ue_reachability_t;
typedef struct amf_event_report_s {
amf_event_type_t m_type; // Mandatory
amf_event_state_t m_state; // Mandatory
std::string m_TimeStamp; // Mandatory
ue_reachability_t m_reachability;
bool m_reachability_is_set;
std::string m_supi;
bool m_supi_is_set;
std::string m_subscription_id;
bool m_subscription_id_is_set;
bool m_any_ue;
bool m_any_ue_is_set;
/*
std::vector<AmfEventArea> m_AreaList;
bool m_AreaListIsSet;
int32_t m_RefId;
bool m_RefIdIsSet;
std::string m_Gpsi;
bool m_GpsiIsSet;
std::string m_Pei;
bool m_PeiIsSet;
UserLocation m_Location;
bool m_LocationIsSet;
std::string m_Timezone;
bool m_TimezoneIsSet;
std::vector<AccessType> m_AccessTypeList;
bool m_AccessTypeListIsSet;
std::vector<RmInfo> m_RmInfoList;
bool m_RmInfoListIsSet;
std::vector<CmInfo> m_CmInfoList;
bool m_CmInfoListIsSet;
//CommunicationFailure m_CommFailure;
// bool m_CommFailureIsSet;
// int32_t m_NumberOfUes;
// bool m_NumberOfUesIsSet;
// std::vector<_5GsUserStateInfo> m_r_5gsUserStateList;
// bool m_r_5gsUserStateListIsSet;
*/
} amf_event_report_t;
enum n1_n2_message_transfer_cause_e {
ATTEMPTING_TO_REACH_UE = 1,
N1_N2_TRANSFER_INITIATED = 2,
......
......@@ -20,6 +20,8 @@
################################################################################
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/utils/)
include_directories(${SRC_TOP_DIR}/utils/bstr)
include_directories(${SRC_TOP_DIR}/../build/ext/spdlog/include)
include_directories(${SRC_TOP_DIR}/common/unicode)
file(GLOB COMMON_SRC ${SRC_TOP_DIR}/common/conversions.cpp)
......@@ -27,4 +29,5 @@ file(GLOB COMMON_SRC ${SRC_TOP_DIR}/common/conversions.cpp)
add_library(3GPP_COMMON_TYPES STATIC
${SRC_TOP_DIR}/common/logger.cpp
${SRC_TOP_DIR}/common/conversions.cpp
${SRC_TOP_DIR}/common/comUt.cpp
)
......@@ -29,73 +29,9 @@
#define __AMF_HPP
#include "3gpp_23.003.h"
#include "3gpp_29.518.h"
/*
typedef struct {
std::string mcc;
std::string mnc;
uint32_t tac;
} plmn_t;
typedef struct s_nssai // section 28.4, TS23.003
{
uint8_t sST;
//uint32_t sD:24;
std::string sD;
s_nssai(const uint8_t &sst, const std::string sd)
:
sST(sst),
sD(sd) {
}
s_nssai()
:
sST(),
sD() {
}
s_nssai(const s_nssai &p)
:
sST(p.sST),
sD(p.sD) {
}
bool operator==(const struct s_nssai &s) const {
if ((s.sST == this->sST) && (s.sD.compare(this->sD) == 0)) {
return true;
} else {
return false;
}
}
} snssai_t;
*/
// SMF + AMF + 3GPP TS 29.571 (Common data)
enum class http_response_codes_e {
HTTP_RESPONSE_CODE_0 = 0,
HTTP_RESPONSE_CODE_200_OK = 200,
HTTP_RESPONSE_CODE_201_CREATED = 201,
HTTP_RESPONSE_CODE_202_ACCEPTED = 202,
HTTP_RESPONSE_CODE_204_UPDATED = 204,
HTTP_RESPONSE_CODE_BAD_REQUEST = 400,
HTTP_RESPONSE_CODE_UNAUTHORIZED = 401,
HTTP_RESPONSE_CODE_FORBIDDEN = 403,
HTTP_RESPONSE_CODE_NOT_FOUND = 404,
HTTP_RESPONSE_CODE_METHOD_NOT_ALLOWED = 405,
HTTP_RESPONSE_CODE_REQUEST_TIMEOUT = 408,
HTTP_RESPONSE_CODE_406_NOT_ACCEPTED = 406,
HTTP_RESPONSE_CODE_CONFLICT = 409,
HTTP_RESPONSE_CODE_GONE = 410,
HTTP_RESPONSE_CODE_LENGTH_REQUIRED = 411,
HTTP_RESPONSE_CODE_PRECONDITION_FAILED = 412,
HTTP_RESPONSE_CODE_PAYLOAD_TOO_LARGE = 413,
HTTP_RESPONSE_CODE_URI_TOO_LONG = 414,
HTTP_RESPONSE_CODE_UNSUPPORTED_MEDIA_TYPE = 415,
HTTP_RESPONSE_CODE_TOO_MANY_REQUESTS = 429,
HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR = 500,
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504
};
#include "string.h"
#include "inttypes.h"
#include "stdio.h"
// for CURL
constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
......@@ -109,7 +45,19 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
#define FUTURE_STATUS_TIMEOUT_MS 100
// Event Subscription IDs)
typedef uint32_t evsub_id_t;
#define EVSUB_ID_FMT "0x%" PRIx32
#define EVSUB_ID_SCAN_FMT SCNx32
#define INVALID_EVSUB_ID ((evsub_id_t) 0x00000000)
#define UNASSIGNED_EVSUB_ID ((evsub_id_t) 0x00000000)
constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
#define UE_AGGREGATE_MAXIMUM_BIT_RATE_DL 300000000
#define UE_AGGREGATE_MAXIMUM_BIT_RATE_UL 200000000
#define NAMF_COMMUNICATION_BASE "/namf-comm/"
#define NAMF_COMMUNICATION_N1N2_MESSAGE_TRANSFER_URL \
"/ue-contexts/{}/n1-n2-messages" // context id
#endif
/*
* 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
*/
/*! \file comUt.cpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
*/
#include "comUt.hpp"
#include "logger.hpp"
//------------------------------------------------------------------------------
void comUt::print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len) {
if (!app.compare("amf_app")) Logger::amf_app().debug(commit.c_str());
if (!app.compare("amf_n1")) Logger::amf_n1().debug(commit.c_str());
if (!app.compare("amf_server")) Logger::amf_server().debug(commit.c_str());
if (!app.compare("amf_n11")) Logger::amf_n11().debug(commit.c_str());
#if DEBUG_IS_ON
for (int i = 0; i < len; i++) printf("%x ", buf[i]);
printf("\n");
#endif
}
//------------------------------------------------------------------------------
void comUt::hexStr2Byte(const char* src, unsigned char* dest, int len) {
short i;
unsigned char hBy, lBy;
for (i = 0; i < len; i += 2) {
hBy = toupper(src[i]);
lBy = toupper(src[i + 1]);
if (hBy > 0x39)
hBy -= 0x37;
else
hBy -= 0x30;
if (lBy > 0x39)
lBy -= 0x37;
else
lBy -= 0x30;
dest[i / 2] = (hBy << 4) | lBy;
}
}
......@@ -33,36 +33,11 @@
#include "logger.hpp"
//------------------------------------------------------------------------------
void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len) {
if (!app.compare("amf_app")) Logger::amf_app().debug(commit.c_str());
if (!app.compare("amf_n1")) Logger::amf_n1().debug(commit.c_str());
if (!app.compare("amf_server")) Logger::amf_server().debug(commit.c_str());
if (!app.compare("amf_n11")) Logger::amf_n11().debug(commit.c_str());
#if DEBUG_IS_ON
for (int i = 0; i < len; i++) printf("%x ", buf[i]);
printf("\n");
#endif
}
//------------------------------------------------------------------------------
void hexStr2Byte(const char* src, unsigned char* dest, int len) {
short i;
unsigned char hBy, lBy;
for (i = 0; i < len; i += 2) {
hBy = toupper(src[i]);
lBy = toupper(src[i + 1]);
if (hBy > 0x39)
hBy -= 0x37;
else
hBy -= 0x30;
if (lBy > 0x39)
lBy -= 0x37;
else
lBy -= 0x30;
dest[i / 2] = (hBy << 4) | lBy;
}
}
class comUt {
public:
static void print_buffer(
const std::string app, const std::string commit, uint8_t* buf, int len);
static void hexStr2Byte(const char* src, unsigned char* dest, int len);
};
#endif
......@@ -153,3 +153,87 @@ std::string conv::toString(const struct in6_addr& in6addr) {
}
return s;
}
//------------------------------------------------------------------------------
void conv::convert_string_2_hex(
std::string& input_str, std::string& output_str) {
unsigned char* data = (unsigned char*) malloc(input_str.length() + 1);
memset(data, 0, input_str.length() + 1);
memcpy((void*) data, (void*) input_str.c_str(), input_str.length());
for (int i = 0; i < input_str.length(); i++) {
printf("%02x ", data[i]);
}
printf("\n");
char* datahex = (char*) malloc(input_str.length() * 2 + 1);
memset(datahex, 0, input_str.length() * 2 + 1);
for (int i = 0; i < input_str.length(); i++)
sprintf(datahex + i * 2, "%02x", data[i]);
output_str = reinterpret_cast<char*>(datahex);
}
//------------------------------------------------------------------------------
unsigned char* conv::format_string_as_hex(std::string str) {
unsigned int str_len = str.length();
unsigned char* datavalue = (unsigned char*) malloc(str_len / 2 + 1);
unsigned char* data = (unsigned char*) malloc(str_len + 1);
memset(data, 0, str_len + 1);
memcpy((void*) data, (void*) str.c_str(), str_len);
std::cout << "Data: " << data << " (" << str_len << " bytes)" << std::endl;
std::cout << "Data (formatted): \n";
for (int i = 0; i < str_len; i++) {
char datatmp[3] = {0};
memcpy(datatmp, &data[i], 2);
// Ensure both characters are hexadecimal
bool bBothDigits = true;
for (int j = 0; j < 2; ++j) {
if (!isxdigit(datatmp[j])) bBothDigits = false;
}
if (!bBothDigits) break;
// Convert two hexadecimal characters into one character
unsigned int nAsciiCharacter;
sscanf(datatmp, "%x", &nAsciiCharacter);
printf("%x ", nAsciiCharacter);
// Concatenate this character onto the output
datavalue[i / 2] = (unsigned char) nAsciiCharacter;
// Skip the next character
i++;
}
printf("\n");
free_wrapper((void**) &data);
return datavalue;
}
//------------------------------------------------------------------------------
char* conv::bstring2charString(bstring b) {
char* buf = (char*) calloc(1, blength(b) + 1);
uint8_t* value = (uint8_t*) bdata(b);
for (int i = 0; i < blength(b); i++) buf[i] = (char) value[i];
buf[blength(b)] = '\0';
free_wrapper((void**) &value);
return buf;
}
//------------------------------------------------------------------------------
void conv::msg_str_2_msg_hex(std::string msg, bstring& b) {
std::string msg_hex_str;
convert_string_2_hex(msg, msg_hex_str);
printf("tmp string: %s\n", msg_hex_str.c_str());
unsigned int msg_len = msg_hex_str.length();
char* data = (char*) malloc(msg_len + 1);
memset(data, 0, msg_len + 1);
memcpy((void*) data, (void*) msg_hex_str.c_str(), msg_len);
printf("data: %s\n", data);
uint8_t* msg_hex = (uint8_t*) malloc(msg_len / 2 + 1);
conv::ascii_to_hex(msg_hex, (const char*) data);
b = blk2bstr(msg_hex, (msg_len / 2));
}
......@@ -33,6 +33,14 @@
#include <string>
#include <iostream>
#include "bstrlib.h"
extern "C" {
#include "dynamic_memory_check.h"
}
/* Used to format an uint32_t containing an ipv4 address */
#define IN_ADDR_FMT "%u.%u.%u.%u"
#define PRI_IN_ADDR(aDDRESS) \
......@@ -55,5 +63,11 @@ class conv {
const uint8_t digit1, const uint8_t digit2, const uint8_t digit3);
static std::string mncToString(
const uint8_t digit1, const uint8_t digit2, const uint8_t digit3);
static void msg_str_2_msg_hex(std::string msg, bstring& b);
static char* bstring2charString(bstring b);
static unsigned char* format_string_as_hex(std::string str);
static void convert_string_2_hex(
std::string& input_str, std::string& output_str);
};
#endif /* FILE_CONVERSIONS_HPP_SEEN */
......@@ -40,6 +40,7 @@ typedef enum {
TASK_AMF_N1,
TASK_AMF_N11,
TASK_AMF_APP,
TASK_AMF_SBI,
AMF_SERVER,
TASK_MAX,
TASK_NONE,
......@@ -69,6 +70,7 @@ typedef enum {
ITTI_DL_NAS_TRANSPORT,
INITIAL_CONTEXT_SETUP_REQUEST,
PDU_SESSION_RESOURCE_SETUP_REQUEST,
PDU_SESSION_RESOURCE_MODIFY_REQUEST,
PDU_SESSION_RESOURCE_RELEASE_COMMAND,
UE_CONTEXT_RELEASE_REQUEST,
UE_CONTEXT_RELEASE_COMPLETE,
......@@ -84,6 +86,9 @@ typedef enum {
N11_UPDATE_NF_INSTANCE_REQUEST,
N11_UPDATE_NF_INSTANCE_RESPONSE,
N11_DEREGISTER_NF_INSTANCE,
SBI_EVENT_EXPOSURE_REQUEST,
SBI_NOTIFICATION_DATA,
SBI_NOTIFY_SUBSCRIBED_EVENT,
UE_CONTEXT_RELEASE_COMMAND,
NSMF_PDU_SESSION_RELEASE_SM_CTX,
HANDOVER_REQUIRED,
......
......@@ -67,9 +67,13 @@ class itti_n1n2_message_transfer_request : public itti_msg_amf_app {
itti_n1n2_message_transfer_request(
const task_id_t origin, const task_id_t destination)
: itti_msg_amf_app(N1N2_MESSAGE_TRANSFER_REQ, origin, destination) {
is_n2sm_set = false;
is_n1sm_set = false;
is_ppi_set = false;
is_n2sm_set = false;
is_n1sm_set = false;
is_ppi_set = false;
supi = {};
n2sm_info_type = {};
pdu_session_id = 0;
ppi = 0;
}
itti_n1n2_message_transfer_request(
const itti_n1n2_message_transfer_request& i)
......
......@@ -160,6 +160,22 @@ class itti_pdu_session_resource_setup_request : public itti_msg_n2 {
uint8_t pdu_session_id;
};
class itti_pdu_session_resource_modify_request : public itti_msg_n2 {
public:
itti_pdu_session_resource_modify_request(
const task_id_t origin, const task_id_t destination)
: itti_msg_n2(PDU_SESSION_RESOURCE_MODIFY_REQUEST, origin, destination) {}
itti_pdu_session_resource_modify_request(
const itti_pdu_session_resource_modify_request& i)
: itti_msg_n2(i) {}
bstring nas;
bstring n2sm;
uint32_t ran_ue_ngap_id;
long amf_ue_ngap_id;
uint8_t pdu_session_id;
S_NSSAI s_NSSAI;
};
class itti_pdu_session_resource_release_command : public itti_msg_n2 {
public:
itti_pdu_session_resource_release_command(
......
/*
* 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
*/
/*
* itti_msg_sbi.hpp
*
* Date: 2021
* Company KCL
* Author: shivam.gandhi@kcl.ac.uk
*/
#ifndef ITTI_MSG_SBI_HPP_INCLUDED_
#define ITTI_MSG_SBI_HPP_INCLUDED_
#include "itti_msg.hpp"
#include "pistache/http.h"
#include "amf_msg.hpp"
using namespace amf_application;
class itti_sbi_msg : public itti_msg {
public:
itti_sbi_msg(
const itti_msg_type_t msg_type, const task_id_t orig,
const task_id_t dest)
: itti_msg(msg_type, orig, dest) {}
itti_sbi_msg(const itti_sbi_msg& i) : itti_msg(i) {}
itti_sbi_msg(
const itti_sbi_msg& i, const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(i) {
origin = orig;
destination = dest;
}
};
//-----------------------------------------------------------------------------
class itti_sbi_event_exposure_request : public itti_sbi_msg {
public:
itti_sbi_event_exposure_request(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_EVENT_EXPOSURE_REQUEST, orig, dest),
event_exposure(),
http_version(1) {}
itti_sbi_event_exposure_request(const itti_sbi_event_exposure_request& i)
: itti_sbi_msg(i), event_exposure(i.event_exposure), http_version(1) {}
itti_sbi_event_exposure_request(
const itti_sbi_event_exposure_request& i, const task_id_t orig,
const task_id_t dest)
: itti_sbi_msg(i, orig, dest),
event_exposure(i.event_exposure),
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_EVENT_EXPOSURE_REQUEST"; };
event_exposure_msg event_exposure;
uint8_t http_version;
};
//-----------------------------------------------------------------------------
class itti_sbi_notification_data : public itti_sbi_msg {
public:
itti_sbi_notification_data(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NOTIFICATION_DATA, orig, dest),
notification_msg(),
http_version(1) {}
itti_sbi_notification_data(const itti_sbi_notification_data& i)
: itti_sbi_msg(i),
notification_msg(i.notification_msg),
http_version(1) {}
itti_sbi_notification_data(
const itti_sbi_notification_data& i, const task_id_t orig,
const task_id_t dest)
: itti_sbi_msg(i, orig, dest),
notification_msg(i.notification_msg),
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_NOTIFICATION_DATA"; };
data_notification_msg notification_msg;
uint8_t http_version;
};
//-----------------------------------------------------------------------------
class itti_sbi_notify_subscribed_event : public itti_sbi_msg {
public:
itti_sbi_notify_subscribed_event(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NOTIFY_SUBSCRIBED_EVENT, orig, dest),
notif_id(),
http_version() {}
itti_sbi_notify_subscribed_event(const itti_sbi_notify_subscribed_event& i)
: itti_sbi_msg(i), notif_id(i.notif_id), http_version(i.http_version) {}
itti_sbi_notify_subscribed_event(
const itti_sbi_notify_subscribed_event& i, const task_id_t orig,
const task_id_t dest)
: itti_sbi_msg(i, orig, dest),
notif_id(i.notif_id),
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_NOTIFY_SUBSCRIBED_EVENT"; };
std::string notif_id;
std::vector<amf_application::event_notification> event_notifs;
uint8_t http_version;
};
#endif /* ITTI_MSG_SBI_HPP_INCLUDED_ */
......@@ -53,8 +53,8 @@ asn_TYPE_member_t asn_MBR_Ngap_PDUSessionResourceModifyItemModRes_1[] = {
0,
0, /* No default value */
"pDUSessionID"},
{ATF_POINTER,
2,
{ATF_NOFLAGS,
0,
offsetof(
struct Ngap_PDUSessionResourceModifyItemModRes,
pDUSessionResourceModifyResponseTransfer),
......@@ -80,8 +80,7 @@ asn_TYPE_member_t asn_MBR_Ngap_PDUSessionResourceModifyItemModRes_1[] = {
0, /* No default value */
"iE-Extensions"},
};
static const int asn_MAP_Ngap_PDUSessionResourceModifyItemModRes_oms_1[] = {1,
2};
static const int asn_MAP_Ngap_PDUSessionResourceModifyItemModRes_oms_1[] = {2};
static const ber_tlv_tag_t
asn_DEF_Ngap_PDUSessionResourceModifyItemModRes_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))};
......@@ -100,7 +99,7 @@ asn_SEQUENCE_specifics_t
3, /* Count of tags in the map */
asn_MAP_Ngap_PDUSessionResourceModifyItemModRes_oms_1, /* Optional
members */
2,
1,
0, /* Root/Additions */
3, /* First extension addition */
};
......
......@@ -26,8 +26,8 @@ struct Ngap_ProtocolExtensionContainer;
/* Ngap_PDUSessionResourceModifyItemModRes */
typedef struct Ngap_PDUSessionResourceModifyItemModRes {
Ngap_PDUSessionID_t pDUSessionID;
OCTET_STRING_t* pDUSessionResourceModifyResponseTransfer; /* OPTIONAL */
struct Ngap_ProtocolExtensionContainer* iE_Extensions; /* OPTIONAL */
OCTET_STRING_t pDUSessionResourceModifyResponseTransfer;
struct Ngap_ProtocolExtensionContainer* iE_Extensions; /* OPTIONAL */
/*
* This type is extensible,
* possible extensions are below.
......
......@@ -55,7 +55,7 @@ bool NAS_PDU::decodefromoctetstring(Ngap_NAS_PDU_t& m_naspdu) {
}
//------------------------------------------------------------------------------
bool NAS_PDU::getNasPdu(uint8_t*& buffer, size_t& size) {
bool NAS_PDU::getNasPdu(uint8_t*& buffer, size_t& size) const {
buffer = (uint8_t*) naspdubuffer;
size = buffersize;
if (!naspdubuffer) return false;
......
......@@ -42,7 +42,7 @@ class NAS_PDU {
bool encode2octetstring(Ngap_NAS_PDU_t&);
bool decodefromoctetstring(Ngap_NAS_PDU_t&);
bool getNasPdu(uint8_t*& buffer, size_t& size);
bool getNasPdu(uint8_t*& buffer, size_t& size) const;
void setNasPdu(uint8_t* buffer, size_t size);
private:
......
......@@ -102,6 +102,20 @@ typedef struct {
OCTET_STRING_t pduSessionResourceSetupRequestTransfer;
} PDUSessionResourceSetupRequestItem_t;
typedef struct {
uint8_t pduSessionId;
uint8_t* pduSessionNAS_PDU;
size_t sizeofpduSessionNAS_PDU;
S_Nssai s_nssai;
OCTET_STRING_t pduSessionResourceModifyRequestTransfer;
} PDUSessionResourceModifyRequestItem_t;
typedef struct {
uint8_t pduSessionId;
OCTET_STRING_t pduSessionResourceModifyResponseTransfer;
OCTET_STRING_t pduSessionResourceModifyUnsuccessfulTransfer;
} PDUSessionResourceModifyResponseItem_t;
// section 9.2.1.3 PDU Session Resource Release Command (3GPP TS 38.413 V16.0.0
// (2019-12))
typedef struct {
......
/*
* 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceModifyItemModReq.hpp"
#include <iostream>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceModifyItemModReq::PDUSessionResourceModifyItemModReq() {
nAS_PDU = nullptr;
}
//------------------------------------------------------------------------------
PDUSessionResourceModifyItemModReq::~PDUSessionResourceModifyItemModReq() {}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyItemModReq::setPDUSessionResourceModifyItemModReq(
const PDUSessionID& m_pDUSessionID, const NAS_PDU& m_nAS_PDU,
const OCTET_STRING_t m_pDUSessionResourceModifyRequestTransfer,
const S_NSSAI& m_s_NSSAI) {
pDUSessionID = m_pDUSessionID;
uint8_t* nas_buf = nullptr;
size_t nas_len = 0;
m_nAS_PDU.getNasPdu(nas_buf, nas_len);
if (!nAS_PDU) nAS_PDU = new NAS_PDU();
nAS_PDU->setNasPdu(nas_buf, nas_len);
pDUSessionResourceModifyRequestTransfer =
m_pDUSessionResourceModifyRequestTransfer;
s_NSSAI->setSd(m_s_NSSAI.getSd());
s_NSSAI->setSst(m_s_NSSAI.getSst());
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyItemModReq::
encode2PDUSessionResourceModifyItemModReq(
Ngap_PDUSessionResourceModifyItemModReq_t&
pduSessionResourceModifyItemModReq) {
if (!pDUSessionID.encode2PDUSessionID(
pduSessionResourceModifyItemModReq.pDUSessionID))
return false;
if (nAS_PDU) {
pduSessionResourceModifyItemModReq.nAS_PDU =
(Ngap_NAS_PDU_t*) calloc(1, sizeof(Ngap_NAS_PDU_t));
if (!pduSessionResourceModifyItemModReq.nAS_PDU) return false;
if (!nAS_PDU->encode2octetstring(
*pduSessionResourceModifyItemModReq.nAS_PDU)) {
if (pduSessionResourceModifyItemModReq.nAS_PDU != nullptr)
free(pduSessionResourceModifyItemModReq.nAS_PDU);
return false;
}
}
pduSessionResourceModifyItemModReq.pDUSessionResourceModifyRequestTransfer =
pDUSessionResourceModifyRequestTransfer;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyItemModReq::
decodefromPDUSessionResourceModifyItemModReq(
Ngap_PDUSessionResourceModifyItemModReq_t&
pduSessionResourceModifyItemModReq) {
if (!pDUSessionID.decodefromPDUSessionID(
pduSessionResourceModifyItemModReq.pDUSessionID))
return false;
if (pduSessionResourceModifyItemModReq.nAS_PDU) {
nAS_PDU = new NAS_PDU();
if (!nAS_PDU->decodefromoctetstring(
*pduSessionResourceModifyItemModReq.nAS_PDU))
return false;
}
pDUSessionResourceModifyRequestTransfer =
pduSessionResourceModifyItemModReq
.pDUSessionResourceModifyRequestTransfer;
return true;
}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyItemModReq::getPDUSessionResourceModifyItemModReq(
PDUSessionID& m_pDUSessionID, NAS_PDU& m_nAS_PDU,
OCTET_STRING_t& m_pDUSessionResourceModifyRequestTransfer,
S_NSSAI& m_s_NSSAI) {
m_pDUSessionID = pDUSessionID;
m_nAS_PDU = *nAS_PDU;
m_pDUSessionResourceModifyRequestTransfer =
pDUSessionResourceModifyRequestTransfer;
m_s_NSSAI = *s_NSSAI;
}
} // 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_MODIFY_ITEM_MOD_REQ_H_
#define _PDU_SESSION_RESOURCE_MODIFY_ITEM_MOD_REQ_H_
#include "NAS-PDU.hpp"
#include "PDUSessionID.hpp"
#include "S-NSSAI.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceModifyItemModReq.h"
}
namespace ngap {
class PDUSessionResourceModifyItemModReq {
public:
PDUSessionResourceModifyItemModReq();
virtual ~PDUSessionResourceModifyItemModReq();
void setPDUSessionResourceModifyItemModReq(
const PDUSessionID& m_pDUSessionID, const NAS_PDU& m_nAS_PDU,
const OCTET_STRING_t m_pDUSessionResourceModifyRequestTransfer,
const S_NSSAI& m_s_NSSAI);
void getPDUSessionResourceModifyItemModReq(
PDUSessionID& m_pDUSessionID, NAS_PDU& m_nAS_PDU,
OCTET_STRING_t& m_pDUSessionResourceModifyRequestTransfer,
S_NSSAI& m_s_NSSAI);
bool encode2PDUSessionResourceModifyItemModReq(
Ngap_PDUSessionResourceModifyItemModReq_t&
pduSessionResourceModifyItemModReq);
bool decodefromPDUSessionResourceModifyItemModReq(
Ngap_PDUSessionResourceModifyItemModReq_t&
pduSessionResourceModifyItemModReq);
private:
PDUSessionID pDUSessionID;
NAS_PDU* nAS_PDU; // Optional
OCTET_STRING_t pDUSessionResourceModifyRequestTransfer;
S_NSSAI* s_NSSAI; // Optional
};
} // namespace ngap
#endif
/*
* 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceModifyItemModRes.hpp"
#include <iostream>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceModifyItemModRes::PDUSessionResourceModifyItemModRes() {}
//------------------------------------------------------------------------------
PDUSessionResourceModifyItemModRes::~PDUSessionResourceModifyItemModRes() {}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyItemModRes::setPDUSessionResourceModifyItemModRes(
const PDUSessionID& m_pDUSessionID,
const OCTET_STRING_t m_pDUSessionResourceModifyResponseTransfer) {
pDUSessionID = m_pDUSessionID;
pDUSessionResourceModifyResponseTransfer =
m_pDUSessionResourceModifyResponseTransfer;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyItemModRes::
encode2PDUSessionResourceModifyItemModRes(
Ngap_PDUSessionResourceModifyItemModRes_t&
pduSessionResourceModifyItemModReq) {
if (!pDUSessionID.encode2PDUSessionID(
pduSessionResourceModifyItemModReq.pDUSessionID))
return false;
pduSessionResourceModifyItemModReq.pDUSessionResourceModifyResponseTransfer =
pDUSessionResourceModifyResponseTransfer;
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyItemModRes::
decodefromPDUSessionResourceModifyItemModRes(
Ngap_PDUSessionResourceModifyItemModRes_t&
pduSessionResourceModifyItemModReq) {
if (!pDUSessionID.decodefromPDUSessionID(
pduSessionResourceModifyItemModReq.pDUSessionID))
return false;
pDUSessionResourceModifyResponseTransfer =
pduSessionResourceModifyItemModReq
.pDUSessionResourceModifyResponseTransfer;
return true;
}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyItemModRes::getPDUSessionResourceModifyItemModRes(
PDUSessionID& m_pDUSessionID,
OCTET_STRING_t& m_pDUSessionResourceModifyResponseTransfer) {
m_pDUSessionID = pDUSessionID;
m_pDUSessionResourceModifyResponseTransfer =
pDUSessionResourceModifyResponseTransfer;
}
} // 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_MODIFY_ITEM_MOD_RES_H_
#define _PDU_SESSION_RESOURCE_MODIFY_ITEM_MOD_RES_H_
#include "NAS-PDU.hpp"
#include "PDUSessionID.hpp"
#include "S-NSSAI.hpp"
extern "C" {
#include "Ngap_PDUSessionResourceModifyItemModRes.h"
}
namespace ngap {
class PDUSessionResourceModifyItemModRes {
public:
PDUSessionResourceModifyItemModRes();
virtual ~PDUSessionResourceModifyItemModRes();
void setPDUSessionResourceModifyItemModRes(
const PDUSessionID& m_pDUSessionID,
const OCTET_STRING_t m_pDUSessionResourceModifyResponseTransfer);
void getPDUSessionResourceModifyItemModRes(
PDUSessionID& m_pDUSessionID,
OCTET_STRING_t& m_pDUSessionResourceModifyResponseTransfer);
bool encode2PDUSessionResourceModifyItemModRes(
Ngap_PDUSessionResourceModifyItemModRes_t&
pduSessionResourceModifyItemModRes);
bool decodefromPDUSessionResourceModifyItemModRes(
Ngap_PDUSessionResourceModifyItemModRes_t&
pduSessionResourceModifyItemModRes);
private:
PDUSessionID pDUSessionID;
OCTET_STRING_t pDUSessionResourceModifyResponseTransfer; // Optional
};
} // namespace ngap
#endif
/*
* 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceModifyListModReq.hpp"
#include <iostream>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceModifyListModReq::PDUSessionResourceModifyListModReq() {}
//------------------------------------------------------------------------------
PDUSessionResourceModifyListModReq::~PDUSessionResourceModifyListModReq() {}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyListModReq::setPDUSessionResourceModifyListModReq(
const std::vector<PDUSessionResourceModifyItemModReq>&
m_pduSessionResourceModifyListModReq) {
pduSessionResourceModifyListModReq = m_pduSessionResourceModifyListModReq;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyListModReq::
encode2PDUSessionResourceModifyListModReq(
Ngap_PDUSessionResourceModifyListModReq_t&
m_pduSessionResourceModifyListModReq) {
for (auto pdu : pduSessionResourceModifyListModReq) {
Ngap_PDUSessionResourceModifyItemModReq_t* request =
(Ngap_PDUSessionResourceModifyItemModReq_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceModifyItemModReq_t));
if (!request) return false;
if (!pdu.encode2PDUSessionResourceModifyItemModReq(*request)) return false;
if (ASN_SEQUENCE_ADD(&m_pduSessionResourceModifyListModReq.list, request) !=
0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyListModReq::
decodefromPDUSessionResourceModifyListModReq(
Ngap_PDUSessionResourceModifyListModReq_t&
pduSessionResourceSetupListSUReq) {
uint32_t numberofPDUSessions = pduSessionResourceSetupListSUReq.list.count;
for (int i = 0; i < numberofPDUSessions; i++) {
PDUSessionResourceModifyItemModReq pduSessionResourceModifyItemModReq = {};
if (!pduSessionResourceModifyItemModReq
.decodefromPDUSessionResourceModifyItemModReq(
*pduSessionResourceSetupListSUReq.list.array[i]))
return false;
pduSessionResourceModifyListModReq.push_back(
pduSessionResourceModifyItemModReq);
}
return true;
}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyListModReq::getPDUSessionResourceModifyListModReq(
std::vector<PDUSessionResourceModifyItemModReq>&
m_pduSessionResourceModifyListModReq) {
m_pduSessionResourceModifyListModReq = pduSessionResourceModifyListModReq;
}
} // 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_MODIFY_LIST_MOD_REQ_H_
#define _PDU_SESSION_RESOURCE_MODIFY_LIST_MOD_REQ_H_
#include "PDUSessionResourceModifyItemModReq.hpp"
#include <vector>
extern "C" {
#include "Ngap_PDUSessionResourceModifyListModReq.h"
}
namespace ngap {
class PDUSessionResourceModifyListModReq {
public:
PDUSessionResourceModifyListModReq();
virtual ~PDUSessionResourceModifyListModReq();
void setPDUSessionResourceModifyListModReq(
const std::vector<PDUSessionResourceModifyItemModReq>&
m_pduSessionResourceModifyListModReq);
void getPDUSessionResourceModifyListModReq(
std::vector<PDUSessionResourceModifyItemModReq>&
m_pduSessionResourceModifyListModReq);
bool encode2PDUSessionResourceModifyListModReq(
Ngap_PDUSessionResourceModifyListModReq_t&
m_pduSessionResourceModifyListModReq);
bool decodefromPDUSessionResourceModifyListModReq(
Ngap_PDUSessionResourceModifyListModReq_t&
m_pduSessionResourceModifyListModReq);
private:
std::vector<PDUSessionResourceModifyItemModReq>
pduSessionResourceModifyListModReq;
};
} // namespace ngap
#endif
/*
* 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#include "PDUSessionResourceModifyListModRes.hpp"
#include <iostream>
using namespace std;
namespace ngap {
//------------------------------------------------------------------------------
PDUSessionResourceModifyListModRes::PDUSessionResourceModifyListModRes() {}
//------------------------------------------------------------------------------
PDUSessionResourceModifyListModRes::~PDUSessionResourceModifyListModRes() {}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyListModRes::setPDUSessionResourceModifyListModRes(
const std::vector<PDUSessionResourceModifyItemModRes>&
m_pduSessionResourceModifyListModRes) {
pduSessionResourceModifyListModRes = m_pduSessionResourceModifyListModRes;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyListModRes::
encode2PDUSessionResourceModifyListModRes(
Ngap_PDUSessionResourceModifyListModRes_t&
m_pduSessionResourceModifyListModRes) {
for (auto pdu : pduSessionResourceModifyListModRes) {
Ngap_PDUSessionResourceModifyItemModRes_t* request =
(Ngap_PDUSessionResourceModifyItemModRes_t*) calloc(
1, sizeof(Ngap_PDUSessionResourceModifyItemModRes_t));
if (!request) return false;
if (!pdu.encode2PDUSessionResourceModifyItemModRes(*request)) return false;
if (ASN_SEQUENCE_ADD(&m_pduSessionResourceModifyListModRes.list, request) !=
0)
return false;
}
return true;
}
//------------------------------------------------------------------------------
bool PDUSessionResourceModifyListModRes::
decodefromPDUSessionResourceModifyListModRes(
Ngap_PDUSessionResourceModifyListModRes_t&
pduSessionResourceSetupListSURes) {
uint32_t numberofPDUSessions = pduSessionResourceSetupListSURes.list.count;
for (int i = 0; i < numberofPDUSessions; i++) {
PDUSessionResourceModifyItemModRes pduSessionResourceModifyItemModRes = {};
if (!pduSessionResourceModifyItemModRes
.decodefromPDUSessionResourceModifyItemModRes(
*pduSessionResourceSetupListSURes.list.array[i]))
return false;
pduSessionResourceModifyListModRes.push_back(
pduSessionResourceModifyItemModRes);
}
return true;
}
//------------------------------------------------------------------------------
void PDUSessionResourceModifyListModRes::getPDUSessionResourceModifyListModRes(
std::vector<PDUSessionResourceModifyItemModRes>&
m_pduSessionResourceModifyListModRes) {
m_pduSessionResourceModifyListModRes = pduSessionResourceModifyListModRes;
}
} // 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
*/
/*! \file
\brief
\author
\date
\email: contact@openairinterface.org
*/
#ifndef _PDU_SESSION_RESOURCE_MODIFY_LIST_MOD_RES_H_
#define _PDU_SESSION_RESOURCE_MODIFY_LIST_MOD_RES_H_
#include "PDUSessionResourceModifyItemModRes.hpp"
#include <vector>
extern "C" {
#include "Ngap_PDUSessionResourceModifyListModRes.h"
}
namespace ngap {
class PDUSessionResourceModifyListModRes {
public:
PDUSessionResourceModifyListModRes();
virtual ~PDUSessionResourceModifyListModRes();
void setPDUSessionResourceModifyListModRes(
const std::vector<PDUSessionResourceModifyItemModRes>&
m_pduSessionResourceModifyListModRes);
void getPDUSessionResourceModifyListModRes(
std::vector<PDUSessionResourceModifyItemModRes>&
m_pduSessionResourceModifyListModRes);
bool encode2PDUSessionResourceModifyListModRes(
Ngap_PDUSessionResourceModifyListModRes_t&
m_pduSessionResourceModifyListModRes);
bool decodefromPDUSessionResourceModifyListModRes(
Ngap_PDUSessionResourceModifyListModRes_t&
m_pduSessionResourceModifyListModRes);
private:
std::vector<PDUSessionResourceModifyItemModRes>
pduSessionResourceModifyListModRes;
};
} // namespace ngap
#endif
......@@ -86,10 +86,15 @@ void S_NSSAI::setSst(const std::string charSst) {
}
//------------------------------------------------------------------------------
void S_NSSAI::getSst(std::string& charSst) {
void S_NSSAI::getSst(std::string& charSst) const {
charSst = to_string((int) sst);
}
//------------------------------------------------------------------------------
std::string S_NSSAI::getSst() const {
return to_string((int) sst);
}
//------------------------------------------------------------------------------
void S_NSSAI::setSd(const std::string charSd) {
sdIsSet = true;
......@@ -97,7 +102,7 @@ void S_NSSAI::setSd(const std::string charSd) {
}
//------------------------------------------------------------------------------
bool S_NSSAI::getSd(std::string& s_nssaiSd) {
bool S_NSSAI::getSd(std::string& s_nssaiSd) const {
if (sdIsSet) {
s_nssaiSd = to_string(sd);
} else
......@@ -106,6 +111,13 @@ bool S_NSSAI::getSd(std::string& s_nssaiSd) {
return sdIsSet;
}
//------------------------------------------------------------------------------
std::string S_NSSAI::getSd() const {
if (sdIsSet) {
return to_string(sd);
} else
return "None";
}
//------------------------------------------------------------------------------
bool S_NSSAI::encode2S_NSSAI(Ngap_S_NSSAI_t* s_NSSAI) {
if (!sSTEncode2OctetString(s_NSSAI->sST)) return false;
......
......@@ -48,14 +48,16 @@ class S_NSSAI {
bool sDEncode2OctetString(Ngap_SD_t*);
bool sDdecodefromOctetString(Ngap_SD_t*);
void setSst(const std::string charSst);
void getSst(std::string& charSst);
void getSst(std::string& charSst) const;
std::string getSst() const;
void setSd(const std::string charSd);
bool getSd(std::string& s_nssaiSd);
bool getSd(std::string& s_nssaiSd) const;
std::string getSd() const;
bool encode2S_NSSAI(Ngap_S_NSSAI_t*);
bool decodefromS_NSSAI(Ngap_S_NSSAI_t*);
private:
uint8_t sst; // mandotory OCTET_STRING(SIZE(1))
uint8_t sst; // mandatory OCTET_STRING(SIZE(1))
uint32_t sd; // OCTET_STRING(SIZE(3))
bool sdIsSet;
};
......
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
*/
/*! \file
\brief
\author
\date 2021
\email: contact@openairinterface.org
*/
#ifndef PDU_SESSION_RESOURCE_MODIFY_REQUEST_H_
#define PDU_SESSION_RESOURCE_MODIFY_REQUEST_H_
#include "AMF-UE-NGAP-ID.hpp"
#include "MessageType.hpp"
#include "NgapIEsStruct.hpp"
#include "PDUSessionResourceModifyListModReq.hpp"
#include "RAN-UE-NGAP-ID.hpp"
#include "RANPagingPriority.hpp"
extern "C" {
#include "Ngap_InitialContextSetupRequest.h"
#include "Ngap_PDUSessionResourceModifyRequest.h"
#include "Ngap_NGAP-PDU.h"
#include "Ngap_ProtocolIE-Field.h"
}
namespace ngap {
class PduSessionResourceModifyRequestMsg {
public:
PduSessionResourceModifyRequestMsg();
virtual ~PduSessionResourceModifyRequestMsg();
void setMessageType();
void setAmfUeNgapId(unsigned long id); // 40 bits
void setRanUeNgapId(uint32_t id); // 32 bits
void setRanPagingPriority(uint8_t priority);
void setNasPdu(uint8_t* nas, size_t sizeofnas);
void setPduSessionResourceModifyRequestList(
std::vector<PDUSessionResourceModifyRequestItem_t> list);
int encode2buffer(uint8_t* buf, int buf_size);
void encode2buffer_new(char* buf, int& encoded_size);
bool decodefrompdu(Ngap_NGAP_PDU_t* ngap_msg_pdu);
unsigned long getAmfUeNgapId();
uint32_t getRanUeNgapId();
int getRanPagingPriority();
bool getNasPdu(uint8_t*& nas, size_t& sizeofnas);
bool getPduSessionResourceModifyRequestList(
std::vector<PDUSessionResourceModifyRequestItem_t>& list);
private:
Ngap_NGAP_PDU_t* pduSessionResourceModifyRequestPdu;
Ngap_PDUSessionResourceModifyRequest_t* pduSessionResourceModifyRequestIEs;
AMF_UE_NGAP_ID amfUeNgapId; // Mandatory
RAN_UE_NGAP_ID ranUeNgapId; // Mandatory
RANPagingPriority* ranPagingPriority; // Optional
PDUSessionResourceModifyListModReq* pduSessionResourceModifyList;
};
} // namespace ngap
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -212,6 +212,7 @@ endif()
add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"")
add_definitions("-DPACKAGE_BUGREPORT=\"openaircn-user@lists.eurecom.fr\"")
add_definitions("-DPACKAGE_NAME=\"AMF\"")
###############################################################################
# Include CMake modules to find other library
......@@ -354,4 +355,4 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
target_link_libraries(amf ${ASAN}
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread ${NETTLE_LIBRARIES} ${MySQL_LIBRARY} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} boost_system boost_thread boost_chrono ssl crypt cpprest gmp pistache curl)
-Wl,--start-group 3GPP_COMMON_TYPES AMF CONTEXTS AMF_SCTP AMF_SECU_5GAKA AMF_SECU_NAS AMF_UTILS AMF_SBI_CLIENT AMF_SBI_SERVER config++ sctp pthread ${NETTLE_LIBRARIES} ${MySQL_LIBRARY} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} nghttp2_asio boost_system boost_thread boost_chrono ssl crypt cpprest gmp pistache curl)
This diff is collapsed.
......@@ -9,6 +9,7 @@ void AMFApiServer::init(size_t thr) {
opts.maxRequestSize(PISTACHE_SERVER_MAX_PAYLOAD);
m_httpEndpoint->init(opts);
m_individualSubscriptionDocumentApiImpl->init();
m_individualSubscriptionDocumentApiImplEventExposure->init();
m_individualUeContextDocumentApiImpl->init();
m_n1N2IndividualSubscriptionDocumentApiImpl->init();
m_n1N2MessageCollectionDocumentApiImpl->init();
......@@ -17,13 +18,17 @@ void AMFApiServer::init(size_t thr) {
m_nonUEN2MessagesCollectionDocumentApiImpl->init();
m_nonUEN2MessagesSubscriptionsCollectionDocumentApiImpl->init();
m_subscriptionsCollectionDocumentApiImpl->init();
Logger::amf_server().debug("Initiate AMF server endpoints done!");
m_subscriptionsCollectionDocumentApiImplEventExposure->init();
Logger::amf_server().debug("Initiate AMF Server Endpoints done!");
}
void AMFApiServer::start() {
if (m_individualSubscriptionDocumentApiImpl != nullptr)
Logger::amf_server().debug(
"AMF handler for IndividualSubscriptionDocumentApiImpl");
if (m_individualSubscriptionDocumentApiImplEventExposure != nullptr)
Logger::amf_server().debug(
"AMF handler for IndividualSubscriptionDocumentApiImpl");
if (m_individualUeContextDocumentApiImpl != nullptr)
Logger::amf_server().debug(
"AMF handler for IndividualUeContextDocumentApiImpl");
......@@ -53,8 +58,13 @@ void AMFApiServer::start() {
if (m_subscriptionsCollectionDocumentApiImpl != nullptr)
Logger::amf_server().debug(
"AMF handler for SubscriptionsCollectionDocumentApiImpl");
if (m_subscriptionsCollectionDocumentApiImplEventExposure != nullptr)
Logger::amf_server().debug(
"AMF handler for SubscriptionsCollectionDocumentApiImplEventExposure");
m_httpEndpoint->setHandler(m_router->handler());
m_httpEndpoint->serve();
m_httpEndpoint->serveThreaded();
}
void AMFApiServer::shutdown() {
m_httpEndpoint->shutdown();
......
This diff is collapsed.
......@@ -41,6 +41,7 @@ include_directories(${SRC_TOP_DIR}/sbi/amf_server/impl)
include_directories(${SRC_TOP_DIR}/sbi/amf_server/model)
file(GLOB AMF_API_SERVER_src_files
${AMF_API_SERVER_DIR}/amf-http2-server.cpp
${AMF_API_SERVER_DIR}/AMFApiServer.cpp
${AMF_API_SERVER_DIR}/model/*.cpp
${AMF_API_SERVER_DIR}/api/*.cpp
......
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.
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