TSDuck v3.46-4930
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::tlv::Message Class Referenceabstract

#include <tstlvMessage.h>

Inheritance diagram for ts::tlv::Message:

Public Member Functions

virtual UString dump (size_t indent=0) const
void forceProtocolVersion (VERSION version)
bool hasProtocolVersion () const
VERSION protocolVersion () const
void serialize (Serializer &zer) const
TAG tag () const

Protected Types

using superclass = Message

Protected Member Functions

 Message (TAG tag)
 Message (VERSION protocol_version, TAG tag)
virtual void serializeParameters (Serializer &zer) const =0

Static Protected Member Functions

template<typename INT>
requires std::integral<INT>
static UString dumpDecimal (size_t indent, const UString &name, const INT &value)
template<typename INT>
requires std::integral<INT>
static UString dumpHexa (size_t indent, const UString &name, const INT &value)
template<typename INT>
requires std::integral<INT>
static UString dumpInteger (size_t indent, const UString &name, const INT &value)
static UString dumpOptional (size_t indent, const UString &name, bool has_value, const ByteBlock &value, uint32_t flags=UString::HEXA|UString::ASCII)
template<typename INT>
requires std::integral<INT>
static UString dumpOptionalDecimal (size_t indent, const UString &name, bool has_value, const INT &value)
template<typename INT>
requires std::integral<INT>
static UString dumpOptionalDecimal (size_t indent, const UString &name, const std::optional< INT > &value)
template<typename INT>
requires std::integral<INT>
static UString dumpOptionalHexa (size_t indent, const UString &name, bool has_value, const INT &value)
template<typename INT>
requires std::integral<INT>
static UString dumpOptionalHexa (size_t indent, const UString &name, const std::optional< INT > &value)
template<typename INT>
requires std::integral<INT>
static UString dumpOptionalInteger (size_t indent, const UString &name, bool has_value, const INT &value)
template<typename INT>
requires std::integral<INT>
static UString dumpOptionalInteger (size_t indent, const UString &name, const std::optional< INT > &value)
template<typename INT>
requires std::integral<INT>
static UString dumpVector (size_t indent, const UString &name, const std::vector< INT > &val, UString(*toString)(INT)=nullptr)
static UString dumpVector (size_t indent, const UString &name, const UStringVector &value)

Detailed Description

Abstract base class for TLV messages

All messages use the same structure as the DVB interfaces defined in the "DVB Simulcrypt Head End" standard, that is to say a TLV protocol. The messages shall have the same generic format as all connection-oriented TLV DVB Simulcrypt protocols and illustrated as follow:

generic_message
{
protocol_version 1 byte
message_type 2 bytes
message_length 2 bytes
for (i=0; i < n; i++)
{
parameter_type 2 bytes
parameter_length 2 bytes
parameter_value <parameter_length> bytes
}
}

The version field is optional and defined by the protocol. A protocol decides if there is a leading version byte to each message

The protocols use the same byte order and parameter order as DVB Simulcrypt protocols: For parameters with a size two or more bytes, the first byte to be transmitted will be the most significant byte. This is commonly known as "big endian" or "MSB first". Parameters do not need to be ordered within the generic message.

Member Typedef Documentation

◆ superclass

Alias for the superclass of subclasses.

Constructor & Destructor Documentation

◆ Message() [1/2]

ts::tlv::Message::Message ( TAG tag)
protected

Protected constructor for subclasses.

Parameters
[in]tagMessage tag.

◆ Message() [2/2]

ts::tlv::Message::Message ( VERSION protocol_version,
TAG tag )
protected

Protected constructor for subclasses.

Parameters
[in]protocol_versionProtocol version.
[in]tagMessage tag.

Member Function Documentation

◆ hasProtocolVersion()

bool ts::tlv::Message::hasProtocolVersion ( ) const
inline

Check if the message has a protocol version number.

Returns
True if the message has a protocol version number.

◆ protocolVersion()

VERSION ts::tlv::Message::protocolVersion ( ) const
inline

Get the protocol version number.

Returns
The protocol version number.

◆ forceProtocolVersion()

void ts::tlv::Message::forceProtocolVersion ( VERSION version)
inline

Force the protocol version number to another value. Use with care.

Parameters
[in]versionThe protocol version number.

◆ tag()

TAG ts::tlv::Message::tag ( ) const
inline

Get the message tag.

Returns
The message tag.

◆ serialize()

void ts::tlv::Message::serialize ( Serializer & zer) const

Serialize the message using a Serializer.

Parameters
[in,out]zerA TLV serializer.

◆ dump()

◆ serializeParameters()

◆ dumpVector() [1/2]

UString ts::tlv::Message::dumpVector ( size_t indent,
const UString & name,
const UStringVector & value )
staticprotected

Dump a vector of strings (helper routine for subclasses).

Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueVector of strings.
Returns
The formatted string with embedded new-lines.

◆ dumpOptional()

UString ts::tlv::Message::dumpOptional ( size_t indent,
const UString & name,
bool has_value,
const ByteBlock & value,
uint32_t flags = UString::HEXA|UString::ASCII )
staticprotected

Dump an optional byte block (helper routine for subclasses).

Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]has_valueIf false, no value is available, return an empty string.
[in]valueByte block.
[in]flagsHexa dump flags for ts::Hexa().
Returns
The formatted string with embedded new-lines.

◆ dumpDecimal()

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpDecimal ( size_t indent,
const UString & name,
const INT & value )
inlinestaticprotected

Dump an integer value in decimal (helper routine for subclasses).

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpHexa()

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpHexa ( size_t indent,
const UString & name,
const INT & value )
inlinestaticprotected

Dump an integer value in hexadecimal (helper routine for subclasses).

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpInteger()

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpInteger ( size_t indent,
const UString & name,
const INT & value )
inlinestaticprotected

Dump an integer value (helper routine for subclasses). Signed integer types are dumped in decimal, unsigned types in hexadecimal.

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpOptionalDecimal() [1/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpOptionalDecimal ( size_t indent,
const UString & name,
bool has_value,
const INT & value )
inlinestaticprotected

Dump an optional integer value in decimal (helper routine for subclasses).

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]has_valueIf false, no value is available, return an empty string.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpOptionalDecimal() [2/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpOptionalDecimal ( size_t indent,
const UString & name,
const std::optional< INT > & value )
inlinestaticprotected

Dump an optional integer value in decimal (helper routine for subclasses).

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpOptionalHexa() [1/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpOptionalHexa ( size_t indent,
const UString & name,
bool has_value,
const INT & value )
inlinestaticprotected

Dump an optional integer value in hexadecimal (helper routine for subclasses).

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]has_valueIf false, no value is available, return an empty string.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpOptionalHexa() [2/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpOptionalHexa ( size_t indent,
const UString & name,
const std::optional< INT > & value )
inlinestaticprotected

Dump an optional integer value in hexadecimal (helper routine for subclasses).

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpOptionalInteger() [1/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpOptionalInteger ( size_t indent,
const UString & name,
bool has_value,
const INT & value )
inlinestaticprotected

Dump an optional integer value (helper routine for subclasses). Signed integer types are dumped in decimal, unsigned types in hexadecimal.

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]has_valueIf false, no value is available, return an empty string.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpOptionalInteger() [2/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpOptionalInteger ( size_t indent,
const UString & name,
const std::optional< INT > & value )
inlinestaticprotected

Dump an optional integer value (helper routine for subclasses). Signed integer types are dumped in decimal, unsigned types in hexadecimal.

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valueInteger value.
Returns
The formatted string with embedded new-lines.

◆ dumpVector() [2/2]

template<typename INT>
requires std::integral<INT>
UString ts::tlv::Message::dumpVector ( size_t indent,
const UString & name,
const std::vector< INT > & val,
UString(* toString )(INT) = nullptr )
staticprotected

Dump a vector of integer values (helper routine for subclasses). Signed integer types are dumped in decimal, unsigned types in hexadecimal.

Template Parameters
INTAn integer type.
Parameters
[in]indentLeft indentation size.
[in]nameParameter name.
[in]valVector of integer values.
[in]toStringOptional function to convert an INT value into a string.
Returns
The formatted string with embedded new-lines.

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