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 CORE_SOCKET_STREAM_SOCKETACCEPTOR_H
43#define CORE_SOCKET_STREAM_SOCKETACCEPTOR_H
45#include "core/eventreceiver/AcceptEventReceiver.h"
46#include "core/socket/State.h"
48namespace core::socket::
stream {
52#ifndef DOXYGEN_SHOULD_SKIP_THIS
59namespace core::socket::
stream {
62
63
64
65
66 template <
typename PhysicalSocketServerT,
typename ConfigT,
template <
typename PhysicalSocketServer>
typename SocketConnectionT>
69 using PhysicalServerSocket = PhysicalSocketServerT;
72 using Config = ConfigT;
73 using SocketAddress =
typename PhysicalServerSocket::SocketAddress;
74 using SocketConnection = SocketConnectionT<PhysicalServerSocket>;
78 const std::function<
void(SocketConnection*)>& onConnect,
79 const std::function<
void(SocketConnection*)>& onConnected,
80 const std::function<
void(SocketConnection*)>& onDisconnect,
81 const std::function<
void(
const SocketAddress&, core::socket::
State)>& onStatus,
82 const std::shared_ptr<Config>& config);
112 std::function<
void(
const SocketAddress&, core::socket::
State)>
onStatus =
nullptr;
#define APPLICATION(req, res)
Config & getConfig() const
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
SocketAcceptor(const std::shared_ptr< core::socket::stream::SocketContextFactory > &socketContextFactory, const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus, const std::shared_ptr< Config > &config)
std::function< void(SocketConnection *)> onConnected
SocketAcceptor(const SocketAcceptor &socketAcceptor)
SocketAddress localAddress
std::function< void(SocketConnection *)> onConnect
std::function< void(SocketConnection *)> onDisconnect
std::shared_ptr< core::socket::stream::SocketContextFactory > socketContextFactory
void unobservedEvent() final
std::shared_ptr< Config > config
virtual void useNextSocketAddress()=0
~SocketAcceptor() override
PhysicalServerSocket physicalServerSocket
std::function< void(const SocketAddress &, core::socket::State)> onStatus
void useNextSocketAddress() override
SocketAcceptor(const SocketAcceptor &socketAcceptor)
SocketAcceptor(const std::shared_ptr< core::socket::stream::SocketContextFactory > &socketContextFactory, const std::function< void(SocketConnection *)> &onConnect, const std::function< void(SocketConnection *)> &onConnected, const std::function< void(SocketConnection *)> &onDisconnect, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus, const std::shared_ptr< Config > &config)
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[])