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
impl Tap
Sourcepub fn builder<I>(interface: I) -> TapBuilder
pub fn builder<I>(interface: I) -> TapBuilder
Creates a new TapBuilder with the specified Interface.
Source§impl<E: Engine> Tap<E>
impl<E: Engine> Tap<E>
Sourcepub fn frame_kind(&self) -> FrameKind
pub fn frame_kind(&self) -> FrameKind
Returns the FrameKind for the selected interface
Sourcepub fn route_channel(&mut self) -> Result<(Sender, Receiver), Error>
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.
Sourcepub fn copy_receiver(&mut self) -> Result<Receiver, Error>
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.
Sourcepub fn add_rule<R>(&mut self, rule: R) -> Result<RuleId, Error>
pub fn add_rule<R>(&mut self, rule: R) -> Result<RuleId, 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.