mirror of https://github.com/aya-rs/aya
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
623 B
Rust
26 lines
623 B
Rust
use core::ffi::c_void;
|
|
|
|
use crate::{args::FromRawTracepointArgs, bindings::bpf_raw_tracepoint_args, EbpfContext};
|
|
|
|
pub struct RawTracePointContext {
|
|
ctx: *mut bpf_raw_tracepoint_args,
|
|
}
|
|
|
|
impl RawTracePointContext {
|
|
pub fn new(ctx: *mut c_void) -> RawTracePointContext {
|
|
RawTracePointContext {
|
|
ctx: ctx as *mut bpf_raw_tracepoint_args,
|
|
}
|
|
}
|
|
|
|
pub unsafe fn arg<T: FromRawTracepointArgs>(&self, n: usize) -> T {
|
|
T::from_argument(&*self.ctx, n)
|
|
}
|
|
}
|
|
|
|
impl EbpfContext for RawTracePointContext {
|
|
fn as_ptr(&self) -> *mut c_void {
|
|
self.ctx as *mut c_void
|
|
}
|
|
}
|