RTI Connext Modern C++ API  Version 7.0.0
dds::core::policy::TransportPriority Class Reference

Allows applications to take advantage of transports capable of sending messages with different priorities. More...

#include <dds/core/policy/CorePolicy.hpp>

Public Member Functions

 TransportPriority ()
 Creates a policy with priority 0. More...
 TransportPriority (int32_t priority)
 Creates a policy with the specified priority. More...
TransportPriorityvalue (int32_t priority)
 Sets the priority. More...
int32_t value () const
 Getter (see setter with the same name) More...

Detailed Description

Allows applications to take advantage of transports capable of sending messages with different priorities.

The Transport Priority QoS policy is optional and only supported on certain OSs and transports. It allows you to specify on a per-DataWriter or DataReader basis that the data sent by that endpoint is of a different priority.

The DDS specification does not indicate how a DDS implementation should treat data of different priorities. It is often difficult or impossible for DDS implementations to treat data of higher priority differently than data of lower priority, especially when data is being sent (delivered to a physical transport) directly by the thread that called dds::pub::DataWriter::write(). Also, many physical network transports themselves do not have a end-user controllable level of data packet priority.

dds::pub::DataWriter, dds::sub::DataReader, dds::topic::Topic
RxO = N/A
Changeable = NO


In RTI Connext, for the IP-based transports (UDPv4, UDPv6, Real-Time WAN, and TCP), the value set in the Transport Priority QoS policy is used in a setsockopt call to set the differentiated services field (DS field) bits of the IPv4 and IPv6 headers for datagrams sent by a dds::pub::DataWriter or dds::sub::DataReader. It is platform-dependent on how and whether the setsockopt has an effect. On some platforms, such as Windows and Linux, external permissions must be given to the user application in order to set the TOS bits.

Note that for the IP-based transports, the transport priority value is not provided as is to the setsockopt call, but transformed according to the following fields: transport_priority_mask (for example, see NDDS_Transport_UDPv4_Property_t::transport_priority_mask), transport_priority_mapping_low (for example, see NDDS_Transport_UDPv4_Property_t::transport_priority_mapping_low), and transport_priority_mapping_high (for example, see NDDS_Transport_UDPv4_Property_t::transport_priority_mapping_high). In most cases, if you want the priority value to be exactly equal to the DS value set with the setsockopt call, then the only change you need to make is to set transport_priority_mask to 0xff (and keep the transport_priority_mapping_low and transport_priority_mapping_high defaults).

It is incorrect to assume that using the Transport Priority QoS policy will have any effect at all on the end-to-end delivery of data from a dds::pub::DataWriter and a dds::sub::DataReader. All network elements, including switches and routers must have the capability and be enabled to actually use the TOS bits to treat higher priority packets differently. Thus the ability to use the Transport Priority QoS policy must be designed and configured at a system level; just turning it on in an application may have no effect at all.

Constructor & Destructor Documentation

◆ TransportPriority() [1/2]

dds::core::policy::TransportPriority::TransportPriority ( )

Creates a policy with priority 0.

◆ TransportPriority() [2/2]

dds::core::policy::TransportPriority::TransportPriority ( int32_t  priority)

Creates a policy with the specified priority.

Member Function Documentation

◆ value() [1/2]

TransportPriority& dds::core::policy::TransportPriority::value ( int32_t  priority)

Sets the priority.

You may choose any value within the range of a 32-bit signed integer; higher values indicate higher priority. However, any further interpretation of this policy is specific to a particular transport and a particular DDS implementation. For example, a particular transport is permitted to treat a range of priority values as equivalent to one another.

[default] 0

◆ value() [2/2]

int32_t dds::core::policy::TransportPriority::value ( ) const

Getter (see setter with the same name)