Trait virtual_net::VirtualUdpSocket
source · pub trait VirtualUdpSocket: VirtualConnectionlessSocket + Debug + Send + Sync + 'static {
Show 13 methods
// Required methods
fn set_broadcast(&mut self, broadcast: bool) -> Result<()>;
fn broadcast(&self) -> Result<bool>;
fn set_multicast_loop_v4(&mut self, val: bool) -> Result<()>;
fn multicast_loop_v4(&self) -> Result<bool>;
fn set_multicast_loop_v6(&mut self, val: bool) -> Result<()>;
fn multicast_loop_v6(&self) -> Result<bool>;
fn set_multicast_ttl_v4(&mut self, ttl: u32) -> Result<()>;
fn multicast_ttl_v4(&self) -> Result<u32>;
fn join_multicast_v4(
&mut self,
multiaddr: Ipv4Addr,
iface: Ipv4Addr
) -> Result<()>;
fn leave_multicast_v4(
&mut self,
multiaddr: Ipv4Addr,
iface: Ipv4Addr
) -> Result<()>;
fn join_multicast_v6(
&mut self,
multiaddr: Ipv6Addr,
iface: u32
) -> Result<()>;
fn leave_multicast_v6(
&mut self,
multiaddr: Ipv6Addr,
iface: u32
) -> Result<()>;
fn addr_peer(&self) -> Result<Option<SocketAddr>>;
}
Required Methods§
sourcefn set_broadcast(&mut self, broadcast: bool) -> Result<()>
fn set_broadcast(&mut self, broadcast: bool) -> Result<()>
Sets a flag that means that the UDP socket is able to receive and process broadcast packets.
sourcefn broadcast(&self) -> Result<bool>
fn broadcast(&self) -> Result<bool>
Indicates if the SO_BROADCAST flag is set which means that the UDP socket will receive and process broadcast packets
sourcefn set_multicast_loop_v4(&mut self, val: bool) -> Result<()>
fn set_multicast_loop_v4(&mut self, val: bool) -> Result<()>
Sets a flag that indicates if multicast packets that this socket is a member of will be looped back to the sending socket. This applies to IPv4 addresses
sourcefn multicast_loop_v4(&self) -> Result<bool>
fn multicast_loop_v4(&self) -> Result<bool>
Gets a flag that indicates if multicast packets that this socket is a member of will be looped back to the sending socket. This applies to IPv4 addresses
sourcefn set_multicast_loop_v6(&mut self, val: bool) -> Result<()>
fn set_multicast_loop_v6(&mut self, val: bool) -> Result<()>
Sets a flag that indicates if multicast packets that this socket is a member of will be looped back to the sending socket. This applies to IPv6 addresses
sourcefn multicast_loop_v6(&self) -> Result<bool>
fn multicast_loop_v6(&self) -> Result<bool>
Gets a flag that indicates if multicast packets that this socket is a member of will be looped back to the sending socket. This applies to IPv6 addresses
sourcefn set_multicast_ttl_v4(&mut self, ttl: u32) -> Result<()>
fn set_multicast_ttl_v4(&mut self, ttl: u32) -> Result<()>
Sets the TTL for IPv4 multicast packets which is the number of network hops before the packet is dropped
sourcefn multicast_ttl_v4(&self) -> Result<u32>
fn multicast_ttl_v4(&self) -> Result<u32>
Gets the TTL for IPv4 multicast packets which is the number of network hops before the packet is dropped
sourcefn join_multicast_v4(
&mut self,
multiaddr: Ipv4Addr,
iface: Ipv4Addr
) -> Result<()>
fn join_multicast_v4( &mut self, multiaddr: Ipv4Addr, iface: Ipv4Addr ) -> Result<()>
Tells this interface that it will subscribe to a particular multicast address. This applies to IPv4 addresses
sourcefn leave_multicast_v4(
&mut self,
multiaddr: Ipv4Addr,
iface: Ipv4Addr
) -> Result<()>
fn leave_multicast_v4( &mut self, multiaddr: Ipv4Addr, iface: Ipv4Addr ) -> Result<()>
Tells this interface that it will unsubscribe to a particular multicast address. This applies to IPv4 addresses
sourcefn join_multicast_v6(&mut self, multiaddr: Ipv6Addr, iface: u32) -> Result<()>
fn join_multicast_v6(&mut self, multiaddr: Ipv6Addr, iface: u32) -> Result<()>
Tells this interface that it will subscribe to a particular multicast address. This applies to IPv6 addresses
sourcefn leave_multicast_v6(&mut self, multiaddr: Ipv6Addr, iface: u32) -> Result<()>
fn leave_multicast_v6(&mut self, multiaddr: Ipv6Addr, iface: u32) -> Result<()>
Tells this interface that it will unsubscribe to a particular multicast address. This applies to IPv6 addresses
sourcefn addr_peer(&self) -> Result<Option<SocketAddr>>
fn addr_peer(&self) -> Result<Option<SocketAddr>>
Returns the remote address of this UDP socket if it has been connected to a specific target destination address