Trait netstack3_device::ArpContext

source ·
pub trait ArpContext<D: ArpDevice, BC: ArpBindingsContext<D, Self::DeviceId>>: DeviceIdContext<D> + SendFrameContext<BC, ArpFrameMetadata<D, Self::DeviceId>> + CounterContext<ArpCounters> {
    type ConfigCtx<'a>: ArpConfigContext;
    type ArpSenderCtx<'a>: ArpSenderContext<D, BC, DeviceId = Self::DeviceId>;

    // Required methods
    fn with_arp_state_mut_and_sender_ctx<O, F: FnOnce(&mut ArpState<D, BC>, &mut Self::ArpSenderCtx<'_>) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn get_protocol_addr(
        &mut self,
        bindings_ctx: &mut BC,
        device_id: &Self::DeviceId,
    ) -> Option<Ipv4Addr>;
    fn get_hardware_addr(
        &mut self,
        bindings_ctx: &mut BC,
        device_id: &Self::DeviceId,
    ) -> UnicastAddr<D::Address>;
    fn with_arp_state_mut<O, F: FnOnce(&mut ArpState<D, BC>, &mut Self::ConfigCtx<'_>) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn with_arp_state<O, F: FnOnce(&ArpState<D, BC>) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
}
Expand description

An execution context for the ARP protocol.

Required Associated Types§

source

type ConfigCtx<'a>: ArpConfigContext

The inner configuration context.

source

type ArpSenderCtx<'a>: ArpSenderContext<D, BC, DeviceId = Self::DeviceId>

The inner sender context.

Required Methods§

source

fn with_arp_state_mut_and_sender_ctx<O, F: FnOnce(&mut ArpState<D, BC>, &mut Self::ArpSenderCtx<'_>) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with a mutable reference to ARP state and the core sender context.

source

fn get_protocol_addr( &mut self, bindings_ctx: &mut BC, device_id: &Self::DeviceId, ) -> Option<Ipv4Addr>

Get a protocol address of this interface.

If device_id does not have any addresses associated with it, return None.

source

fn get_hardware_addr( &mut self, bindings_ctx: &mut BC, device_id: &Self::DeviceId, ) -> UnicastAddr<D::Address>

Get the hardware address of this interface.

source

fn with_arp_state_mut<O, F: FnOnce(&mut ArpState<D, BC>, &mut Self::ConfigCtx<'_>) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with a mutable reference to ARP state and the ARP configuration context.

source

fn with_arp_state<O, F: FnOnce(&ArpState<D, BC>) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with an immutable reference to ARP state.

Object Safety§

This trait is not object safe.

Implementors§