Skip to main content

Spdp

Struct Spdp 

Source
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

Source

pub fn new(local: ParticipantData, config: SpdpConfig) -> Self

The SPDP endpoints of local. The first announcement is due at once.

Source

pub fn local(&self) -> &ParticipantData

The local participant’s data.

Source

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.

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub fn participants(&self) -> impl Iterator<Item = &ParticipantData>

The remote participants currently known.

Source

pub fn participant(&self, prefix: &GuidPrefix) -> Option<&ParticipantData>

Looks up a remote participant.

Source

pub fn remove_expired(&mut self, now: Instant) -> Vec<ParticipantEvent>

Removes participants whose lease has passed.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for Spdp

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for Spdp

§

impl Freeze for Spdp

§

impl Move for Spdp

§

impl RefUnwindSafe for Spdp

§

impl Send for Spdp
where RawVecInner: Send, RawTable<(GuidPrefix, Remote)>: Send, RawTable<(GuidPrefix, ())>: Send,

§

impl Sync for Spdp
where RawVecInner: Sync, RawTable<(GuidPrefix, Remote)>: Sync, RawTable<(GuidPrefix, ())>: Sync,

§

impl Unpin for Spdp
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Spdp

§

impl UnwindSafe for Spdp
where RawVecInner: UnwindSafe, HashMap<GuidPrefix, Remote>: UnwindSafe, NonNull<u8>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.