Skip to main content

MulticastAddressRecord

Struct MulticastAddressRecord 

Source
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

Source

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.

Source

pub fn record_type(self, record_type: MulticastRecordType) -> Self

Set the Record Type (RFC 3810 section 5.2.12).

Source

pub fn multicast_address(self, multicast_address: Ipv6Addr) -> Self

Set the Multicast Address (RFC 3810 section 5.2.4: the group the record describes).

Source

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.

Source

pub fn sources(self, sources: Vec<Ipv6Addr>) -> Self

Replace the whole ordered Source Address list (RFC 3810 section 5.2.5).

Source

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.

Source

pub fn record_type_value(&self) -> MulticastRecordType

The Record Type (RFC 3810 section 5.2.12).

Source

pub fn multicast_address_value(&self) -> Ipv6Addr

The Multicast Address (RFC 3810 section 5.2.4).

Source

pub fn number_of_sources(&self) -> u16

The Number of Sources field (RFC 3810 section 5.2.3), derived from the source list.

Source

pub fn sources_ref(&self) -> &[Ipv6Addr]

The ordered Source Address list (RFC 3810 section 5.2.5).

Source

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

Source

pub fn aux_data_value(&self) -> &[u8]

The Auxiliary Data (RFC 3810 section 5.2.6).

Trait Implementations§

Source§

impl Clone for MulticastAddressRecord

Source§

fn clone(&self) -> MulticastAddressRecord

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 MulticastAddressRecord

Source§

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

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

impl Display for MulticastAddressRecord

Source§

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

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

impl Eq for MulticastAddressRecord

Source§

impl PartialEq for MulticastAddressRecord

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for MulticastAddressRecord

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> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.