Skip to main content

ReceiverState

Struct ReceiverState 

Source
pub struct ReceiverState {
    pub source_version: ProtocolVersion,
    pub source_vendor_id: VendorId,
    pub source_guid_prefix: GuidPrefix,
    pub dest_guid_prefix: GuidPrefix,
    pub have_timestamp: bool,
    pub timestamp: HeTimestamp,
    pub message_length: Option<u32>,
    pub message_checksum: ChecksumValue,
    pub parameters: Option<ParameterList>,
    pub unicast_reply_locator_list: Vec<Locator>,
    pub multicast_reply_locator_list: Vec<Locator>,
    pub clock_skew_detected: bool,
}
Expand description

Receiver state per spec table §8.3.4 and update rules in §8.3.7.4.

Fields§

§source_version: ProtocolVersion

ProtocolVersion from the RTPS header (or overwritten by InfoSource).

§source_vendor_id: VendorId

VendorId from the RTPS header (or overwritten by InfoSource).

§source_guid_prefix: GuidPrefix

GuidPrefix of the sender (RTPS header or InfoSource).

§dest_guid_prefix: GuidPrefix

GuidPrefix of the receiver (configuration value, fixed).

§have_timestamp: bool

true if the receiver has a sender timestamp.

§timestamp: HeTimestamp

Last sender timestamp (valid if have_timestamp).

§message_length: Option<u32>

Set by HE.L — expected remaining length of the RTPS message.

§message_checksum: ChecksumValue

Set by HE.C — expected checksum of the RTPS message.

§parameters: Option<ParameterList>

Set by HE.P — ParameterList from the HE.

§unicast_reply_locator_list: Vec<Locator>

Reply locator lists (default LOCATOR_INVALID lists, overridable by InfoReply).

§multicast_reply_locator_list: Vec<Locator>

Reply locator lists (default LOCATOR_INVALID lists, overridable by InfoReply).

§clock_skew_detected: bool

Heuristic flag: |timestamp - now| > threshold. Set by note_clock_skew; the decode module provides only the input data.

Implementations§

Source§

impl ReceiverState

Source

pub fn new(dest_guid_prefix: GuidPrefix) -> Self

Initial state before receiving a message: all fields at spec defaults, dest_guid_prefix taken from the receiver config.

Source

pub fn init_from_header(&mut self, header: &RtpsHeader)

Initializes from an RtpsHeader (Spec §8.3.4.1).

Source

pub fn apply_info_source( &mut self, version: ProtocolVersion, vendor_id: VendorId, guid_prefix: GuidPrefix, )

Update from an InfoSource submessage (§8.3.8.9.4).

“An InfoSource Submessage MUST set the receiver’s source GuidPrefix, source ProtocolVersion, source VendorId, and MUST reset haveTimestamp = false and the reply-locator-lists to LOCATOR_INVALID.”

Source

pub fn apply_info_timestamp(&mut self, ts: HeTimestamp, invalidate: bool)

Update from InfoTimestamp (§8.3.8.5.4). invalidate = true (i.e. the I flag in the submessage) clears the timestamp.

Source

pub fn apply_info_reply( &mut self, unicast: Vec<Locator>, multicast: Option<Vec<Locator>>, )

Update from InfoReply (§8.3.8.10.4): sets the two reply locator lists.

Source

pub fn apply_header_extension(&mut self, he: &HeaderExtension)

Update from HeaderExtension (§8.3.7.4). Updates messageLength, timestamp, messageChecksum and parameters depending on the set flags.

Source

pub fn note_clock_skew(&mut self, now_seconds: i32, threshold_seconds: u32)

Sets the clock_skew_detected flag if the given now seconds value deviates from the sender timestamp by more than threshold_seconds. No-op if !have_timestamp.

Trait Implementations§

Source§

impl Clone for ReceiverState

Source§

fn clone(&self) -> ReceiverState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ReceiverState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ReceiverState

Source§

impl PartialEq for ReceiverState

Source§

fn eq(&self, other: &ReceiverState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ReceiverState

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.