TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
The class ts::tlv::Protocol defines the syntax of a TLV protocol. More...
#include <tstlvProtocol.h>
Public Member Functions | |
Protocol ()=default | |
Constructor for a protocol without version number. | |
Protocol (VERSION v) | |
Constructor for a protocol with version number. | |
virtual | ~Protocol () |
Virtual destructor. | |
void | add (TAG cmd_tag) |
This method declares a command tag in the protocol. | |
void | add (TAG cmd_tag, TAG param_tag, const Protocol *compound, size_t min_count, size_t max_count) |
This method declares a command tag in the protocol and one of its parameters. | |
void | add (TAG cmd_tag, TAG param_tag, size_t min_size, size_t max_size, size_t min_count, size_t max_count) |
This method declares a command tag in the protocol and one of its parameters. | |
virtual void | buildErrorResponse (const MessageFactory &mf, MessagePtr &msg) const =0 |
Error response creation. | |
virtual void | factory (const MessageFactory &mf, MessagePtr &msg) const =0 |
Generic factory method. | |
bool | hasVersion () const |
Check if the protocol has a protocol version number. | |
virtual UString | name () const =0 |
Get the protocol name (for information only). | |
void | setVersion (VERSION v) |
Change the protocol version number. | |
VERSION | version () const |
Get the protocol version number. | |
The class ts::tlv::Protocol defines the syntax of a TLV protocol.
Used by ts::tlv::MessageFactory to validate a message.
ts::tlv::Protocol::Protocol | ( | VERSION | v | ) |
Constructor for a protocol with version number.
The message format is version + compound TLV.
[in] | v | Expected protocol version. |
|
inline |
Check if the protocol has a protocol version number.
|
inline |
Get the protocol version number.
|
inline |
Change the protocol version number.
[in] | v | The new protocol version number. |
|
inline |
This method declares a command tag in the protocol.
Required only for commands without parameters.
[in] | cmd_tag | Message tag. |
void ts::tlv::Protocol::add | ( | TAG | cmd_tag, |
TAG | param_tag, | ||
size_t | min_size, | ||
size_t | max_size, | ||
size_t | min_count, | ||
size_t | max_count | ||
) |
This method declares a command tag in the protocol and one of its parameters.
Must be invoked for each parameter of each command.
[in] | cmd_tag | Message tag. |
[in] | param_tag | Parameter tag. |
[in] | min_size | Minimum allowed size for the parameter value. |
[in] | max_size | Maximum allowed size for the parameter value. |
[in] | min_count | Minimum number of occurences of this parameter in the command. |
[in] | max_count | Maximum number of occurences of this parameter in the command. |
void ts::tlv::Protocol::add | ( | TAG | cmd_tag, |
TAG | param_tag, | ||
const Protocol * | compound, | ||
size_t | min_count, | ||
size_t | max_count | ||
) |
This method declares a command tag in the protocol and one of its parameters.
Same as add() but with a parameter which is a compound TLV structure.
|
pure virtual |
Generic factory method.
This pure virtual method must be implemented by subclasses. This method is invoked by the MessageFactory after analysis of the command and parameters. All actual parameters have been checked for consistency with the protocol.
[in] | mf | The message factory which analyzed the binary message. |
[out] | msg | Safe pointer to the new message. |
Implemented in ts::duck::Protocol, ts::ecmgscs::Protocol, and ts::emmgmux::Protocol.
|
pure virtual |
Error response creation.
This method creates an error response from the result of the analysis of a faulty incoming message.
[in] | mf | The message factory which analyzed the binary message. |
[out] | msg | Safe pointer to the new error message. |
Implemented in ts::duck::Protocol, ts::ecmgscs::Protocol, and ts::emmgmux::Protocol.
|
pure virtual |
Get the protocol name (for information only).
Implemented in ts::duck::Protocol, ts::ecmgscs::Protocol, and ts::emmgmux::Protocol.