pub struct MulticastAddressRecord { /* private fields */ }Expand description
One Multicast Address Record inside an MLDv2 Report (RFC 3810 section 5.2.1).
On the wire a record is a Record Type (1 byte), an Aux Data Len (1 byte, in
32-bit words), a Number of Sources N (2 bytes), a 128-bit Multicast
Address, N 128-bit Source Addresses, and then Aux Data Len * 4 bytes of
Auxiliary Data. The Aux Data Len and Number of Sources count fields are
auto-filled from the carried data on serialization — set the
multicast_address, sources, and aux_data and the counts follow — so an
agent never hand-counts. (The crate-wide convention is that explicit values
the agent sets survive untouched; these two are derived counters with no
dedicated setter, so they always reflect the data. Build a deliberately wrong
count by emitting the record bytes directly through a Raw body.)
Implementations§
Source§impl MulticastAddressRecord
impl MulticastAddressRecord
Sourcepub fn new(
record_type: MulticastRecordType,
multicast_address: Ipv6Addr,
) -> Self
pub fn new( record_type: MulticastRecordType, multicast_address: Ipv6Addr, ) -> Self
Create a Multicast Address Record of record_type for multicast_address
with no sources and no auxiliary data (RFC 3810 section 5.2.1).
Add sources with MulticastAddressRecord::source /
MulticastAddressRecord::sources and auxiliary data with
MulticastAddressRecord::aux_data; the Number of Sources and Aux Data
Len fields are filled from those on serialization.
Sourcepub fn record_type(self, record_type: MulticastRecordType) -> Self
pub fn record_type(self, record_type: MulticastRecordType) -> Self
Set the Record Type (RFC 3810 section 5.2.12).
Sourcepub fn multicast_address(self, multicast_address: Ipv6Addr) -> Self
pub fn multicast_address(self, multicast_address: Ipv6Addr) -> Self
Set the Multicast Address (RFC 3810 section 5.2.4: the group the record describes).
Sourcepub fn source(self, source: Ipv6Addr) -> Self
pub fn source(self, source: Ipv6Addr) -> Self
Append one Source Address (RFC 3810 section 5.2.5), preserving order. The Number of Sources field is filled from the source count on serialization.
Sourcepub fn sources(self, sources: Vec<Ipv6Addr>) -> Self
pub fn sources(self, sources: Vec<Ipv6Addr>) -> Self
Replace the whole ordered Source Address list (RFC 3810 section 5.2.5).
Sourcepub fn aux_data(self, aux_data: impl Into<Vec<u8>>) -> Self
pub fn aux_data(self, aux_data: impl Into<Vec<u8>>) -> Self
Set the Auxiliary Data (RFC 3810 section 5.2.6). The Aux Data Len field (in 32-bit words) is filled from the data length on serialization; the data is zero-padded to a 32-bit-word boundary so a non-multiple-of-4 length still produces a well-formed record.
Sourcepub fn record_type_value(&self) -> MulticastRecordType
pub fn record_type_value(&self) -> MulticastRecordType
The Record Type (RFC 3810 section 5.2.12).
Sourcepub fn multicast_address_value(&self) -> Ipv6Addr
pub fn multicast_address_value(&self) -> Ipv6Addr
The Multicast Address (RFC 3810 section 5.2.4).
Sourcepub fn number_of_sources(&self) -> u16
pub fn number_of_sources(&self) -> u16
The Number of Sources field (RFC 3810 section 5.2.3), derived from the source list.
Sourcepub fn sources_ref(&self) -> &[Ipv6Addr]
pub fn sources_ref(&self) -> &[Ipv6Addr]
The ordered Source Address list (RFC 3810 section 5.2.5).
Sourcepub fn aux_data_len(&self) -> u8
pub fn aux_data_len(&self) -> u8
The Aux Data Len field (RFC 3810 section 5.2.2), in 32-bit words, derived from the auxiliary-data length (rounded up to a word boundary).
Sourcepub fn aux_data_value(&self) -> &[u8] ⓘ
pub fn aux_data_value(&self) -> &[u8] ⓘ
The Auxiliary Data (RFC 3810 section 5.2.6).
Trait Implementations§
Source§impl Clone for MulticastAddressRecord
impl Clone for MulticastAddressRecord
Source§fn clone(&self) -> MulticastAddressRecord
fn clone(&self) -> MulticastAddressRecord
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MulticastAddressRecord
impl Debug for MulticastAddressRecord
Source§impl Display for MulticastAddressRecord
impl Display for MulticastAddressRecord
impl Eq for MulticastAddressRecord
Source§impl PartialEq for MulticastAddressRecord
impl PartialEq for MulticastAddressRecord
Source§fn eq(&self, other: &MulticastAddressRecord) -> bool
fn eq(&self, other: &MulticastAddressRecord) -> bool
self and other values to be equal, and is used by ==.