netstack3_ip

Struct RoutesApi

Source
pub struct RoutesApi<I: Ip, C>(/* private fields */);
Expand description

The routes API for a specific IP version I.

Implementations§

Source§

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

Source

pub fn new(ctx: C) -> Self

Creates a new API instance.

Source§

impl<I, C> RoutesApi<I, C>
where I: IpLayerIpExt + IpDeviceIpExt, C: ContextPair, C::CoreContext: RoutesApiCoreContext<I, C::BindingsContext>, C::BindingsContext: RoutesApiBindingsContext<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId: Ord,

Source

pub fn new_table( &mut self, ) -> RoutingTableId<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>

Allocates a new table in Core.

Source

pub fn remove_table( &mut self, id: RoutingTableId<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, ) -> RemoveResourceResultWithContext<(), C::BindingsContext>

Removes a table in Core.

§Panics

Panics if id is the main table id.

Source

pub fn main_table_id( &mut self, ) -> RoutingTableId<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>

Gets the core ID of the main table.

Source

pub fn collect_routes_into<X: From<Entry<I::Addr, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>>, T: Extend<X>>( &mut self, table_id: &RoutingTableId<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, target: &mut T, )

Collects all the routes in the specified table into target.

Source

pub fn collect_main_table_routes_into<X: From<Entry<I::Addr, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>>, T: Extend<X>>( &mut self, target: &mut T, )

Collects all the routes in the main table into target.

Source

pub fn fold_routes<B, F>(&mut self, init: B, cb: F) -> B

Like the Iterator fold accumulator.

Applies the given cb to each route across all routing tables.

Source

pub fn resolve_route( &mut self, destination: Option<RoutableIpAddr<I::Addr>>, ) -> Result<ResolvedRoute<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, ResolveRouteError>

Resolve the route to a given destination.

Returns Some ResolvedRoute with details for reaching the destination, or None if the destination is unreachable.

Source

pub fn select_device_for_gateway( &mut self, gateway: SpecifiedAddr<I::Addr>, ) -> Option<<C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>

Selects the device to use for gateway routes when the device was unspecified by the client.

Source

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

Writes routing table information to the provided inspector.

Source

pub fn set_routes( &mut self, table_id: &RoutingTableId<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>, entries: Vec<EntryAndGeneration<I::Addr, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>>, )

Replaces the entire route table atomically.

Source

pub fn set_rules( &mut self, rules: Vec<Rule<I, <C::CoreContext as DeviceIdContext<AnyDevice>>::DeviceId>>, )

Replaces the entire rule table atomically.

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<I, C> UnwindSafe for RoutesApi<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

Source§

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>,

Source§

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>,

Source§

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>,