#[repr(C)]pub struct Callbacks {
pub context: *mut c_void,
pub start_thread: unsafe extern "C" fn(context: *mut c_void, arg: *const c_void),
pub on_new_session: unsafe extern "C" fn(context: *mut c_void, session: *const Session),
pub on_requests: unsafe extern "C" fn(context: *mut c_void, requests: *mut Request, request_count: usize),
pub log: unsafe extern "C" fn(context: *mut c_void, message: *const c_char, message_len: usize),
}Fields§
§context: *mut c_voidAn opaque context object retained by this library. The library will pass this back into all
callbacks. The memory pointed to by context must last until block_server_delete is
called.
start_thread: unsafe extern "C" fn(context: *mut c_void, arg: *const c_void)Starts a thread. The implementation must call block_server_thread on this newly created
thread, providing arg. The implementation must then call block_server_thread_delete
after block_server_thread returns (but before block_server_delete is called).
on_new_session: unsafe extern "C" fn(context: *mut c_void, session: *const Session)Notifies the implementation of a new session. The implementation must call
block_server_session_run on a separate thread, and must call
block_server_session_release after block_server_session_run (but before
block_server_delete is called).
on_requests: unsafe extern "C" fn(context: *mut c_void, requests: *mut Request, request_count: usize)Submits a batch of requests to be handled by the implementation. The implementation must
not retain references to requests after it returns. The implementation must ensure that
block_server_send_reply is called exactly once with the request ID of each entry in
requests, regardless of its status; this call can be asynchronous but must occur before
block_server_delete is called.
log: unsafe extern "C" fn(context: *mut c_void, message: *const c_char, message_len: usize)Logs message to the implementation’s logger. The implementation must not retain
references to message.