falco_plugin/plugin/
event.rs1use falco_event::events::RawEvent;
2use std::ffi::CStr;
3
4pub use falco_plugin_api::ss_plugin_event_input;
5
6#[derive(Debug)]
8pub struct EventInput(pub(crate) ss_plugin_event_input);
9
10impl EventInput {
11 pub fn event(&self) -> std::io::Result<RawEvent> {
16 unsafe { RawEvent::from_ptr(self.0.evt as *const _) }
17 }
18
19 pub fn source(&self) -> Option<&CStr> {
23 unsafe {
24 if self.0.evtsrc.is_null() {
25 None
26 } else {
27 Some(CStr::from_ptr(self.0.evtsrc))
28 }
29 }
30 }
31
32 pub fn event_number(&self) -> usize {
36 self.0.evtnum as usize
37 }
38}