Struct netstack3_ip::device::DeviceIpApi

source ·
pub struct DeviceIpApi<I: Ip, C>(/* private fields */);
Expand description

Provides an API for dealing with devices at the IP layer, aka interfaces.

Implementations§

source§

impl<I: Ip, C> DeviceIpApi<I, C>

source

pub fn new(ctx: C) -> Self

Creates a new API instance.

source§

impl<I, C> DeviceIpApi<I, C>

source

pub fn add_ip_addr_subnet( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, addr_subnet: AddrSubnet<I::Addr>, ) -> Result<(), AddIpAddrSubnetError>

Like DeviceIpApi::add_ip_addr_subnet_with_config with a default address configuration.

source

pub fn add_ip_addr_subnet_with_config( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, addr_subnet: AddrSubnet<I::Addr>, addr_config: I::ManualAddressConfig<<C::BindingsContext as InstantBindingsTypes>::Instant>, ) -> Result<(), AddIpAddrSubnetError>

Adds an IP address and associated subnet to this device.

If Duplicate Address Detection (DAD) is enabled, begins performing DAD.

For IPv6, this function also joins the solicited-node multicast group.

source

pub fn del_ip_addr( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, addr: SpecifiedAddr<I::Addr>, ) -> Result<RemoveResourceResultWithContext<AddrSubnet<I::Addr>, C::BindingsContext>, NotFoundError>

Delete an IP address on a device.

source

pub fn new_configuration_update<'a>( &mut self, device_id: &'a <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, config: I::ConfigurationUpdate, ) -> Result<PendingIpDeviceConfigurationUpdate<'a, I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, UpdateIpConfigurationError>

Updates the IP configuration for a device.

Each field in [Ipv4DeviceConfigurationUpdate] or [Ipv6DeviceConfigurationUpdate] represents an optionally updateable configuration. If the field has a Some(_) value, then an attempt will be made to update that configuration on the device. A None value indicates that an update for the configuration is not requested.

Note that some fields have the type Option<Option<T>>. In this case, as long as the outer Option is Some, then an attempt will be made to update the configuration.

This function returns a [PendingDeviceConfigurationUpdate] which is validated and [DeviceIpApi::apply] can be called to apply the configuration.

source

pub fn apply_configuration( &mut self, config: PendingIpDeviceConfigurationUpdate<'_, I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, ) -> I::ConfigurationUpdate

Applies a pre-validated pending configuration to the device.

Returns a configuration update with the previous value for all the requested fields in config.

source

pub fn update_configuration( &mut self, device_id: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, config: I::ConfigurationUpdate, ) -> Result<I::ConfigurationUpdate, UpdateIpConfigurationError>

source

pub fn get_configuration( &mut self, device_id: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, ) -> I::ConfigurationAndFlags

Gets the IP configuration and flags for a device_id.

source

pub fn get_routing_metric( &mut self, device_id: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, ) -> RawMetric

Gets the routing metric for the device.

source

pub fn set_addr_properties( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, address: SpecifiedAddr<I::Addr>, next_valid_until: Lifetime<<C::BindingsContext as InstantBindingsTypes>::Instant>, ) -> Result<(), SetIpAddressPropertiesError>

Sets properties on an IP address.

source

pub fn for_each_assigned_ip_addr_subnet<F: FnMut(AddrSubnet<I::Addr>)>( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, f: F, )

Calls f for each assigned IP address on the device.

source

pub fn get_assigned_ip_addr_subnets( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, ) -> Vec<AddrSubnet<I::Addr>>

Shorthand for [DeviceIpApi::Collect_assigned_ip_addr_subnets], returning the addresses in a Vec.

source

pub fn inspect<N: Inspector>( &mut self, device: &<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId, inspector: &mut N, )

Exports IP state for device into inspector.

Auto Trait Implementations§

§

impl<I, C> Freeze for DeviceIpApi<I, C>
where C: Freeze,

§

impl<I, C> RefUnwindSafe for DeviceIpApi<I, C>

§

impl<I, C> Send for DeviceIpApi<I, C>
where C: Send,

§

impl<I, C> Sync for DeviceIpApi<I, C>
where C: Sync,

§

impl<I, C> Unpin for DeviceIpApi<I, C>
where C: Unpin, I: Unpin,

§

impl<I, C> UnwindSafe for DeviceIpApi<I, C>
where C: UnwindSafe, I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<CC, BC, Meta> RecvFrameContext<Meta, BC> for CC
where Meta: ReceivableFrameMeta<CC, BC>,

source§

fn receive_frame<B>(&mut self, bindings_ctx: &mut BC, metadata: Meta, frame: B)
where B: BufferMut + Debug,

Receive a frame. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<CC, BC, Meta> SendFrameContext<BC, Meta> for CC
where Meta: SendableFrameMeta<CC, BC>,

source§

fn send_frame<S>( &mut self, bindings_ctx: &mut BC, metadata: Meta, frame: S, ) -> Result<(), ErrorAndSerializer<SendFrameErrorReason, S>>
where S: Serializer, <S as Serializer>::Buffer: BufferMut,

Send a frame. Read more
source§

impl<Id, CC, BC> TimerHandler<BC, Id> for CC
where BC: TimerBindingsTypes, Id: HandleableTimer<CC, BC>,

source§

fn handle_timer( &mut self, bindings_ctx: &mut BC, dispatch: Id, timer: <BC as TimerBindingsTypes>::UniqueTimerId, )

Handle a timer firing. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<L, T> UnlockedAccess<L> for T
where L: UnlockedAccessMarkerFor<T>,

§

type Data = <L as UnlockedAccessMarkerFor<T>>::Data

The type of state being accessed.
§

type Guard<'l> = &'l <L as UnlockedAccessMarkerFor<T>>::Data where T: 'l

A guard providing read access to the data.
§

fn access(&self) -> <T as UnlockedAccess<L>>::Guard<'_>

How to access the state.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<B, A> LockBefore<B> for A
where B: LockAfter<A>,