Skip to main content

Groups

Struct Groups 

Source
#[non_exhaustive]
pub struct Groups { pub broadcast: SocketAddrV4, pub interface: Ipv4Addr, pub directed: Ipv4Addr, }
Expand description

A link’s group destinations: the B/IP addresses that reach more than one node. No node sends from one, so a datagram from one, or a Forwarded-NPDU naming one as its origin, is dropped: answering it would reach the whole group.

It is #[non_exhaustive], so a link that comes to have another group destination of its own (a second broadcast address, say) isn’t a breaking change: outside this crate, take it from Link::groups or build it with Groups::new.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§broadcast: SocketAddrV4

The link’s broadcast address: its broadcast IP at the network’s port.

§interface: Ipv4Addr

The node’s own interface IP. A broadcast IP equal to it, or a loopback one, as loopback tests set up, is a group only at the network’s port.

§directed: Ipv4Addr

For a B/IP-M node, its IP subnet’s directed broadcast address (LocalSubnet::directed): no longer where its broadcasts go, but still an address that reaches more than one node. It counts as the broadcast IP does, at any port. 0.0.0.0 for none: a plain address rather than an Option, so a router’s empty group rule stays all zero bits and its storage stays in .bss.

Implementations§

Source§

impl Groups

Source

pub const fn new(broadcast: SocketAddrV4, interface: Ipv4Addr) -> Self

The group destinations of a link whose broadcast address is broadcast, on the interface whose IP is interface, with no directed broadcast beside it.

Source

pub const fn contains(&self, address: SocketAddrV4) -> bool

Whether address is a group destination: the link’s broadcast address, or any address whose IP is a group IP (Groups::contains_ip).

Source

pub const fn contains_ip(&self, ip: Ipv4Addr) -> bool

Whether ip is a group at any port: 255.255.255.255, a multicast address, or the broadcast IP or a member’s directed broadcast when it is neither loopback nor the node’s own interface. This is the test for a datagram’s UDP source.

Trait Implementations§

Source§

impl Clone for Groups

Source§

fn clone(&self) -> Self

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 Copy for Groups

Source§

impl Debug for Groups

Source§

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

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

impl Eq for Groups

Source§

impl PartialEq for Groups

Source§

fn eq(&self, other: &Self) -> 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 Groups

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.