Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDR
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UDR
Commits
bff0ba48
Commit
bff0ba48
authored
Jun 23, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
9dd80b75
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2 additions
and
204 deletions
+2
-204
src/api_server/udr-api-server.cpp
src/api_server/udr-api-server.cpp
+0
-3
src/api_server/udr-api-server.h
src/api_server/udr-api-server.h
+2
-0
src/oai_udr/main.cpp
src/oai_udr/main.cpp
+0
-3
src/udr_app/udr_app.cpp
src/udr_app/udr_app.cpp
+0
-10
src/udr_app/udr_server.cpp
src/udr_app/udr_server.cpp
+0
-123
src/udr_app/udr_server.hpp
src/udr_app/udr_server.hpp
+0
-65
No files found.
src/api_server/udr-api-server.cpp
View file @
bff0ba48
...
@@ -34,9 +34,6 @@
...
@@ -34,9 +34,6 @@
#include "udr-api-server.h"
#include "udr-api-server.h"
#include "logger.hpp"
#include "logger.hpp"
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#ifdef __linux__
#ifdef __linux__
#include <signal.h>
#include <signal.h>
#include <unistd.h>
#include <unistd.h>
...
...
src/api_server/udr-api-server.h
View file @
bff0ba48
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
#include <vector>
#include <vector>
#endif
#endif
#define PISTACHE_SERVER_MAX_PAYLOAD 32768
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
...
...
src/oai_udr/main.cpp
View file @
bff0ba48
...
@@ -25,9 +25,6 @@
...
@@ -25,9 +25,6 @@
#include "logger.hpp"
#include "logger.hpp"
#include "options.hpp"
#include "options.hpp"
#include "pid_file.hpp"
#include "pid_file.hpp"
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#include "udr-api-server.h"
#include "udr-api-server.h"
#include "udr_app.hpp"
#include "udr_app.hpp"
#include "udr_config.hpp"
#include "udr_config.hpp"
...
...
src/udr_app/udr_app.cpp
View file @
bff0ba48
...
@@ -31,15 +31,6 @@
...
@@ -31,15 +31,6 @@
#include <mysql/mysql.h>
#include <mysql/mysql.h>
#include <unistd.h>
#include <unistd.h>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/posix_time/time_formatters.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <chrono>
#include "AccessAndMobilitySubscriptionData.h"
#include "AccessAndMobilitySubscriptionData.h"
#include "AuthenticationSubscription.h"
#include "AuthenticationSubscription.h"
#include "ProblemDetails.h"
#include "ProblemDetails.h"
...
@@ -49,7 +40,6 @@
...
@@ -49,7 +40,6 @@
using
namespace
oai
::
udr
::
app
;
using
namespace
oai
::
udr
::
app
;
using
namespace
oai
::
udr
::
model
;
using
namespace
oai
::
udr
::
model
;
using
namespace
std
::
chrono
;
using
namespace
config
;
using
namespace
config
;
extern
udr_app
*
udr_app_inst
;
extern
udr_app
*
udr_app_inst
;
...
...
src/udr_app/udr_server.cpp
deleted
100644 → 0
View file @
9dd80b75
#include "udr_server.hpp"
#include "logger.hpp"
#ifdef __linux__
static
void
sigHandler
[[
noreturn
]]
(
int
sig
)
{
switch
(
sig
)
{
case
SIGINT
:
case
SIGQUIT
:
case
SIGTERM
:
case
SIGHUP
:
default:
// m_httpEndpoint->shutdown();
break
;
}
exit
(
0
);
}
static
void
setUpUnixSignals
(
std
::
vector
<
int
>
quitSignals
)
{
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
;
for
(
auto
sig
:
quitSignals
)
sigaction
(
sig
,
&
sa
,
nullptr
);
}
#endif
using
namespace
org
::
openapitools
::
server
::
api
;
UDRApiServer
::
UDRApiServer
(
Pistache
::
Address
address
,
MYSQL
*
mysql
)
:
m_httpEndpoint
(
std
::
make_shared
<
Pistache
::
Http
::
Endpoint
>
(
address
))
{
m_router
=
std
::
make_shared
<
Pistache
::
Rest
::
Router
>
();
m_AuthenticationSubscriptionDocumentApiserver
=
std
::
make_shared
<
AuthenticationSubscriptionDocumentApiImpl
>
(
m_router
,
mysql
);
m_AuthenticationStatusDocumentApiserver
=
std
::
make_shared
<
AuthenticationStatusDocumentApiImpl
>
(
m_router
,
mysql
);
m_AccessAndMobilitySubscriptionDataDocumentApiserver
=
std
::
make_shared
<
AccessAndMobilitySubscriptionDataDocumentApiImpl
>
(
m_router
,
mysql
);
m_SMFSelectionSubscriptionDataDocumentApiserver
=
std
::
make_shared
<
SMFSelectionSubscriptionDataDocumentApiImpl
>
(
m_router
,
mysql
);
m_SessionManagementSubscriptionDataApiserver
=
std
::
make_shared
<
SessionManagementSubscriptionDataApiImpl
>
(
m_router
,
mysql
);
m_AMF3GPPAccessRegistrationDocumentApiserver
=
std
::
make_shared
<
AMF3GPPAccessRegistrationDocumentApiImpl
>
(
m_router
,
mysql
);
m_SMFRegistrationDocumentApiserver
=
std
::
make_shared
<
SMFRegistrationDocumentApiImpl
>
(
m_router
,
mysql
);
m_SMFRegistrationsCollectionApiserver
=
std
::
make_shared
<
SMFRegistrationsCollectionApiImpl
>
(
m_router
,
mysql
);
m_SDMSubscriptionDocumentApiserver
=
std
::
make_shared
<
SDMSubscriptionDocumentApiImpl
>
(
m_router
,
mysql
);
m_SDMSubscriptionsCollectionApiserver
=
std
::
make_shared
<
SDMSubscriptionsCollectionApiImpl
>
(
m_router
,
mysql
);
}
void
UDRApiServer
::
init
(
size_t
thr
)
{
#ifdef __linux__
std
::
vector
<
int
>
sigs
{
SIGQUIT
,
SIGINT
,
SIGTERM
,
SIGHUP
};
setUpUnixSignals
(
sigs
);
#endif
auto
opts
=
Pistache
::
Http
::
Endpoint
::
options
().
threads
(
thr
);
opts
.
flags
(
Pistache
::
Tcp
::
Options
::
ReuseAddr
);
opts
.
maxRequestSize
(
PISTACHE_SERVER_MAX_REQUEST_SIZE
);
opts
.
maxResponseSize
(
PISTACHE_SERVER_MAX_RESPONSE_SIZE
);
m_httpEndpoint
->
init
(
opts
);
m_AuthenticationSubscriptionDocumentApiserver
->
init
();
m_AuthenticationStatusDocumentApiserver
->
init
();
m_AccessAndMobilitySubscriptionDataDocumentApiserver
->
init
();
m_SMFSelectionSubscriptionDataDocumentApiserver
->
init
();
m_SessionManagementSubscriptionDataApiserver
->
init
();
m_AMF3GPPAccessRegistrationDocumentApiserver
->
init
();
m_SMFRegistrationDocumentApiserver
->
init
();
m_SMFRegistrationsCollectionApiserver
->
init
();
m_SDMSubscriptionDocumentApiserver
->
init
();
m_SDMSubscriptionsCollectionApiserver
->
init
();
Logger
::
udr_server
().
debug
(
"Initiate UDR server endpoints done!"
);
}
void
UDRApiServer
::
start
()
{
if
(
m_AuthenticationSubscriptionDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for AuthenticationSubscriptionDocumentApiImpl"
);
if
(
m_AuthenticationStatusDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for AuthenticationStatusDocumentApiImpl"
);
if
(
m_AccessAndMobilitySubscriptionDataDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for AccessAndMobilitySubscriptionDataDocumentApiImpl"
);
if
(
m_SMFSelectionSubscriptionDataDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for SMFSelectionSubscriptionDataDocumentApiImpl"
);
if
(
m_SessionManagementSubscriptionDataApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for SessionManagementSubscriptionDataApiImpl"
);
if
(
m_AMF3GPPAccessRegistrationDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for AMF3GPPAccessRegistrationDocumentApiImpl"
);
if
(
m_SMFRegistrationDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for SMFRegistrationsCollectionApiImpl"
);
if
(
m_SMFRegistrationsCollectionApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for SDMSubscriptionDocumentApiImpl"
);
if
(
m_SDMSubscriptionDocumentApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for SDMSubscriptionsCollectionApiImpl"
);
if
(
m_SDMSubscriptionsCollectionApiserver
!=
nullptr
)
Logger
::
udr_server
().
debug
(
"UDR handler for AuthenticationSubscriptionDocumentApiImpl"
);
m_httpEndpoint
->
setHandler
(
m_router
->
handler
());
m_httpEndpoint
->
serve
();
}
void
UDRApiServer
::
shutdown
()
{
m_httpEndpoint
->
shutdown
();
}
src/udr_app/udr_server.hpp
deleted
100644 → 0
View file @
9dd80b75
#ifndef _UDR_SERVER_H_
#define _UDR_SERVER_H_
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#ifdef __linux__
#include <signal.h>
#include <unistd.h>
#include <vector>
#endif
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
#include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "SDMSubscriptionDocumentApiImpl.h"
#include "SDMSubscriptionsCollectionApiImpl.h"
#include "SMFRegistrationDocumentApiImpl.h"
#include "SMFRegistrationsCollectionApiImpl.h"
#include "SMFSelectionSubscriptionDataDocumentApiImpl.h"
#include "SessionManagementSubscriptionDataApiImpl.h"
#include <mysql/mysql.h>
#define PISTACHE_SERVER_THREADS 2
#define PISTACHE_SERVER_MAX_REQUEST_SIZE 32768
#define PISTACHE_SERVER_MAX_RESPONSE_SIZE 32768
using
namespace
org
::
openapitools
::
server
::
api
;
class
UDRApiServer
{
public:
UDRApiServer
(
Pistache
::
Address
address
,
MYSQL
*
mysql
);
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
<
AuthenticationSubscriptionDocumentApiImpl
>
m_AuthenticationSubscriptionDocumentApiserver
;
std
::
shared_ptr
<
AuthenticationStatusDocumentApiImpl
>
m_AuthenticationStatusDocumentApiserver
;
std
::
shared_ptr
<
AccessAndMobilitySubscriptionDataDocumentApiImpl
>
m_AccessAndMobilitySubscriptionDataDocumentApiserver
;
std
::
shared_ptr
<
SMFSelectionSubscriptionDataDocumentApiImpl
>
m_SMFSelectionSubscriptionDataDocumentApiserver
;
std
::
shared_ptr
<
SessionManagementSubscriptionDataApiImpl
>
m_SessionManagementSubscriptionDataApiserver
;
std
::
shared_ptr
<
AMF3GPPAccessRegistrationDocumentApiImpl
>
m_AMF3GPPAccessRegistrationDocumentApiserver
;
std
::
shared_ptr
<
SMFRegistrationDocumentApiImpl
>
m_SMFRegistrationDocumentApiserver
;
std
::
shared_ptr
<
SMFRegistrationsCollectionApiImpl
>
m_SMFRegistrationsCollectionApiserver
;
std
::
shared_ptr
<
SDMSubscriptionDocumentApiImpl
>
m_SDMSubscriptionDocumentApiserver
;
std
::
shared_ptr
<
SDMSubscriptionsCollectionApiImpl
>
m_SDMSubscriptionsCollectionApiserver
;
};
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment