TSDuck v3.45-4686
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::ReactiveTCPConnectionHandlerInterface Class Reference

Interface class for TCP connection Reactor handlers. More...

#include <tsReactiveTCPConnectionHandlerInterface.h>

Inheritance diagram for ts::ReactiveTCPConnectionHandlerInterface:

Public Member Functions

virtual void handleTCPAccepted (ReactiveTCPServer &server, ReactiveTCPConnection &sock, int error_code, const ObjectPtr &user_data)
 Handle the completion of a client connection of a TCP socket in the context of a server.
 
virtual void handleTCPClosed (ReactiveTCPConnection &sock, const ObjectPtr &user_data)
 Handle the completion of closing a TCP socket.
 
virtual void handleTCPConnected (ReactiveTCPConnection &sock, int error_code, const ObjectPtr &user_data)
 Handle the completion of a connection of a TCP socket.
 
virtual void handleTCPReceive (ReactiveTCPConnection &sock, const ByteBlock &data, ReactiveTCPInputControl &control, int error_code, const ObjectPtr &user_data)
 Handle the reception of TCP data.
 
virtual void handleTCPSend (ReactiveTCPConnection &sock, size_t position, int error_code, const ObjectPtr &user_data)
 Handle the completion of a send operation on a TCP socket.
 

Detailed Description

Interface class for TCP connection Reactor handlers.

All methods are empty by default. An application may implement the required ones only.

Member Function Documentation

◆ handleTCPConnected()

virtual void ts::ReactiveTCPConnectionHandlerInterface::handleTCPConnected ( ReactiveTCPConnection sock,
int  error_code,
const ObjectPtr user_data 
)
virtual

Handle the completion of a connection of a TCP socket.

Parameters
[in,out]sockTCP socket for which the handler is invoked.
[in]error_codeSystem-specific error code, SYS_SUCCESS on success, SYS_ERROR in case of unknown error, SYS_CANCELED if the connection was canceled before completion.
[in]user_dataThe user-data shared pointer which was passed to startConnect().

◆ handleTCPAccepted()

virtual void ts::ReactiveTCPConnectionHandlerInterface::handleTCPAccepted ( ReactiveTCPServer server,
ReactiveTCPConnection sock,
int  error_code,
const ObjectPtr user_data 
)
virtual

Handle the completion of a client connection of a TCP socket in the context of a server.

Parameters
[in,out]serverTCP server in the context of which sock is starting a new client session.
[in,out]sockTCP socket for which the handler is invoked.
[in]error_codeSystem-specific error code, SYS_SUCCESS on success, SYS_ERROR in case of unknown error.
[in]user_dataThe user-data shared pointer which was passed to whenAccepted().

◆ handleTCPSend()

virtual void ts::ReactiveTCPConnectionHandlerInterface::handleTCPSend ( ReactiveTCPConnection sock,
size_t  position,
int  error_code,
const ObjectPtr user_data 
)
virtual

Handle the completion of a send operation on a TCP socket.

Parameters
[in,out]sockTCP socket for which the handler is invoked.
[in]positionThe number of sent bytes since the socket was connected, at the end of the send operation for which the hanlder is called. This is informative only.
[in]error_codeSystem-specific error code, SYS_SUCCESS on success, SYS_EOF if the handler is called as a completion of startCloseWriter(), SYS_ERROR in case of unknown error, SYS_CANCELED if the I/O was canceled before completion.
[in]user_dataThe user-data shared pointer which was passed to startSend().

◆ handleTCPReceive()

virtual void ts::ReactiveTCPConnectionHandlerInterface::handleTCPReceive ( ReactiveTCPConnection sock,
const ByteBlock data,
ReactiveTCPInputControl control,
int  error_code,
const ObjectPtr user_data 
)
virtual

Handle the reception of TCP data.

Parameters
[in,out]sockTCP socket for which the handler is invoked.
[in]dataReceived data.
[in,out]controlInput control data that the handler may update according to the usage of data.
[in]error_codeSystem-specific error code, SYS_SUCCESS on success, SYS_EOF if the peer has disconnected, SYS_ERROR in case of unknown error.
[in]user_dataThe user-data shared pointer which was passed to startReceive().

◆ handleTCPClosed()

virtual void ts::ReactiveTCPConnectionHandlerInterface::handleTCPClosed ( ReactiveTCPConnection sock,
const ObjectPtr user_data 
)
virtual

Handle the completion of closing a TCP socket.

An application closes a ReactiveTCPConnection using startClose() and this handler is called when the closing of the socket is complete. This is specifically important on operating systems with asynchronous I/O such as Windows. The application shall not call TCPSocket::close() and immediately consider the socket as done. If there are pending asynchronous I/O, the associated data buffers are still in use, until the cancelation of the these I/O are completed, after closing the socket. The application shall therefore wait for the handleTCPClosed() handler to destroy the data buffers and consider the socket as completely done.

Parameters
[in,out]sockTCP socket for which the handler is invoked.
[in]user_dataThe user-data shared pointer which was passed to startClose().

The documentation for this class was generated from the following file: