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_IN_STREAM_LEGACY_SOCKETSERVER_H
43#define NET_IN_STREAM_LEGACY_SOCKETSERVER_H
47#include "core/socket/stream/legacy/SocketAcceptor.h"
48#include "core/socket/stream/legacy/SocketConnection.h"
49#include "net/in/stream/SocketServer.h"
50#include "net/in/stream/legacy/config/ConfigSocketServer.h"
56#ifndef DOXYGEN_SHOULD_SKIP_THIS
65namespace net::in::stream::
legacy {
67 template <
typename SocketContextFactoryT,
typename... Args>
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)...);
#define APPLICATION(req, res)
Config & getConfig() const
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
Controller(const std::shared_ptr< web::http::server::Request > &request, const std::shared_ptr< web::http::server::Response > &response)
void send(const std::string &chunk)
WebAppT(const std::string &name, const Router &router)
WebAppT(const std::string &name)
static void init(int argc, char *argv[])
static core::TickStatus tick(const utils::Timeval &timeOut=0)
static core::State state()
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
WebApp(const Router &router)
const std::string & getInstanceName() const
std::string toString(bool expanded=true) const override
void listen(uint16_t port, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
void getAttribute(const std::function< void(Attribute &)> &onFound, const std::function< void(const std::string &)> &onNotFound, const std::string &subKey="") const
Timeval(const std::initializer_list< time_t > &initList) noexcept
int main(int argc, char *argv[])
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)