blob: 131bae968a97c24e8a247431be93af9ba79eb91e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include <boost/asio/io_context.hpp>
#include <boost/asio/ssl.hpp>
#include "config.h"
#include "plugin.h"
#include "statistics.h"
namespace ssl = boost::asio::ssl; // from <boost/asio/ssl.hpp>
using namespace std::string_literals;
// Base class for HTTP and HTTPS classes
class Server
{
protected:
Config& m_config;
boost::asio::io_context& m_ioc;
const Socket& m_socket;
plugins_container_type& m_plugins;
Statistics& m_statistics;
public:
static const std::string VersionString;
Server(Config& config, boost::asio::io_context& ioc, const Socket& socket, plugins_container_type& plugins, Statistics& statistics);
virtual ~Server();
virtual int start() = 0;
// Getters
Config& GetConfig();
const Socket& GetSocket();
plugin_type GetPlugin(const std::string& name);
Statistics& GetStatistics();
};
int run_server(Config& config, plugins_container_type& plugins);
|