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_LEGACY_SOCKETCONNECTION_H
43#define CORE_SOCKET_STREAM_LEGACY_SOCKETCONNECTION_H
45#include "core/socket/stream/SocketConnection.h"
46#include "core/socket/stream/legacy/SocketReader.h"
47#include "core/socket/stream/legacy/SocketWriter.h"
49#ifndef DOXYGEN_SHOULD_SKIP_THIS
57 template <
typename PhysicalSocketT,
typename ConfigT>
58 class SocketConnection final
78 const std::function<
void(SocketConnection*)>& onDisconnect,
79 const std::shared_ptr<
Config>& config);
81 template <
typename PhysicalSocket,
typename Config>
84 template <
typename PhysicalSocket,
typename Config>
core::socket::stream::SocketContext * create(core::socket::stream::SocketConnection *socketConnection) override
~SimpleSocketProtocolFactory() override
void onDisconnected() override
~SimpleSocketProtocol() override
web::http::client::ResponseParser * responseParser
SimpleSocketProtocol(core::socket::stream::SocketConnection *socketConnection)
bool onSignal(int signum) override
void onConnected() override
void onReadError(int errnum) override
void onWriteError(int errnum) override
std::size_t onReceivedFromPeer() override
static void init(int argc, char *argv[])
static int start(const utils::Timeval &timeOut={LONG_MAX, 0})
Config & getConfig() const
static constexpr int DISABLED
static constexpr int ERROR
static constexpr int FATAL
const SocketClient & connect(const SocketAddress &remoteAddress, const std::function< void(const SocketAddress &, core::socket::State)> &onStatus) const
const SocketAddress & getRemoteAddress() const final
const SocketAddress & getLocalAddress() const final
void sendToPeer(const std::string &data)
SocketContext(core::socket::stream::SocketConnection *socketConnection)
void onReadError(int errnum) override
void shutdownWrite(bool forceClose=false)
void onWriteError(int errnum) override
PhysicalSocketT PhysicalSocket
SocketConnection(PhysicalSocket &&physicalSocket, const std::function< void(SocketConnection *)> &onDisconnect, const std::shared_ptr< Config > &config)
typename Super::SocketWriter SocketWriter
typename Super::SocketReader SocketReader
core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::legacy::SocketReader, core::socket::stream::legacy::SocketWriter, ConfigT > Super
typename Super::SocketAddress SocketAddress
const std::string & getInstanceName() const
SocketAddress(const std::string &ipOrHostname, uint16_t port)
std::string getCanonName() const
std::string toString(bool expanded=true) const override
void init(const Hints &hints={.aiFlags=0,.aiSockType=0,.aiProtocol=0})
ResponseParser(core::socket::stream::SocketContext *socketContext, const std::function< void()> &onResponseStart, const std::function< void(Response &)> &onResponseParsed, const std::function< void(int, const std::string &)> &onResponseParseError)
int main(int argc, char *argv[])
static web::http::client::ResponseParser * getResponseParser(core::socket::stream::SocketContext *socketContext)
net::in::stream::legacy::SocketClient< apps::http::SimpleSocketProtocolFactory > SocketClient
SocketClient::SocketAddress SocketAddress
SocketClient::SocketConnection SocketConnection
SocketClient getLegacyClient()
SocketClient< SocketContextFactory, SocketContextFactoryArgs... > Client(const std::string &instanceName, SocketContextFactoryArgs &&... socketContextFactoryArgs)
SocketClient< SocketContextFactory, SocketContextFactoryArgs... > Client(const std::string &instanceName, const std::function< void(typename SocketClient< SocketContextFactory, SocketContextFactoryArgs... >::Config &)> &configurator, SocketContextFactoryArgs &&... socketContextFactoryArgs)
net::in::stream::SocketClient< core::socket::stream::legacy::SocketConnector, net::in::stream::legacy::config::ConfigSocketClient, SocketContextFactoryT, Args... > SocketClient
net::in::stream::SocketClient< core::socket::stream::tls::SocketConnector, net::in::stream::tls::config::ConfigSocketClient, SocketContextFactoryT, Args... > SocketClient
net::in::stream::tls::SocketClient< apps::http::SimpleSocketProtocolFactory > SocketClient
SocketClient::SocketConnection SocketConnection
SocketClient::SocketAddress SocketAddress