TSDuck v3.46-4930
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::duck::Protocol Class Reference

Generic description of the TSDuck internal messaging protocol. More...

#include <tsDuckProtocol.h>

Inheritance diagram for ts::duck::Protocol:
Collaboration diagram for ts::duck::Protocol:

Public Member Functions

 Protocol ()
void add (TAG cmd_tag)
void add (TAG cmd_tag, TAG param_tag, const Protocol *compound, size_t min_count, size_t max_count)
void add (TAG cmd_tag, TAG param_tag, size_t min_size, size_t max_size, size_t min_count, size_t max_count)
virtual void buildErrorResponse (const tlv::MessageFactory &, tlv::MessagePtr &) const override
virtual void factory (const tlv::MessageFactory &, tlv::MessagePtr &) const override
bool hasVersion () const
size_t headerSize () const
size_t lengthOffset () const
virtual UString name () const override
void setVersion (VERSION v)
size_t tagOffset () const
VERSION version () const

Detailed Description

Generic description of the TSDuck internal messaging protocol.

Constructor & Destructor Documentation

◆ Protocol()

ts::duck::Protocol::Protocol ( )

Default constructor.

Member Function Documentation

◆ factory()

virtual void ts::duck::Protocol::factory ( const tlv::MessageFactory & mf,
tlv::MessagePtr & msg ) const
overridevirtual

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.

Implements ts::tlv::Protocol.

◆ buildErrorResponse()

virtual void ts::duck::Protocol::buildErrorResponse ( const tlv::MessageFactory & mf,
tlv::MessagePtr & msg ) const
overridevirtual

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.

Implements ts::tlv::Protocol.

◆ name()

virtual UString ts::duck::Protocol::name ( ) const
overridevirtual

Get the protocol name (for information only).

Returns
The protocol name.

Implements ts::tlv::Protocol.

◆ hasVersion()

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

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
inlineinherited

Get the protocol version number.

Returns
The protocol version number.

◆ setVersion()

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

Change the protocol version number.

Parameters
[in]vThe new protocol version number.

◆ tagOffset()

size_t ts::tlv::Protocol::tagOffset ( ) const
inlineinherited

Get the offset in bytes of the "tag" field in binary messages.

Returns
The offset in bytes of the "tag" field in binary messages.

◆ lengthOffset()

size_t ts::tlv::Protocol::lengthOffset ( ) const
inlineinherited

Get the offset in bytes of the "length" field in binary messages.

Returns
The offset in bytes of the "length" field in binary messages.

◆ headerSize()

size_t ts::tlv::Protocol::headerSize ( ) const
inlineinherited

Get the size in bytes of the header in binary messages.

Returns
The size in bytes of the header in binary messages.

◆ add() [1/3]

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

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

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 occurrences of this parameter in the command.
[in]max_countMaximum number of occurrences 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 )
inherited

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 occurrences of this parameter in the command.
[in]max_countMaximum number of occurrences of this parameter in the command.

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