![]() |
TSDuck v3.45-4725
MPEG Transport Stream Toolkit
|
The class describes input data, as provided by a ReactiveTCPConnection to a ReactiveTCPConnectionHandlerInterface. More...
#include <tsReactiveTCPInputControl.h>
Public Member Functions | |
| ReactiveTCPInputControl ()=default | |
| Default constructor. | |
| void | reset () |
| Reset the content to the original values, suitable for processing an input buffer. | |
Public Attributes | |
| std::optional< size_t > | min_next_size {} |
| Minimum data size for next call. | |
| std::optional< uint8_t > | next_delimiter {} |
| Required end-of-message delimiter for next call. | |
| std::optional< size_t > | used_size {} |
| Number of used bytes in the handler. | |
The class describes input data, as provided by a ReactiveTCPConnection to a ReactiveTCPConnectionHandlerInterface.
The handler updates the ReactiveTCPInputControl structure depending on its processing of the input data.
Sample scenario for ReactiveTCPConnectionHandlerInterface::handleTCPReceive(), using a message format consisting of a message header, containing the payload size, followed by a payload of that size.
Sample scenario for ReactiveTCPConnectionHandlerInterface::handleTCPReceive(), using a text line format where each line is terminated by LF or a CR/LF combination.
In all cases, the handler shall check error_code and verify that it is equal to SYS_SUCCESS before proceeding. Otherwise, the connection shall be considered as lost or terminated.
| std::optional<size_t> ts::ReactiveTCPInputControl::used_size {} |
Number of used bytes in the handler.
In input, used_size is unset. On return, the handler may set the number of bytes which were used in used_size. If the returned value of used_size is less than the input data size, the remaining unused data stay in the input buffer and will be present at the beginning of the data buffer the next time this handler will be called. If used_size is left unset, all input data are assumed to be used by the handler.
| std::optional<size_t> ts::ReactiveTCPInputControl::min_next_size {} |
Minimum data size for next call.
In input, min_next_size is unset. On return, the handler can specify in min_next_size the minimum data size to receive before being called again. This is the minimum size of the data buffer, including remaining unused data when used_size is set to a value lower that data size. This means that if min_next_size is less than the remaining unused bytes in the buffer, the handler will be immediately called again on return.
| std::optional<uint8_t> ts::ReactiveTCPInputControl::next_delimiter {} |
Required end-of-message delimiter for next call.
In input, next_delimiter is unset. On return, if next_delimiter is set, its value is used as a delimiter for the next message. This means that the handler will be called again only when input data contains the corresponding byte value, including unused bytes if used_size is less than data size.