Loading...
Searching...
No Matches
server.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_SERVER
19#define NAF_CORE_SERVER
20
21
22#include <Poco/ThreadPool.h>
23#include <map>
24#include <exception>
25#include <vector>
26#include <memory>
27#include <stdexcept>
28
29#include "Poco/Exception.h"
30#include "Poco/Util/ServerApplication.h"
31#include "Poco/Net/HTTPServer.h"
32#include "Poco/Net/ServerSocket.h"
33#include "Poco/Net/SecureServerSocket.h"
34
35#include "core/handler_factory.h"
36#include "tools/output_logger.h"
37#include "tools/settings_manager.h"
38
39using namespace Poco;
40using namespace Poco::Net;
41using namespace Poco::Util;
42
43namespace NAF
44{
45 namespace Core
46 {
47 class Server;
48 }
49}
50
51
52class NAF::Core::Server : public Util::ServerApplication
53{
54 public:
55 using Ptr = std::shared_ptr<Server>;
56
57 Server(HandlerFactory* handler_factory);
58
59 bool get_use_ssl() const { return use_ssl_; }
60
61 void set_use_ssl(bool use_ssl){ use_ssl_ = use_ssl; }
62
63 void initialize(Application& self) override;
64 void uninitialize() override;
65 int main(const std::vector<std::string>& args) override;
66
67 protected:
68 void SetupParams_(HTTPServerParams::Ptr params);
69
70 private:
71 bool use_ssl_;
72 std::string server_name_;
73 HandlerFactory* handler_factory_;
74 std::unique_ptr<HTTPServer> http_server_;
75};
76
77#endif // NAF_CORE_SERVER
Definition handler_factory.h:80
Definition server.h:53