Commit 09c7657e authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

First version for allowing SMF to receive notification from NRF

parent fa438400
...@@ -27,112 +27,91 @@ ...@@ -27,112 +27,91 @@
# either expressed or implied, of the FreeBSD Project. # either expressed or implied, of the FreeBSD Project.
# #
--- # see https://clang.llvm.org/docs/ClangFormatStyleOptions.html for explanation
Language: Cpp # of style options
# BasedOnStyle: Google
AccessModifierOffset: -1 BasedOnStyle: Google
AlignAfterOpenBracket: Align Language: Cpp
AlignConsecutiveAssignments: false IndentWidth: 2
ColumnLimit: 80
IncludeBlocks: Preserve
SortIncludes: false
# alignment
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left AlignEscapedNewlines: Right
AlignOperands: true AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true DerivePointerAlignment: false
AllowShortBlocksOnASingleLine: false PointerAlignment: Left
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All # function style
AllowShortIfStatementsOnASingleLine: true AllowAllParametersOfDeclarationOnNextLine: false
AllowShortLoopsOnASingleLine: true AllowShortFunctionsOnASingleLine: Inline
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true IndentWrappedFunctionNames: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true # template style
BinPackParameters: true AlwaysBreakTemplateDeclarations: Yes
BraceWrapping:
AfterClass: false # preprocessor style
AfterControlStatement: false IndentPPDirectives: None
AfterEnum: false
AfterFunction: false # block style
AfterNamespace: false AllowShortBlocksOnASingleLine: false
AfterObjCDeclaration: false KeepEmptyLinesAtTheStartOfBlocks: false
AfterStruct: false
AfterUnion: false # break style
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false BreakBeforeTernaryOperators: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4 ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
NamespaceIndentation: None ReflowComments: true
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false # spacing style
ObjCSpaceBeforeProtocolList: false UseTab: Never
PenaltyBreakAssignment: 2 SpaceAfterCStyleCast: true
PenaltyBreakBeforeFirstCallParameter: 1 SpaceAfterTemplateKeyword: false
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2 SpacesBeforeTrailingComments: 2
SpacesInAngles: false SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...
# 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_EventExposure
* Session Management Event Exposure 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 "NFStatusNotifyApi.h"
#include "Helpers.h"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
NFStatusNotifyApi::NFStatusNotifyApi(
std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void NFStatusNotifyApi::init() {
setupRoutes();
}
void NFStatusNotifyApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(
*router, base + smf_cfg.sbi_api_version + "/subscriptions",
Routes::bind(&NFStatusNotifyApi::notify_nf_status_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(
Routes::bind(&NFStatusNotifyApi::notify_nf_status_default_handler, this));
}
void NFStatusNotifyApi::notify_nf_status_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) {
// Getting the body param
NotificationData notificationData;
try {
nlohmann::json::parse(request.body()).get_to(notificationData);
this->receive_nf_status_notification(notificationData, response);
} catch (nlohmann::detail::exception& e) {
// send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (Pistache::Http::HttpError& e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} catch (std::exception& e) {
// send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void NFStatusNotifyApi::notify_nf_status_default_handler(
const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
response.send(
Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
} // namespace api
} // namespace smf_server
} // namespace oai
/**
* Nsmf_EventExposure
* Session Management Event Exposure 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.
*/
/*
* NFStatusNotifyApi.h
*
*
*/
#ifndef NFStatusNotifyApi_H_
#define NFStatusNotifyApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "NotificationData.h"
#include "ProblemDetails.h"
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
class NFStatusNotifyApi {
public:
NFStatusNotifyApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~NFStatusNotifyApi() {}
void init();
const std::string base = "/nsmf_nfstatus_notify/";
private:
void setupRoutes();
void notify_nf_status_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
void notify_nf_status_default_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="NotificationData"></param>
virtual void receive_nf_status_notification(
const NotificationData& notificationData,
Pistache::Http::ResponseWriter& response) = 0;
};
} // namespace api
} // namespace smf_server
} // namespace oai
#endif /* NFStatusNotifyApi_H_ */
/**
* Nsmf_EventExposure
* Session Management Event Exposure 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 "NFStatusNotifyApiImpl.h"
#include "logger.hpp"
#include "smf_msg.hpp"
#include "itti_msg_sbi.hpp"
#include "smf_config.hpp"
extern smf::smf_config smf_cfg;
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
NFStatusNotifyApiImpl::NFStatusNotifyApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app* smf_app_inst,
std::string address)
: NFStatusNotifyApi(rtr), m_smf_app(smf_app_inst), m_address(address) {}
void NFStatusNotifyApiImpl::receive_nf_status_notification(
const NotificationData& notificationData,
Pistache::Http::ResponseWriter& response) {
Logger::smf_api_server().info(
"NFStatusNotifyApiImpl, received a NF status notification...");
smf::data_notification_msg notification_msg = {};
notification_msg.set_notification_event_type(notificationData.getEvent());
notification_msg.set_nf_instance_uri(notificationData.getNfInstanceUri());
std::shared_ptr<smf::nf_profile> p = {};
// Only support UPF for now
if (notificationData.getNfProfile().getNfType() == "UPF")
p = std::make_shared<smf::upf_profile>();
nlohmann::json pj = {};
to_json(pj, notificationData);
p.get()->from_json(pj);
notification_msg.set_profile(p);
// Step 2. Handle the message in smf_app
std::shared_ptr<itti_sbi_notification_data> itti_msg =
std::make_shared<itti_sbi_notification_data>(TASK_SMF_N11, TASK_SMF_APP);
itti_msg->notification_msg = notification_msg;
itti_msg->http_version = 1;
ProblemDetails problem_details = {};
uint8_t http_code = 0;
if (m_smf_app->handle_nf_status_notification(
itti_msg, problem_details, http_code)) {
response.send(Pistache::Http::Code(204));
} else {
nlohmann::json json_data = {};
to_json(json_data, problem_details);
// content type
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType("application/problem+json"));
response.send(Pistache::Http::Code(http_code), json_data.dump().c_str());
}
}
} // namespace api
} // namespace smf_server
} // namespace oai
/**
* Nsmf_EventExposure
* Session Management Event Exposure 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.
*/
/*
* NFStatusNotifyApiImpl.h
*
*
*/
#ifndef NF_STATUS_NOTIFY_API_IMPL_H_
#define NF_STATUS_NOTIFY_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <NFStatusNotifyApi.h>
#include <pistache/optional.h>
#include "NotificationData.h"
#include "ProblemDetails.h"
#include "smf_app.hpp"
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
class NFStatusNotifyApiImpl : public oai::smf_server::api::NFStatusNotifyApi {
public:
NFStatusNotifyApiImpl(
std::shared_ptr<Pistache::Rest::Router>, smf::smf_app* smf_app_inst,
std::string address);
~NFStatusNotifyApiImpl() {}
void receive_nf_status_notification(
const NotificationData& notificationData,
Pistache::Http::ResponseWriter& response);
private:
smf::smf_app* m_smf_app;
std::string m_address;
};
} // namespace api
} // namespace smf_server
} // namespace oai
#endif
...@@ -53,10 +53,10 @@ void from_json(const nlohmann::json &j, NotificationData &o) { ...@@ -53,10 +53,10 @@ void from_json(const nlohmann::json &j, NotificationData &o) {
} }
} }
NotificationEventType NotificationData::getEvent() const { std::string NotificationData::getEvent() const {
return m_Event; return m_Event;
} }
void NotificationData::setEvent(NotificationEventType const &value) { void NotificationData::setEvent(std::string const &value) {
m_Event = value; m_Event = value;
} }
std::string NotificationData::getNfInstanceUri() const { std::string NotificationData::getNfInstanceUri() const {
......
...@@ -45,8 +45,8 @@ class NotificationData { ...@@ -45,8 +45,8 @@ class NotificationData {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
NotificationEventType getEvent() const; std::string getEvent() const;
void setEvent(NotificationEventType const &value); void setEvent(std::string const &value);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
...@@ -70,7 +70,7 @@ class NotificationData { ...@@ -70,7 +70,7 @@ class NotificationData {
friend void to_json(nlohmann::json &j, const NotificationData &o); friend void to_json(nlohmann::json &j, const NotificationData &o);
friend void from_json(const nlohmann::json &j, NotificationData &o); friend void from_json(const nlohmann::json &j, NotificationData &o);
protected: protected:
NotificationEventType m_Event; std::string m_Event;
std::string m_NfInstanceUri; std::string m_NfInstanceUri;
......
This diff is collapsed.
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * 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 * the OAI Public License, Version 1.1 (the "License"); you may not use this
* except in compliance with the License. * file except in compliance with the License. You may obtain a copy of the
* You may obtain a copy of the License at * License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -30,64 +30,64 @@ ...@@ -30,64 +30,64 @@
#define ITTI_MSG_SBI_HPP_INCLUDED_ #define ITTI_MSG_SBI_HPP_INCLUDED_
#include "itti_msg.hpp" #include "itti_msg.hpp"
#include "smf_msg.hpp"
#include "pistache/http.h" #include "pistache/http.h"
#include "smf_msg.hpp"
class itti_sbi_msg : public itti_msg { class itti_sbi_msg : public itti_msg {
public: public:
itti_sbi_msg(const itti_msg_type_t msg_type, const task_id_t orig, itti_sbi_msg(
const task_id_t dest) const itti_msg_type_t msg_type, const task_id_t orig,
: const task_id_t dest)
itti_msg(msg_type, orig, dest) { : itti_msg(msg_type, orig, dest) {}
itti_sbi_msg(const itti_sbi_msg& i) : itti_msg(i) {}
} itti_sbi_msg(
itti_sbi_msg(const itti_sbi_msg &i) const itti_sbi_msg& i, const task_id_t orig, const task_id_t dest)
: : itti_sbi_msg(i) {
itti_msg(i) { origin = orig;
}
itti_sbi_msg(const itti_sbi_msg &i, const task_id_t orig,
const task_id_t dest)
:
itti_sbi_msg(i) {
origin = orig;
destination = dest; destination = dest;
} }
}; };
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class itti_sbi_event_exposure_request : public itti_sbi_msg { class itti_sbi_event_exposure_request : public itti_sbi_msg {
public: public:
itti_sbi_event_exposure_request(const task_id_t orig, const task_id_t dest) itti_sbi_event_exposure_request(const task_id_t orig, const task_id_t dest)
: : itti_sbi_msg(SBI_EVENT_EXPOSURE_REQUEST, orig, dest),
itti_sbi_msg(SBI_EVENT_EXPOSURE_REQUEST, orig, dest), event_exposure(),
event_exposure(), http_version(1) {}
http_version(1) { itti_sbi_event_exposure_request(const itti_sbi_event_exposure_request& i)
} : itti_sbi_msg(i), event_exposure(i.event_exposure), http_version(1) {}
itti_sbi_event_exposure_request(
const itti_sbi_event_exposure_request &i)
:
itti_sbi_msg(i),
event_exposure(i.event_exposure),
http_version(1) {
}
itti_sbi_event_exposure_request( itti_sbi_event_exposure_request(
const itti_sbi_event_exposure_request &i, const task_id_t orig, const itti_sbi_event_exposure_request& i, const task_id_t orig,
const task_id_t dest) const task_id_t dest)
: : itti_sbi_msg(i, orig, dest),
itti_sbi_msg(i, orig, dest), event_exposure(i.event_exposure),
event_exposure(i.event_exposure), http_version(i.http_version) {}
http_version(i.http_version) { const char* get_msg_name() { return "SBI_EVENT_EXPOSURE_REQUEST"; };
}
const char* get_msg_name() {
return "SBI_EVENT_EXPOSURE_REQUEST";
}
;
smf::event_exposure_msg event_exposure; smf::event_exposure_msg event_exposure;
uint8_t http_version; uint8_t http_version;
}; };
//-----------------------------------------------------------------------------
class itti_sbi_notification_data : public itti_sbi_msg {
public:
itti_sbi_notification_data(const task_id_t orig, const task_id_t dest)
: itti_sbi_msg(SBI_NOTIFICATION_DATA, orig, dest),
notification_msg(),
http_version(1) {}
itti_sbi_notification_data(const itti_sbi_notification_data& i)
: itti_sbi_msg(i),
notification_msg(i.notification_msg),
http_version(1) {}
itti_sbi_notification_data(
const itti_sbi_notification_data& i, const task_id_t orig,
const task_id_t dest)
: itti_sbi_msg(i, orig, dest),
notification_msg(i.notification_msg),
http_version(i.http_version) {}
const char* get_msg_name() { return "SBI_NOTIFICATION_DATA"; };
smf::data_notification_msg notification_msg;
uint8_t http_version;
};
#endif /* ITTI_MSG_SBI_HPP_INCLUDED_ */ #endif /* ITTI_MSG_SBI_HPP_INCLUDED_ */
This diff is collapsed.
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * 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 * the OAI Public License, Version 1.1 (the "License"); you may not use this
* except in compliance with the License. *file except in compliance with the License. You may obtain a copy of the
* You may obtain a copy of the License at *License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <utility> #include <utility>
typedef enum { typedef enum {
TASK_FIRST = 0, TASK_FIRST = 0,
TASK_ITTI_TIMER = TASK_FIRST, TASK_ITTI_TIMER = TASK_FIRST,
TASK_ASYNC_SHELL_CMD, TASK_ASYNC_SHELL_CMD,
TASK_SMF_APP, TASK_SMF_APP,
...@@ -54,9 +54,9 @@ typedef enum message_priorities_e { ...@@ -54,9 +54,9 @@ typedef enum message_priorities_e {
} message_priorities_t; } message_priorities_t;
typedef enum { typedef enum {
ITTI_MSG_TYPE_NONE = -1, ITTI_MSG_TYPE_NONE = -1,
ITTI_MSG_TYPE_FIRST = 0, ITTI_MSG_TYPE_FIRST = 0,
ASYNC_SHELL_CMD = ITTI_MSG_TYPE_FIRST, ASYNC_SHELL_CMD = ITTI_MSG_TYPE_FIRST,
RESTORE_N4_SESSIONS, RESTORE_N4_SESSIONS,
S11_REMOTE_PEER_NOT_RESPONDING, S11_REMOTE_PEER_NOT_RESPONDING,
S11_CREATE_SESSION_REQUEST, S11_CREATE_SESSION_REQUEST,
...@@ -79,7 +79,7 @@ typedef enum { ...@@ -79,7 +79,7 @@ typedef enum {
S1U_ERROR_INDICATION, S1U_ERROR_INDICATION,
S1U_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION, S1U_SUPPORTED_EXTENSION_HEADERS_NOTIFICATION,
S1U_END_MARKER, S1U_END_MARKER,
S1U_G_PDU, // UNUSED S1U_G_PDU, // UNUSED
N4_HEARTBEAT_REQUEST, N4_HEARTBEAT_REQUEST,
N4_HEARTBEAT_RESPONSE, N4_HEARTBEAT_RESPONSE,
N4_PFCP_PFD_MANAGEMENT_REQUEST, N4_PFCP_PFD_MANAGEMENT_REQUEST,
...@@ -121,8 +121,10 @@ typedef enum { ...@@ -121,8 +121,10 @@ typedef enum {
N11_UPDATE_NF_INSTANCE_REQUEST, N11_UPDATE_NF_INSTANCE_REQUEST,
N11_UPDATE_NF_INSTANCE_RESPONSE, N11_UPDATE_NF_INSTANCE_RESPONSE,
N11_DEREGISTER_NF_INSTANCE, N11_DEREGISTER_NF_INSTANCE,
N11_SUBSCRIBE_UPF_STATUS_NOTIFY,
NX_TRIGGER_SESSION_MODIFICATION, NX_TRIGGER_SESSION_MODIFICATION,
SBI_EVENT_EXPOSURE_REQUEST, SBI_EVENT_EXPOSURE_REQUEST,
SBI_NOTIFICATION_DATA,
UDP_INIT, UDP_INIT,
UDP_DATA_REQ, UDP_DATA_REQ,
UDP_DATA_IND, UDP_DATA_IND,
...@@ -135,13 +137,14 @@ typedef enum { ...@@ -135,13 +137,14 @@ typedef enum {
typedef unsigned long message_number_t; typedef unsigned long message_number_t;
class itti_msg { class itti_msg {
public: public:
itti_msg(); itti_msg();
itti_msg(const itti_msg_type_t msg_type, const task_id_t origin, const task_id_t destination); itti_msg(
const itti_msg_type_t msg_type, const task_id_t origin,
const task_id_t destination);
itti_msg(const itti_msg& i); itti_msg(const itti_msg& i);
itti_msg& operator=(itti_msg other) itti_msg& operator=(itti_msg other) {
{
std::swap(msg_num, other.msg_num); std::swap(msg_num, other.msg_num);
std::swap(origin, other.origin); std::swap(origin, other.origin);
std::swap(destination, other.destination); std::swap(destination, other.destination);
...@@ -153,36 +156,47 @@ public: ...@@ -153,36 +156,47 @@ public:
static const char* get_msg_name(); static const char* get_msg_name();
message_number_t msg_num; message_number_t msg_num;
task_id_t origin; task_id_t origin;
task_id_t destination; task_id_t destination;
itti_msg_type_t msg_type; itti_msg_type_t msg_type;
}; };
class itti_msg_timeout : public itti_msg { class itti_msg_timeout : public itti_msg {
public: public:
itti_msg_timeout(const task_id_t origin, const task_id_t destination, uint32_t timer_id, uint64_t arg1_user, uint64_t arg2_user): itti_msg_timeout(
itti_msg(TIME_OUT, origin, destination), timer_id(timer_id), arg1_user(arg1_user), arg2_user(arg2_user) {} const task_id_t origin, const task_id_t destination, uint32_t timer_id,
itti_msg_timeout(const itti_msg_timeout& i) : itti_msg(i), timer_id(i.timer_id), arg1_user(i.arg1_user), arg2_user(i.arg2_user) {} uint64_t arg1_user, uint64_t arg2_user)
static const char* get_msg_name() {return "TIME_OUT";}; : itti_msg(TIME_OUT, origin, destination),
timer_id(timer_id),
arg1_user(arg1_user),
arg2_user(arg2_user) {}
itti_msg_timeout(const itti_msg_timeout& i)
: itti_msg(i),
timer_id(i.timer_id),
arg1_user(i.arg1_user),
arg2_user(i.arg2_user) {}
static const char* get_msg_name() { return "TIME_OUT"; };
uint32_t timer_id; uint32_t timer_id;
uint64_t arg1_user; uint64_t arg1_user;
uint64_t arg2_user; uint64_t arg2_user;
}; };
class itti_msg_ping : public itti_msg { class itti_msg_ping : public itti_msg {
public: public:
itti_msg_ping(const task_id_t origin, const task_id_t destination, uint32_t seq): itti_msg(HEALTH_PING, origin, destination), seq(seq) {} itti_msg_ping(
const task_id_t origin, const task_id_t destination, uint32_t seq)
: itti_msg(HEALTH_PING, origin, destination), seq(seq) {}
itti_msg_ping(const itti_msg_ping& i) : itti_msg(i), seq(i.seq) {} itti_msg_ping(const itti_msg_ping& i) : itti_msg(i), seq(i.seq) {}
static const char* get_msg_name() {return "HEALTH_PING";}; static const char* get_msg_name() { return "HEALTH_PING"; };
uint32_t seq; uint32_t seq;
}; };
class itti_msg_terminate : public itti_msg { class itti_msg_terminate : public itti_msg {
public: public:
itti_msg_terminate(const task_id_t origin, const task_id_t destination): itti_msg_terminate(const task_id_t origin, const task_id_t destination)
itti_msg(TERMINATE, origin, destination) {} : itti_msg(TERMINATE, origin, destination) {}
itti_msg_terminate(const itti_msg_terminate& i) : itti_msg(i) {} itti_msg_terminate(const itti_msg_terminate& i) : itti_msg(i) {}
static const char* get_msg_name() {return "TERMINATE";}; static const char* get_msg_name() { return "TERMINATE"; };
}; };
#endif /* SRC_ITTI_ITTI_MSG_HPP_INCLUDED_ */ #endif /* SRC_ITTI_ITTI_MSG_HPP_INCLUDED_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -48,8 +48,8 @@ class smf_n11 { ...@@ -48,8 +48,8 @@ class smf_n11 {
public: public:
smf_n11(); smf_n11();
smf_n11(smf_n11 const &) = delete; smf_n11(smf_n11 const&) = delete;
void operator=(smf_n11 const &) = delete; void operator=(smf_n11 const&) = delete;
/* /*
* Send N1N2 Message Transfer Request to AMF * Send N1N2 Message Transfer Request to AMF
...@@ -123,13 +123,24 @@ class smf_n11 { ...@@ -123,13 +123,24 @@ class smf_n11 {
*/ */
void deregister_nf_instance( void deregister_nf_instance(
std::shared_ptr<itti_n11_deregister_nf_instance> msg); std::shared_ptr<itti_n11_deregister_nf_instance> msg);
/*
* Send a NFStatusSubscribe to NRF (to be notified when a new UPF becomes
* available)
* @param [std::shared_ptr<itti_n11_subscribe_upf_status_notify>] msg: Content
* of message to be sent
* @return void
*/
void subscribe_upf_status_notify(
std::shared_ptr<itti_n11_subscribe_upf_status_notify> msg);
/* /*
* Create Curl handle for multi curl * Create Curl handle for multi curl
* @param [event_notification&] ev_notif: content of the event notification * @param [event_notification&] ev_notif: content of the event notification
* @param [std::string *] data: data * @param [std::string *] data: data
* @return pointer to the created curl * @return pointer to the created curl
*/ */
CURL *curl_create_handle(event_notification &ev_notif, std::string *data); CURL* curl_create_handle(event_notification& ev_notif, std::string* data);
}; };
} // namespace smf } // namespace smf
#endif /* FILE_SMF_N11_HPP_SEEN */ #endif /* FILE_SMF_N11_HPP_SEEN */
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