49 virtual void OnReceivedData(
const char * a_Data,
size_t a_Length) = 0;
61 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg) = 0;
71 virtual bool Send(
const void * a_Data,
size_t a_Length) = 0;
77 return Send(a_Data.data(), a_Data.size());
99 virtual void Close(
void) = 0;
135 m_Callbacks(a_Callbacks)
155 virtual void Close(
void) = 0;
158 virtual bool IsListening(
void)
const = 0;
177 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg) = 0;
189 virtual void Close(
void) = 0;
192 virtual bool IsOpen(
void)
const = 0;
195 virtual UInt16 GetPort(
void)
const = 0;
203 virtual void EnableBroadcasts(
void) = 0;
212 m_Callbacks(a_Callbacks)
235 virtual void OnConnected(
cTCPLink & a_Link) = 0;
238 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg) = 0;
259 virtual void OnAccepted(
cTCPLink & a_Link) = 0;
262 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg) = 0;
278 virtual void OnNameResolved(
const AString & a_Name,
const AString & a_IP) = 0;
294 virtual void OnError(
int a_ErrorCode,
const AString & a_ErrorMsg) = 0;
298 virtual void OnFinished(
void) = 0;
312 cConnectCallbacksPtr a_ConnectCallbacks,
324 cListenCallbacksPtr a_ListenCallbacks
333 static bool HostnameToIP(
335 cResolveNameCallbacksPtr a_Callbacks
344 static bool IPToHostName(
346 cResolveNameCallbacksPtr a_Callbacks
virtual AString GetLocalIP(void) const =0
Returns the IP address of the local endpoint of the connection.
std::vector< cTCPLinkPtr > cTCPLinkPtrs
std::shared_ptr< cX509Cert > cX509CertPtr
virtual ~cListenCallbacks()
virtual void Close(void)=0
Drops the connection without any more processing.
cUDPEndpoint(cCallbacks &a_Callbacks)
Creates a new instance of an endpoint, with the specified callbacks.
virtual bool Send(const void *a_Data, size_t a_Length)=0
Queues the specified data for sending to the remote peer.
cTCPLink(cCallbacksPtr a_Callbacks)
Creates a new link, with the specified callbacks.
virtual void Shutdown(void)=0
Closes the link gracefully.
Interface that provides the methods available on a listening server socket.
virtual UInt16 GetLocalPort(void) const =0
Returns the port used by the local endpoint of the connection.
std::shared_ptr< cX509Cert > cX509CertPtr
virtual AString StartTLSServer(cX509CertPtr a_OwnCert, cCryptoKeyPtr a_OwnPrivKey, const AString &a_StartTLSData)=0
Starts a TLS handshake as a server connection.
virtual bool OnNameResolvedV6(const AString &a_Name, const sockaddr_in6 *a_IP)
Called when the hostname is successfully resolved into an IPv6 address.
virtual UInt16 GetRemotePort(void) const =0
Returns the port used by the remote endpoint of the connection.
Callbacks used when resolving names to IPs.
std::shared_ptr< cCryptoKey > cCryptoKeyPtr
std::shared_ptr< cUDPEndpoint > cUDPEndpointPtr
virtual void OnReceivedData(const char *a_Data, size_t a_Length)=0
Called when there's data incoming from the remote peer.
Interface for the callbacks for events that can happen on the endpoint.
virtual AString StartTLSClient(cX509CertPtr a_OwnCert, cCryptoKeyPtr a_OwnPrivKey)=0
Starts a TLS handshake as a client connection.
bool Send(const AString &a_Data)
Queues the specified data for sending to the remote peer.
std::vector< AString > AStringVector
cCallbacksPtr m_Callbacks
Callbacks to be used for the various situations.
std::shared_ptr< cServerHandle > cServerHandlePtr
virtual void OnTlsHandshakeCompleted(void)
Called when the TLS handshake has been completed and communication can continue regularly.
std::shared_ptr< cTCPLink > cTCPLinkPtr
virtual bool OnNameResolvedV4(const AString &a_Name, const sockaddr_in *a_IP)
Called when the hostname is successfully resolved into an IPv4 address.
Interface that provides methods available on UDP communication endpoints.
std::shared_ptr< cCallbacks > cCallbacksPtr
Callbacks used when listening for incoming connections as a server.
virtual AString GetRemoteIP(void) const =0
Returns the IP address of the remote endpoint of the connection.
std::shared_ptr< cResolveNameCallbacks > cResolveNameCallbacksPtr
std::shared_ptr< cCryptoKey > cCryptoKeyPtr
std::shared_ptr< cConnectCallbacks > cConnectCallbacksPtr
virtual ~cConnectCallbacks()
Interface that provides the methods available on a single TCP connection.
virtual void OnRemoteClosed(void)=0
Called when the remote end closes the connection.
virtual void OnLinkCreated(cTCPLinkPtr a_Link)=0
Called when the cTCPLink for the connection is created.
cCallbacks & m_Callbacks
The callbacks used for various events on the endpoint.
Callbacks used for connecting to other servers as a client.
virtual ~cResolveNameCallbacks()
std::vector< cServerHandlePtr > cServerHandlePtrs
cCallbacksPtr GetCallbacks(void) const
Returns the callbacks that are used.
std::shared_ptr< cListenCallbacks > cListenCallbacksPtr
virtual void OnError(int a_ErrorCode, const AString &a_ErrorMsg)=0
Called when an error is detected on the connection.