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: Ipv4AddrThe destination multicast group.
dst_port: u16The 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: u32The multicast TTL for transmitted packets.
loopback: boolWhether outbound multicast packets should be looped back to the local host.
Implementations§
Source§impl PublicationConfig
impl PublicationConfig
Sourcepub fn new(group: Ipv4Addr, port: u16) -> Self
pub fn new(group: Ipv4Addr, port: u16) -> Self
Creates a basic multicast publication configuration.
Sourcepub fn validate(&self) -> Result<(), MctxError>
pub fn validate(&self) -> Result<(), MctxError>
Validates the configuration and returns an error if it is not usable.
Sourcepub fn with_interface(self, interface: Ipv4Addr) -> Self
pub fn with_interface(self, interface: Ipv4Addr) -> Self
Sets the multicast egress interface.
Sourcepub fn with_source_port(self, source_port: u16) -> Self
pub fn with_source_port(self, source_port: u16) -> Self
Sets the source UDP port.
Sourcepub fn with_source_addr(self, source_addr: Ipv4Addr) -> Self
pub fn with_source_addr(self, source_addr: Ipv4Addr) -> Self
Sets the exact local IPv4 source address to bind before sending.
Sourcepub fn with_bind_addr(self, bind_addr: SocketAddrV4) -> Self
pub fn with_bind_addr(self, bind_addr: SocketAddrV4) -> Self
Sets the exact local IPv4 address and UDP port to bind before sending.
Sourcepub fn with_loopback(self, loopback: bool) -> Self
pub fn with_loopback(self, loopback: bool) -> Self
Enables or disables multicast loopback.
Sourcepub fn destination(&self) -> SocketAddrV4
pub fn destination(&self) -> SocketAddrV4
Returns the configured destination socket address.
Sourcepub fn bind_addr(&self) -> Option<SocketAddrV4>
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
impl Clone for PublicationConfig
Source§fn clone(&self) -> PublicationConfig
fn clone(&self) -> PublicationConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more