Trait netstack3_ip::device::IpDeviceStateContext

source ·
pub trait IpDeviceStateContext<I: IpDeviceIpExt, BT: IpDeviceStateBindingsTypes>: IpDeviceAddressContext<I, BT> {
    type IpDeviceAddressCtx<'a>: IpDeviceAddressContext<I, BT, DeviceId = Self::DeviceId, AddressId = Self::AddressId>;
    type AddressIdsIter<'a>: Iterator<Item = Self::AddressId> + 'a;

    // Required methods
    fn with_ip_device_flags<O, F: FnOnce(&IpDeviceFlags) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn add_ip_address(
        &mut self,
        device_id: &Self::DeviceId,
        addr: AddrSubnet<I::Addr, I::AssignedWitness>,
        config: I::AddressConfig<BT::Instant>,
    ) -> Result<Self::AddressId, ExistsError>;
    fn remove_ip_address(
        &mut self,
        device_id: &Self::DeviceId,
        addr: Self::AddressId,
    ) -> RemoveResourceResultWithContext<AddrSubnet<I::Addr>, BT>;
    fn get_address_id(
        &mut self,
        device_id: &Self::DeviceId,
        addr: SpecifiedAddr<I::Addr>,
    ) -> Result<Self::AddressId, NotFoundError>;
    fn with_address_ids<O, F: FnOnce(Self::AddressIdsIter<'_>, &mut Self::IpDeviceAddressCtx<'_>) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn with_default_hop_limit<O, F: FnOnce(&NonZeroU8) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn with_default_hop_limit_mut<O, F: FnOnce(&mut NonZeroU8) -> O>(
        &mut self,
        device_id: &Self::DeviceId,
        cb: F,
    ) -> O;
    fn join_link_multicast_group(
        &mut self,
        bindings_ctx: &mut BT,
        device_id: &Self::DeviceId,
        multicast_addr: MulticastAddr<I::Addr>,
    );
    fn leave_link_multicast_group(
        &mut self,
        bindings_ctx: &mut BT,
        device_id: &Self::DeviceId,
        multicast_addr: MulticastAddr<I::Addr>,
    );
}
Expand description

Accessor for IP device state.

Required Associated Types§

source

type IpDeviceAddressCtx<'a>: IpDeviceAddressContext<I, BT, DeviceId = Self::DeviceId, AddressId = Self::AddressId>

Inner accessor context.

source

type AddressIdsIter<'a>: Iterator<Item = Self::AddressId> + 'a

The iterator given to with_address_ids.

Required Methods§

source

fn with_ip_device_flags<O, F: FnOnce(&IpDeviceFlags) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with immutable access to the device’s flags.

Note that this trait should only provide immutable access to the flags. Changes to the IP device flags must only be performed while synchronizing with the IP device configuration, so mutable access to the flags is through WithIpDeviceConfigurationMutInner::with_configuration_and_flags_mut.

source

fn add_ip_address( &mut self, device_id: &Self::DeviceId, addr: AddrSubnet<I::Addr, I::AssignedWitness>, config: I::AddressConfig<BT::Instant>, ) -> Result<Self::AddressId, ExistsError>

Adds an IP address for the device.

source

fn remove_ip_address( &mut self, device_id: &Self::DeviceId, addr: Self::AddressId, ) -> RemoveResourceResultWithContext<AddrSubnet<I::Addr>, BT>

Removes an address from the device identified by the ID.

source

fn get_address_id( &mut self, device_id: &Self::DeviceId, addr: SpecifiedAddr<I::Addr>, ) -> Result<Self::AddressId, NotFoundError>

Returns the address ID for the given address value.

source

fn with_address_ids<O, F: FnOnce(Self::AddressIdsIter<'_>, &mut Self::IpDeviceAddressCtx<'_>) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with an iterator over all the address IDs associated with the device.

source

fn with_default_hop_limit<O, F: FnOnce(&NonZeroU8) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with an immutable reference to the device’s default hop limit for this IP version.

source

fn with_default_hop_limit_mut<O, F: FnOnce(&mut NonZeroU8) -> O>( &mut self, device_id: &Self::DeviceId, cb: F, ) -> O

Calls the function with a mutable reference to the device’s default hop limit for this IP version.

Joins the link-layer multicast group associated with the given IP multicast group.

Leaves the link-layer multicast group associated with the given IP multicast group.

Object Safety§

This trait is not object safe.

Implementors§