|
SNode.C
|
#include <SocketConnection.h>
Public Types | |
| using | SocketAddress = typename Super::SocketAddress |
Public Member Functions | |
| SocketConnection (PhysicalSocket &&physicalSocket, const std::function< void(SocketConnection *)> &onDisconnect, const std::shared_ptr< Config > &config) | |
| SSL * | getSSL () const |
Public Member Functions inherited from core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::tls::SocketReader, core::socket::stream::tls::SocketWriter, ConfigT > | |
| SocketConnectionT ()=delete | |
| int | getFd () const final |
| void | setTimeout (const utils::Timeval &timeout) final |
| void | setReadTimeout (const utils::Timeval &timeout) final |
| void | setWriteTimeout (const utils::Timeval &timeout) final |
| const SocketAddress & | getBindAddress () const final |
| const SocketAddress & | getLocalAddress () const final |
| const SocketAddress & | getRemoteAddress () const final |
| std::size_t | readFromPeer (char *chunk, std::size_t chunkLen) final |
| void | sendToPeer (const char *chunk, std::size_t chunkLen) final |
| virtual void | sendToPeer (const char *chunk, std::size_t chunkLen)=0 |
| void | sendToPeer (const std::string &data) |
| bool | streamToPeer (core::pipe::Source *source) final |
| void | streamEof () final |
| void | shutdownRead () final |
| void | shutdownWrite (bool forceClose) final |
| void | close () final |
| Config & | getConfig () const |
| std::size_t | getTotalSent () const override |
| std::size_t | getTotalQueued () const override |
| std::size_t | getTotalRead () const override |
| std::size_t | getTotalProcessed () const override |
Public Member Functions inherited from core::socket::stream::SocketConnection | |
| SocketConnection (int fd, const net::config::ConfigInstance *config) | |
| SocketConnection (const SocketConnection &)=delete | |
| void | sendToPeer (const std::string &data) |
| void | sentToPeer (const std::vector< uint8_t > &data) |
| void | sentToPeer (const std::vector< char > &data) |
| const std::string & | getInstanceName () const |
| const std::string & | getConnectionName () const |
| SocketContext * | getSocketContext () const |
| std::string | getOnlineSince () const |
| std::string | getOnlineDuration () const |
| const net::config::ConfigInstance * | getConfig () const |
Private Types | |
| using | Super = core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::tls::SocketReader, core::socket::stream::tls::SocketWriter, ConfigT > |
| using | Config = ConfigT |
| using | PhysicalSocket = PhysicalSocketT |
| using | SocketReader = typename Super::SocketReader |
| using | SocketWriter = typename Super::SocketWriter |
Private Member Functions | |
| SSL * | startSSL (int fd, SSL_CTX *ctx, const utils::Timeval &sslInitTimeout, const utils::Timeval &sslShutdownTimeout, bool closeNotifyIsEOF) |
| void | stopSSL () |
| bool | doSSLHandshake (const std::function< void()> &onSuccess, const std::function< void()> &onTimeout, const std::function< void(int)> &onStatus) final |
| void | doSSLShutdown () |
| void | onReadShutdown () final |
| void | doWriteShutdown (const std::function< void()> &onShutdown) final |
Private Attributes | |
| SSL * | ssl = nullptr |
| utils::Timeval | sslInitTimeout |
| utils::Timeval | sslShutdownTimeout |
Friends | |
| template<typename PhysicalSocket , typename Config > | |
| class | SocketAcceptor |
| template<typename PhysicalSocket , typename Config > | |
| class | SocketConnector |
Additional Inherited Members | |
Protected Types inherited from core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::tls::SocketReader, core::socket::stream::tls::SocketWriter, ConfigT > | |
| using | Super = core::socket::stream::SocketConnection |
| using | Config = ConfigT |
| using | PhysicalSocket = PhysicalSocketT |
| using | SocketReader = core::socket::stream::tls::SocketReader |
| using | SocketWriter = core::socket::stream::tls::SocketWriter |
| using | SocketAddress = typename PhysicalSocket::SocketAddress |
Protected Member Functions inherited from core::socket::stream::SocketConnectionT< PhysicalSocketT, core::socket::stream::tls::SocketReader, core::socket::stream::tls::SocketWriter, ConfigT > | |
| SocketConnectionT (PhysicalSocket &&physicalSocket, const std::function< void()> &onDisconnectm, const std::shared_ptr< Config > &config) | |
| ~SocketConnectionT () override | |
| void | doWriteShutdown (const std::function< void()> &onShutdown) override |
| void | onWriteError (int errnum) |
| void | onReadError (int errnum) |
Protected Member Functions inherited from core::socket::stream::SocketConnection | |
| virtual | ~SocketConnection () |
| void | setSocketContext (const std::shared_ptr< SocketContextFactory > &socketContextFactory) |
Protected Member Functions inherited from core::socket::stream::SocketReader | |
| SocketReader (const std::string &instanceName, const std::function< void(int)> &onStatus, const utils::Timeval &timeout, std::size_t blockSize, const utils::Timeval &terminateTimeout) | |
| std::size_t | getTotalRead () const |
| std::size_t | getTotalProcessed () const |
| void | setBlockSize (std::size_t readBlockSize) |
| std::size_t | readFromPeer (char *chunk, std::size_t chunkLen) |
| void | shutdownRead () |
| SocketReader ()=delete | |
Protected Member Functions inherited from core::eventreceiver::ReadEventReceiver | |
| ReadEventReceiver (const std::string &name, const utils::Timeval &timeout) | |
Protected Member Functions inherited from core::DescriptorEventReceiver | |
| bool | enable (int fd) |
| void | disable () |
| void | suspend () |
| void | resume () |
| DescriptorEventReceiver (const std::string &name, DescriptorEventPublisher &descriptorEventPublisher, const utils::Timeval &timeout=TIMEOUT::DISABLE) | |
| int | getRegisteredFd () const |
| bool | isEnabled () const |
| bool | isSuspended () const |
| void | setTimeout (const utils::Timeval &timeout) |
| utils::Timeval | getTimeout (const utils::Timeval ¤tTime) const |
| void | checkTimeout (const utils::Timeval ¤tTime) |
Protected Member Functions inherited from core::Observer | |
| void | observed () |
| void | unObserved () |
| Observer ()=default | |
| Observer (Observer &)=delete | |
| Observer (Observer &&)=delete | |
| virtual | ~Observer () |
Protected Member Functions inherited from core::EventReceiver | |
| virtual | ~EventReceiver ()=default |
| EventReceiver (const std::string &name) | |
| EventReceiver (EventReceiver &)=delete | |
| EventReceiver (EventReceiver &&)=delete | |
| EventReceiver & | operator= (EventReceiver &)=delete |
| EventReceiver & | operator= (EventReceiver &&)=delete |
| virtual void | destruct () |
| void | span () |
| void | relax () |
| const std::string & | getName () const |
Protected Member Functions inherited from core::socket::stream::SocketWriter | |
| SocketWriter (const std::string &instanceName, const std::function< void(int)> &onStatus, const utils::Timeval &timeout, std::size_t blockSize, const utils::Timeval &terminateTimeout) | |
| std::size_t | getTotalSent () const |
| std::size_t | getTotalQueued () const |
| void | setBlockSize (std::size_t writeBlockSize) |
| void | sendToPeer (const char *chunk, std::size_t chunkLen) |
| bool | streamToPeer (core::pipe::Source *source) |
| void | streamEof () |
| void | shutdownWrite (const std::function< void()> &onShutdown) |
| SocketWriter ()=delete | |
Protected Member Functions inherited from core::eventreceiver::WriteEventReceiver | |
| WriteEventReceiver (const std::string &name, const utils::Timeval &timeout) | |
Static Protected Member Functions inherited from core::EventReceiver | |
| static void | atNextTick (const std::function< void(void)> &callBack) |
Protected Attributes inherited from core::socket::stream::SocketConnection | |
| core::socket::stream::SocketContext * | socketContext = nullptr |
| std::string | instanceName |
| std::string | connectionName |
| std::chrono::time_point< std::chrono::system_clock > | onlineSinceTimePoint |
Protected Attributes inherited from core::socket::stream::tls::SocketReader | |
| SSL * | ssl = nullptr |
| bool | closeNotifyIsEOF = true |
Protected Attributes inherited from core::socket::stream::SocketReader | |
| utils::Timeval | terminateTimeout |
Protected Attributes inherited from core::socket::stream::tls::SocketWriter | |
| SSL * | ssl = nullptr |
| bool | closeNotifyIsEOF = true |
Protected Attributes inherited from core::socket::stream::SocketWriter | |
| bool | markShutdown = false |
| std::function< void()> | onShutdown |
| std::vector< char > | writePuffer |
| bool | shutdownInProgress = false |
| utils::Timeval | terminateTimeout |
Definition at line 60 of file SocketConnection.h.
|
private |
Definition at line 69 of file SocketConnection.h.
|
private |
Definition at line 70 of file SocketConnection.h.
| using core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::SocketAddress = typename Super::SocketAddress |
Definition at line 75 of file SocketConnection.h.
|
private |
Definition at line 71 of file SocketConnection.h.
|
private |
Definition at line 72 of file SocketConnection.h.
|
private |
Definition at line 66 of file SocketConnection.h.
| core::socket::stream::tls::SocketConnection< PhysicalSocket, Config >::SocketConnection | ( | PhysicalSocket && | physicalSocket, |
| const std::function< void(SocketConnection< PhysicalSocketT, ConfigT > *)> & | onDisconnect, | ||
| const std::shared_ptr< Config > & | config | ||
| ) |
Definition at line 61 of file SocketConnection.hpp.
|
finalprivatevirtual |
Implements core::socket::stream::tls::SocketReader.
Definition at line 115 of file SocketConnection.hpp.
References core::socket::stream::tls::TLSHandshake::doHandshake(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl, and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::sslInitTimeout.
|
private |
Definition at line 146 of file SocketConnection.hpp.
References core::socket::stream::tls::TLSShutdown::doShutdown(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl, and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::sslShutdownTimeout.
Referenced by core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doWriteShutdown(), and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::onReadShutdown().
|
finalprivatevirtual |
Implements core::socket::stream::SocketWriter.
Definition at line 230 of file SocketConnection.hpp.
References core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doSSLShutdown(), and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl.
| SSL * core::socket::stream::tls::SocketConnection< PhysicalSocket, Config >::getSSL | ( | ) | const |
Definition at line 73 of file SocketConnection.hpp.
References core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl.
Referenced by tls::getClient().
|
finalprivatevirtual |
Implements core::socket::stream::tls::SocketReader.
Definition at line 210 of file SocketConnection.hpp.
References core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doSSLShutdown(), and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl.
|
private |
Definition at line 78 of file SocketConnection.hpp.
References utils::Timeval::operator=(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl, core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::sslInitTimeout, and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::sslShutdownTimeout.
|
private |
Definition at line 104 of file SocketConnection.hpp.
References core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::ssl.
|
friend |
Definition at line 105 of file SocketConnection.h.
|
friend |
Definition at line 108 of file SocketConnection.h.
|
private |
Definition at line 99 of file SocketConnection.h.
Referenced by core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doSSLHandshake(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doSSLShutdown(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doWriteShutdown(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::getSSL(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::onReadShutdown(), core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::startSSL(), and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::stopSSL().
|
private |
Definition at line 101 of file SocketConnection.h.
Referenced by core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doSSLHandshake(), and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::startSSL().
|
private |
Definition at line 102 of file SocketConnection.h.
Referenced by core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::doSSLShutdown(), and core::socket::stream::tls::SocketConnection< PhysicalSocketT, ConfigT >::startSSL().