diff options
Diffstat (limited to '')
-rw-r--r-- | src/OSSupport/TCPLinkImpl.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/OSSupport/TCPLinkImpl.h b/src/OSSupport/TCPLinkImpl.h index d26b1e358..c757303d2 100644 --- a/src/OSSupport/TCPLinkImpl.h +++ b/src/OSSupport/TCPLinkImpl.h @@ -40,9 +40,16 @@ public: /** Creates a new link based on the given socket. Used for connections accepted in a server using cNetwork::Listen(). + a_Host is the hostname used for TLS SNI (can be empty in cases TLS is not used). a_Address and a_AddrLen describe the remote peer that has connected. The link is created disabled, you need to call Enable() to start the regular communication. */ - cTCPLinkImpl(evutil_socket_t a_Socket, cCallbacksPtr a_LinkCallbacks, cServerHandleImplPtr a_Server, const sockaddr * a_Address, socklen_t a_AddrLen); + cTCPLinkImpl( + evutil_socket_t a_Socket, + cCallbacksPtr a_LinkCallbacks, + cServerHandleImplPtr a_Server, + const sockaddr * a_Address, + socklen_t a_AddrLen + ); /** Destroys the LibEvent handle representing the link. */ virtual ~cTCPLinkImpl() override; @@ -68,8 +75,7 @@ public: virtual void Close(void) override; virtual AString StartTLSClient( cX509CertPtr a_OwnCert, - cCryptoKeyPtr a_OwnPrivKey, - const std::string_view hostname + cCryptoKeyPtr a_OwnPrivKey ) override; virtual AString StartTLSServer( cX509CertPtr a_OwnCert, @@ -151,6 +157,10 @@ protected: /** The port of the local endpoint. Valid only after the socket has been connected. */ UInt16 m_LocalPort; + /** The original host parameter which was used for creating the link, either hostname or IP address. + Used for TLS SNI. */ + AString m_RemoteHost; + /** The IP address of the remote endpoint. Valid only after the socket has been connected. */ AString m_RemoteIP; @@ -175,7 +185,7 @@ protected: Used for outgoing connections created using cNetwork::Connect(). To be used only by the Connect() factory function. The link is created disabled, you need to call Enable() to start the regular communication. */ - cTCPLinkImpl(const cCallbacksPtr a_LinkCallbacks); + cTCPLinkImpl(const std::string & a_Host, const cCallbacksPtr a_LinkCallbacks); /** Callback that LibEvent calls when there's data available from the remote peer. */ static void ReadCallback(bufferevent * a_BufferEvent, void * a_Self); |