![]() |
TSDuck v3.46-4930
MPEG Transport Stream Toolkit
|
#include <tsTLVStream.h>


Public Member Functions | |
| TLVStream (tlv::Logger &logger, const tlv::Protocol &protocol, StreamInterface &stream, bool auto_error_response=true, size_t max_invalid_msg=0) | |
| bool | getAutoErrorResponse () const |
| size_t | getMaxInvalidMessages () const |
| bool | receiveMessage (tlv::MessagePtr &msg, const AbortInterface *abort=nullptr) |
| bool | sendMessage (const tlv::Message &msg) |
| void | setAutoErrorResponse (bool on) |
| void | setMaxInvalidMessages (size_t n) |
| StreamInterface & | stream () |
Protected Member Functions | |
| virtual void | handleSocketCloseComplete (Socket &sock, bool silent, bool success) |
| virtual void | handleSocketCloseStart (Socket &sock, bool silent) |
| virtual void | handleSocketConnected (TCPConnection &sock) override |
| virtual void | handleSocketDisconnected (TCPConnection &sock, bool silent) |
| virtual void | handleSocketOpenComplete (Socket &sock, bool success) |
| virtual void | handleSocketOpenStart (Socket &sock) |
Exchanging TLV messages over a stream device.
| ts::TLVStream::TLVStream | ( | tlv::Logger & | logger, |
| const tlv::Protocol & | protocol, | ||
| StreamInterface & | stream, | ||
| bool | auto_error_response = true, | ||
| size_t | max_invalid_msg = 0 ) |
Constructor.
| [in,out] | logger | Where to report errors and messages. The logger object must remain valid as long as this object exists. |
| [in] | protocol | The incoming messages are interpreted according to this protocol. The reference is kept in this object. |
| [in,out] | stream | Associated stream device. The device object must remain valid as long as this object is valid. |
| [in] | auto_error_response | When an invalid message is received, the corresponding error message is automatically sent back to the sender when auto_error_response is true. |
| [in] | max_invalid_msg | When non-zero, the connection is automatically disconnected when the number of consecutive invalid messages has reached this value. This applies only when a stream object is a subclass of TCPConnection. |
|
inline |
Get a reference to the associated stream device.
| bool ts::TLVStream::sendMessage | ( | const tlv::Message & | msg | ) |
Serialize and send a TLV message.
| [in] | msg | The message to send. |
| bool ts::TLVStream::receiveMessage | ( | tlv::MessagePtr & | msg, |
| const AbortInterface * | abort = nullptr ) |
Receive a TLV message. Wait for the message, deserialize it and validate it. Process invalid messages and loop until a valid message is received.
| [out] | msg | A safe pointer to the received message. |
| [in] | abort | If non-zero, invoked when I/O is interrupted (in case of user-interrupt, return, otherwise retry). |
|
inline |
Get invalid incoming messages processing.
|
inline |
Set invalid incoming messages processing.
| [in] | on | When an invalid message is received, the corresponding error message is automatically sent back to the sender when on is true. |
|
inline |
Get invalid message threshold. This applies only when a stream object is a subclass of TCPConnection.
|
inline |
Set invalid message threshold. This applies only when a stream object is a subclass of TCPConnection.
| [in] | n | When non-zero, the connection is automatically disconnected when the number of consecutive invalid messages has reached this value. |
|
overrideprotectedvirtual |
Called when a TCP socket is successfully connected.
| [in,out] | sock | Socket for which the handler is invoked. |
Reimplemented from ts::SocketHandlerInterface.
|
virtualinherited |
Called when a socket is about to be opened. Never called when the application tries to open a socket which is already open.
| [in,out] | sock | Socket for which the handler is invoked. |
|
virtualinherited |
Called after a socket is opened (or failed to open).
| [in,out] | sock | Socket for which the handler is invoked. |
| [in] | success | True if the open was successful, false if the open failed. In case of error, the socket shall be considered as closed. |
|
virtualinherited |
Called when a TCP socket is disconnected.
| [in,out] | sock | Socket for which the handler is invoked. |
| [in] | silent | Same value as passed to disconnect() or close(). |
|
virtualinherited |
Called when a socket is about to be closed. Never called when the application tries to close a socket which is not open.
| [in,out] | sock | Socket for which the handler is invoked. |
| [in] | silent | Same value as passed to close(). |
|
virtualinherited |
Called after a socket is closed.
| [in,out] | sock | Socket for which the handler is invoked. |
| [in] | silent | Same value as passed to close(). |
| [in] | success | True if the close was successful, false if there was an error during the close. The socket shall be considered as closed on all cases, regardless of success. |