cradle-plugin-api 0.1.2

API for cradle plugins
Documentation
/// Type definition for the API version check function
pub type CradleCheckApiVerFn = extern "C" fn() -> u32;
/// Type definition for the API cleanup function
pub type CradleCleanupFn = extern "C" fn();

/// FFI-safe agent event
#[repr(C)]
pub struct FfiEvent {
    /// Event kind
    pub kind: u32,
    /// Target PID
    pub pid: u32,
    /// Target handle
    pub process: isize,
    /// Newly loaded DLL name pointer
    pub dll_name: *const std::os::raw::c_char,
    /// Newly loaded DLL base address
    pub dll_base: usize,
    /// Thread ID
    pub tid: u32,
    /// Thread Handle
    pub thread_handle: isize,
    /// Identified debug string
    pub dbg_string: *const u8,
    /// Target binary path
    pub target_path: *const u8,
    /// Target bytes pointer
    pub target_bytes: *const u8,
    /// Target bytes length
    pub target_bytes_len: usize,
}

/// Process created event constant
pub const EVENT_PROCESS_CREATED: u32 = 1;
/// DLL loaded event constant
pub const EVENT_DLL_LOADED: u32 = 2;
/// Initial breakpoint event constant
pub const EVENT_INITIAL_BREAKPOINT: u32 = 3;
/// Process execution finished event constant
pub const EVENT_FINISHED: u32 = 4;
/// Thread created event constant
pub const EVENT_THREAD_CREATED: u32 = 5;
/// Thread finished event constant
pub const EVENT_THREAD_FINISHED: u32 = 6;
/// Debug string event constant
pub const EVENT_DEBUG_STRING: u32 = 7;
/// Agent initialized event constant
pub const EVENT_AGENT_INITIALIZED: u32 = 8;
/// Agent finished execution event constant
pub const EVENT_AGENT_FINISHED: u32 = 9;
#[repr(C)]
/// FFI-safe version of the check result array
pub struct FfiResultArray {
    /// Pointer to data
    pub ptr: *mut FfiCheckResult,
    /// Size of data
    pub len: usize,
}

#[repr(C)]
/// FFI-safe array of owned strings.
pub struct FfiStringArray {
    /// Pointer to string pointers.
    pub ptr: *mut *mut std::os::raw::c_char,
    /// Number of strings.
    pub len: usize,
}

#[repr(C)]
/// FFI-safe version of [`cradle_shared::CheckResult`]
pub struct FfiCheckResult {
    /// Plugin name ptr
    pub plugin: *mut std::os::raw::c_char,
    /// Check name ptr
    pub check: *mut std::os::raw::c_char,
    /// Severity level
    pub severity: u32,
    /// Message ptr
    pub message: *mut std::os::raw::c_char,
    /// Details ptr
    pub details: *mut std::os::raw::c_char,
}