Skip to main content

Module runtime

Module runtime 

Source
Expand description

DcpsRuntime — event loop + UDP sockets per DomainParticipant.

§Structure

  • Binds 3 UDP sockets per participant:
    • SPDP multicast receiver (domain-based port).
    • SPDP unicast fallback (ephemeral, for bidirectional SPDP).
    • User unicast (ephemeral, where matched peers send to).
  • Spawns a single event-loop thread that periodically:
    • sends the SPDP beacon (every 5 s by default),
    • polls all sockets non-blocking,
    • moves SPDP datagrams into the DiscoveredParticipantsCache,
    • dispatches SEDP datagrams (pub/sub announces),
    • delivers user data to the correct DataReader slots,
    • runs the WLP/liveliness tick,
    • serves the TypeLookup service endpoints (XTypes 1.3 §7.6.3.3.4).
  • Thread lifecycle via Arc<AtomicBool> stop_flag + JoinHandle in Drop.

With the security feature active, all outbound/inbound bytes pass through the SharedSecurityGate (DDS-Security 1.2). Multi-interface binding (RuntimeConfig::interface_bindings) enables per-subnet routing for production topologies.

Structs§

DcpsRuntime
The runtime of a DomainParticipant. Hosts all background threads and UDP sockets.
DcpsTickDriver
Drives a runtime’s periodic tick from an external executor (tokio, an embedded scheduler, a manual test loop). Obtained via DcpsRuntime::tick_driver; only does useful work when the runtime was started with RuntimeConfig::external_tick = true.
DiscoveredEndpointInfo
Helper struct for announcing a local publication/subscription as SEDP BuiltinTopicData. The caller creates it once per writer/reader registration and passes it to SedpStack. QoS config for registering a user writer with the runtime. Bundles all policies that go on the wire via SEDP plus the local Per-endpoint discovery info for ROS 2 endpoint-info-by-topic introspection (rmw_get_publishers_info_by_topic / rmw_get_subscriptions_info_by_topic, the data behind ros2 topic info -v). Covers local user endpoints plus remote SEDP-discovered ones. QoS is best-effort from what discovery carries (history/depth are not on the wire, so the consumer fills rmw defaults).
RuntimeConfig
Configuration for the runtime. Exposed via DomainParticipant factory methods.
UserReaderConfig
QoS config for registering a user reader.
UserWriterConfig
monitoring. Avoids 10+-argument functions.

Enums§

UserSample
Sample channel item: either data payload or lifecycle marker. Lifecycle is reconstructed by the wire path as key_hash + ChangeKind from the PID_STATUS_INFO header; the DataReader DCPS layer translates that into __push_lifecycle.
UserTransportKind
Choice of transport for DCPS user traffic. Discovery (SPDP/SEDP) remains UDPv4 multicast independently of this.

Constants§

DEFAULT_INITIAL_ANNOUNCE_COUNT
Default number of SPDP announces sent at the fast initial-burst cadence (C3 WiFi-robust discovery) before falling back to DEFAULT_SPDP_PERIOD. Analogous to Fast DDS initial_announcements.
DEFAULT_INITIAL_ANNOUNCE_PERIOD
Default period between initial-announcement-burst SPDP sends.
DEFAULT_SPDP_PERIOD
Default SPDP announce period (Spec §8.5.3.2 recommends 5 s).
DEFAULT_TICK_PERIOD
Default tick period of the event loop.
USER_PAYLOAD_ENCAP
RTPS serialized-payload header for user samples: CDR_LE (PLAIN_CDR / XCDR1, little-endian) + options=0. Spec OMG RTPS 2.5 §9.4.2.13.

Functions§

user_multicast_endpoint
Default user-multicast locator for a DomainParticipant. Not used in live mode 1 yet; SPDP-announced in B2.

Type Aliases§

UserReaderListener
User-reader slot. ReliableReader + topic meta + channel to the DataReader (DCPS API side). Listener callback for sample arrival.
UserSampleWithEncap
The listener dispatch carries, alongside the UserSample, a zero-copy view on the original Arc<[u8]> with an encap offset (lever-E zero-copy path).