|
| virtual void | send (const char *msg, size_t len)=0 |
| | Send some data to the peer.
|
|
virtual void | send (const void *msg, size_t len)=0 |
|
virtual void | send (const std::string &msg)=0 |
|
virtual void | send (std::string &&msg)=0 |
|
virtual void | send (const MsgBuffer &buffer)=0 |
|
virtual void | send (MsgBuffer &&buffer)=0 |
|
virtual void | send (const std::shared_ptr< std::string > &msgPtr)=0 |
|
virtual void | send (const std::shared_ptr< MsgBuffer > &msgPtr)=0 |
| virtual void | sendFile (const char *fileName, long long offset=0, long long length=0)=0 |
| | Send a file to the peer.
|
| virtual void | sendFile (const wchar_t *fileName, long long offset=0, long long length=0)=0 |
| | Send a file to the peer.
|
| virtual void | sendStream (std::function< std::size_t(char *, std::size_t)> callback)=0 |
| | Send a stream to the peer.
|
| virtual AsyncStreamPtr | sendAsyncStream (bool disableKickoff=false)=0 |
| | Send a stream to the peer asynchronously.
|
| virtual const InetAddress & | localAddr () const =0 |
| | Get the local address of the connection.
|
| virtual const InetAddress & | peerAddr () const =0 |
| | Get the remote address of the connection.
|
| virtual bool | connected () const =0 |
| | Return true if the connection is established.
|
| virtual bool | disconnected () const =0 |
| | Return false if the connection is established.
|
| virtual void | setHighWaterMarkCallback (const HighWaterMarkCallback &cb, size_t markLen)=0 |
| | Set the high water mark callback.
|
| virtual void | setTcpNoDelay (bool on)=0 |
| | Set the TCP_NODELAY option to the socket.
|
| virtual void | shutdown ()=0 |
| | Shutdown the connection.
|
|
virtual void | forceClose ()=0 |
| | Close the connection forcefully.
|
| virtual EventLoop * | getLoop ()=0 |
| | Get the event loop in which the connection I/O is handled.
|
| void | setContext (const std::shared_ptr< void > &context) |
| | Set the custom data on the connection.
|
|
void | setContext (std::shared_ptr< void > &&context) |
|
virtual std::string | applicationProtocol () const =0 |
| template<typename T> |
| std::shared_ptr< T > | getContext () const |
| | Get the custom data from the connection.
|
| bool | hasContext () const |
| | Return true if the custom data is set by user.
|
|
void | clearContext () |
| | Clear the custom data.
|
|
virtual void | keepAlive ()=0 |
| | Call this method to avoid being kicked off by TcpServer, refer to the kickoffIdleConnections method in the TcpServer class.
|
| virtual bool | isKeepAlive ()=0 |
| | Return true if the keepAlive() method is called.
|
| virtual size_t | bytesSent () const =0 |
| | Return the number of bytes sent.
|
| virtual size_t | bytesReceived () const =0 |
| | Return the number of bytes received.
|
| virtual bool | isSSLConnection () const =0 |
| | Check whether the connection is SSL encrypted.
|
|
virtual MsgBuffer * | getRecvBuffer ()=0 |
| | Get buffer of unprompted data.
|
| virtual CertificatePtr | peerCertificate () const =0 |
| | Get peer certificate (if any).
|
| virtual std::string | sniName () const =0 |
| | Get the SNI name (for server connections only).
|
| virtual void | startEncryption (TLSPolicyPtr policy, bool isServer, std::function< void(const TcpConnectionPtr &)> upgradeCallback=nullptr)=0 |
| | Start TLS. If the connection is specified as a server, the connection will be upgraded to a TLS server connection. If the connection is specified as a client, the connection will be upgraded to a TLS client.
|
| void | startClientEncryption (std::function< void(const TcpConnectionPtr &)> &&callback, bool useOldTLS=false, bool validateCert=true, const std::string &hostname="", const std::vector< std::pair< std::string, std::string > > &sslConfCmds={}) |
| | Start TLS as a client.
|
|
void | setValidationPolicy (TLSPolicy &&policy) |
|
void | setRecvMsgCallback (const RecvMessageCallback &cb) |
|
void | setRecvMsgCallback (RecvMessageCallback &&cb) |
|
void | setConnectionCallback (const ConnectionCallback &cb) |
|
void | setConnectionCallback (ConnectionCallback &&cb) |
|
void | setWriteCompleteCallback (const WriteCompleteCallback &cb) |
|
void | setWriteCompleteCallback (WriteCompleteCallback &&cb) |
|
void | setCloseCallback (const CloseCallback &cb) |
|
void | setCloseCallback (CloseCallback &&cb) |
|
CloseCallback | getCloseCallback () const |
|
void | setSSLErrorCallback (const SSLErrorCallback &cb) |
|
void | setSSLErrorCallback (SSLErrorCallback &&cb) |
|
virtual void | connectEstablished ()=0 |
|
virtual void | connectDestroyed ()=0 |
|
virtual void | enableKickingOff (size_t timeout, const std::shared_ptr< TimingWheel > &timingWheel)=0 |
|
virtual void | forwardToTLSBuffer (MsgBuffer *buffer)=0 |
This class represents a TCP connection.