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/sessions_manager.h"
54 #include "tools/output_logger.h"
55 
56 
57 namespace NAF
58 {
59  namespace Core
60  {
61  class NebulaAtom;
62  }
63 }
64 
65 using namespace Poco;
66 using namespace Poco::Net;
67 using namespace Poco::Util;
68 
70 {
71  public:
72  NebulaAtom(bool use_ssl = false);
73  virtual ~NebulaAtom();
74 
75  bool get_use_ssl() const { return use_ssl_; }
76  Core::Server::Ptr get_server() const { return server_; }
77  HandlerFactory* get_handler_factory()
78  {
79  auto& var = handler_factory_;
80  return var;
81  }
82  std::vector<std::string>& get_console_parameters()
83  {
84  auto& var = console_parameters_;
85  return var;
86  }
87 
88  int Init_();
89  int Init_(int argc, char** argv);
90  void CustomHandlerCreator_(HandlerFactory::FunctionHandlerCreator handler_creator);
91  void AddHandler_(std::string route, HandlerFactory::FunctionHandler handler);
92 
93  private:
94  const bool use_ssl_;
95  Core::Server::Ptr server_;
96  HandlerFactory* handler_factory_;
97  std::vector<std::string> console_parameters_;
98 };
99 
100 #endif // NAF_CORE_NEBULAATOM
Definition: handler_factory.h:81
Definition: nebula_atom.h:70