2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#ifndef NET_IN6_STREAM_TLS_SOCKETSERVER_H
43#define NET_IN6_STREAM_TLS_SOCKETSERVER_H
47#include "core/socket/stream/tls/SocketAcceptor.h"
48#include "core/socket/stream/tls/SocketConnection.h"
49#include "net/in6/stream/SocketServer.h"
50#include "net/in6/stream/tls/config/ConfigSocketServer.h"
56#ifndef DOXYGEN_SHOULD_SKIP_THIS
65namespace net::in6::stream::tls {
67 template <
typename SocketContextFactoryT,
typename... Args>
69 net::in6::stream::tls::
config::ConfigSocketServer,
70 SocketContextFactoryT,
73 template <
typename SocketContextFactory,
typename... SocketContextFactoryArgs>
74 SocketServer<SocketContextFactory, SocketContextFactoryArgs...>
75 Server(
const std::string& instanceName,
76 const std::function<
void(
typename SocketServer<SocketContextFactory, SocketContextFactoryArgs...>::Config&)>& configurator,
77 SocketContextFactoryArgs&&... socketContextFactoryArgs) {
78 return core::socket::
stream::Server<SocketServer<SocketContextFactory, SocketContextFactoryArgs...>>(
79 instanceName, configurator, std::forward<SocketContextFactoryArgs>(socketContextFactoryArgs)...);
82 template <
typename SocketContextFactory,
83 typename... SocketContextFactoryArgs,
84 typename = std::enable_if_t<
not std::is_invocable_v<std::tuple_element_t<0, std::tuple<SocketContextFactoryArgs...>>,
85 typename SocketServer<SocketContextFactory>::Config&>>>
86 SocketServer<SocketContextFactory, SocketContextFactoryArgs...>
Server(
const std::string& instanceName,
87 SocketContextFactoryArgs&&... socketContextFactoryArgs) {
88 return core::socket::
stream::Server<SocketServer<SocketContextFactory, SocketContextFactoryArgs...>>(
89 instanceName, std::forward<SocketContextFactoryArgs>(socketContextFactoryArgs)...);
96 net::in6::stream::tls::
config::ConfigSocketServer>;
#define APPLICATION(req, res)
Config & getConfig() const
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
void send(const std::string &chunk)
Response & status(int status)
WebAppT(const std::string &name)
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
friend class BasicAuthentication & BasicAuthentication(const std::string &userName, const std::string &password, const std::string &realm)
BasicAuthentication(const std::string &userName, const std::string &password, const std::string &realm)
static class BasicAuthentication & instance(const std::string &userName, const std::string &password, const std::string &realm)
VHost(const std::string &host)
static class VHost & instance(const std::string &host)
const std::string & getInstanceName() const
SocketAddress(uint16_t port)
SocketAddress & setHost(const std::string &ipOrHostname)
SocketAddress & setPort(uint16_t port)
void init(const Hints &hints={.aiFlags=0,.aiSockType=0,.aiProtocol=0})
std::string getCanonName() const
SocketAddress(const std::string &ipOrHostname)
std::string getHost() const
std::string toString(bool expanded=true) const override
std::shared_ptr< SocketAddrInfo > socketAddrInfo
SocketAddress(const std::string &ipOrHostname, uint16_t port)
SocketAddress(const SockAddr &sockAddr, SockLen sockAddrLen, bool numeric=true)
ConfigAddressReverse(net::config::ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
CLI::Option * numericReverseOpt
ConfigAddressReverse & setNumericReverse(bool numeric=true)
SocketAddress getSocketAddress(const SocketAddress::SockAddr &sockAddr, SocketAddress::SockLen sockAddrLen)
bool getNumericReverse() const
ConfigAddress & setIpv4Mapped(bool ipv4Mapped=true)
ConfigAddress & setNumericReverse(bool numeric=true)
bool getIpv4Mapped() const
ConfigAddress & setAiFlags(int aiFlags)
CLI::Option * numericReverseOpt
ConfigAddress & setPortRequired(bool required=true)
SocketAddress getSocketAddress(const SocketAddress::SockAddr &sockAddr, SocketAddress::SockLen sockAddrLen)
ConfigAddress(net::config::ConfigInstance *instance, const std::string &addressOptionName, const std::string &addressOptionDescription)
ConfigAddress & setNumeric(bool numeric=true)
ConfigAddress & setPort(uint16_t port)
ConfigAddress & setSocketAddress(const SocketAddress &socketAddress)
int getAiProtocol() const
SocketAddress * init() final
ConfigAddress & setHost(const std::string &ipOrHostname)
ConfigAddress & setAiSockType(int aiSocktype)
ConfigAddress & setHostRequired(bool required=true)
bool getNumericReverse() const
std::string getHost() const
ConfigAddress & setAiProtocol(int aiProtocol)
CLI::Option * ipv4MappedOpt
int getAiSockType() const
PhysicalSocket(int type, int protocol)
PhysicalSocket(PhysicalSocket &&) noexcept=default
~PhysicalSocket() override
PhysicalSocketServer(PhysicalSocketServer &&) noexcept=default
~PhysicalSocketServer() override
PhysicalSocket(PhysicalSocket &&) noexcept=default
~PhysicalSocket() override
void listen(const std::string &ipOrHostname, uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
void listen(uint16_t port, int backlog, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
void listen(uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
void listen(const std::string &ipOrHostname, uint16_t port, int backlog, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
~ConfigSocketServer() override
bool getReuseAddress() const
bool getDisableNagleAlgorithm() const
CLI::Option * reuseAddressOpt
CLI::Option * disableNagleAlgorithmOpt
CLI::Option * iPv6OnlyOpt
ConfigSocketServer & setDisableNagleAlgorithm(bool disableNagleAlgorithm=true)
ConfigSocketServer & setIPv6Only(bool iPv6Only=true)
ConfigSocketServer(net::config::ConfigInstance *instance)
bool getReusePort() const
CLI::Option * reusePortOpt
ConfigSocketServer & setReusePort(bool reusePort=true)
ConfigSocketServer & setReuseAddress(bool reuseAddress=true)
ConfigSocketServer(const std::string &name)
~ConfigSocketServer() override
int main(int argc, char *argv[])
SocketServer< SocketContextFactory, SocketContextFactoryArgs... > Server(const std::string &instanceName, SocketContextFactoryArgs &&... socketContextFactoryArgs)
SocketServer< SocketContextFactory, SocketContextFactoryArgs... > Server(const std::string &instanceName, const std::function< void(typename SocketServer< SocketContextFactory, SocketContextFactoryArgs... >::Config &)> &configurator, SocketContextFactoryArgs &&... socketContextFactoryArgs)
SocketServer< SocketContextFactory, SocketContextFactoryArgs... > Server(const std::string &instanceName, const std::function< void(typename SocketServer< SocketContextFactory, SocketContextFactoryArgs... >::Config &)> &configurator, SocketContextFactoryArgs &&... socketContextFactoryArgs)
SocketServer< SocketContextFactory, SocketContextFactoryArgs... > Server(const std::string &instanceName, SocketContextFactoryArgs &&... socketContextFactoryArgs)
Router getRouter(const std::string &webRoot)