TSDuck v3.46-4806
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::ReactiveUDPHandlerInterface Class Reference

Interface class for UDP operation Reactor handlers. More...

#include <tsReactiveUDPHandlerInterface.h>

Public Member Functions

virtual void handleUDPClosed (ReactiveUDPSocket &sock, const ObjectPtr &user_data)
 Handle the completion of closing a UDP socket.
 
virtual void handleUDPReceive (ReactiveUDPSocket &sock, const ByteBlockPtr &data, const IPSocketAddress &sender, const IPSocketAddress &destination, cn::microseconds timestamp, UDPSocket::TimeStampType timestamp_type, int error_code, const ObjectPtr &user_data)
 Handle the reception of a UDP datagram.
 
virtual void handleUDPSend (ReactiveUDPSocket &sock, const void *data, size_t size, const IPSocketAddress &destination, int error_code, const ObjectPtr &user_data)
 Handle the completion of a send operation on a UDP socket.
 

Detailed Description

Interface class for UDP operation Reactor handlers.

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

Member Function Documentation

◆ handleUDPSend()

virtual void ts::ReactiveUDPHandlerInterface::handleUDPSend ( ReactiveUDPSocket &  sock,
const void *  data,
size_t  size,
const IPSocketAddress &  destination,
int  error_code,
const ObjectPtr &  user_data 
)
virtual

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

Parameters
[in,out]sockUDP socket for which the handler is invoked.
[in]dataAddress of the message which was sent. For information only.
[in]sizeSize in bytes of the sent message. For information only.
[in]destinationSocket address of the destination. For information only.
[in]error_codeSystem-specific error code, SYS_SUCCESS on success, 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().

◆ handleUDPReceive()

virtual void ts::ReactiveUDPHandlerInterface::handleUDPReceive ( ReactiveUDPSocket &  sock,
const ByteBlockPtr &  data,
const IPSocketAddress &  sender,
const IPSocketAddress &  destination,
cn::microseconds  timestamp,
UDPSocket::TimeStampType  timestamp_type,
int  error_code,
const ObjectPtr &  user_data 
)
virtual

Handle the reception of a UDP datagram.

Parameters
[in,out]sockUDP socket for which the handler is invoked.
[in]dataSafe pointer to the received data packet. Can be null in case of error. The handler may safely copy the shared pointer, the pointed data will not be modified by the ReactiveUDPSocker.
[in]senderSocket address of the sender.
[in]destinationSocket address of the packet destination. Useful in multicast packets.
[in]timestampReceive timestamp in micro-seconds. If the value is negative, no timestamp is available.
[in]timestamp_typeType of receive timestamp.
[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 startReceive().

◆ handleUDPClosed()

virtual void ts::ReactiveUDPHandlerInterface::handleUDPClosed ( ReactiveUDPSocket &  sock,
const ObjectPtr &  user_data 
)
virtual

Handle the completion of closing a UDP socket.

An application closes a ReactiveUDPSocket 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 UDPSocket::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 handleUDPClosed() handler to destroy the data buffers and consider the socket as completely done.

Parameters
[in,out]sockUDP 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: