185 lines
5.3 KiB
C
185 lines
5.3 KiB
C
#ifndef VOID_PLUGIN_CABI_H
|
|
#define VOID_PLUGIN_CABI_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define VOID_CABI_MAJOR_V1 UINT32_C(1)
|
|
#define VOID_CABI_MINOR_V1 UINT32_C(0)
|
|
#define VOID_MODULE_QUERY_SYMBOL_V1 "void_module_query_v1"
|
|
|
|
#define VOID_CAP_STATELESS_RELOAD (UINT64_C(1) << 0)
|
|
#define VOID_CAP_STATEFUL_CHECKPOINT (UINT64_C(1) << 1)
|
|
#define VOID_CAP_ASYNC_OPS (UINT64_C(1) << 2)
|
|
#define VOID_CAP_SERVICE_INTERFACES (UINT64_C(1) << 3)
|
|
|
|
enum void_status_v1 {
|
|
VOID_STATUS_OK = 0,
|
|
VOID_STATUS_INVALID_ARGUMENT = 1,
|
|
VOID_STATUS_NOT_FOUND = 2,
|
|
VOID_STATUS_CONFLICT = 3,
|
|
VOID_STATUS_CANCELLED = 4,
|
|
VOID_STATUS_TIMEOUT = 5,
|
|
VOID_STATUS_OVERLOADED = 6,
|
|
VOID_STATUS_UNSUPPORTED = 7,
|
|
VOID_STATUS_CORRUPT = 8,
|
|
VOID_STATUS_EXHAUSTED = 9,
|
|
VOID_STATUS_INTERNAL = 10,
|
|
VOID_STATUS_NOT_READY = 11,
|
|
VOID_STATUS_QUIESCING = 12,
|
|
VOID_STATUS_STATE_REJECTED = 13,
|
|
VOID_STATUS_RESTART_REQUIRED = 14
|
|
};
|
|
|
|
enum void_activation_policy_v1 {
|
|
VOID_POLICY_RELOADABLE = 0,
|
|
VOID_POLICY_RESTART_REQUIRED = 1,
|
|
VOID_POLICY_INSTALLER_REQUIRED = 2
|
|
};
|
|
|
|
typedef struct void_module_handle void_module_handle;
|
|
typedef struct void_operation_handle void_operation_handle;
|
|
typedef struct void_host_context void_host_context;
|
|
|
|
typedef struct void_bytes_v1 {
|
|
const uint8_t* data;
|
|
uint64_t size;
|
|
} void_bytes_v1;
|
|
|
|
typedef struct void_owned_bytes_v1 {
|
|
const uint8_t* data;
|
|
uint64_t size;
|
|
void (*release)(void* release_ctx, const uint8_t* data, uint64_t size);
|
|
void* release_ctx;
|
|
} void_owned_bytes_v1;
|
|
|
|
typedef struct void_interface_id_v1 {
|
|
uint8_t bytes[16];
|
|
} void_interface_id_v1;
|
|
|
|
typedef struct void_dependency_v1 {
|
|
const char* module_id;
|
|
const char* version_range;
|
|
uint8_t optional_dep;
|
|
uint8_t reserved[7];
|
|
} void_dependency_v1;
|
|
|
|
typedef struct void_module_info_v1 {
|
|
uint32_t struct_size;
|
|
uint32_t reserved;
|
|
const char* module_id;
|
|
const char* version;
|
|
uint32_t activation_policy;
|
|
uint32_t state_schema_version;
|
|
const void_dependency_v1* dependencies;
|
|
uint64_t dependency_count;
|
|
} void_module_info_v1;
|
|
|
|
typedef struct void_op_options_v1 {
|
|
uint32_t struct_size;
|
|
uint32_t flags;
|
|
uint64_t deadline_ns;
|
|
uint8_t stop_requested;
|
|
uint8_t reserved[7];
|
|
} void_op_options_v1;
|
|
|
|
typedef struct void_error_detail_v1 {
|
|
uint32_t struct_size;
|
|
int32_t status;
|
|
const char* message;
|
|
void (*release)(void* release_ctx, const char* message);
|
|
void* release_ctx;
|
|
} void_error_detail_v1;
|
|
|
|
typedef struct void_interface_view_v1 {
|
|
uint32_t struct_size;
|
|
uint32_t major;
|
|
uint32_t minor;
|
|
uint32_t table_size;
|
|
const void* function_table;
|
|
} void_interface_view_v1;
|
|
|
|
typedef struct void_host_api_v1 {
|
|
uint32_t struct_size;
|
|
uint32_t abi_major;
|
|
uint32_t abi_minor;
|
|
uint32_t reserved;
|
|
void_host_context* host_ctx;
|
|
uint64_t generation;
|
|
uint64_t (*monotonic_now_ns)(void_host_context* ctx);
|
|
int32_t (*acquire_activity_pin)(void_host_context* ctx, uint64_t generation);
|
|
void (*release_activity_pin)(void_host_context* ctx, uint64_t generation);
|
|
void (*log_message)(void_host_context* ctx, int32_t level, const char* msg);
|
|
} void_host_api_v1;
|
|
|
|
typedef void (*void_async_complete_fn)(void* user_ctx,
|
|
int32_t status,
|
|
const void_bytes_v1* result_bytes);
|
|
|
|
typedef struct void_module_api_v1 {
|
|
uint32_t struct_size;
|
|
uint32_t abi_major;
|
|
uint32_t abi_minor;
|
|
uint32_t reserved;
|
|
uint64_t capabilities;
|
|
|
|
int32_t (*get_info)(void_module_info_v1* out_info);
|
|
int32_t (*create)(const void_host_api_v1* host_api,
|
|
void_module_handle** out_handle);
|
|
int32_t (*activate)(void_module_handle* handle,
|
|
void_bytes_v1 config,
|
|
void_error_detail_v1* out_err);
|
|
int32_t (*readiness)(void_module_handle* handle,
|
|
uint32_t* out_ready,
|
|
void_error_detail_v1* out_err);
|
|
int32_t (*quiesce)(void_module_handle* handle,
|
|
const void_op_options_v1* opts,
|
|
void_error_detail_v1* out_err);
|
|
int32_t (*resume)(void_module_handle* handle, void_error_detail_v1* out_err);
|
|
int32_t (*checkpoint)(void_module_handle* handle,
|
|
const void_op_options_v1* opts,
|
|
void_owned_bytes_v1* out_state,
|
|
void_error_detail_v1* out_err);
|
|
int32_t (*restore)(void_module_handle* handle,
|
|
void_bytes_v1 state,
|
|
void_error_detail_v1* out_err);
|
|
int32_t (*query_interface)(void_module_handle* handle,
|
|
const void_interface_id_v1* iface_id,
|
|
uint32_t min_major,
|
|
uint32_t min_table_size,
|
|
void_interface_view_v1* out_view);
|
|
void (*release_interface)(void_module_handle* handle,
|
|
const void_interface_id_v1* iface_id,
|
|
const void_interface_view_v1* view);
|
|
int32_t (*submit_async)(void_module_handle* handle,
|
|
uint32_t op_kind,
|
|
void_bytes_v1 payload,
|
|
const void_op_options_v1* opts,
|
|
void_async_complete_fn cb,
|
|
void* cb_ctx,
|
|
void_operation_handle** out_op,
|
|
void_error_detail_v1* out_err);
|
|
int32_t (*cancel_async)(void_module_handle* handle,
|
|
void_operation_handle* op);
|
|
void (*release_async)(void_module_handle* handle,
|
|
void_operation_handle* op);
|
|
int32_t (*request_stop)(void_module_handle* handle);
|
|
int32_t (*deactivate)(void_module_handle* handle);
|
|
void (*destroy)(void_module_handle* handle);
|
|
} void_module_api_v1;
|
|
|
|
#define VOID_MODULE_API_V1_MIN_SIZE sizeof(void_module_api_v1)
|
|
|
|
typedef int32_t (*void_module_query_v1_fn)(uint32_t host_struct_size,
|
|
void_module_api_v1* out_api);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* VOID_PLUGIN_CABI_H */
|