12 #include "../OSSupport/Network.h"
73 const AString & a_OwnPrivKeyData,
74 const AString & a_OwnPrivKeyPassword,
75 const AString & a_TrustedRootCAs
88 const AString & a_OwnPrivKeyData,
89 const AString & a_OwnPrivKeyPassword,
115 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg)
override;
119 virtual void OnReceivedData(
const char * a_Data,
size_t a_Length)
override;
std::weak_ptr< cLuaServerHandle > cLuaServerHandleWPtr
std::shared_ptr< cTCPLink > cTCPLinkPtr
std::unique_ptr< cTableRef > cTableRefPtr
UInt16 GetRemotePort(void) const
Returns the port used by the remote endpoint of the connection.
cLuaServerHandleWPtr m_Server
The server that is responsible for this link, if any.
virtual void OnReceivedData(const char *a_Data, size_t a_Length) override
Called when there's data incoming from the remote peer.
AString GetLocalIP(void) const
Returns the IP address of the local endpoint of the connection.
cLuaTCPLink(cLuaState::cTableRefPtr &&a_Callbacks)
Creates a new instance of the link, wrapping the callbacks that are in the specified table.
bool Send(const AString &a_Data)
Sends the data contained in the string to the remote peer.
AString StartTLSClient(const AString &a_OwnCertData, const AString &a_OwnPrivKeyData, const AString &a_OwnPrivKeyPassword, const AString &a_TrustedRootCAs)
Starts a TLS handshake as a client connection.
virtual void OnError(int a_ErrorCode, const AString &a_ErrorMsg) override
Called when an error is detected on the connection.
virtual void OnRemoteClosed(void) override
Called when the remote end closes the connection.
void Close(void)
Drops the connection without any more processing.
void ReceivedCleartextData(const char *a_Data, size_t a_NumBytes)
Called by the SSL context when there's incoming data available in the cleartext.
AString StartTLSServer(const AString &a_OwnCertData, const AString &a_OwnPrivKeyData, const AString &a_OwnPrivKeyPassword, const AString &a_StartTLSData)
Starts a TLS handshake as a server connection.
void Terminated(void)
Common code called when the link is considered as terminated.
cLuaState::cTableRefPtr m_Callbacks
The Lua table that holds the callbacks to be invoked.
virtual void OnConnected(cTCPLink &a_Link) override
Called when the Connect call succeeds.
AString GetRemoteIP(void) const
Returns the IP address of the remote endpoint of the connection.
void Shutdown(void)
Closes the link gracefully.
virtual void OnLinkCreated(cTCPLinkPtr a_Link) override
Called when the cTCPLink for the connection is created.
cTCPLinkPtr m_Link
The underlying link representing the connection.
UInt16 GetLocalPort(void) const
Returns the port used by the local endpoint of the connection.
virtual ~cLuaTCPLink() override
Interface that provides the methods available on a single TCP connection.
Callbacks used for connecting to other servers as a client.