SNode.C
|
#include <SocketConnection.h>
Public Member Functions | |
SocketConnection (const std::string &instanceName, int fd, const std::string &configuredServer) | |
virtual int | getFd () const =0 |
void | switchSocketContext (SocketContext *newSocketContext) |
virtual void | sendToPeer (const char *chunk, std::size_t chunkLen)=0 |
void | sendToPeer (const std::string &data) |
void | sentToPeer (const std::vector< uint8_t > &data) |
void | sentToPeer (const std::vector< char > &data) |
virtual bool | streamToPeer (core::pipe::Source *source)=0 |
virtual void | streamEof ()=0 |
virtual std::size_t | readFromPeer (char *chunk, std::size_t chunkLen)=0 |
virtual void | shutdownRead ()=0 |
virtual void | shutdownWrite (bool forceClose)=0 |
const std::string & | getInstanceName () const |
const std::string & | getConnectionName () const |
const std::string & | getConfiguredServer () const |
virtual const core::socket::SocketAddress & | getLocalAddress () const =0 |
virtual const core::socket::SocketAddress & | getRemoteAddress () const =0 |
virtual void | close ()=0 |
virtual void | setTimeout (const utils::Timeval &timeout)=0 |
Protected Member Functions | |
virtual | ~SocketConnection () |
void | setSocketContext (SocketContext *socketContext) |
void | connectSocketContext (const std::shared_ptr< SocketContextFactory > &socketContextFactory) |
void | disconnectCurrentSocketContext () |
Protected Attributes | |
core::socket::stream::SocketContext * | socketContext = nullptr |
core::socket::stream::SocketContext * | newSocketContext = nullptr |
std::string | instanceName |
std::string | connectionName |
std::string | configuredServer |
Definition at line 75 of file SocketConnection.h.
core::socket::stream::SocketConnection::SocketConnection | ( | const std::string & | instanceName, |
int | fd, | ||
const std::string & | configuredServer | ||
) |
Definition at line 55 of file SocketConnection.cpp.
References configuredServer, connectionName, and instanceName.
|
protectedvirtual |
Definition at line 61 of file SocketConnection.cpp.
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by core::socket::stream::SocketContext::close(), and connectSocketContext().
|
protected |
Definition at line 102 of file SocketConnection.cpp.
References close(), connectionName, core::socket::stream::SocketContextFactory::create(), and setSocketContext().
|
protected |
Definition at line 114 of file SocketConnection.cpp.
References connectionName, core::socket::stream::SocketContext::onDisconnected(), and socketContext.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onReceivedFromPeer(), and core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::unobservedEvent().
const std::string & core::socket::stream::SocketConnection::getConfiguredServer | ( | ) | const |
Definition at line 98 of file SocketConnection.cpp.
References configuredServer.
Referenced by web::http::client::SocketContext::SocketContext().
const std::string & core::socket::stream::SocketConnection::getConnectionName | ( | ) | const |
Definition at line 94 of file SocketConnection.cpp.
References connectionName.
Referenced by web::http::server::SocketContext::deliverRequest(), web::http::client::SocketContext::deliverResponse(), web::http::client::SocketContext::deliverResponseParseError(), web::http::client::SocketContext::initiateRequest(), web::http::client::SocketContext::onConnected(), web::http::server::SocketContext::onConnected(), web::http::client::SocketContext::onDisconnected(), web::http::server::SocketContext::onDisconnected(), web::websocket::SubProtocol< SocketContextUpgradeT >::onPongReceived(), core::socket::stream::SocketContext::onReadError(), web::http::client::SocketContext::onSignal(), web::http::server::SocketContext::onSignal(), core::socket::stream::SocketContext::onWriteError(), web::http::server::SocketContext::requestCompleted(), web::http::client::SocketContext::requestDelivered(), web::http::client::SocketContext::requestPrepared(), web::http::server::SocketContext::responseCompleted(), web::http::client::SocketContext::responseDelivered(), web::http::client::Request::responseParseError(), web::http::client::SocketContext::responseStarted(), web::http::server::SocketContext::responseStarted(), web::http::server::SocketContext::SocketContext(), express::middleware::StaticMiddleware::StaticMiddleware(), core::socket::stream::SocketContext::switchSocketContext(), web::http::server::Response::upgrade(), web::http::client::Request::upgrade(), express::middleware::VerboseRequest::VerboseRequest(), and web::http::client::SocketContext::~SocketContext().
|
pure virtual |
const std::string & core::socket::stream::SocketConnection::getInstanceName | ( | ) | const |
Definition at line 90 of file SocketConnection.cpp.
References instanceName.
|
pure virtual |
|
pure virtual |
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by web::websocket::Receiver::readFrameData(), and core::socket::stream::SocketContext::readFromPeer().
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >, and core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by web::websocket::Transmitter::sendFrameData(), core::socket::stream::SocketContext::sendToPeer(), sendToPeer(), sentToPeer(), and sentToPeer().
void core::socket::stream::SocketConnection::sendToPeer | ( | const std::string & | data | ) |
Definition at line 78 of file SocketConnection.cpp.
References sendToPeer().
Referenced by tls::getClient(), and legacy::getLegacyClient().
void core::socket::stream::SocketConnection::sentToPeer | ( | const std::vector< char > & | data | ) |
Definition at line 86 of file SocketConnection.cpp.
References sendToPeer().
void core::socket::stream::SocketConnection::sentToPeer | ( | const std::vector< uint8_t > & | data | ) |
Definition at line 82 of file SocketConnection.cpp.
References sendToPeer().
|
protected |
Definition at line 68 of file SocketConnection.cpp.
References connectionName, core::socket::stream::SocketContext::onConnected(), and socketContext.
Referenced by connectSocketContext(), and core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onReceivedFromPeer().
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by iot::mqtt::Mqtt::initSession(), and core::socket::stream::SocketContext::setTimeout().
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by core::socket::stream::SocketContext::shutdownRead().
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by core::socket::stream::SocketContext::shutdownWrite().
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by core::socket::stream::SocketContext::streamEof().
|
pure virtual |
Implemented in core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >.
Referenced by core::socket::stream::SocketContext::streamToPeer().
void core::socket::stream::SocketConnection::switchSocketContext | ( | SocketContext * | newSocketContext | ) |
Definition at line 64 of file SocketConnection.cpp.
References newSocketContext.
Referenced by core::socket::stream::SocketContext::switchSocketContext().
|
protected |
Definition at line 125 of file SocketConnection.h.
Referenced by getConfiguredServer(), and SocketConnection().
|
protected |
Definition at line 123 of file SocketConnection.h.
Referenced by connectSocketContext(), disconnectCurrentSocketContext(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::doWriteShutdown(), getConnectionName(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onReceivedFromPeer(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onSignal(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::readFromPeer(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::readTimeout(), setSocketContext(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::shutdownRead(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::shutdownWrite(), SocketConnection(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::SocketConnectionT(), and core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::writeTimeout().
|
protected |
Definition at line 122 of file SocketConnection.h.
Referenced by getInstanceName(), and SocketConnection().
|
protected |
Definition at line 120 of file SocketConnection.h.
Referenced by core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onReceivedFromPeer(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::readFromPeer(), and switchSocketContext().
|
protected |
Definition at line 119 of file SocketConnection.h.
Referenced by disconnectCurrentSocketContext(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onReadError(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onReceivedFromPeer(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onSignal(), core::socket::stream::SocketConnectionT< PhysicalSocketT, SocketReaderT, SocketWriterT >::onWriteError(), and setSocketContext().