Skip to main content

PublicationConfig

Struct PublicationConfig 

Source
pub struct PublicationConfig {
    pub group: Ipv4Addr,
    pub dst_port: u16,
    pub interface: Option<Ipv4Addr>,
    pub source_port: Option<u16>,
    pub source_addr: Option<Ipv4Addr>,
    pub ttl: u32,
    pub loopback: bool,
}
Expand description

Configuration for one multicast publication socket.

Fields§

§group: Ipv4Addr

The destination multicast group.

§dst_port: u16

The destination UDP port.

§interface: Option<Ipv4Addr>

The local interface to use for multicast egress, if explicitly set.

§source_port: Option<u16>

The source UDP port to bind before sending, if explicitly set.

§source_addr: Option<Ipv4Addr>

The source IPv4 address to bind before sending, if explicitly set.

§ttl: u32

The multicast TTL for transmitted packets.

§loopback: bool

Whether outbound multicast packets should be looped back to the local host.

Implementations§

Source§

impl PublicationConfig

Source

pub fn new(group: Ipv4Addr, port: u16) -> Self

Creates a basic multicast publication configuration.

Source

pub fn validate(&self) -> Result<(), MctxError>

Validates the configuration and returns an error if it is not usable.

Source

pub fn with_interface(self, interface: Ipv4Addr) -> Self

Sets the multicast egress interface.

Source

pub fn with_source_port(self, source_port: u16) -> Self

Sets the source UDP port.

Source

pub fn with_source_addr(self, source_addr: Ipv4Addr) -> Self

Sets the exact local IPv4 source address to bind before sending.

Source

pub fn with_bind_addr(self, bind_addr: SocketAddrV4) -> Self

Sets the exact local IPv4 address and UDP port to bind before sending.

Source

pub fn with_ttl(self, ttl: u32) -> Self

Sets the multicast TTL.

Source

pub fn with_loopback(self, loopback: bool) -> Self

Enables or disables multicast loopback.

Source

pub fn destination(&self) -> SocketAddrV4

Returns the configured destination socket address.

Source

pub fn bind_addr(&self) -> Option<SocketAddrV4>

Returns the exact local bind address requested by the configuration, if any.

Trait Implementations§

Source§

impl Clone for PublicationConfig

Source§

fn clone(&self) -> PublicationConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PublicationConfig

Source§

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

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

impl Hash for PublicationConfig

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PublicationConfig

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Eq for PublicationConfig

Source§

impl StructuralPartialEq for PublicationConfig

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