Skip to main content

rustorb_rtps/
lib.rs

1//! The DDSI-RTPS 2.5 wire protocol for rustorb-dds.
2//!
3//! What is here so far: reading and writing RTPS messages and
4//! submessages (DDSI-RTPS 2.5 clauses 8.3 and 9.4, rustorb-dds#3), the
5//! UDP transport (9.6.2, rustorb-dds#4), participant discovery (SPDP,
6//! 8.5.3, rustorb-dds#5) in [`spdp`] with the PL_CDR helpers in [`pl`],
7//! and endpoint discovery and matching (SEDP, 8.5.4, rustorb-dds#6) in
8//! [`sedp`], built on the reliable writer and reader of [`reliable`], the
9//! message receiver of [`receiver`] and the QoS policies of [`qos`].
10//! Changes too large for a datagram are split into DATA_FRAG and put back
11//! together by [`frag`] (8.4.14.1, rustorb-dds#18). The Writer Liveliness
12//! Protocol (8.4.13, rustorb-dds#19) is in [`wlp`], and the endpoints of
13//! the DDS-XTypes TypeLookup service (rustorb-dds#33) in [`typelookup`].
14//! The secure participant discovery of DDS Security (DCPSParticipantsSecure,
15//! rustorb-dds#69) is in [`spdp_secure`].
16//!
17//! - [`Message`], [`Header`] and the [`Submessage`] kinds. All submessage
18//!   kinds of version 2.5 are handled; unknown and vendor-specific ones
19//!   are kept as [`UnknownSubmessage`] and skipped by receivers.
20//! - The basic types: [`Guid`], [`EntityId`], [`SequenceNumber`],
21//!   [`SequenceNumberSet`], [`Time`], [`Locator`] and so on.
22//! - The UDPv4 transport and the default port numbers, in [`udp`]
23//!   (rustorb-dds#4).
24//! - [`ParameterList`] framing. Parameter values and serialized payloads
25//!   stay as raw octets; PL_CDR and the payload encodings are read by
26//!   higher layers.
27//!
28//! ```
29//! use rustorb_rtps::*;
30//!
31//! let mut msg = Message::new(Header::new(VendorId([0x01, 0x02]), GuidPrefix([7; 12])));
32//! msg.submessages.push(Submessage::InfoTimestamp(InfoTimestamp {
33//!     timestamp: Some(Time { seconds: 1, fraction: 0 }),
34//! }));
35//! msg.submessages.push(Submessage::Data(Data {
36//!     reader_id: EntityId::UNKNOWN,
37//!     writer_id: EntityId::user([0, 0, 1], entity_kind::USER_WRITER_NO_KEY),
38//!     writer_sn: SequenceNumber(1),
39//!     inline_qos: None,
40//!     serialized_payload: Some(SerializedPayload {
41//!         kind: PayloadKind::Data,
42//!         bytes: vec![0x00, 0x01, 0x00, 0x00, 1, 0, 0, 0],
43//!     }),
44//!     non_standard_payload: false,
45//! }));
46//! let bytes = msg.encode(Endianness::Little).unwrap();
47//! assert_eq!(Message::decode(&bytes).unwrap(), msg);
48//! ```
49//!
50//! The user writers and readers built on these are in rustorb-dds.
51
52mod error;
53pub mod frag;
54mod message;
55mod parameter;
56pub mod pl;
57pub mod qos;
58pub mod receiver;
59pub mod reliable;
60pub mod sedp;
61#[cfg(feature = "shm")]
62pub mod shm;
63pub mod spdp;
64pub mod spdp_secure;
65mod submessage;
66pub mod typelookup;
67mod types;
68pub mod udp;
69mod wire;
70pub mod wlp;
71
72pub use error::{DecodeError, EncodeError};
73pub use message::{Header, Message, PROTOCOL_RTPS, Submessages};
74pub use parameter::{Parameter, ParameterId, ParameterList, SecurityParameters};
75pub use submessage::{
76    AckNack, Checksum, Data, DataFrag, Gap, HeaderExtension, Heartbeat, HeartbeatFrag,
77    HeartbeatGroupInfo, InfoDestination, InfoReply, InfoReplyIp4, InfoSource, InfoTimestamp,
78    NackFrag, Pad, PayloadKind, SerializedPayload, Submessage, UnknownSubmessage, submessage_id,
79};
80pub use types::{
81    BuiltinEndpointSet, ChangeCount, Count, Duration, EntityId, FragmentNumber, FragmentNumberSet,
82    GroupDigest, Guid, GuidPrefix, Locator, LocatorUdpV4, ProtocolVersion, SampleIdentity,
83    SequenceNumber, SequenceNumberSet, Time, VendorId, entity_kind,
84};
85pub use wire::Endianness;