Trait 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,
        device_id: &Self::DeviceId,
    ) -> Option<Ipv4Addr>;
    fn addr_on_interface(
        &mut self,
        device_id: &Self::DeviceId,
        addr: Ipv4Addr,
    ) -> bool;
    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, 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.

NOTE: If the interface has multiple addresses, an arbitrary one will be returned.

Source

fn addr_on_interface( &mut self, device_id: &Self::DeviceId, addr: Ipv4Addr, ) -> bool

Check if addr is assigned to this interface.

If device_id does not have any addresses, return false.

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.

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§