pub trait SendOptions<I: IpExt> {
// Required methods
fn hop_limit(
&self,
destination: &SpecifiedAddr<I::Addr>,
) -> Option<NonZeroU8>;
fn multicast_loop(&self) -> bool;
fn allow_broadcast(&self) -> Option<I::BroadcastMarker>;
fn dscp_and_ecn(&self) -> DscpAndEcn;
fn mtu(&self) -> Mtu;
}
Expand description
Provides hooks for altering sending behavior of IpSock
.
Must be implemented by the socket option type of an IpSock
when using it
to call IpSocketHandler::send_ip_packet
. This is implemented as a trait
instead of an inherent impl on a type so that users of sockets that don’t
need certain option types, like TCP for anything multicast-related, can
avoid allocating space for those options.
Required Methods§
Sourcefn hop_limit(&self, destination: &SpecifiedAddr<I::Addr>) -> Option<NonZeroU8>
fn hop_limit(&self, destination: &SpecifiedAddr<I::Addr>) -> Option<NonZeroU8>
Returns the hop limit to set on a packet going to the given destination.
If Some(u)
, u
will be used as the hop limit (IPv6) or TTL (IPv4) for
a packet going to the given destination. Otherwise the default value
will be used.
Sourcefn multicast_loop(&self) -> bool
fn multicast_loop(&self) -> bool
Returns true if outgoing multicast packets should be looped back and delivered to local receivers who joined the multicast group.
Sourcefn allow_broadcast(&self) -> Option<I::BroadcastMarker>
fn allow_broadcast(&self) -> Option<I::BroadcastMarker>
Some
if the socket can be used to send broadcast packets.
Sourcefn dscp_and_ecn(&self) -> DscpAndEcn
fn dscp_and_ecn(&self) -> DscpAndEcn
Returns TCLASS/TOS field value that should be set in IP headers.