Commit 4d7c34a1 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'cleanup_format' into 'develop'

Remove dead code, apply google style format, fix issue for Pistache

See merge request oai/oai-cn5g-smf!2
parents 78b39c24 16e3b213
......@@ -110,7 +110,7 @@ install_spdlog_from_git() {
install_pistache_from_git() {
if [ $1 -eq 0 ]; then
read -p "Do you want to install Pistache ? <y/N> " prompt
OPTION=""
OPTION="-y"
else
prompt='y'
OPTION="-y"
......@@ -135,7 +135,7 @@ install_pistache_from_git() {
git clone $GIT_URL
git submodule update --init
cd pistache && git checkout master
cd pistache && git checkout e18ed9baeb2145af6f9ea41246cf48054ffd9907
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
......
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
WORKDIR /openair-smf/src/test/amf_client
RUN mkdir build && cd build && cmake .. && make
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as test-amf-client
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
libcurl4-gnutls-dev \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /test-amf-client/bin
COPY --from=oai-smf-builder /openair-smf/src/test/amf_client/build/amf-client .
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /test-amf-client
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
WORKDIR /openair-smf/src/test/amf
RUN mkdir build && cd build && cmake .. && make
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as test-amf-server
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /test-amf-server/bin
COPY --from=oai-smf-builder /openair-smf/src/test/amf/build/amf-server .
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /test-amf-server
......@@ -62,7 +62,7 @@ RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs
RUN ./build_smf --clean --Verbose --build-type Debug --jobs
#---------------------------------------------------------------------
# TARGET IMAGE
......
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG EURECOM_PROXY
ARG GITLAB_USERNAME
ARG GITLAB_PASSWORD
ARG BUILD_FOR_CI
ARG CI_SRC_BRANCH
ARG CI_SRC_COMMIT
ARG CI_DEST_BRANCH
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v EURECOM_PROXY ]]; then git config --global http.proxy $EURECOM_PROXY; fi"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# In normal case, we build out of the develop branch
RUN /bin/bash -c "if [[ -v CI_SRC_BRANCH ]]; then git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b $CI_SRC_BRANCH /openair-smf; else git clone https://$GITLAB_USERNAME:$GITLAB_PASSWORD@gitlab.eurecom.fr/oai/oai-cn5g-smf.git -b develop /openair-smf; fi"
# For CI, especially for Pull/Merge Requests, we build out of temp merge
WORKDIR /openair-smf
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.name \"OAI CI\"; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git config --global user.email ci@openairinterface.org; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git checkout -f $CI_SRC_COMMIT; fi"
RUN /bin/bash -c "if [[ -v BUILD_FOR_CI ]]; then git merge --ff origin/$CI_DEST_BRANCH -m \"Temporary merge for CI\"; fi"
# Installing and Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
WORKDIR /openair-smf/src/test/udm
RUN mkdir build && cd build && cmake .. && make
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as test-udm-server
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
&& rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /test-udm-server/bin
COPY --from=oai-smf-builder /openair-smf/src/test/udm/build/udm-server .
COPY --from=oai-smf-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /test-udm-server
This diff is collapsed.
#
# Copyright (c) 2015, EURECOM (www.eurecom.fr)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
#
# see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for explanation
# of style options
BasedOnStyle: Google
Language: Cpp
IndentWidth: 2
ColumnLimit: 80
IncludeBlocks: Preserve
SortIncludes: false
# alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
DerivePointerAlignment: false
PointerAlignment: Left
# function style
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterReturnType: None
IndentWrappedFunctionNames: false
# template style
AlwaysBreakTemplateDeclarations: Yes
# preprocessor style
IndentPPDirectives: None
# block style
AllowShortBlocksOnASingleLine: false
KeepEmptyLinesAtTheStartOfBlocks: false
# break style
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: false
BreakStringLiterals: true
CompactNamespaces: false
ContinuationIndentWidth: 4
MaxEmptyLinesToKeep: 1
ReflowComments: true
# spacing style
UseTab: Never
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
# class style
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
# case statements
IndentCaseLabels: true
# cpp
Cpp11BracedListStyle: true
FixNamespaceComments: true
NamespaceIndentation: None
SortUsingDeclarations: true
# todo
# AlwaysBreakBeforeMultilineStrings: bool
# PenaltyBreakAssignment (unsigned)
# PenaltyBreakBeforeFirstCallParameter (unsigned)
# PenaltyBreakComment (unsigned)
# PenaltyBreakFirstLessLess (unsigned)
# PenaltyBreakString (unsigned)
# PenaltyBreakTemplateDeclaration (unsigned)
# PenaltyExcessCharacter (unsigned)
# PenaltyReturnTypeOnItsOwnLine (unsigned)
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "IndividualPDUSessionHSMFApi.h"
#include "Helpers.h"
......@@ -20,71 +20,89 @@ namespace api {
using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
IndividualPDUSessionHSMFApi::IndividualPDUSessionHSMFApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
IndividualPDUSessionHSMFApi::IndividualPDUSessionHSMFApi(
std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void IndividualPDUSessionHSMFApi::init() {
setupRoutes();
setupRoutes();
}
void IndividualPDUSessionHSMFApi::setupRoutes() {
using namespace Pistache::Rest;
using namespace Pistache::Rest;
Routes::Post(*router, base + "/pdu-sessions/:pduSessionRef/release", Routes::bind(&IndividualPDUSessionHSMFApi::release_pdu_session_handler, this));
Routes::Post(*router, base + "/pdu-sessions/:pduSessionRef/modify", Routes::bind(&IndividualPDUSessionHSMFApi::update_pdu_session_handler, this));
Routes::Post(
*router,
base + "/pdu-sessions/:pduSessionRef/release",
Routes::bind(&IndividualPDUSessionHSMFApi::release_pdu_session_handler,
this));
Routes::Post(
*router,
base + "/pdu-sessions/:pduSessionRef/modify",
Routes::bind(&IndividualPDUSessionHSMFApi::update_pdu_session_handler,
this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_api_default_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(
Routes::bind(
&IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_api_default_handler,
this));
}
void IndividualPDUSessionHSMFApi::release_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
ReleaseData releaseData = {};
try {
nlohmann::json::parse(request.body()).get_to(releaseData);
this->release_pdu_session(pduSessionRef, releaseData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
void IndividualPDUSessionHSMFApi::release_pdu_session_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response) {
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
ReleaseData releaseData = { };
try {
nlohmann::json::parse(request.body()).get_to(releaseData);
this->release_pdu_session(pduSessionRef, releaseData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void IndividualPDUSessionHSMFApi::update_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
HsmfUpdateData hsmfUpdateData = {};
try {
nlohmann::json::parse(request.body()).get_to(hsmfUpdateData);
this->update_pdu_session(pduSessionRef, hsmfUpdateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
void IndividualPDUSessionHSMFApi::update_pdu_session_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response) {
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
HsmfUpdateData hsmfUpdateData = { };
try {
nlohmann::json::parse(request.body()).get_to(hsmfUpdateData);
this->update_pdu_session(pduSessionRef, hsmfUpdateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
void IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_api_default_handler(
const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found,
"The requested method does not exist");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* IndividualPDUSessionHSMFApi.h
*
......@@ -18,13 +18,11 @@
#ifndef IndividualPDUSessionHSMFApi_H_
#define IndividualPDUSessionHSMFApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "HsmfUpdateData.h"
#include "HsmfUpdateError.h"
#include "HsmfUpdatedData.h"
......@@ -38,42 +36,51 @@ namespace api {
using namespace oai::smf_server::model;
class IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualPDUSessionHSMFApi() {}
void init();
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
void release_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void update_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_pdu_session_hsmf_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="releaseData">representation of the data to be sent to H-SMF when releasing the PDU session (optional)</param>
virtual void release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update (initiated by V-SMF)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="hsmfUpdateData">representation of the updates to apply to the PDU session</param>
virtual void update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response) = 0;
class IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualPDUSessionHSMFApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
void release_pdu_session_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void update_pdu_session_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void individual_pdu_session_hsmf_api_default_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="releaseData">representation of the data to be sent to H-SMF when releasing the PDU session (optional)</param>
virtual void release_pdu_session(
const std::string &pduSessionRef, const ReleaseData &releaseData,
Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update (initiated by V-SMF)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="hsmfUpdateData">representation of the updates to apply to the PDU session</param>
virtual void update_pdu_session(const std::string &pduSessionRef,
const HsmfUpdateData &hsmfUpdateData,
Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* IndividualSMContextApi.h
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -37,17 +36,14 @@
* contact@openairinterface.org
*/
#ifndef IndividualSMContextApi_H_
#define IndividualSMContextApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "ProblemDetails.h"
#include "SmContextReleaseData.h"
#include "SmContextRetrieveData.h"
......@@ -62,60 +58,74 @@
#include "SmContextCreateError.h"
#include "SmContextCreatedData.h"
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
class IndividualSMContextApi {
public:
IndividualSMContextApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualSMContextApi() {}
void init();
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
void release_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void retrieve_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void update_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_sm_context_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextReleaseData">representation of the data to be sent to the SMF when releasing the SM context (optional)</param>
virtual void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieve SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextRetrieveData">parameters used to retrieve the SM context (optional)</param>
virtual void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextUpdateData">representation of the updates to apply to the SM context</param>
virtual void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response) = 0;
class IndividualSMContextApi {
public:
IndividualSMContextApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualSMContextApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
void release_sm_context_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void retrieve_sm_context_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void update_sm_context_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void individual_sm_context_api_default_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextReleaseData">representation of the data to be sent to the SMF when releasing the SM context (optional)</param>
virtual void release_sm_context(
const std::string &smContextRef,
const SmContextReleaseMessage &smContextReleaseMessage,
Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieve SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextRetrieveData">parameters used to retrieve the SM context (optional)</param>
virtual void retrieve_sm_context(
const std::string &smContextRef,
const SmContextRetrieveData &smContextRetrieveData,
Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextUpdateData">representation of the updates to apply to the SM context</param>
virtual void update_sm_context(
const std::string &smContextRef,
const SmContextUpdateMessage &smContextUpdateMessage,
Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "PDUSessionsCollectionApi.h"
#include "Helpers.h"
......@@ -20,46 +20,56 @@ namespace api {
using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
PDUSessionsCollectionApi::PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
PDUSessionsCollectionApi::PDUSessionsCollectionApi(
std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void PDUSessionsCollectionApi::init() {
setupRoutes();
setupRoutes();
}
void PDUSessionsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
using namespace Pistache::Rest;
Routes::Post(*router, base + "/pdu-sessions", Routes::bind(&PDUSessionsCollectionApi::post_pdu_sessions_handler, this));
Routes::Post(
*router, base + "/pdu-sessions",
Routes::bind(&PDUSessionsCollectionApi::post_pdu_sessions_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(
Routes::bind(
&PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler,
this));
}
void PDUSessionsCollectionApi::post_pdu_sessions_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the body param
PduSessionCreateData pduSessionCreateData;
try {
nlohmann::json::parse(request.body()).get_to(pduSessionCreateData);
this->post_pdu_sessions(pduSessionCreateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
void PDUSessionsCollectionApi::post_pdu_sessions_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response) {
// Getting the body param
PduSessionCreateData pduSessionCreateData;
try {
nlohmann::json::parse(request.body()).get_to(pduSessionCreateData);
this->post_pdu_sessions(pduSessionCreateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
void PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler(
const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found,
"The requested method does not exist");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* PDUSessionsCollectionApi.h
*
......@@ -18,13 +18,11 @@
#ifndef PDUSessionsCollectionApi_H_
#define PDUSessionsCollectionApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "PduSessionCreateData.h"
#include "PduSessionCreateError.h"
#include "PduSessionCreatedData.h"
......@@ -36,30 +34,36 @@ namespace api {
using namespace oai::smf_server::model;
class PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~PDUSessionsCollectionApi() {}
void init();
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
void post_pdu_sessions_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void pdu_sessions_collection_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Create
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionCreateData">representation of the PDU session to be created in the H-SMF</param>
virtual void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response) = 0;
class PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~PDUSessionsCollectionApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
void post_pdu_sessions_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void pdu_sessions_collection_api_default_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Create
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionCreateData">representation of the PDU session to be created in the H-SMF</param>
virtual void post_pdu_sessions(
const PduSessionCreateData &pduSessionCreateData,
Pistache::Http::ResponseWriter &response) = 0;
};
......
......@@ -53,7 +53,8 @@ namespace api {
using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
SMContextsCollectionApi::SMContextsCollectionApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
SMContextsCollectionApi::SMContextsCollectionApi(
std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
......@@ -64,24 +65,32 @@ void SMContextsCollectionApi::init() {
void SMContextsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(*router, base + "/sm-contexts", Routes::bind(&SMContextsCollectionApi::post_sm_contexts_handler, this));
Routes::Post(
*router, base + "/sm-contexts",
Routes::bind(&SMContextsCollectionApi::post_sm_contexts_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&SMContextsCollectionApi::sm_contexts_collection_api_default_handler, this));
router->addCustomHandler(
Routes::bind(
&SMContextsCollectionApi::sm_contexts_collection_api_default_handler,
this));
}
void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
void SMContextsCollectionApi::post_sm_contexts_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response) {
Logger::smf_api_server().info("\nReceived a SM context create request from AMF");
Logger::smf_api_server().debug("Request body: %s",request.body().c_str());
Logger::smf_api_server().info(
"\nReceived a SM context create request from AMF");
Logger::smf_api_server().debug("Request body: %s", request.body().c_str());
//find boundary
std::size_t found = request.body().find("Content-Type");
std::string boundary_str = request.body().substr(2, found - 4);
Logger::smf_api_server().debug("Boundary: %s", boundary_str.c_str());
SmContextMessage smContextMessage = {};
SmContextCreateData smContextCreateData = {};
SmContextMessage smContextMessage = { };
SmContextCreateData smContextCreateData = { };
//step 1. use multipartparser to decode the request
multipartparser_callbacks_init(&g_callbacks);
......@@ -94,30 +103,39 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
g_callbacks.on_part_end = &on_part_end;
g_callbacks.on_body_end = &on_body_end;
multipartparser parser = {};
multipartparser parser = { };
init_globals();
multipartparser_init(&parser, reinterpret_cast<const char*>(boundary_str.c_str()));
if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) != strlen(request.body().c_str())) or (!g_body_begin_called)){
Logger::smf_api_server().warn("The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
multipartparser_init(&parser,
reinterpret_cast<const char*>(boundary_str.c_str()));
if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(),
strlen(request.body().c_str()))
!= strlen(request.body().c_str())) or (!g_body_begin_called)) {
Logger::smf_api_server().warn(
"The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
//return;
}
Logger::smf_api_server().debug("Number of g_parts %d", g_parts.size());
//at least 2 parts for Json data and N1 (+ N2)
if (g_parts.size() < 2){
if (g_parts.size() < 2) {
response.send(Pistache::Http::Code::Bad_Request, "");
return;
}
part p0 = g_parts.front(); g_parts.pop_front();
part p0 = g_parts.front();
g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 1: \n%s", p0.body.c_str());
part p1 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 2: \n %s",p1.body.c_str());
part p1 = g_parts.front();
g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 2: \n %s",
p1.body.c_str());
if (g_parts.size() > 0) {
part p2 = g_parts.front(); g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 3: \n %s",p2.body.c_str());
part p2 = g_parts.front();
g_parts.pop_front();
Logger::smf_api_server().debug("Request body, part 3: \n %s",
p2.body.c_str());
}
//step 2. process the request
......@@ -128,8 +146,9 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
this->post_sm_contexts(smContextMessage, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
Logger::smf_api_server().warn("Can not parse the json data (error: %s)!", e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
Logger::smf_api_server().warn("Can not parse the json data (error: %s)!",
e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
......@@ -140,8 +159,10 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
}
void SMContextsCollectionApi::sm_contexts_collection_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
void SMContextsCollectionApi::sm_contexts_collection_api_default_handler(
const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found,
"The requested method does not exist");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* SMContextsCollectionApi.h
*
......@@ -36,17 +36,14 @@
* contact@openairinterface.org
*/
#ifndef SMContextsCollectionApi_H_
#define SMContextsCollectionApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "SmContextMessage.h"
#include "ProblemDetails.h"
#include "SmContextCreateError.h"
......@@ -58,30 +55,35 @@ namespace api {
using namespace oai::smf_server::model;
class SMContextsCollectionApi {
public:
SMContextsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~SMContextsCollectionApi() {}
void init();
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
void post_sm_contexts_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void sm_contexts_collection_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Create SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextMessage"></param>
virtual void post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) = 0;
class SMContextsCollectionApi {
public:
SMContextsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~SMContextsCollectionApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
void post_sm_contexts_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void sm_contexts_collection_api_default_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Create SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextMessage"></param>
virtual void post_sm_contexts(const SmContextMessage &smContextMessage,
Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "IndividualPDUSessionHSMFApiImpl.h"
......@@ -18,17 +18,28 @@ namespace api {
using namespace oai::smf_server::model;
IndividualPDUSessionHSMFApiImpl::IndividualPDUSessionHSMFApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: IndividualPDUSessionHSMFApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
IndividualPDUSessionHSMFApiImpl::IndividualPDUSessionHSMFApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst,
std::string address)
:
IndividualPDUSessionHSMFApi(rtr),
m_smf_app(smf_app_inst),
m_address(address) {
}
void IndividualPDUSessionHSMFApiImpl::release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("release_pdu_session...");
response.send(Pistache::Http::Code::Ok, "Release_pdu_session API has not been implemented yet!\n");
void IndividualPDUSessionHSMFApiImpl::release_pdu_session(
const std::string &pduSessionRef, const ReleaseData &releaseData,
Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("release_pdu_session...");
response.send(Pistache::Http::Code::Ok,
"Release_pdu_session API has not been implemented yet!\n");
}
void IndividualPDUSessionHSMFApiImpl::update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("update_pdu_session...");
response.send(Pistache::Http::Code::Ok, "Update_pdu_session API has not been implemented yet!\n");
void IndividualPDUSessionHSMFApiImpl::update_pdu_session(
const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData,
Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("update_pdu_session...");
response.send(Pistache::Http::Code::Ok,
"Update_pdu_session API has not been implemented yet!\n");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* IndividualPDUSessionHSMFApiImpl.h
*
*
*/
* IndividualPDUSessionHSMFApiImpl.h
*
*
*/
#ifndef INDIVIDUAL_PDU_SESSION_HSMF_API_IMPL_H_
#define INDIVIDUAL_PDU_SESSION_HSMF_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -43,22 +42,28 @@ namespace api {
using namespace oai::smf_server::model;
class IndividualPDUSessionHSMFApiImpl : public oai::smf_server::api::IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualPDUSessionHSMFApiImpl() {}
class IndividualPDUSessionHSMFApiImpl :
public oai::smf_server::api::IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApiImpl(std::shared_ptr<Pistache::Rest::Router>,
smf::smf_app *smf_app_inst,
std::string address);
~IndividualPDUSessionHSMFApiImpl() {
}
void release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response);
void update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
void release_pdu_session(const std::string &pduSessionRef,
const ReleaseData &releaseData,
Pistache::Http::ResponseWriter &response);
void update_pdu_session(const std::string &pduSessionRef,
const HsmfUpdateData &hsmfUpdateData,
Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
......@@ -31,7 +31,6 @@
* contact@openairinterface.org
*/
#include "IndividualSMContextApiImpl.h"
namespace oai {
......@@ -40,29 +39,41 @@ namespace api {
using namespace oai::smf_server::model;
IndividualSMContextApiImpl::IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: IndividualSMContextApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
IndividualSMContextApiImpl::IndividualSMContextApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst,
std::string address)
:
IndividualSMContextApi(rtr),
m_smf_app(smf_app_inst),
m_address(address) {
}
void IndividualSMContextApiImpl::release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) {
void IndividualSMContextApiImpl::release_sm_context(
const std::string &smContextRef,
const SmContextReleaseMessage &smContextReleaseMessage,
Pistache::Http::ResponseWriter &response) {
//TODO: to be updated as update_sm_context_handler
Logger::smf_api_server().info("release_sm_context...");
//handle Nsmf_PDUSession_UpdateSMContext Request
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request: PDU Session Release request from AMF.");
Logger::smf_api_server().info(
"Received a PDUSession_UpdateSMContext Request: PDU Session Release request from AMF.");
//Get the SmContextUpdateData from this message and process in smf_app
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
smf::pdu_session_update_sm_context_request sm_context_req_msg = { };
SmContextReleaseData smContextReleaseData = smContextReleaseMessage.getJsonData();
SmContextReleaseData smContextReleaseData = smContextReleaseMessage
.getJsonData();
if (smContextReleaseData.n2SmInfoIsSet()){
if (smContextReleaseData.n2SmInfoIsSet()) {
//N2 SM (for Session establishment)
std::string n2_sm_information = smContextReleaseMessage.getBinaryDataN2SmInformation();
std::string n2_sm_information = smContextReleaseMessage
.getBinaryDataN2SmInformation();
//std::string n2_sm_information = (smContextUpdateData.getN2SmInfo()).getContentId();
std::string n2_sm_msg_hex;
m_smf_app->convert_string_2_hex(n2_sm_information, n2_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s", n2_sm_information.c_str());
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s",
n2_sm_information.c_str());
std::string n2_sm_info_type = smContextReleaseData.getN2SmInfoType();
sm_context_req_msg.set_n2_sm_information(n2_sm_msg_hex);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
......@@ -77,31 +88,44 @@ void IndividualSMContextApiImpl::release_sm_context(const std::string &smContext
}
void IndividualSMContextApiImpl::retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response) {
void IndividualSMContextApiImpl::retrieve_sm_context(
const std::string &smContextRef,
const SmContextRetrieveData &smContextRetrieveData,
Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("retrieve_sm_context...");
response.send(Pistache::Http::Code::Ok, "Retrieve_sm_context API has not been implemented yet!\n");
response.send(Pistache::Http::Code::Ok,
"Retrieve_sm_context API has not been implemented yet!\n");
}
void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response) {
void IndividualSMContextApiImpl::update_sm_context(
const std::string &smContextRef,
const SmContextUpdateMessage &smContextUpdateMessage,
Pistache::Http::ResponseWriter &response) {
//Get the SmContextUpdateData from this message and process in smf_app
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request from AMF.");
Logger::smf_api_server().info(
"Received a PDUSession_UpdateSMContext Request from AMF.");
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
SmContextUpdateData smContextUpdateData = smContextUpdateMessage.getJsonData();
smf::pdu_session_update_sm_context_request sm_context_req_msg = { };
SmContextUpdateData smContextUpdateData =
smContextUpdateMessage.getJsonData();
if (smContextUpdateData.n2SmInfoIsSet()){
if (smContextUpdateData.n2SmInfoIsSet()) {
//N2 SM (for Session establishment)
std::string n2_sm_information = smContextUpdateMessage.getBinaryDataN2SmInformation();
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s", n2_sm_information.c_str());
std::string n2_sm_information = smContextUpdateMessage
.getBinaryDataN2SmInformation();
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s",
n2_sm_information.c_str());
std::string n2_sm_info_type = smContextUpdateData.getN2SmInfoType();
sm_context_req_msg.set_n2_sm_information(n2_sm_information);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
} else if (smContextUpdateData.n1SmMsgIsSet()){
} else if (smContextUpdateData.n1SmMsgIsSet()) {
//N1 SM (for session modification)
std::string n1_sm_message = smContextUpdateMessage.getBinaryDataN1SmMessage();
Logger::smf_api_server().debug("smContextMessage, n1 sm message %s", n1_sm_message.c_str());
std::string n1_sm_message =
smContextUpdateMessage.getBinaryDataN1SmMessage();
Logger::smf_api_server().debug("smContextMessage, n1 sm message %s",
n1_sm_message.c_str());
sm_context_req_msg.set_n1_sm_message(n1_sm_message);
}
//Step 2. TODO: initialize necessary values for sm context req from smContextUpdateData
......@@ -110,11 +134,14 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
//Step 4: PDU Session IDs, Operation Type, UE location Info, Access Type, RAT Type, UE presence in LADN service area, Indication of Access Type can be changed
//PDU Session IDs
//UpCnxState, for activation of user plane (see 5.2.2.3.2.2@3GPP TS 29.502)
if(smContextUpdateData.upCnxStateIsSet()) sm_context_req_msg.set_upCnx_state(smContextUpdateData.getUpCnxState());
if (smContextUpdateData.upCnxStateIsSet())
sm_context_req_msg.set_upCnx_state(smContextUpdateData.getUpCnxState());
//Access Type
if (smContextUpdateData.anTypeIsSet()) sm_context_req_msg.set_an_type(smContextUpdateData.getAnType());
if (smContextUpdateData.anTypeIsSet())
sm_context_req_msg.set_an_type(smContextUpdateData.getAnType());
//RAT Type
if (smContextUpdateData.ratTypeIsSet()) sm_context_req_msg.set_rat_type(smContextUpdateData.getRatType());
if (smContextUpdateData.ratTypeIsSet())
sm_context_req_msg.set_rat_type(smContextUpdateData.getRatType());
//TODO:
//UE presence in LADN service area
//UE location information
......@@ -126,15 +153,17 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
//TODO: Existing PDU session, step 3, SUPI, DNN, S-NSSAIs, SM Context ID, AMF ID, Request Type, N1 SM Container (PDU Session Establishment Request), User location, Access Type, RAT Type, PEI
//step 15. (SM Context ID -> SCID, N2 SM, Request Type)(Initial Request)
//TODO: verify why Request Type is not define in smContextUpdateData
/* PDU Session Modification (SM Context ID -> SCID, N1/N2), section 4.3.3.2@3GPP TS 23.502: */
//step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification Request)
//step 1.e (AN initiated modification): SM Context ID, N2 SM information (QFI, User location Information and an indication that the QoS Flow is released)
//step 7a, SM Context ID, N2 SM information, UE location information
//Step 11, SM Context ID, N1 SM (PDU Session Modification Command ACK), User location
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg = std::make_shared<itti_n11_update_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response, smContextRef);
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg =
std::make_shared<itti_n11_update_sm_context_request>(TASK_SMF_N11,
TASK_SMF_APP,
response,
smContextRef);
itti_msg->req = sm_context_req_msg;
itti_msg->scid = smContextRef;
m_smf_app->handle_pdu_session_update_sm_context_request(itti_msg);
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* IndividualSMContextApiImpl.h
*
*
*/
* IndividualSMContextApiImpl.h
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -39,7 +39,6 @@
#ifndef INDIVIDUAL_SM_CONTEXT_API_IMPL_H_
#define INDIVIDUAL_SM_CONTEXT_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -67,23 +66,31 @@ namespace api {
using namespace oai::smf_server::model;
class IndividualSMContextApiImpl : public oai::smf_server::api::IndividualSMContextApi {
public:
IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualSMContextApiImpl() {}
class IndividualSMContextApiImpl :
public oai::smf_server::api::IndividualSMContextApi {
public:
IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router>,
smf::smf_app *smf_app_inst, std::string address);
~IndividualSMContextApiImpl() {
}
void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response);
void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response);
void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
void release_sm_context(
const std::string &smContextRef,
const SmContextReleaseMessage &smContextReleaseMessage,
Pistache::Http::ResponseWriter &response);
void retrieve_sm_context(const std::string &smContextRef,
const SmContextRetrieveData &smContextRetrieveData,
Pistache::Http::ResponseWriter &response);
void update_sm_context(const std::string &smContextRef,
const SmContextUpdateMessage &smContextUpdateMessage,
Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "PDUSessionsCollectionApiImpl.h"
......@@ -18,13 +18,21 @@ namespace api {
using namespace oai::smf_server::model;
PDUSessionsCollectionApiImpl::PDUSessionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: PDUSessionsCollectionApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
PDUSessionsCollectionApiImpl::PDUSessionsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst,
std::string address)
:
PDUSessionsCollectionApi(rtr),
m_smf_app(smf_app_inst),
m_address(address) {
}
void PDUSessionsCollectionApiImpl::post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("post_pdu_sessions...");
response.send(Pistache::Http::Code::Ok, "Post_pdu_sessions API has not been implemented yet!\n");
void PDUSessionsCollectionApiImpl::post_pdu_sessions(
const PduSessionCreateData &pduSessionCreateData,
Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("post_pdu_sessions...");
response.send(Pistache::Http::Code::Ok,
"Post_pdu_sessions API has not been implemented yet!\n");
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* PDUSessionsCollectionApiImpl.h
*
*
*/
* PDUSessionsCollectionApiImpl.h
*
*
*/
#ifndef PDU_SESSIONS_COLLECTION_API_IMPL_H_
#define PDU_SESSIONS_COLLECTION_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -41,21 +40,23 @@ namespace api {
using namespace oai::smf_server::model;
class PDUSessionsCollectionApiImpl : public oai::smf_server::api::PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~PDUSessionsCollectionApiImpl() {}
void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
class PDUSessionsCollectionApiImpl :
public oai::smf_server::api::PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
smf::smf_app *smf_app_inst, std::string address);
~PDUSessionsCollectionApiImpl() {
}
void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData,
Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
......@@ -31,7 +31,6 @@
* contact@openairinterface.org
*/
#include "SMContextsCollectionApiImpl.h"
#include "logger.hpp"
#include "smf_msg.hpp"
......@@ -44,12 +43,20 @@ namespace api {
using namespace oai::smf_server::model;
SMContextsCollectionApiImpl::SMContextsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: SMContextsCollectionApi(rtr), m_smf_app(smf_app_inst), m_address(address)
SMContextsCollectionApiImpl::SMContextsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst,
std::string address)
:
SMContextsCollectionApi(rtr),
m_smf_app(smf_app_inst),
m_address(address)
{ }
{
}
void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) {
void SMContextsCollectionApiImpl::post_sm_contexts(
const SmContextMessage &smContextMessage,
Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("PDU Session Create SM Context Request ...");
......@@ -61,11 +68,13 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
std::string n1_sm_msg = smContextMessage.getBinaryDataN1SmMessage();
std::string n1_sm_msg_hex;
m_smf_app->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s",n1_sm_msg.c_str());
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s",
n1_sm_msg.c_str());
//Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
Logger::smf_api_server().debug("Create a pdu_session_create_sm_context_request message and store the necessary information");
smf::pdu_session_create_sm_context_request sm_context_req_msg = {};
Logger::smf_api_server().debug(
"Create a pdu_session_create_sm_context_request message and store the necessary information");
smf::pdu_session_create_sm_context_request sm_context_req_msg = { };
//set N1 SM Message
sm_context_req_msg.set_n1_sm_message(n1_sm_msg_hex);
......@@ -73,34 +82,46 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
sm_context_req_msg.set_api_root(m_address + base + "/sm-contexts");
//supi
supi_t supi = {.length = 0};
supi_t supi = { .length = 0 };
std::size_t pos = smContextCreateData.getSupi().find("-");
std::string supi_str = smContextCreateData.getSupi().substr(pos +1);
std::string supi_str = smContextCreateData.getSupi().substr(pos + 1);
std::string supi_prefix = smContextCreateData.getSupi().substr(0, pos);
smf_string_to_supi(&supi, supi_str.c_str());
sm_context_req_msg.set_supi(supi);
sm_context_req_msg.set_supi_prefix(supi_prefix);
Logger::smf_api_server().debug("SmContextCreateData, supi %s, prefix %s, imsi %s", smContextCreateData.getSupi().c_str(), supi_prefix.c_str(), supi_str.c_str());
Logger::smf_api_server().debug(
"SmContextCreateData, supi %s, prefix %s, imsi %s",
smContextCreateData.getSupi().c_str(), supi_prefix.c_str(),
supi_str.c_str());
//dnn
Logger::smf_api_server().debug("SmContextCreateData, dnn %s", smContextCreateData.getDnn().c_str());
Logger::smf_api_server().debug("SmContextCreateData, dnn %s",
smContextCreateData.getDnn().c_str());
sm_context_req_msg.set_dnn(smContextCreateData.getDnn().c_str());
//S-Nssai
Logger::smf_api_server().debug("SmContextCreateData, S-NSSAI sst %d, sd %s", smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSd().c_str());
snssai_t snssai(smContextCreateData.getSNssai().getSst(), smContextCreateData.getSNssai().getSd().c_str());
Logger::smf_api_server().debug(
"SmContextCreateData, S-NSSAI sst %d, sd %s",
smContextCreateData.getSNssai().getSst(),
smContextCreateData.getSNssai().getSd().c_str());
snssai_t snssai(smContextCreateData.getSNssai().getSst(),
smContextCreateData.getSNssai().getSd().c_str());
sm_context_req_msg.set_snssai(snssai);
//PDU session ID
Logger::smf_api_server().debug("SmContextCreateData, PDU SessionID %d", smContextCreateData.getPduSessionId());
Logger::smf_api_server().debug("SmContextCreateData, PDU SessionID %d",
smContextCreateData.getPduSessionId());
sm_context_req_msg.set_pdu_session_id(smContextCreateData.getPduSessionId());
//AMF ID (ServingNFId)
Logger::smf_api_server().debug("SmContextCreateDatea, ServingNfId %s", smContextCreateData.getServingNfId().c_str());
sm_context_req_msg.set_serving_nf_id(smContextCreateData.getServingNfId().c_str()); //TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
Logger::smf_api_server().debug("SmContextCreateDatea, ServingNfId %s",
smContextCreateData.getServingNfId().c_str());
sm_context_req_msg.set_serving_nf_id(
smContextCreateData.getServingNfId().c_str()); //TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
//Request Type
Logger::smf_api_server().debug("SmContextCreateData, RequestType %s", smContextCreateData.getRequestType().c_str());
Logger::smf_api_server().debug("SmContextCreateData, RequestType %s",
smContextCreateData.getRequestType().c_str());
sm_context_req_msg.set_request_type(smContextCreateData.getRequestType());
//PCF ID
// Priority Access
......@@ -117,8 +138,10 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//PCFId
// DNN Selection Mode
Logger::smf_api_server().debug("SmContextCreateData, SelMode %s", smContextCreateData.getSelMode().c_str());
sm_context_req_msg.set_dnn_selection_mode(smContextCreateData.getSelMode().c_str());
Logger::smf_api_server().debug("SmContextCreateData, SelMode %s",
smContextCreateData.getSelMode().c_str());
sm_context_req_msg.set_dnn_selection_mode(
smContextCreateData.getSelMode().c_str());
//Subscription for PDU Session Status Notification
// Trace requirement
......@@ -132,7 +155,10 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//Extended protocol configuration options (Optional) e.g, FOR DHCP
//Step 3. Handle the pdu_session_create_sm_context_request message in smf_app
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg = std::make_shared<itti_n11_create_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response);
std::shared_ptr<itti_n11_create_sm_context_request> itti_msg =
std::make_shared<itti_n11_create_sm_context_request>(TASK_SMF_N11,
TASK_SMF_APP,
response);
itti_msg->req = sm_context_req_msg;
m_smf_app->handle_pdu_session_create_sm_context_request(itti_msg);
......
/**
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* Nsmf_PDUSession
* SMF PDU Session Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* SMContextsCollectionApiImpl.h
*
*
*/
* SMContextsCollectionApiImpl.h
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -39,7 +39,6 @@
#ifndef SM_CONTEXTS_COLLECTION_API_IMPL_H_
#define SM_CONTEXTS_COLLECTION_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -61,21 +60,23 @@ namespace api {
using namespace oai::smf_server::model;
class SMContextsCollectionApiImpl : public oai::smf_server::api::SMContextsCollectionApi {
public:
SMContextsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~SMContextsCollectionApiImpl() {}
class SMContextsCollectionApiImpl :
public oai::smf_server::api::SMContextsCollectionApi {
public:
SMContextsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
smf::smf_app *smf_app_inst, std::string address);
~SMContextsCollectionApiImpl() {
}
void post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
void post_sm_contexts(const SmContextMessage &smContextMessage,
Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
/**
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -43,69 +43,68 @@
#define PISTACHE_SERVER_MAX_PAYLOAD 32768
#ifdef __linux__
void sigHandler(int sig){
switch(sig){
case SIGINT:
case SIGQUIT:
case SIGTERM:
case SIGHUP:
default:
break;
}
exit(0);
void sigHandler(int sig) {
switch (sig) {
case SIGINT:
case SIGQUIT:
case SIGTERM:
case SIGHUP:
default:
break;
}
exit(0);
}
void setUpUnixSignals(std::vector<int> quitSignals) {
sigset_t blocking_mask;
sigemptyset(&blocking_mask);
for (auto sig : quitSignals)
sigaddset(&blocking_mask, sig);
sigset_t blocking_mask;
sigemptyset(&blocking_mask);
for (auto sig : quitSignals)
sigaddset(&blocking_mask, sig);
struct sigaction sa;
sa.sa_handler = sigHandler;
sa.sa_mask = blocking_mask;
sa.sa_flags = 0;
struct sigaction sa;
sa.sa_handler = sigHandler;
sa.sa_mask = blocking_mask;
sa.sa_flags = 0;
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
}
#endif
using namespace oai::smf_server::api;
void SMFApiServer::init(size_t thr) {
auto opts = Pistache::Http::Endpoint::options()
.threads(thr);
opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD);
m_httpEndpoint->init(opts);
m_individualPDUSessionHSMFApiImpl->init();
m_individualSMContextApiImpl->init();
m_pduSessionsCollectionApiImpl->init();
m_smContextsCollectionApiImpl->init();
auto opts = Pistache::Http::Endpoint::options().threads(thr);
opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD);
m_httpEndpoint->init(opts);
m_individualPDUSessionHSMFApiImpl->init();
m_individualSMContextApiImpl->init();
m_pduSessionsCollectionApiImpl->init();
m_smContextsCollectionApiImpl->init();
}
void SMFApiServer::start(){
m_httpEndpoint->setHandler(m_router->handler());
m_httpEndpoint->serve();
void SMFApiServer::start() {
m_httpEndpoint->setHandler(m_router->handler());
m_httpEndpoint->serve();
}
void SMFApiServer::shutdown(){
m_httpEndpoint->shutdown();
void SMFApiServer::shutdown() {
m_httpEndpoint->shutdown();
}
/*
int main() {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
int main() {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
SMFApiServer smfApiServer(addr);
smfApiServer.init(2);
smfApiServer.start();
smfApiServer.shutdown();
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
SMFApiServer smfApiServer(addr);
smfApiServer.init(2);
smfApiServer.start();
smfApiServer.shutdown();
}
*/
}
*/
/**
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
......@@ -31,7 +31,6 @@
* contact@openairinterface.org
*/
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
......@@ -49,30 +48,35 @@
using namespace oai::smf_server::api;
class SMFApiServer {
public:
SMFApiServer(Pistache::Address address, smf::smf_app *smf_app_inst) : m_httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(address)) {
m_router = std::make_shared<Pistache::Rest::Router>();
m_address = address.host() + ":"+ (address.port()).toString();
m_individualPDUSessionHSMFApiImpl = std::make_shared<IndividualPDUSessionHSMFApiImpl> (m_router, smf_app_inst, m_address);
m_individualSMContextApiImpl = std::make_shared<IndividualSMContextApiImpl> (m_router, smf_app_inst, m_address);
m_pduSessionsCollectionApiImpl = std::make_shared<PDUSessionsCollectionApiImpl> (m_router, smf_app_inst, m_address);
m_smContextsCollectionApiImpl = std::make_shared<SMContextsCollectionApiImpl> (m_router, smf_app_inst, m_address);
public:
SMFApiServer(Pistache::Address address, smf::smf_app *smf_app_inst)
:
m_httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(address)) {
m_router = std::make_shared<Pistache::Rest::Router>();
m_address = address.host() + ":" + (address.port()).toString();
m_individualPDUSessionHSMFApiImpl = std::make_shared<
IndividualPDUSessionHSMFApiImpl>(m_router, smf_app_inst, m_address);
m_individualSMContextApiImpl = std::make_shared<IndividualSMContextApiImpl>(
m_router, smf_app_inst, m_address);
m_pduSessionsCollectionApiImpl = std::make_shared<
PDUSessionsCollectionApiImpl>(m_router, smf_app_inst, m_address);
m_smContextsCollectionApiImpl =
std::make_shared<SMContextsCollectionApiImpl>(m_router, smf_app_inst,
m_address);
}
void init(size_t thr = 1);
void start();
void shutdown();
}
void init(size_t thr = 1);
void start();
void shutdown();
private:
std::shared_ptr<Pistache::Http::Endpoint> m_httpEndpoint;
std::shared_ptr<Pistache::Rest::Router> m_router;
std::shared_ptr<IndividualPDUSessionHSMFApiImpl> m_individualPDUSessionHSMFApiImpl;
std::shared_ptr <IndividualSMContextApiImpl> m_individualSMContextApiImpl;
std::shared_ptr <PDUSessionsCollectionApiImpl> m_pduSessionsCollectionApiImpl;
std::shared_ptr <SMContextsCollectionApiImpl> m_smContextsCollectionApiImpl;
std::string m_address;
private:
std::shared_ptr<Pistache::Http::Endpoint> m_httpEndpoint;
std::shared_ptr<Pistache::Rest::Router> m_router;
std::shared_ptr<IndividualPDUSessionHSMFApiImpl> m_individualPDUSessionHSMFApiImpl;
std::shared_ptr<IndividualSMContextApiImpl> m_individualSMContextApiImpl;
std::shared_ptr<PDUSessionsCollectionApiImpl> m_pduSessionsCollectionApiImpl;
std::shared_ptr<SMContextsCollectionApiImpl> m_smContextsCollectionApiImpl;
std::string m_address;
};
......@@ -20,11 +20,11 @@
*/
/*! \file 3gpp_23.003.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_23_003_SEEN
#define FILE_3GPP_23_003_SEEN
......@@ -32,12 +32,12 @@
#include <stdint.h>
typedef struct plmn_s {
uint8_t mcc_digit2:4;
uint8_t mcc_digit1:4;
uint8_t mcc_digit3:4;
uint8_t mnc_digit3:4;
uint8_t mnc_digit2:4;
uint8_t mnc_digit1:4;
uint8_t mcc_digit2 :4;
uint8_t mcc_digit1 :4;
uint8_t mcc_digit3 :4;
uint8_t mnc_digit3 :4;
uint8_t mnc_digit2 :4;
uint8_t mnc_digit1 :4;
} plmn_t;
#define INVALID_TAC_0000 (uint16_t)0x0000
......@@ -47,80 +47,72 @@ typedef struct plmn_s {
#define INVALID_TMSI UINT32_MAX /*!< \brief The network shall not allocate a TMSI with all 32 bits equal to 1
(this is because the TMSI must be stored in the SIM, and the SIM uses 4 octets with all bits
equal to 1 to indicate that no valid TMSI is available). */
typedef uint16_t tac_t;
typedef uint16_t tac_t;
typedef struct tai_s {
plmn_t plmn; /*!< \brief <MCC> + <MNC> */
tac_t tac; /*!< \brief Tracking Area Code */
plmn_t plmn; /*!< \brief <MCC> + <MNC> */
tac_t tac; /*!< \brief Tracking Area Code */
} tai_t;
typedef struct eci_s {
uint32_t gnb_id:20;
uint32_t cell_id:8;
uint32_t empty:4;
uint32_t gnb_id :20;
uint32_t cell_id :8;
uint32_t empty :4;
} ci_t;
typedef struct cgi_s {
plmn_t plmn;
ci_t cell_identity; //28 bits
plmn_t plmn;
ci_t cell_identity; //28 bits
} cgi_t;
typedef struct nr_tai_s /*5G ADD it*/
typedef struct nr_tai_s /*5G ADD it*/
{
plmn_t plmn;
uint32_t tac:24;
}nr_tai_t;
plmn_t plmn;
uint32_t tac :24;
} nr_tai_t;
typedef struct nr_cell_identity_s /*5G ADD it */
{
uint32_t gnb_id;
uint8_t cell_id:4;
}nr_cell_identity_t;
typedef struct nr_cgi_s /*5G ADD it */
{
plmn_t plmn;
nr_cell_identity_t cell_identity;
}nr_cgi_t;
typedef struct fiveG_s_tmsi_s /*5G ADD it */
{
uint16_t amf_set_id:10;
uint8_t amf_pointer:6;
uint32_t fiveG_s_tmsi; //32
}fiveG_s_tmsi_t;
typedef struct fiveG_s_gua_s /*5G ADD it */
{
plmn_t plmn;
uint8_t region_id;
uint16_t amf_set_id:10;
uint8_t amf_pointer:6;
}fiveG_s_gua_t;
typedef struct amf_set_id_s /*5G ADD it*/
uint32_t gnb_id;
uint8_t cell_id :4;
} nr_cell_identity_t;
typedef struct nr_cgi_s /*5G ADD it */
{
uint16_t amf_set_id:10;
}amf_set_id_t;
plmn_t plmn;
nr_cell_identity_t cell_identity;
} nr_cgi_t;
typedef struct fiveG_s_tmsi_s /*5G ADD it */
{
uint16_t amf_set_id :10;
uint8_t amf_pointer :6;
uint32_t fiveG_s_tmsi; //32
} fiveG_s_tmsi_t;
typedef struct allowed_nssai /*5G ADD it*/
typedef struct fiveG_s_gua_s /*5G ADD it */
{
uint8_t sST;
uint32_t sD:24;
}allowed_nssai;
plmn_t plmn;
uint8_t region_id;
uint16_t amf_set_id :10;
uint8_t amf_pointer :6;
typedef struct allowed_nssai_s /*5G ADD it*/
} fiveG_s_gua_t;
typedef struct amf_set_id_s /*5G ADD it*/
{
allowed_nssai *s_nssai;
uint32_t count;
}allowed_nssai_t;
uint16_t amf_set_id :10;
} amf_set_id_t;
typedef struct allowed_nssai /*5G ADD it*/
{
uint8_t sST;
uint32_t sD :24;
} allowed_nssai;
typedef struct allowed_nssai_s /*5G ADD it*/
{
allowed_nssai *s_nssai;
uint32_t count;
} allowed_nssai_t;
#endif
......@@ -20,11 +20,11 @@
*/
/*! \file 3gpp_24.008.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_24_008_SEEN
#define FILE_3GPP_24_008_SEEN
......@@ -124,22 +124,21 @@
#define PCO_CI_IM_CN_SUBSYSTEM_SIGNALING_FLAG (0x0002)
typedef struct pco_protocol_or_container_id_s {
uint16_t protocol_id;
uint8_t length_of_protocol_id_contents;
uint16_t protocol_id;
uint8_t length_of_protocol_id_contents;
std::string protocol_id_contents;
} pco_protocol_or_container_id_t;
typedef struct protocol_configuration_options_s {
uint8_t ext:1;
uint8_t spare:4;
uint8_t configuration_protocol:3;
uint8_t num_protocol_or_container_id;
uint8_t ext :1;
uint8_t spare :4;
uint8_t configuration_protocol :3;
uint8_t num_protocol_or_container_id;
// arbitrary value, can be greater than defined (250/3)
# define PCO_UNSPEC_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID 8
pco_protocol_or_container_id_t protocol_or_container_ids[PCO_UNSPEC_MAXIMUM_PROTOCOL_ID_OR_CONTAINER_ID];
} protocol_configuration_options_t;
//------------------------------------------------------------------------------
// 10.5.6.11 Packet Flow Identifier
//------------------------------------------------------------------------------
......@@ -149,8 +148,12 @@ typedef struct protocol_configuration_options_s {
typedef uint8_t packet_flow_identifier_t;
int encode_packet_flow_identifier_ie(packet_flow_identifier_t *packetflowidentifier, const bool iei_present, uint8_t *buffer, const uint32_t len);
int decode_packet_flow_identifier_ie(packet_flow_identifier_t *packetflowidentifier, const bool iei_present, uint8_t *buffer, const uint32_t len);
int encode_packet_flow_identifier_ie(
packet_flow_identifier_t *packetflowidentifier, const bool iei_present,
uint8_t *buffer, const uint32_t len);
int decode_packet_flow_identifier_ie(
packet_flow_identifier_t *packetflowidentifier, const bool iei_present,
uint8_t *buffer, const uint32_t len);
//------------------------------------------------------------------------------
// 10.5.6.12 Traffic Flow Template
......@@ -246,7 +249,8 @@ typedef struct packet_filter_contents_s {
* and "no TFT operation" shall be empty.
* ---------------------------------------------------------------
*/
typedef struct {} no_packet_filter_t;
typedef struct {
} no_packet_filter_t;
typedef no_packet_filter_t delete_existing_tft_t;
typedef no_packet_filter_t no_tft_operation_t;
......@@ -257,7 +261,7 @@ typedef no_packet_filter_t no_tft_operation_t;
* ------------------------------------------------------------------
*/
#define TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX 16
typedef struct packet_filter_identifier_s{
typedef struct packet_filter_identifier_s {
uint8_t identifier;
} packet_filter_identifier_t;
......@@ -271,15 +275,15 @@ typedef packet_filter_identifier_t delete_packet_filter_t;
*/
#define TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX 4
typedef struct packet_filter_s {
uint8_t spare:2;
uint8_t spare :2;
#define TRAFFIC_FLOW_TEMPLATE_PRE_REL7_TFT_FILTER 0b00
#define TRAFFIC_FLOW_TEMPLATE_DOWNLINK_ONLY 0b01
#define TRAFFIC_FLOW_TEMPLATE_UPLINK_ONLY 0b10
#define TRAFFIC_FLOW_TEMPLATE_BIDIRECTIONAL 0b11
uint8_t direction:2;
uint8_t identifier:4;
uint8_t eval_precedence;
uint8_t length;
uint8_t direction :2;
uint8_t identifier :4;
uint8_t eval_precedence;
uint8_t length;
packet_filter_contents_t packetfiltercontents;
} packet_filter_t;
......@@ -290,29 +294,28 @@ typedef packet_filter_t replace_packet_filter_t;
* Packet filter list
* ------------------
*/
typedef union {
create_new_tft_t createnewtft[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
add_packet_filter_t addpacketfilter[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
typedef union {
create_new_tft_t createnewtft[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
add_packet_filter_t addpacketfilter[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
replace_packet_filter_t replacepacketfilter[TRAFFIC_FLOW_TEMPLATE_NB_PACKET_FILTERS_MAX];
delete_packet_filter_t deletepacketfilter[TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX];
delete_existing_tft_t deleteexistingtft;
no_tft_operation_t notftoperation;
delete_packet_filter_t deletepacketfilter[TRAFFIC_FLOW_TEMPLATE_PACKET_IDENTIFIER_MAX];
delete_existing_tft_t deleteexistingtft;
no_tft_operation_t notftoperation;
} packet_filter_list_t;
typedef struct parameter_s{
typedef struct parameter_s {
#define PARAMETER_IDENTIFIER_AUTHORIZATION_TOKEN 0x01 // Authorization Token
#define PARAMETER_IDENTIFIER_FLOW_IDENTIFIER 0x02 // Flow Identifier
#define PARAMETER_IDENTIFIER_PACKET_FILTER_IDENTIFIER 0x03 // Packet Filter Identifier
uint8_t parameteridentifier;
uint8_t length;
std::string contents;
uint8_t parameteridentifier;
uint8_t length;
std::string contents;
} parameter_t;
typedef struct parameters_list_s{
uint8_t num_parameters;
typedef struct parameters_list_s {
uint8_t num_parameters;
#define TRAFFIC_FLOW_TEMPLATE_NB_PARAMETERS_MAX 16 // TODO or may use []
parameter_t parameter[TRAFFIC_FLOW_TEMPLATE_NB_PARAMETERS_MAX];
parameter_t parameter[TRAFFIC_FLOW_TEMPLATE_NB_PARAMETERS_MAX];
} parameters_list_t;
typedef struct traffic_flow_template_s {
......@@ -324,15 +327,15 @@ typedef struct traffic_flow_template_s {
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_DELETE_PACKET_FILTERS_FROM_EXISTING_TFT 0b101
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_NO_TFT_OPERATION 0b110
#define TRAFFIC_FLOW_TEMPLATE_OPCODE_RESERVED 0b111
uint8_t tftoperationcode:3;
uint8_t tftoperationcode :3;
#define TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_NOT_INCLUDED 0
#define TRAFFIC_FLOW_TEMPLATE_PARAMETER_LIST_IS_INCLUDED 1
uint8_t ebit:1;
uint8_t numberofpacketfilters:4;
uint8_t ebit :1;
uint8_t numberofpacketfilters :4;
packet_filter_list_t packetfilterlist;
parameters_list_t parameterslist; // The parameters list contains a variable number of parameters that may be
// transferred. If the parameters list is included, the E bit is set to 1; otherwise, the E bit
// is set to 0.
parameters_list_t parameterslist; // The parameters list contains a variable number of parameters that may be
// transferred. If the parameters list is included, the E bit is set to 1; otherwise, the E bit
// is set to 0.
} traffic_flow_template_t;
#define TFT_ENCODE_IEI_TRUE true
......
This diff is collapsed.
This diff is collapsed.
......@@ -20,11 +20,11 @@
*/
/*! \file 3gpp_29.281.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_29_281_SEEN
#define FILE_3GPP_29_281_SEEN
......@@ -41,97 +41,122 @@
namespace gtpv1u {
struct gtpu_exception : public std::exception {
gtpu_exception() throw() {
gtpu_exception() throw () {
cause = 0;
phrase.assign("GTPV1-U Exception unknown cause");
}
gtpu_exception(int acause) throw() {
gtpu_exception(int acause) throw () {
cause = acause;
phrase = fmt::format("GTPV1-U Exception cause {}", cause);
}
const char * what () const throw () {
return phrase.c_str();
}
public:
int cause;
std::string phrase;
const char* what() const throw () {
return phrase.c_str();
}
public:
int cause;
std::string phrase;
};
struct gtpu_msg_bad_length_exception : public gtpu_exception {
public:
gtpu_msg_bad_length_exception(const uint8_t msg_type, const uint16_t msg_size) throw() {
phrase = fmt::format("GTPV1-U msg {} Bad Length {} Exception", msg_type, msg_size);
public:
gtpu_msg_bad_length_exception(const uint8_t msg_type,
const uint16_t msg_size) throw () {
phrase = fmt::format("GTPV1-U msg {} Bad Length {} Exception", msg_type,
msg_size);
}
gtpu_msg_bad_length_exception(std::string& aphrase) throw() {
gtpu_msg_bad_length_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_msg_bad_length_exception() throw(){}
virtual ~gtpu_msg_bad_length_exception() throw () {
}
};
struct gtpu_msg_unimplemented_ie_exception : public gtpu_exception {
public:
gtpu_msg_unimplemented_ie_exception(const uint8_t msg_type, const uint8_t ie_type, const uint8_t instance = 0) throw() {
phrase = fmt::format("GTPV1-U msg {} Unimplemented {} IE Instance {} Exception", msg_type, ie_type, instance);
public:
gtpu_msg_unimplemented_ie_exception(const uint8_t msg_type,
const uint8_t ie_type,
const uint8_t instance = 0) throw () {
phrase = fmt::format(
"GTPV1-U msg {} Unimplemented {} IE Instance {} Exception", msg_type,
ie_type, instance);
}
gtpu_msg_unimplemented_ie_exception(std::string& aphrase) throw() {
gtpu_msg_unimplemented_ie_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_msg_unimplemented_ie_exception() throw(){}
virtual ~gtpu_msg_unimplemented_ie_exception() throw () {
}
};
struct gtpu_msg_illegal_ie_exception : public gtpu_exception {
public:
gtpu_msg_illegal_ie_exception(const uint8_t msg_type, const uint8_t ie_type) throw() {
phrase = fmt::format("GTPV1-U msg {} Illegal {} Exception", msg_type, ie_type);
public:
gtpu_msg_illegal_ie_exception(const uint8_t msg_type,
const uint8_t ie_type) throw () {
phrase = fmt::format("GTPV1-U msg {} Illegal {} Exception", msg_type,
ie_type);
}
gtpu_msg_illegal_ie_exception(std::string& aphrase) throw() {
gtpu_msg_illegal_ie_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_msg_illegal_ie_exception() throw(){}
virtual ~gtpu_msg_illegal_ie_exception() throw () {
}
};
struct gtpu_ie_exception : public gtpu_exception {
public:
gtpu_ie_exception(uint8_t ie_type) throw() {
public:
gtpu_ie_exception(uint8_t ie_type) throw () {
phrase = fmt::format("GTPV1-U IE {} Exception", ie_type);
}
gtpu_ie_exception(std::string& aphrase) throw() {
gtpu_ie_exception(std::string &aphrase) throw () {
phrase = aphrase;
}
virtual ~gtpu_ie_exception() throw(){}
virtual ~gtpu_ie_exception() throw () {
}
};
struct gtpu_ie_unimplemented_exception : public gtpu_ie_exception {
public:
gtpu_ie_unimplemented_exception(uint8_t ie_type) throw() : gtpu_ie_exception(ie_type) {
public:
gtpu_ie_unimplemented_exception(uint8_t ie_type) throw ()
:
gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE {} Unimplemented Exception", ie_type);
}
virtual ~gtpu_ie_unimplemented_exception() throw(){}
virtual ~gtpu_ie_unimplemented_exception() throw () {
}
};
struct gtpu_tlv_exception : public gtpu_ie_exception {
public:
gtpu_tlv_exception(uint8_t ie_type) throw() : gtpu_ie_exception(ie_type) {
public:
gtpu_tlv_exception(uint8_t ie_type) throw ()
:
gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE TLV {} Exception", ie_type);
}
virtual ~gtpu_tlv_exception() throw(){}
virtual ~gtpu_tlv_exception() throw () {
}
};
struct gtpu_tlv_bad_length_exception : public gtpu_tlv_exception {
public:
gtpu_tlv_bad_length_exception(uint8_t ie_type, uint16_t ie_length) throw() : gtpu_tlv_exception(ie_type){
public:
gtpu_tlv_bad_length_exception(uint8_t ie_type, uint16_t ie_length) throw ()
:
gtpu_tlv_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE TLV {} Bad Length {} Exception", ie_type);
}
virtual ~gtpu_tlv_bad_length_exception() throw(){}
virtual ~gtpu_tlv_bad_length_exception() throw () {
}
};
struct gtpu_ie_value_exception : public gtpu_ie_exception {
public:
gtpu_ie_value_exception(uint8_t ie_type, const char* field) throw() : gtpu_ie_exception(ie_type){
phrase = fmt::format("GTPV1-U IE {} Bad Value of {} Exception", ie_type, field);
public:
gtpu_ie_value_exception(uint8_t ie_type, const char *field) throw ()
:
gtpu_ie_exception(ie_type) {
phrase = fmt::format("GTPV1-U IE {} Bad Value of {} Exception", ie_type,
field);
}
virtual ~gtpu_ie_value_exception() throw () {
}
virtual ~gtpu_ie_value_exception() throw(){}
};
#define GTPU_IE_RECOVERY 14
......@@ -147,26 +172,26 @@ public:
#define GTPU_END_MARKER (254)
#define GTPU_G_PDU (255)
} // namespace
} // namespace
// 8.2 Recovery
// 8.2 Recovery
// 8.3 Tunnel Endpoint Identifier Data I
typedef struct tunnel_endpoint_identifier_data_i_s {
uint32_t tunnel_endpoint_identifier_data_i;
uint32_t tunnel_endpoint_identifier_data_i;
} tunnel_endpoint_identifier_data_i_t;
// 8.4 GTP-U Peer Address
typedef struct gtp_u_peer_address_s {
// may use variant if can stay with C++17
struct in_addr ipv4_address;
struct in6_addr ipv6_address;
struct in_addr ipv4_address;
struct in6_addr ipv6_address;
bool is_v4;
} gtp_u_peer_address_t;
// 8.5 Extension Header Type List
typedef struct extension_header_type_list_s {
uint8_t length;
uint8_t length;
std::vector<uint8_t> extension_types_list;
} extension_header_type_list_t;
......
......@@ -19,13 +19,11 @@
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_29_502_SMF_SEEN
#define FILE_3GPP_29_502_SMF_SEEN
enum pdu_session_application_error_e {
PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR = 1,
PDU_SESSION_APPLICATION_ERROR_N1_SM_ERROR = 1,
PDU_SESSION_APPLICATION_ERROR_SNSSAI_DENIED = 2,
PDU_SESSION_APPLICATION_ERROR_DNN_DENIED = 3,
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_DENIED = 4,
......@@ -61,110 +59,64 @@ enum pdu_session_application_error_e {
PDU_SESSION_APPLICATION_ERROR_NETWORK_FAILURE = 34
};
static const std::vector<std::string> pdu_session_application_error_e2str = {
"UNKNOWN ERROR",
"N1_SM_ERROR",
"SNSSAI_DENIED",
"DNN_DENIED",
"PDUTYPE_DENIED",
"SSC_DENIED",
"SUBSCRIPTION_DENIED",
"DNN_NOT_SUPPORTED",
"PDUTYPE_NOT_SUPPORTED",
"SSC_NOT_SUPPORTED",
"HOME_ROUTED_ROAMING_REQUIRED",
"OUT_OF_LADN_SERVICE_AREA",
"N2_SM_ERROR",
"PRIORITIZED_SERVICES_ONLY",
"PDU_SESSION_ANCHOR_CHANGE",
"TARGET_MME_CAPABILITY",
"NO_EPS_5GS_CONTINUITY",
"UNABLE_TO_PAGE_UE",
"UE_NOT_RESPONDING",
"REJECTED_BY_UE",
"REJECTED_DUE_VPLMN_POLICY",
"HO_TAU_IN_PROGRESS",
"INTEGRITY_PROTECTED_MDR_NOT_ACCEPTABLE",
"EBI_EXHAUSTED",
"EBI_REJECTED_LOCAL_POLICY",
"EBI_REJECTED_NO_N26",
"DEFAULT_EPS_BEARER_INACTIVE",
"HANDOVER_RESOURCE_ALLOCATION_FAILURE",
"CONTEXT_NOT_FOUND",
"INSUFFICIENT_RESOURCES_SLICE",
"INSUFFICIENT_RESOURCES_SLICE_DNN",
"DNN_CONGESTION",
"S_NSSAI_CONGESTION",
"PEER_NOT_RESPONDING",
"NETWORK_FAILURE"
};
"UNKNOWN ERROR", "N1_SM_ERROR", "SNSSAI_DENIED", "DNN_DENIED",
"PDUTYPE_DENIED", "SSC_DENIED", "SUBSCRIPTION_DENIED", "DNN_NOT_SUPPORTED",
"PDUTYPE_NOT_SUPPORTED", "SSC_NOT_SUPPORTED",
"HOME_ROUTED_ROAMING_REQUIRED", "OUT_OF_LADN_SERVICE_AREA", "N2_SM_ERROR",
"PRIORITIZED_SERVICES_ONLY", "PDU_SESSION_ANCHOR_CHANGE",
"TARGET_MME_CAPABILITY", "NO_EPS_5GS_CONTINUITY", "UNABLE_TO_PAGE_UE",
"UE_NOT_RESPONDING", "REJECTED_BY_UE", "REJECTED_DUE_VPLMN_POLICY",
"HO_TAU_IN_PROGRESS", "INTEGRITY_PROTECTED_MDR_NOT_ACCEPTABLE",
"EBI_EXHAUSTED", "EBI_REJECTED_LOCAL_POLICY", "EBI_REJECTED_NO_N26",
"DEFAULT_EPS_BEARER_INACTIVE", "HANDOVER_RESOURCE_ALLOCATION_FAILURE",
"CONTEXT_NOT_FOUND", "INSUFFICIENT_RESOURCES_SLICE",
"INSUFFICIENT_RESOURCES_SLICE_DNN", "DNN_CONGESTION", "S_NSSAI_CONGESTION",
"PEER_NOT_RESPONDING", "NETWORK_FAILURE" };
//6.1.6.3.12 Enumeration: N2SmInfoType @3GPP TS 29.502 V16.0.0
enum class n2_sm_info_type_e {
PDU_RES_SETUP_REQ = 1, //PDU Session Resource Setup Request Transfer
PDU_RES_SETUP_RSP = 2, //PDU Session Resource Setup Response Transfer
PDU_RES_SETUP_FAIL = 3, //PDU Session Resource Setup Unsuccessful Transfer
PDU_RES_REL_CMD = 4, //PDU Session Resource Release Command Transfer
PDU_RES_REL_RSP = 5, //PDU Session Resource Release Response Transfer
PDU_RES_MOD_REQ = 6, //PDU Session Resource Modify Request Transfer
PDU_RES_MOD_RSP = 7, //PDU Session Resource Modify Response Transfer
PDU_RES_MOD_FAIL = 8, //PDU Session Resource Modify Unsuccessful Transfer
PDU_RES_NTY = 9, //PDU Session Resource Notify Transfer
PDU_RES_NTY_REL = 10, //PDU Session Resource Notify Released Transfer
PDU_RES_MOD_IND = 11, //PDU Session Resource Modify Indication Transfer
PDU_RES_MOD_CFM = 12, //PDU Session Resource Modify Confirm Transfer
PATH_SWITCH_REQ = 13, //Path Switch Request Transfer
PATH_SWITCH_SETUP_FAIL = 14, //Path Switch Request Setup Failed Transfer
PATH_SWITCH_REQ_ACK = 15, //Path Switch Request Acknowledge Transfer
PATH_SWITCH_REQ_FAIL = 16, //Path Switch Request Unsuccessful Transfer
HANDOVER_REQUIRED = 17, //Handover Required Transfer
HANDOVER_CMD = 18, //Handover Command Transfer
HANDOVER_PREP_FAIL = 19, //Handover Preparation Unsuccessful Transfer
HANDOVER_REQ_ACK = 20, //Handover Request Acknowledge Transfer
HANDOVER_RES_ALLOC_FAIL = 21, //Handover Resource Allocation Unsuccessful Transfer
SECONDARY_RAT_USAGE = 22 //Secondary RAT Data Usage Report Transfer
PDU_RES_SETUP_REQ = 1, //PDU Session Resource Setup Request Transfer
PDU_RES_SETUP_RSP = 2, //PDU Session Resource Setup Response Transfer
PDU_RES_SETUP_FAIL = 3, //PDU Session Resource Setup Unsuccessful Transfer
PDU_RES_REL_CMD = 4, //PDU Session Resource Release Command Transfer
PDU_RES_REL_RSP = 5, //PDU Session Resource Release Response Transfer
PDU_RES_MOD_REQ = 6, //PDU Session Resource Modify Request Transfer
PDU_RES_MOD_RSP = 7, //PDU Session Resource Modify Response Transfer
PDU_RES_MOD_FAIL = 8, //PDU Session Resource Modify Unsuccessful Transfer
PDU_RES_NTY = 9, //PDU Session Resource Notify Transfer
PDU_RES_NTY_REL = 10, //PDU Session Resource Notify Released Transfer
PDU_RES_MOD_IND = 11, //PDU Session Resource Modify Indication Transfer
PDU_RES_MOD_CFM = 12, //PDU Session Resource Modify Confirm Transfer
PATH_SWITCH_REQ = 13, //Path Switch Request Transfer
PATH_SWITCH_SETUP_FAIL = 14, //Path Switch Request Setup Failed Transfer
PATH_SWITCH_REQ_ACK = 15, //Path Switch Request Acknowledge Transfer
PATH_SWITCH_REQ_FAIL = 16, //Path Switch Request Unsuccessful Transfer
HANDOVER_REQUIRED = 17, //Handover Required Transfer
HANDOVER_CMD = 18, //Handover Command Transfer
HANDOVER_PREP_FAIL = 19, //Handover Preparation Unsuccessful Transfer
HANDOVER_REQ_ACK = 20, //Handover Request Acknowledge Transfer
HANDOVER_RES_ALLOC_FAIL = 21, //Handover Resource Allocation Unsuccessful Transfer
SECONDARY_RAT_USAGE = 22 //Secondary RAT Data Usage Report Transfer
};
static const std::vector<std::string> n2_sm_info_type_e2str = {
"UNKNOWN_TYPE",
"PDU_RES_SETUP_REQ",
"PDU_RES_SETUP_RSP",
"PDU_RES_SETUP_FAIL",
"PDU_RES_REL_CMD",
"PDU_RES_REL_RSP",
"PDU_RES_MOD_REQ",
"PDU_RES_MOD_RSP",
"PDU_RES_MOD_FAIL",
"PDU_RES_NTY",
"PDU_RES_NTY_REL",
"PDU_RES_MOD_IND",
"PDU_RES_MOD_CFM",
"PATH_SWITCH_REQ",
"PATH_SWITCH_SETUP_FAIL",
"PATH_SWITCH_REQ_ACK",
"PATH_SWITCH_REQ_FAIL",
"HANDOVER_REQUIRED",
"HANDOVER_CMD",
"HANDOVER_PREP_FAIL",
"HANDOVER_REQ_ACK",
"HANDOVER_RES_ALLOC_FAIL",
"SECONDARY_RAT_USAGE"
};
static const std::vector<std::string> n2_sm_info_type_e2str = { "UNKNOWN_TYPE",
"PDU_RES_SETUP_REQ", "PDU_RES_SETUP_RSP", "PDU_RES_SETUP_FAIL",
"PDU_RES_REL_CMD", "PDU_RES_REL_RSP", "PDU_RES_MOD_REQ", "PDU_RES_MOD_RSP",
"PDU_RES_MOD_FAIL", "PDU_RES_NTY", "PDU_RES_NTY_REL", "PDU_RES_MOD_IND",
"PDU_RES_MOD_CFM", "PATH_SWITCH_REQ", "PATH_SWITCH_SETUP_FAIL",
"PATH_SWITCH_REQ_ACK", "PATH_SWITCH_REQ_FAIL", "HANDOVER_REQUIRED",
"HANDOVER_CMD", "HANDOVER_PREP_FAIL", "HANDOVER_REQ_ACK",
"HANDOVER_RES_ALLOC_FAIL", "SECONDARY_RAT_USAGE" };
enum class upCnx_state_e {
UPCNX_STATE_ACTIVATED = 0,
UPCNX_STATE_DEACTIVATED = 1,
UPCNX_STATE_ACTIVATING =2
};
static const std::vector<std::string> upCnx_state_e2str = {
"UPCNX_STATE_ACTIVATED",
"UPCNX_STATE_DEACTIVATED",
"UPCNX_STATE_ACTIVATING"
UPCNX_STATE_DEACTIVATED = 1,
UPCNX_STATE_ACTIVATING = 2
};
static const std::vector<std::string> upCnx_state_e2str =
{ "UPCNX_STATE_ACTIVATED", "UPCNX_STATE_DEACTIVATED",
"UPCNX_STATE_ACTIVATING" };
#endif
......@@ -19,7 +19,6 @@
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_29_503_SMF_SEEN
#define FILE_3GPP_29_503_SMF_SEEN
......@@ -31,33 +30,41 @@ enum ssc_mode_e {
SSC_MODE_2 = 2,
SSC_MODE_3 = 3,
};
static const std::vector<std::string> ssc_mode_e2str = {"Error", "SSC_MODE_1", "SSC_MODE_2", "SSC_MODE_3"};
static const std::vector<std::string> ssc_mode_e2str = { "Error", "SSC_MODE_1",
"SSC_MODE_2", "SSC_MODE_3" };
typedef struct ssc_mode_s {
uint8_t ssc_mode;
ssc_mode_s() : ssc_mode(SSC_MODE_1) {}
ssc_mode_s(ssc_mode_e mode) : ssc_mode(mode) {}
ssc_mode_s(const struct ssc_mode_s& p) : ssc_mode(p.ssc_mode) {}
ssc_mode_s()
:
ssc_mode(SSC_MODE_1) {
}
ssc_mode_s(ssc_mode_e mode)
:
ssc_mode(mode) {
}
ssc_mode_s(const struct ssc_mode_s &p)
:
ssc_mode(p.ssc_mode) {
}
} ssc_mode_t;
typedef struct pdu_session_types_s {
pdu_session_type_t default_session_type;
std::vector<pdu_session_type_t> allowed_session_types;
pdu_session_type_t default_session_type;
std::vector<pdu_session_type_t> allowed_session_types;
} pdu_session_types_t;
typedef struct ssc_modes_s {
ssc_mode_t default_ssc_mode;
std::vector<ssc_mode_t> allowed_ssc_modes;
ssc_mode_t default_ssc_mode;
std::vector<ssc_mode_t> allowed_ssc_modes;
} ssc_modes_t;
typedef struct dnn_configuration_s {
pdu_session_types_t pdu_session_types;
ssc_modes_t ssc_modes;
session_ambr_t session_ambr;
subscribed_default_qos_t _5g_qos_profile;
//staticIpAddresses
pdu_session_types_t pdu_session_types;
ssc_modes_t ssc_modes;
session_ambr_t session_ambr;
subscribed_default_qos_t _5g_qos_profile;
//staticIpAddresses
} dnn_configuration_t;
#endif
......@@ -19,44 +19,42 @@
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_29_571_SEEN
#define FILE_3GPP_29_571_SEEN
typedef struct session_ambr_s {
std::string uplink;
std::string downlink;
std::string uplink;
std::string downlink;
} session_ambr_t;
enum preemtion_capability_e {
NOT_PREEMPT = 1,
MAY_PREEMPT = 2
NOT_PREEMPT = 1,
MAY_PREEMPT = 2
};
static const std::vector<std::string> preemtion_capability_e2str = {"Error", "NOT_PREEMPT", "MAY_PREEMPT"};
static const std::vector<std::string> preemtion_capability_e2str = { "Error",
"NOT_PREEMPT", "MAY_PREEMPT" };
//see section 5.5.4.1@TS 29.571
typedef struct arp_5gc_s {
uint8_t priority_level;// (integer 1-15)
std::string preempt_cap;
std::string preempt_vuln; //NOT_PREEMPTABLE, PREEMPTABLE
uint8_t priority_level; // (integer 1-15)
std::string preempt_cap;
std::string preempt_vuln; //NOT_PREEMPTABLE, PREEMPTABLE
} arp_5gc_t;
//see section 5.4.4.1@TS 29.571
typedef struct subscribed_default_qos_s{
uint8_t _5qi;
arp_5gc_t arp;
uint8_t priority_level;//1-127
typedef struct subscribed_default_qos_s {
uint8_t _5qi;
arp_5gc_t arp;
uint8_t priority_level; //1-127
} subscribed_default_qos_t;
enum reflective_qos_attribute_e{
enum reflective_qos_attribute_e {
RQOS = 1,
NO_RQOS = 2
};
static const std::vector<std::string> reflective_qos_attribute_e2str = {"ERROR", "RQOS", "NO_RQOS"};
static const std::vector<std::string> reflective_qos_attribute_e2str = {
"ERROR", "RQOS", "NO_RQOS" };
#endif
......@@ -20,18 +20,18 @@
*/
/*! \file 3gpp_commons.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_COMMONS_SEEN
#define FILE_3GPP_COMMONS_SEEN
#include <stdint.h>
// 8.2 Recovery
// 8.2 Recovery
typedef struct recovery_s {
uint8_t restart_counter;
} recovery_t;
......
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 common_root_types.c
\brief
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
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.
......@@ -32,6 +32,7 @@ include_directories(${SRC_TOP_DIR}/utils)
include_directories(${SRC_TOP_DIR}/utils/bstr)
include_directories(${SRC_TOP_DIR}/nas/security)
include_directories(${SRC_TOP_DIR}/common)
include_directories(${SRC_TOP_DIR}/common/nas)
include_directories(${SRC_TOP_DIR}/ngap/asn1c)
include_directories(${SRC_TOP_DIR}/ngap/ies)
......
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