Trait netstack3_ip::socket::SendOptions

source ·
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§

source

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.

source

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.

source

fn allow_broadcast(&self) -> Option<I::BroadcastMarker>

Some if the socket can be used to send broadcast packets.

source

fn dscp_and_ecn(&self) -> DscpAndEcn

Returns TCLASS/TOS field value that should be set in IP headers.

source

fn mtu(&self) -> Mtu

The IP MTU to use for this transmission.

Note that the minimum overall MTU is used considering the device and path. This option can be used to restrict an MTU to an upper bound.

Implementors§