pub struct Spdp { /* private fields */ }Expand description
The SPDP built-in writer and reader of one participant.
The writer is a best-effort stateless writer with one change; it is
resent every announce_period (8.5.3.1). The reader keeps the remote
participants and drops those whose lease has passed (8.5.3.3.2).
Implementations§
Source§impl Spdp
impl Spdp
Sourcepub fn new(local: ParticipantData, config: SpdpConfig) -> Self
pub fn new(local: ParticipantData, config: SpdpConfig) -> Self
The SPDP endpoints of local. The first announcement is due at
once.
Sourcepub fn local(&self) -> &ParticipantData
pub fn local(&self) -> &ParticipantData
The local participant’s data.
Sourcepub fn set_local(&mut self, data: ParticipantData)
pub fn set_local(&mut self, data: ParticipantData)
Replaces the local data. It is announced at the next
Spdp::poll_announce with a new sequence number.
Sourcepub fn announcement(&self, endianness: Endianness) -> Message
pub fn announcement(&self, endianness: Endianness) -> Message
The announcement message: the header, INFO_TS and a DATA with the
local participant data, from the SPDP writer to any reader
(8.4.8.1.4: DATA.readerId := ENTITYID_UNKNOWN).
Sourcepub fn dispose(&mut self) -> (Vec<u8>, &[Locator])
pub fn dispose(&mut self) -> (Vec<u8>, &[Locator])
The message that tells the others that the local participant is
going away, and the locators to send it to: a DATA with
PID_STATUS_INFO disposed and unregistered, the key hash in-line
and the key, PID_PARTICIPANT_GUID, as the payload (9.6.3.2). It
takes the next sequence number.
Sourcepub fn poll_announce(&mut self, now: Instant) -> Option<(Vec<u8>, &[Locator])>
pub fn poll_announce(&mut self, now: Instant) -> Option<(Vec<u8>, &[Locator])>
If an announcement is due at now, returns the encoded message and
the locators to send it to, and schedules the next one.
Sourcepub fn next_deadline(&self) -> Option<Instant>
pub fn next_deadline(&self) -> Option<Instant>
The next time Spdp::poll_announce or Spdp::remove_expired
has something to do.
An announcement that is due (the first one, or one to answer a new participant) makes it now: the caller does not sleep first.
Sourcepub fn participants(&self) -> impl Iterator<Item = &ParticipantData>
pub fn participants(&self) -> impl Iterator<Item = &ParticipantData>
The remote participants currently known.
Sourcepub fn participant(&self, prefix: &GuidPrefix) -> Option<&ParticipantData>
pub fn participant(&self, prefix: &GuidPrefix) -> Option<&ParticipantData>
Looks up a remote participant.
Sourcepub fn remove_expired(&mut self, now: Instant) -> Vec<ParticipantEvent>
pub fn remove_expired(&mut self, now: Instant) -> Vec<ParticipantEvent>
Removes participants whose lease has passed.
Sourcepub fn handle_message(
&mut self,
bytes: &[u8],
now: Instant,
) -> Vec<ParticipantEvent>
pub fn handle_message( &mut self, bytes: &[u8], now: Instant, ) -> Vec<ParticipantEvent>
Processes one received RTPS message and returns what changed.
Only DATA from SPDP writers is looked at. Messages and submessages that are invalid, data for another domain or domain tag, and the local participant’s own announcements are ignored. The receiver state follows 8.3.4 as far as SPDP needs: INFO_DST to another participant makes the DATA after it not for us.
Sourcepub fn handle_secure(
&mut self,
event: SecureParticipantEvent,
now: Instant,
) -> Option<ParticipantEvent>
pub fn handle_secure( &mut self, event: SecureParticipantEvent, now: Instant, ) -> Option<ParticipantEvent>
Takes in what an authenticated participant sent on DCPSParticipantsSecure (DDS Security 1.2, 7.5.1.6). From then on its data and its deletion are only taken from there: what SPDP says of it only keeps it alive.