Skip to main content

Tap

Struct Tap 

Source
pub struct Tap<E: Engine = LinearEngine> { /* private fields */ }
Expand description

Taps into a network interface. This struct stores all eBPF primitives required for the specific combination of Actions and the Engine. It defaults to using a LinearEngine.

Implementations§

Source§

impl Tap

Source

pub fn builder<I>(interface: I) -> TapBuilder
where I: TryInto<Interface>, I::Error: Into<Error>,

Creates a new TapBuilder with the specified Interface.

Source§

impl<E: Engine> Tap<E>

Source

pub fn frame_kind(&self) -> FrameKind

Returns the FrameKind for the selected interface

Source

pub fn route_channel(&mut self) -> Result<(Sender, Receiver), Error>

Returns a tuple of channels::route::Sender and channels::route::Receiver.

§Errors

Returns Error::RouteNotEnabled if routing is not enabled. Returns Error::ChannelNotAvailable if the channel has already been taken.

Source

pub fn copy_receiver(&mut self) -> Result<Receiver, Error>

Returns a channels::copy::Receiver for receiving data.

§Errors

Returns Error::CopyNotEnabled if copying is not enabled.. Returns Error::ChannelNotAvailable if the channel has already been taken.

Source

pub fn add_rule<R>(&mut self, rule: R) -> Result<RuleId, Error>
where R: TryInto<Rule>, R::Error: Into<Error>,

Add a Rule or RuleBuilder.

§Errors

Returns Error::CopyNotEnabled or Error::RouteNotEnabled if the Tap hasn’t provisioned the required primitives. Returns an Error if the engine cannot add the rule.

Source

pub fn remove_rule(&mut self, rule_id: RuleId) -> Result<Rule, Error>

Remove a Rule by its RuleId.

§Errors

Returns Error::MissingRule if the RuleId is invalid. Returns an error if the Engine cannot remove the rule.

Source

pub fn interface(&self) -> &Interface

Access the Interface

Auto Trait Implementations§

§

impl<E> Freeze for Tap<E>
where E: Freeze,

§

impl<E = LinearEngine> !RefUnwindSafe for Tap<E>

§

impl<E> Send for Tap<E>
where E: Send,

§

impl<E = LinearEngine> !Sync for Tap<E>

§

impl<E> Unpin for Tap<E>
where E: Unpin,

§

impl<E> UnsafeUnpin for Tap<E>
where E: UnsafeUnpin,

§

impl<E = LinearEngine> !UnwindSafe for Tap<E>

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