netstack3_ip::device

Trait RsContext

Source
pub trait RsContext<BC: RsBindingsTypes>: DeviceIdContext<AnyDevice> + CoreTimerContext<RsTimerId<Self::WeakDeviceId>, BC> {
    type LinkLayerAddr: AsRef<[u8]>;

    // Required methods
    fn with_rs_state_mut_and_max<O, F: FnOnce(&mut RsState<BC>, Option<NonZeroU8>) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn get_link_layer_addr_bytes(
        &mut self,
        device_id: &Self::DeviceId,
    ) -> Option<Self::LinkLayerAddr>;
    fn send_rs_packet<S: Serializer<Buffer = EmptyBuf>, F: FnOnce(Option<UnicastAddr<Ipv6Addr>>) -> S>(
        &mut self,
        bindings_ctx: &mut BC,
        device_id: &Self::DeviceId,
        message: RouterSolicitation,
        body: F,
    ) -> Result<(), IpSendFrameError<S>>;

    // Provided method
    fn with_rs_state_mut<O, F: FnOnce(&mut RsState<BC>) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O { ... }
}
Expand description

The execution context for router solicitation.

Required Associated Types§

Source

type LinkLayerAddr: AsRef<[u8]>

A link-layer address.

Required Methods§

Source

fn with_rs_state_mut_and_max<O, F: FnOnce(&mut RsState<BC>, Option<NonZeroU8>) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the callback with a mutable reference to the router solicitation state and the maximum number of router solications to send.

Gets the device’s link-layer address bytes, if the device supports link-layer addressing.

Source

fn send_rs_packet<S: Serializer<Buffer = EmptyBuf>, F: FnOnce(Option<UnicastAddr<Ipv6Addr>>) -> S>( &mut self, bindings_ctx: &mut BC, device_id: &Self::DeviceId, message: RouterSolicitation, body: F, ) -> Result<(), IpSendFrameError<S>>

Sends an NDP Router Solicitation to the local-link.

The callback is called with a source address suitable for an outgoing router solicitation message and returns the message body.

Provided Methods§

Source

fn with_rs_state_mut<O, F: FnOnce(&mut RsState<BC>) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the callback with a mutable reference to the router solicitation state.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§