roar
Loading...
Searching...
No Matches
factory.hpp
Go to the documentation of this file.
1#pragma once
2
7#include <roar/error.hpp>
8
9#include <memory>
10#include <optional>
11#include <functional>
12#include <variant>
13#include <chrono>
14
15namespace Roar
16{
17 class Router;
18
22 class Factory
23 {
24 public:
25 constexpr static std::chrono::seconds sslDetectionTimeout{10};
26
27 public:
28 Factory(
29 std::optional<std::variant<SslServerContext, boost::asio::ssl::context>>& sslContext,
30 std::function<void(Error&&)> onError);
32
40 void makeSession(
42 std::weak_ptr<Router> router,
43 std::shared_ptr<const StandardResponseProvider> standardResponseProvider);
44
45 private:
46 struct ProtoSession;
47 struct Implementation;
48 std::unique_ptr<Implementation> impl_;
49 };
50}
This factory creates sessions.
Definition factory.hpp:23
ROAR_PIMPL_SPECIAL_FUNCTIONS(Factory)
static constexpr std::chrono::seconds sslDetectionTimeout
Definition factory.hpp:25
std::unique_ptr< Implementation > impl_
Definition factory.hpp:48
void makeSession(boost::asio::basic_stream_socket< boost::asio::ip::tcp > &&socket, std::weak_ptr< Router > router, std::shared_ptr< const StandardResponseProvider > standardResponseProvider)
Creates a new http session.
Definition factory.cpp:46
Definition forward.hpp:11
Definition authorization.hpp:10
Holds errors that are produced asynchronously anywhere.
Definition error.hpp:20
Definition factory.cpp:30
Definition factory.cpp:19