TSDuck Version 3.16-1064 (TSDuck - The MPEG Transport Stream Toolkit)
ts::tlv::Protocol Class Referenceabstract

The class ts::tlv::Protocol defines the syntax of a TLV protocol. More...

Inheritance diagram for ts::tlv::Protocol:

Public Member Functions

 Protocol ()
 Constructor for a protocol without version number.
 
 Protocol (VERSION v)
 Constructor for a protocol with version number. More...
 
virtual ~Protocol ()
 Virtual destructor.
 
void add (TAG cmd_tag)
 This method declares a command tag in the protocol. More...
 
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. More...
 
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. More...
 
virtual void buildErrorResponse (const MessageFactory &mf, MessagePtr &msg) const =0
 Error response creation. More...
 
virtual void factory (const MessageFactory &mf, MessagePtr &msg) const =0
 Generic factory method. More...
 
bool hasVersion () const
 Check if the protocol has a protocol version number. More...
 
void setVersion (VERSION v)
 Change the protocol version number. More...
 
VERSION version () const
 Get the protocol version number. More...
 

Detailed Description

The class ts::tlv::Protocol defines the syntax of a TLV protocol.

Used by ts::tlv::MessageFactory to validate a message.

Constructor & Destructor Documentation

◆ Protocol()

ts::tlv::Protocol::Protocol ( VERSION  v)
inline

Constructor for a protocol with version number.

The message format is version + compound TLV.

Parameters
[in]vExpected protocol version.

Member Function Documentation

◆ hasVersion()

bool ts::tlv::Protocol::hasVersion ( ) const
inline

Check if the protocol has a protocol version number.

Returns
True if the message has a protocol version number.

◆ version()

VERSION ts::tlv::Protocol::version ( ) const
inline

Get the protocol version number.

Returns
The protocol version number.

◆ setVersion()

void ts::tlv::Protocol::setVersion ( VERSION  v)
inline

Change the protocol version number.

Parameters
[in]vThe new protocol version number.

◆ add() [1/3]

void ts::tlv::Protocol::add ( TAG  cmd_tag)
inline

This method declares a command tag in the protocol.

Required only for commands without parameters.

Parameters
[in]cmd_tagMessage tag.

◆ add() [2/3]

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 
)
inline

This method declares a command tag in the protocol and one of its parameters.

Must be invoked for each parameter of each command.

Parameters
[in]cmd_tagMessage tag.
[in]param_tagParameter tag.
[in]min_sizeMinimum allowed size for the parameter value.
[in]max_sizeMaximum allowed size for the parameter value.
[in]min_countMinimum number of occurences of this parameter in the command.
[in]max_countMaximum number of occurences of this parameter in the command.

◆ add() [3/3]

void ts::tlv::Protocol::add ( TAG  cmd_tag,
TAG  param_tag,
const Protocol compound,
size_t  min_count,
size_t  max_count 
)
inline

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.

Parameters
[in]cmd_tagMessage tag.
[in]param_tagParameter tag.
[in]compoundProtocol describing the compound TLV structure.
[in]min_countMinimum number of occurences of this parameter in the command.
[in]max_countMaximum number of occurences of this parameter in the command.

◆ factory()

virtual void ts::tlv::Protocol::factory ( const MessageFactory mf,
MessagePtr msg 
) const
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.

Parameters
[in]mfThe message factory which analyzed the binary message.
[out]msgSafe pointer to the new message.

Implemented in ts::duck::Protocol, ts::ecmgscs::Protocol, and ts::emmgmux::Protocol.

◆ buildErrorResponse()

virtual void ts::tlv::Protocol::buildErrorResponse ( const MessageFactory mf,
MessagePtr msg 
) const
pure virtual

Error response creation.

This method creates an error response from the result of the analysis of a faulty incoming message.

Parameters
[in]mfThe message factory which analyzed the binary message.
[out]msgSafe pointer to the new error message.

Implemented in ts::duck::Protocol, ts::ecmgscs::Protocol, and ts::emmgmux::Protocol.


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