actr_framework/guest/vtable.rs
1//! Host callback function table for dynclib guests.
2//!
3//! Dynclib guests use a single business entry point plus a buffer free callback.
4
5/// Host callback function pointer table.
6///
7/// # Safety
8///
9/// - All function pointers remain valid from `actr_init` until process exit.
10/// - The host guarantees serialized entry per guest instance.
11/// - All buffers returned by `invoke` must be released with `free_host_buf`.
12/// - Context tokens remain valid while retained by the guest.
13#[repr(C)]
14pub struct HostVTable {
15 /// Retain a host bridge token for a cloned or background context.
16 pub retain_context: unsafe extern "C" fn(u64) -> i32,
17
18 /// Release a previously retained host bridge token.
19 pub release_context: unsafe extern "C" fn(u64),
20
21 /// Invoke a host operation encoded as `AbiFrame` through a retained token.
22 pub invoke: unsafe extern "C" fn(u64, *const u8, usize, *mut *mut u8, *mut usize) -> i32,
23
24 /// Free a host-allocated buffer returned by `invoke`.
25 pub free_host_buf: unsafe extern "C" fn(*mut u8, usize),
26}