Loading...
Searching...
No Matches
nebula_atom.h
1/*
2* Nebula Atom
3
4* This program is free software: you can redistribute it and/or modify
5* it under the terms of the GNU General Public License as published by
6* the Free Software Foundation, either version 3 of the License, or
7* (at your option) any later version.
8*
9* This program is distributed in the hope that it will be useful,
10* but WITHOUT ANY WARRANTY; without even the implied warranty of
11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12* GNU General Public License for more details.
13*
14* You should have received a copy of the GNU General Public License
15* along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#ifndef NAF_CORE_NEBULAATOM
19#define NAF_CORE_NEBULAATOM
20
21
22#include <string>
23#include <vector>
24#include <iostream>
25#include <memory>
26#include <exception>
27
28#include <Poco/Net/ServerSocket.h>
29#include <Poco/Net/HTTPServer.h>
30#include <Poco/Net/HTTPServerParams.h>
31#include <Poco/Net/NetSSL.h>
32#include "Poco/Format.h"
33#include "Poco/Exception.h"
34#include "Poco/Net/SecureStreamSocket.h"
35#include "Poco/Net/SecureServerSocket.h"
36#include "Poco/Net/X509Certificate.h"
37#include "Poco/Net/SSLManager.h"
38#include "Poco/Net/SSLException.h"
39#include "Poco/Net/KeyConsoleHandler.h"
40#include "Poco/Net/AcceptCertificateHandler.h"
41#include "Poco/Net/ConsoleCertificateHandler.h"
42#include <Poco/Crypto/RSAKey.h>
43#include <Poco/Net/AcceptCertificateHandler.h>
44#include <Poco/Net/Context.h>
45#include <Poco/Net/NetException.h>
46#include <Poco/Net/NetSSL.h>
47#include <Poco/Net/SSLManager.h>
48
49#include "core/server.h"
50#include "core/handler_factory.h"
51#include "query/database_manager.h"
52#include "tools/settings_manager.h"
53#include "tools/output_logger.h"
54#include "tools/sessions_manager.h"
55#include "security/permissions_manager.h"
56
57
58namespace NAF
59{
60 namespace Core
61 {
62 class NebulaAtom;
63 }
64}
65
66using namespace Poco;
67using namespace Poco::Net;
68using namespace Poco::Util;
69
71{
72 public:
73 NebulaAtom(bool use_ssl = false);
74 virtual ~NebulaAtom();
75
76 bool get_use_ssl() const { return use_ssl_; }
77 Core::Server::Ptr get_server() const { return server_; }
78 HandlerFactory* get_handler_factory()
79 {
80 auto& var = handler_factory_;
81 return var;
82 }
83 std::vector<std::string>& get_console_parameters()
84 {
85 auto& var = console_parameters_;
86 return var;
87 }
88
89 int Init_();
90 int Init_(int argc, char** argv);
91 void CustomHandlerCreator_(HandlerFactory::FunctionHandlerCreator handler_creator);
92 void AddHandler_(std::string route, HandlerFactory::FunctionHandler handler);
93 void SetupSettings_();
94
95 protected:
96 void AddBasicSettings_();
97
98 private:
99 const bool use_ssl_;
100 Core::Server::Ptr server_;
101 HandlerFactory* handler_factory_;
102 std::vector<std::string> console_parameters_;
103};
104
105#endif // NAF_CORE_NEBULAATOM
Definition handler_factory.h:80
Definition nebula_atom.h:71