Class astutedds::rtps::RtpsUdpTransport

ClassList > astutedds > rtps > RtpsUdpTransport

RTPS UDP transport with full discovery and reliable delivery. More...

  • #include <udp_transport.hpp>

Classes

Type Name
struct TopicTrafficStats
Per-topic traffic counters (user data only, not discovery traffic)

Public Types

Type Name
typedef std::function< void(const std::string &topicName, const std::vector< std::string > &fieldNames, const std::vector< uint8_t > &fieldKinds, const std::vector< ParsedTypeLookupReply::NestedFieldSchema > &nestedSchemas)> TypeLookupCallback

Public Functions

Type Name
RtpsUdpTransport (uint32_t domainId=0)
RtpsUdpTransport (uint32_t domainId, uint32_t participantId)
RtpsUdpTransport (const RtpsUdpTransport &) = delete
const DiscoveryConfig & discovery_config () const
std::vector< DiscoveredReader > get_all_discovered_readers () const
Get all discovered readers across all topics (§8.5.4)
std::vector< DiscoveredWriter > get_all_discovered_writers () const
Get all discovered writers across all topics (§8.5.3)
std::map< std::string, TopicTrafficStats > get_all_traffic_stats () const
Get current per-topic traffic statistics.
std::vector< DiscoveredParticipant > get_discovered_participants () const
Get discovered participants.
std::vector< DiscoveredReader > get_discovered_readers (const std::string & topicName) const
Get discovered readers for a topic.
std::vector< DiscoveredWriter > get_discovered_writers (const std::string & topicName) const
Get discovered writers for a topic.
DiscoveryRuntimeInfo get_discovery_runtime_info () const
Returns effective runtime discovery settings and peers.
const GuidPrefix_t & guid_prefix () const
Get the GUID prefix for this participant.
bool init ()
Initialize the transport (creates sockets, starts discovery)
bool is_running () const
Check if transport is running.
bool load_discovery_config_file (const std::string & path)
RtpsUdpTransport & operator= (const RtpsUdpTransport &) = delete
uint32_t participant_id () const
Get the participant ID.
uint32_t participant_lease_duration_seconds () const
Current outbound PID_PARTICIPANT_LEASE_DURATION in seconds.
const std::vector< uint8_t > & participant_user_data () const
Get the currently configured local participant USER_DATA blob.
bool publish (const std::string & topicName, const std::vector< uint8_t > & data)
Publish data on a topic.
bool publish (const std::string & topicName, const std::vector< uint8_t > & xcdr1Data, const std::vector< uint8_t > & xcdr2Data)
Publish data on a topic with dual encoding.
EntityId_t register_reader (const std::string & topicName, const std::string & typeName, const std::vector< std::string > & partitions={}, const dcps::DataReaderQos & qos={})
Register a reader for a topic.
EntityId_t register_writer (const std::string & topicName, const std::string & typeName, const std::vector< std::string > & partitions={}, const dcps::DataWriterQos & qos={})
Register a writer for a topic.
bool reload_discovery_config ()
Reload the existing discovery JSON path (if configured).
void send_participant_message_assertion (uint8_t kind)
Emit a ParticipantMessageData sample on the built-in ParticipantMessage writer (entity id 00:02:00:c2), targeted at every discovered remote participant's metatraffic locator with an INFO_DST prefix. kind is the low byte of the 4-octet kind array — 0x01 for PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE, 0x02 for the MANUAL variant (RTPS §9.6.4.1).
void send_type_lookup_request (const GuidPrefix_t & remoteGuid, const std::array< uint8_t, 4 > & metatrafficAddr, uint16_t metatrafficPort, const std::string & topicName, const std::array< uint8_t, 14 > & hash)
void set_data_callback (DataReceivedCallback callback)
Set callback for received data.
void set_discovery_config (const DiscoveryConfig & config)
Apply discovery config (explicit peers and interface filters).
void set_participant_discovered_callback (ParticipantDiscoveredCallback callback)
Set callback for participant discovery.
void set_participant_lease_duration_seconds (uint32_t sec)
Override the outbound SPDP PID_PARTICIPANT_LEASE_DURATION. Default is 100 s (RTPS 2.5 recommendation). Values below 1 s are clamped to 1 s to keep the sweeper margin sensible. Must be called before init() to affect the first announcement.
void set_participant_lost_callback (ParticipantLostCallback callback)
Set callback fired when a discovered remote participant is evicted from the cache (lease expiry today; SEDP DISPOSE in future). The callback runs on the discovery thread — callers must marshal to their own thread if needed.
void set_participant_message_callback (ParticipantMessageCallback callback)
Set callback fired when a ParticipantMessageData sample is received on the built-in ParticipantMessage reader (RTPS §8.4.13). The DCPS layer bridges this into LivelinessManager to refresh remote writer leases without waiting for user-data traffic.
void set_participant_user_data (std::vector< uint8_t > data)
Set the participant USER_DATA blob advertised in outbound SPDP (PID_USER_DATA, 0x002c). Must be called before init() .
void set_reader_discovered_callback (ReaderDiscoveredCallback callback)
Set callback for reader discovery.
void set_reader_lost_callback (ReaderLostCallback callback)
Set callback fired when a discovered remote reader is evicted (currently only as a cascade of participant eviction).
void set_sample_lost_callback (SampleLostCallback callback)
Set callback fired when a writer's GAP submessage (§8.3.7.4) marks sequence numbers as permanently unavailable that had not yet been delivered to the local reader. The DCPS layer uses this to raise DataReader::bump_sample_lost() so get_sample_lost_status() and on_sample_lost fire per DDS §2.2.4.1.7.
void set_spdp_announce_interval_ms (uint32_t ms)
Override the SPDP announcement interval. Default is 3000 ms. Values below 50 ms are clamped to 50 ms to avoid excessive wire traffic. Intended for tests and dense-topology tuning.
void set_type_lookup_callback (TypeLookupCallback cb)
Register a callback to receive type schema from TLS replies.
void set_writer_discovered_callback (WriterDiscoveredCallback callback)
Set callback for writer discovery.
void set_writer_lost_callback (WriterLostCallback callback)
Set callback fired when a discovered remote writer is evicted (currently only as a cascade of participant eviction).
uint32_t spdp_announce_interval_ms () const
Current SPDP announcement interval in milliseconds.
void stop ()
Stop the transport.
void subscribe (const std::string & topicName)
Subscribe to a topic (enables reception)
void test_inject_gap (const GuidPrefix_t & senderPrefix, const EntityId_t & writerEntityId, uint64_t gapStart, uint64_t gapListBase)
Test-only: exercise parseGap directly with a synthetic contiguous [gapStart, gapListBase-1] range. Constructs the 28-byte GAP submessage body and dispatches it as if received from senderPrefix . Used by tests covering the GAP → DataReader::bump_sample_lost bridge (§1.1b-B item 7); not part of the normal transport contract.
void unregister_reader (const EntityId_t & entityId)
Unregister a reader.
bool unregister_reader (const std::string & topicName)
Unregister the reader registered for topicName .
void unregister_writer (const EntityId_t & entityId)
Unregister a writer.
bool unregister_writer (const std::string & topicName)
Unregister the writer registered for topicName .
void unsubscribe (const std::string & topicName)
Unsubscribe from a topic.
~RtpsUdpTransport ()

Detailed Description

Provides interoperability with: * eProsima Fast DDS * Eclipse Cyclone DDS * RTI Connext DDS * OpenDDS

Public Types Documentation

typedef TypeLookupCallback

using astutedds::rtps::RtpsUdpTransport::TypeLookupCallback =  std::function<void(const std::string& topicName, const std::vector<std::string>& fieldNames, const std::vector<uint8_t>& fieldKinds, const std::vector<ParsedTypeLookupReply::NestedFieldSchema>& nestedSchemas)>;

Callback fired when a TypeLookup_Reply delivers field names for a topic. Invoked from the receive thread — callers must marshal to their own thread.


Public Functions Documentation

function RtpsUdpTransport [1/3]

explicit astutedds::rtps::RtpsUdpTransport::RtpsUdpTransport (
    uint32_t domainId=0
) 

function RtpsUdpTransport [2/3]

astutedds::rtps::RtpsUdpTransport::RtpsUdpTransport (
    uint32_t domainId,
    uint32_t participantId
) 

function RtpsUdpTransport [3/3]

astutedds::rtps::RtpsUdpTransport::RtpsUdpTransport (
    const RtpsUdpTransport &
) = delete

function discovery_config

inline const DiscoveryConfig & astutedds::rtps::RtpsUdpTransport::discovery_config () const

function get_all_discovered_readers

Get all discovered readers across all topics (§8.5.4)

std::vector< DiscoveredReader > astutedds::rtps::RtpsUdpTransport::get_all_discovered_readers () const


function get_all_discovered_writers

Get all discovered writers across all topics (§8.5.3)

std::vector< DiscoveredWriter > astutedds::rtps::RtpsUdpTransport::get_all_discovered_writers () const


function get_all_traffic_stats

Get current per-topic traffic statistics.

std::map< std::string, TopicTrafficStats > astutedds::rtps::RtpsUdpTransport::get_all_traffic_stats () const


function get_discovered_participants

Get discovered participants.

std::vector< DiscoveredParticipant > astutedds::rtps::RtpsUdpTransport::get_discovered_participants () const


function get_discovered_readers

Get discovered readers for a topic.

std::vector< DiscoveredReader > astutedds::rtps::RtpsUdpTransport::get_discovered_readers (
    const std::string & topicName
) const


function get_discovered_writers

Get discovered writers for a topic.

std::vector< DiscoveredWriter > astutedds::rtps::RtpsUdpTransport::get_discovered_writers (
    const std::string & topicName
) const


function get_discovery_runtime_info

Returns effective runtime discovery settings and peers.

DiscoveryRuntimeInfo astutedds::rtps::RtpsUdpTransport::get_discovery_runtime_info () const


function guid_prefix

Get the GUID prefix for this participant.

inline const GuidPrefix_t & astutedds::rtps::RtpsUdpTransport::guid_prefix () const


function init

Initialize the transport (creates sockets, starts discovery)

bool astutedds::rtps::RtpsUdpTransport::init () 

Returns:

true on success


function is_running

Check if transport is running.

inline bool astutedds::rtps::RtpsUdpTransport::is_running () const


function load_discovery_config_file

bool astutedds::rtps::RtpsUdpTransport::load_discovery_config_file (
    const std::string & path
) 

Load discovery config from JSON file. Returns true on successful parse.


function operator=

RtpsUdpTransport & astutedds::rtps::RtpsUdpTransport::operator= (
    const RtpsUdpTransport &
) = delete

function participant_id

Get the participant ID.

inline uint32_t astutedds::rtps::RtpsUdpTransport::participant_id () const


function participant_lease_duration_seconds

Current outbound PID_PARTICIPANT_LEASE_DURATION in seconds.

inline uint32_t astutedds::rtps::RtpsUdpTransport::participant_lease_duration_seconds () const


function participant_user_data

Get the currently configured local participant USER_DATA blob.

inline const std::vector< uint8_t > & astutedds::rtps::RtpsUdpTransport::participant_user_data () const


function publish [1/2]

Publish data on a topic.

bool astutedds::rtps::RtpsUdpTransport::publish (
    const std::string & topicName,
    const std::vector< uint8_t > & data
) 

Parameters:

  • topicName Topic name
  • data Serialized data (XCDR1 format)

Returns:

true on success


function publish [2/2]

Publish data on a topic with dual encoding.

bool astutedds::rtps::RtpsUdpTransport::publish (
    const std::string & topicName,
    const std::vector< uint8_t > & xcdr1Data,
    const std::vector< uint8_t > & xcdr2Data
) 

Parameters:

  • topicName Topic name
  • xcdr1Data Serialized data in XCDR1 format
  • xcdr2Data Serialized data in XCDR2 format

Returns:

true on success

Sends XCDR1 to multicast and readers that advertise XCDR1 (or no preference). Sends XCDR2 to readers that only advertise XCDR2.


function register_reader

Register a reader for a topic.

EntityId_t astutedds::rtps::RtpsUdpTransport::register_reader (
    const std::string & topicName,
    const std::string & typeName,
    const std::vector< std::string > & partitions={},
    const dcps::DataReaderQos & qos={}
) 

Parameters:

  • topicName Topic name to subscribe to
  • typeName IDL type name as registered via TypeSupport (e.g., "MyModule::MyType")
  • qos Optional DataReaderQos (defaults to interop-friendly settings)

Returns:

EntityId for the new reader


function register_writer

Register a writer for a topic.

EntityId_t astutedds::rtps::RtpsUdpTransport::register_writer (
    const std::string & topicName,
    const std::string & typeName,
    const std::vector< std::string > & partitions={},
    const dcps::DataWriterQos & qos={}
) 

Returns:

EntityId for the new writer


function reload_discovery_config

Reload the existing discovery JSON path (if configured).

bool astutedds::rtps::RtpsUdpTransport::reload_discovery_config () 


function send_participant_message_assertion

Emit a ParticipantMessageData sample on the built-in ParticipantMessage writer (entity id 00:02:00:c2), targeted at every discovered remote participant's metatraffic locator with an INFO_DST prefix. kind is the low byte of the 4-octet kind array — 0x01 for PARTICIPANT_MESSAGE_DATA_KIND_AUTOMATIC_LIVELINESS_UPDATE, 0x02 for the MANUAL variant (RTPS §9.6.4.1).

void astutedds::rtps::RtpsUdpTransport::send_participant_message_assertion (
    uint8_t kind
) 

Silently no-ops if the transport has not been enabled or if no remote participants have been discovered yet.


function send_type_lookup_request

void astutedds::rtps::RtpsUdpTransport::send_type_lookup_request (
    const GuidPrefix_t & remoteGuid,
    const std::array< uint8_t, 4 > & metatrafficAddr,
    uint16_t metatrafficPort,
    const std::string & topicName,
    const std::array< uint8_t, 14 > & hash
) 

Send a TypeLookup GET_TYPES request (§7.6.3.3) to the remote participant.

Parameters:

  • remoteGuid GUID prefix of the target participant
  • metatrafficAddr Remote metatraffic unicast IPv4 address
  • metatrafficPort Remote metatraffic unicast port
  • topicName Topic whose type we are querying (for callback routing)
  • hash 14-byte EK_COMPLETE EquivalenceHash from PID_TYPE_INFORMATION

function set_data_callback

Set callback for received data.

inline void astutedds::rtps::RtpsUdpTransport::set_data_callback (
    DataReceivedCallback callback
) 


function set_discovery_config

Apply discovery config (explicit peers and interface filters).

void astutedds::rtps::RtpsUdpTransport::set_discovery_config (
    const DiscoveryConfig & config
) 


function set_participant_discovered_callback

Set callback for participant discovery.

inline void astutedds::rtps::RtpsUdpTransport::set_participant_discovered_callback (
    ParticipantDiscoveredCallback callback
) 


function set_participant_lease_duration_seconds

Override the outbound SPDP PID_PARTICIPANT_LEASE_DURATION. Default is 100 s (RTPS 2.5 recommendation). Values below 1 s are clamped to 1 s to keep the sweeper margin sensible. Must be called before init() to affect the first announcement.

inline void astutedds::rtps::RtpsUdpTransport::set_participant_lease_duration_seconds (
    uint32_t sec
) 


function set_participant_lost_callback

Set callback fired when a discovered remote participant is evicted from the cache (lease expiry today; SEDP DISPOSE in future). The callback runs on the discovery thread — callers must marshal to their own thread if needed.

inline void astutedds::rtps::RtpsUdpTransport::set_participant_lost_callback (
    ParticipantLostCallback callback
) 


function set_participant_message_callback

Set callback fired when a ParticipantMessageData sample is received on the built-in ParticipantMessage reader (RTPS §8.4.13). The DCPS layer bridges this into LivelinessManager to refresh remote writer leases without waiting for user-data traffic.

inline void astutedds::rtps::RtpsUdpTransport::set_participant_message_callback (
    ParticipantMessageCallback callback
) 


function set_participant_user_data

Set the participant USER_DATA blob advertised in outbound SPDP (PID_USER_DATA, 0x002c). Must be called before init() .

inline void astutedds::rtps::RtpsUdpTransport::set_participant_user_data (
    std::vector< uint8_t > data
) 

Corresponds to DomainParticipantQos::user_data.value.


function set_reader_discovered_callback

Set callback for reader discovery.

inline void astutedds::rtps::RtpsUdpTransport::set_reader_discovered_callback (
    ReaderDiscoveredCallback callback
) 


function set_reader_lost_callback

Set callback fired when a discovered remote reader is evicted (currently only as a cascade of participant eviction).

inline void astutedds::rtps::RtpsUdpTransport::set_reader_lost_callback (
    ReaderLostCallback callback
) 


function set_sample_lost_callback

Set callback fired when a writer's GAP submessage (§8.3.7.4) marks sequence numbers as permanently unavailable that had not yet been delivered to the local reader. The DCPS layer uses this to raise DataReader::bump_sample_lost() so get_sample_lost_status() and on_sample_lost fire per DDS §2.2.4.1.7.

inline void astutedds::rtps::RtpsUdpTransport::set_sample_lost_callback (
    SampleLostCallback callback
) 


function set_spdp_announce_interval_ms

Override the SPDP announcement interval. Default is 3000 ms. Values below 50 ms are clamped to 50 ms to avoid excessive wire traffic. Intended for tests and dense-topology tuning.

inline void astutedds::rtps::RtpsUdpTransport::set_spdp_announce_interval_ms (
    uint32_t ms
) 


function set_type_lookup_callback

Register a callback to receive type schema from TLS replies.

inline void astutedds::rtps::RtpsUdpTransport::set_type_lookup_callback (
    TypeLookupCallback cb
) 


function set_writer_discovered_callback

Set callback for writer discovery.

inline void astutedds::rtps::RtpsUdpTransport::set_writer_discovered_callback (
    WriterDiscoveredCallback callback
) 


function set_writer_lost_callback

Set callback fired when a discovered remote writer is evicted (currently only as a cascade of participant eviction).

inline void astutedds::rtps::RtpsUdpTransport::set_writer_lost_callback (
    WriterLostCallback callback
) 


function spdp_announce_interval_ms

Current SPDP announcement interval in milliseconds.

inline uint32_t astutedds::rtps::RtpsUdpTransport::spdp_announce_interval_ms () const


function stop

Stop the transport.

void astutedds::rtps::RtpsUdpTransport::stop () 


function subscribe

Subscribe to a topic (enables reception)

void astutedds::rtps::RtpsUdpTransport::subscribe (
    const std::string & topicName
) 


function test_inject_gap

Test-only: exercise parseGap directly with a synthetic contiguous [gapStart, gapListBase-1] range. Constructs the 28-byte GAP submessage body and dispatches it as if received from senderPrefix . Used by tests covering the GAP → DataReader::bump_sample_lost bridge (§1.1b-B item 7); not part of the normal transport contract.

void astutedds::rtps::RtpsUdpTransport::test_inject_gap (
    const GuidPrefix_t & senderPrefix,
    const EntityId_t & writerEntityId,
    uint64_t gapStart,
    uint64_t gapListBase
) 


function unregister_reader [1/2]

Unregister a reader.

void astutedds::rtps::RtpsUdpTransport::unregister_reader (
    const EntityId_t & entityId
) 


function unregister_reader [2/2]

Unregister the reader registered for topicName .

bool astutedds::rtps::RtpsUdpTransport::unregister_reader (
    const std::string & topicName
) 

Convenience overload used by the DCPS Subscriber on delete_datareader — routes through the same SEDP DISPOSE (§1.1b-A) fast-path as the EntityId overload. Returns true if a reader was found and unregistered.


function unregister_writer [1/2]

Unregister a writer.

void astutedds::rtps::RtpsUdpTransport::unregister_writer (
    const EntityId_t & entityId
) 


function unregister_writer [2/2]

Unregister the writer registered for topicName .

bool astutedds::rtps::RtpsUdpTransport::unregister_writer (
    const std::string & topicName
) 

Convenience overload used by the DCPS Publisher on delete_datawriter — routes through the same SEDP DISPOSE (§1.1b-A) fast-path as the EntityId overload. Returns true if a writer was found and unregistered.


function unsubscribe

Unsubscribe from a topic.

void astutedds::rtps::RtpsUdpTransport::unsubscribe (
    const std::string & topicName
) 


function ~RtpsUdpTransport

astutedds::rtps::RtpsUdpTransport::~RtpsUdpTransport () 


The documentation for this class was generated from the following file include/astutedds/rtps/udp_transport.hpp