EbpfProgram

Struct EbpfProgram 

Source
pub struct EbpfProgram<C: EbpfProgramContext, T: ArgumentTypeChecker<C> = StaticTypeChecker> { /* private fields */ }
Expand description

An abstraction over an eBPF program and its registered helper functions.

Implementations§

Source§

impl<C: EbpfProgramContext, T: ArgumentTypeChecker<C>> EbpfProgram<C, T>

Source

pub fn code(&self) -> &[EbpfInstruction]

Source§

impl<C, T: ArgumentTypeChecker<C>> EbpfProgram<C, T>
where C: StaticHelperSet + for<'a> EbpfProgramContext<Arg2<'a> = (), Arg3<'a> = (), Arg4<'a> = (), Arg5<'a> = ()>,

Source

pub fn run_with_1_argument<'a>( &self, run_context: &mut C::RunContext<'a>, arg1: C::Arg1<'a>, ) -> u64

Source§

impl<C, T: ArgumentTypeChecker<C>> EbpfProgram<C, T>
where C: StaticHelperSet + for<'a> EbpfProgramContext<Arg3<'a> = (), Arg4<'a> = (), Arg5<'a> = ()>,

Source

pub fn run_with_2_arguments<'a>( &self, run_context: &mut C::RunContext<'a>, arg1: C::Arg1<'a>, arg2: C::Arg2<'a>, ) -> u64

Source§

impl<C, T: ArgumentTypeChecker<C>> EbpfProgram<C, T>
where C: BpfProgramContext + StaticHelperSet + for<'a> EbpfProgramContext<Arg2<'a> = (), Arg3<'a> = (), Arg4<'a> = (), Arg5<'a> = ()>,

Source

pub fn run<'a>( &self, run_context: &mut <C as EbpfProgramContext>::RunContext<'a>, packet: <C as EbpfProgramContext>::Arg1<'a>, ) -> u64

Executes the current program on the specified packet. The program receives a pointer to the packet and the size of the packet as the first two arguments.

Trait Implementations§

Source§

impl<C: EbpfProgramContext, T: ArgumentTypeChecker<C>> Debug for EbpfProgram<C, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C, T> Freeze for EbpfProgram<C, T>
where T: Freeze,

§

impl<C, T> RefUnwindSafe for EbpfProgram<C, T>

§

impl<C, T> Send for EbpfProgram<C, T>
where T: Send, <C as EbpfProgramContext>::Map: Send,

§

impl<C, T> Sync for EbpfProgram<C, T>
where T: Sync, <C as EbpfProgramContext>::Map: Sync,

§

impl<C, T> Unpin for EbpfProgram<C, T>
where T: Unpin, <C as EbpfProgramContext>::Map: Unpin,

§

impl<C, T> UnwindSafe for EbpfProgram<C, T>

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.