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: ProtocolVersionProtocolVersion from the RTPS header (or overwritten by InfoSource).
source_vendor_id: VendorIdVendorId from the RTPS header (or overwritten by InfoSource).
source_guid_prefix: GuidPrefixGuidPrefix of the sender (RTPS header or InfoSource).
dest_guid_prefix: GuidPrefixGuidPrefix of the receiver (configuration value, fixed).
have_timestamp: booltrue if the receiver has a sender timestamp.
timestamp: HeTimestampLast sender timestamp (valid if have_timestamp).
message_length: Option<u32>Set by HE.L — expected remaining length of the RTPS message.
message_checksum: ChecksumValueSet 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: boolHeuristic flag: |timestamp - now| > threshold. Set by
note_clock_skew; the decode module provides only the
input data.
Implementations§
Source§impl ReceiverState
impl ReceiverState
Sourcepub fn new(dest_guid_prefix: GuidPrefix) -> Self
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.
Sourcepub fn init_from_header(&mut self, header: &RtpsHeader)
pub fn init_from_header(&mut self, header: &RtpsHeader)
Initializes from an RtpsHeader (Spec §8.3.4.1).
Sourcepub fn apply_info_source(
&mut self,
version: ProtocolVersion,
vendor_id: VendorId,
guid_prefix: GuidPrefix,
)
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.”
Sourcepub fn apply_info_timestamp(&mut self, ts: HeTimestamp, invalidate: bool)
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.
Sourcepub fn apply_info_reply(
&mut self,
unicast: Vec<Locator>,
multicast: Option<Vec<Locator>>,
)
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.
Sourcepub fn apply_header_extension(&mut self, he: &HeaderExtension)
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.
Sourcepub fn note_clock_skew(&mut self, now_seconds: i32, threshold_seconds: u32)
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
impl Clone for ReceiverState
Source§fn clone(&self) -> ReceiverState
fn clone(&self) -> ReceiverState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more