1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use crate::structure::guid::EntityId;
use crate::structure::sequence_number::{SequenceNumber, SequenceNumberSet};
use speedy::{Readable, Writable};
/// This Submessage is sent from an RTPS Writer to an RTPS Reader and
/// indicates to the RTPS Reader that a range of sequence numbers
/// is no longer relevant. The set may be a contiguous range of
/// sequence numbers or a specific set of sequence numbers.
#[derive(Debug, PartialEq, Readable, Writable)]
pub struct Gap {
/// Identifies the Reader Entity that is being informed of the
/// irrelevance of a set of sequence numbers.
pub reader_id: EntityId,
/// Identifies the Writer Entity to which the range of sequence
/// numbers applies.
pub writer_id: EntityId,
/// Identifies the first sequence number in the interval of
/// irrelevant sequence numbers
pub gap_start: SequenceNumber,
/// Identifies the last sequence number in the interval of irrelevant
/// sequence numbers.
///
/// Identifies an additional list of sequence numbers that are
/// irrelevant.
pub gap_list: SequenceNumberSet,
}
#[cfg(test)]
mod tests {
use super::*;
serialization_test!( type = Gap,
{
gap,
Gap {
reader_id: EntityId::ENTITYID_SEDP_BUILTIN_PUBLICATIONS_READER,
writer_id: EntityId::ENTITYID_SEDP_BUILTIN_PUBLICATIONS_WRITER,
gap_start: SequenceNumber::from(42),
gap_list: SequenceNumberSet::new(SequenceNumber::from(7))
},
le = [0x00, 0x00, 0x03, 0xC7,
0x00, 0x00, 0x03, 0xC2,
0x00, 0x00, 0x00, 0x00,
0x2A, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00],
be = [0x00, 0x00, 0x03, 0xC7,
0x00, 0x00, 0x03, 0xC2,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x2A,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x07,
0x00, 0x00, 0x00, 0x00]
});
}