#![warn(
clippy::cargo,
clippy::missing_docs_in_private_items,
clippy::nursery,
clippy::pedantic,
missing_docs
)]
#![cfg_attr(
feature = "nightly",
feature(external_doc),
doc(include = "../README.md")
)]
#![cfg_attr(not(feature = "nightly"), doc = "")]
use std::{
fmt::Debug,
os::raw::{c_char, c_int, c_void},
};
#[allow(non_camel_case_types)]
pub type c_wchar = u16;
pub const SDK_USER_AGENT: &str = "sentry.native/0.4.9";
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Options([u8; 0]);
#[repr(C)]
#[derive(Copy, Clone)]
#[allow(clippy::missing_docs_in_private_items)]
pub union Value {
_bits: u64,
_double: f64,
_bindgen_union_align: u64,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Uuid {
pub bytes: [c_char; 16],
}
#[repr(i32)]
#[derive(Debug, Copy, Clone)]
pub enum Level {
Debug = -1,
Info = 0,
Warning = 1,
Error = 2,
Fatal = 3,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone)]
pub enum ValueType {
Null = 0,
Bool = 1,
Int = 2,
Double = 3,
String = 4,
List = 5,
Object = 6,
}
#[repr(i32)]
#[derive(Debug, Copy, Clone)]
pub enum UserConsent {
Unknown = -1,
Given = 1,
Revoked = 0,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Transport([u8; 0]);
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Envelope([u8; 0]);
pub type EventFunction =
extern "C" fn(event: Value, hint: *mut c_void, closure: *mut c_void) -> Value;
pub type LoggerFunction =
extern "C" fn(level: i32, message: *const c_char, args: *mut c_void, userdata: *mut c_void);
pub type SendEnvelopeFunction = extern "C" fn(envelope: *mut Envelope, state: *mut c_void);
pub type StartupFunction = extern "C" fn(options: *const Options, state: *mut c_void) -> c_int;
pub type ShutdownFunction = extern "C" fn(timeout: u64, state: *mut c_void) -> c_int;
extern "C" {
#[link_name = "sentry_free"]
pub fn free(ptr: *mut c_void);
#[link_name = "sentry_value_incref"]
pub fn value_incref(value: Value);
#[link_name = "sentry_value_decref"]
pub fn value_decref(value: Value);
#[link_name = "sentry_value_new_null"]
pub fn value_new_null() -> Value;
#[link_name = "sentry_value_new_int32"]
pub fn value_new_int32(value: i32) -> Value;
#[link_name = "sentry_value_new_double"]
pub fn value_new_double(value: f64) -> Value;
#[link_name = "sentry_value_new_bool"]
pub fn value_new_bool(value: c_int) -> Value;
#[link_name = "sentry_value_new_string"]
pub fn value_new_string(value: *const c_char) -> Value;
#[link_name = "sentry_value_new_list"]
pub fn value_new_list() -> Value;
#[link_name = "sentry_value_new_object"]
pub fn value_new_object() -> Value;
#[link_name = "sentry_value_get_type"]
pub fn value_get_type(value: Value) -> ValueType;
#[link_name = "sentry_value_set_by_key"]
pub fn value_set_by_key(value: Value, k: *const c_char, v: Value) -> c_int;
#[link_name = "sentry_value_remove_by_key"]
pub fn value_remove_by_key(value: Value, k: *const c_char) -> c_int;
#[link_name = "sentry_value_append"]
pub fn value_append(value: Value, v: Value) -> c_int;
#[link_name = "sentry_value_set_by_index"]
pub fn value_set_by_index(value: Value, index: usize, v: Value) -> c_int;
#[link_name = "sentry_value_remove_by_index"]
pub fn value_remove_by_index(value: Value, index: usize) -> c_int;
#[link_name = "sentry_value_get_by_key"]
pub fn value_get_by_key(value: Value, k: *const c_char) -> Value;
#[link_name = "sentry_value_get_by_key_owned"]
pub fn value_get_by_key_owned(value: Value, k: *const c_char) -> Value;
#[link_name = "sentry_value_get_by_index"]
pub fn value_get_by_index(value: Value, index: usize) -> Value;
#[link_name = "sentry_value_get_by_index_owned"]
pub fn value_get_by_index_owned(value: Value, index: usize) -> Value;
#[link_name = "sentry_value_get_length"]
pub fn value_get_length(value: Value) -> usize;
#[link_name = "sentry_value_as_int32"]
pub fn value_as_int32(value: Value) -> i32;
#[link_name = "sentry_value_as_double"]
pub fn value_as_double(value: Value) -> f64;
#[link_name = "sentry_value_as_string"]
pub fn value_as_string(value: Value) -> *const c_char;
#[link_name = "sentry_value_is_true"]
pub fn value_is_true(value: Value) -> c_int;
#[link_name = "sentry_value_new_event"]
pub fn value_new_event() -> Value;
#[link_name = "sentry_value_new_message_event"]
pub fn value_new_message_event(level: i32, logger: *const c_char, text: *const c_char)
-> Value;
#[link_name = "sentry_value_new_breadcrumb"]
pub fn value_new_breadcrumb(type_: *const c_char, message: *const c_char) -> Value;
#[link_name = "sentry_value_new_exception"]
pub fn value_new_exception(type_: *const c_char, value: *const c_char) -> Value;
#[link_name = "sentry_value_new_thread"]
pub fn value_new_thread(id: u64, value: *const c_char) -> Value;
#[link_name = "sentry_value_new_stacktrace"]
pub fn value_new_stacktrace(ips: *mut *mut c_void, len: usize) -> Value;
#[link_name = "sentry_event_add_exception"]
pub fn event_add_exception(event: Value, exception: Value);
#[link_name = "sentry_event_add_thread"]
pub fn event_add_thread(event: Value, thread: Value);
#[link_name = "sentry_value_to_msgpack"]
pub fn value_to_msgpack(value: Value, size_out: *mut usize) -> *mut c_char;
#[link_name = "sentry_event_value_add_stacktrace"]
pub fn event_value_add_stacktrace(event: Value, ips: *mut *mut c_void, len: usize);
#[link_name = "sentry_uuid_nil"]
pub fn uuid_nil() -> Uuid;
#[link_name = "sentry_uuid_as_string"]
pub fn uuid_as_string(uuid: *const Uuid, str: *mut c_char);
#[link_name = "sentry_envelope_free"]
pub fn envelope_free(envelope: *mut Envelope);
#[link_name = "sentry_envelope_get_event"]
pub fn envelope_get_event(envelope: *const Envelope) -> Value;
#[link_name = "sentry_envelope_serialize"]
pub fn envelope_serialize(envelope: *const Envelope, size: *mut usize) -> *const c_char;
#[link_name = "sentry_transport_new"]
pub fn transport_new(send_func: Option<SendEnvelopeFunction>) -> *mut Transport;
#[link_name = "sentry_transport_set_state"]
pub fn transport_set_state(transport: *mut Transport, state: *mut c_void);
#[link_name = "sentry_transport_set_free_func"]
pub fn transport_set_free_func(
transport: *mut Transport,
free_func: Option<extern "C" fn(state: *mut c_void)>,
);
#[link_name = "sentry_transport_set_startup_func"]
pub fn transport_set_startup_func(
transport: *mut Transport,
startup_func: Option<StartupFunction>,
);
#[link_name = "sentry_transport_set_shutdown_func"]
pub fn transport_set_shutdown_func(
transport: *mut Transport,
shutdown_func: Option<ShutdownFunction>,
);
#[link_name = "sentry_transport_free"]
pub fn transport_free(transport: *mut Transport);
#[link_name = "sentry_options_new"]
pub fn options_new() -> *mut Options;
#[link_name = "sentry_options_free"]
pub fn options_free(opts: *mut Options);
#[link_name = "sentry_options_set_transport"]
pub fn options_set_transport(opts: *mut Options, transport: *mut Transport);
#[link_name = "sentry_options_set_before_send"]
pub fn options_set_before_send(
opts: *mut Options,
func: Option<EventFunction>,
data: *mut c_void,
);
#[link_name = "sentry_options_set_dsn"]
pub fn options_set_dsn(opts: *mut Options, dsn: *const c_char);
#[link_name = "sentry_options_get_dsn"]
pub fn options_get_dsn(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_sample_rate"]
pub fn options_set_sample_rate(opts: *mut Options, sample_rate: f64);
#[link_name = "sentry_options_get_sample_rate"]
pub fn options_get_sample_rate(opts: *const Options) -> f64;
#[link_name = "sentry_options_set_release"]
pub fn options_set_release(opts: *mut Options, release: *const c_char);
#[link_name = "sentry_options_get_release"]
pub fn options_get_release(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_environment"]
pub fn options_set_environment(opts: *mut Options, environment: *const c_char);
#[link_name = "sentry_options_get_environment"]
pub fn options_get_environment(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_dist"]
pub fn options_set_dist(opts: *mut Options, dist: *const c_char);
#[link_name = "sentry_options_get_dist"]
pub fn options_get_dist(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_http_proxy"]
pub fn options_set_http_proxy(opts: *mut Options, proxy: *const c_char);
#[link_name = "sentry_options_get_http_proxy"]
pub fn options_get_http_proxy(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_ca_certs"]
pub fn options_set_ca_certs(opts: *mut Options, path: *const c_char);
#[link_name = "sentry_options_get_ca_certs"]
pub fn options_get_ca_certs(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_transport_thread_name"]
pub fn options_set_transport_thread_name(opts: *mut Options, name: *const c_char);
#[link_name = "sentry_options_get_transport_thread_name"]
pub fn options_get_transport_thread_name(opts: *const Options) -> *const c_char;
#[link_name = "sentry_options_set_debug"]
pub fn options_set_debug(opts: *mut Options, debug: c_int);
#[link_name = "sentry_options_get_debug"]
pub fn options_get_debug(opts: *const Options) -> c_int;
#[link_name = "sentry_options_set_max_breadcrumbs"]
pub fn options_set_max_breadcrumbs(opts: *mut Options, max_breadcrumbs: usize);
#[link_name = "sentry_options_get_max_breadcrumbs"]
pub fn options_get_max_breadcrumbs(opts: *const Options) -> usize;
#[link_name = "sentry_options_set_logger"]
pub fn options_set_logger(
opts: *mut Options,
logger_func: Option<LoggerFunction>,
userdata: *mut c_void,
);
#[link_name = "sentry_options_set_auto_session_tracking"]
pub fn options_set_auto_session_tracking(opts: *mut Options, val: c_int);
#[link_name = "sentry_options_get_auto_session_tracking"]
pub fn options_get_auto_session_tracking(opts: *const Options) -> c_int;
#[link_name = "sentry_options_set_require_user_consent"]
pub fn options_set_require_user_consent(opts: *mut Options, val: c_int);
#[link_name = "sentry_options_get_require_user_consent"]
pub fn options_get_require_user_consent(opts: *const Options) -> c_int;
#[link_name = "sentry_options_set_symbolize_stacktraces"]
pub fn options_set_symbolize_stacktraces(opts: *const Options, val: c_int);
#[link_name = "sentry_options_get_symbolize_stacktraces"]
pub fn options_get_symbolize_stacktraces(opts: *const Options) -> c_int;
#[link_name = "sentry_options_add_attachment"]
pub fn options_add_attachment(opts: *mut Options, path: *const c_char);
#[link_name = "sentry_options_set_handler_path"]
pub fn options_set_handler_path(opts: *mut Options, path: *const c_char);
#[link_name = "sentry_options_set_database_path"]
pub fn options_set_database_path(opts: *mut Options, path: *const c_char);
#[link_name = "sentry_options_add_attachmentw"]
pub fn options_add_attachmentw(opts: *mut Options, path: *const c_wchar);
#[link_name = "sentry_options_set_handler_pathw"]
pub fn options_set_handler_pathw(opts: *mut Options, path: *const c_wchar);
#[link_name = "sentry_options_set_database_pathw"]
pub fn options_set_database_pathw(opts: *mut Options, path: *const c_wchar);
#[link_name = "sentry_options_set_system_crash_reporter_enabled"]
pub fn options_set_system_crash_reporter_enabled(opts: *mut Options, enabled: c_int);
#[link_name = "sentry_init"]
pub fn init(options: *mut Options) -> c_int;
#[link_name = "sentry_close"]
pub fn close() -> c_int;
#[link_name = "sentry_get_modules_list"]
pub fn get_modules_list() -> Value;
#[link_name = "sentry_clear_modulecache"]
pub fn clear_modulecache();
#[link_name = "sentry_reinstall_backend"]
pub fn reinstall_backend() -> c_int;
#[link_name = "sentry_user_consent_give"]
pub fn user_consent_give();
#[link_name = "sentry_user_consent_revoke"]
pub fn user_consent_revoke();
#[link_name = "sentry_user_consent_reset"]
pub fn user_consent_reset();
#[link_name = "sentry_user_consent_get"]
pub fn user_consent_get() -> UserConsent;
#[link_name = "sentry_capture_event"]
pub fn capture_event(event: Value) -> Uuid;
#[link_name = "sentry_add_breadcrumb"]
pub fn add_breadcrumb(breadcrumb: Value);
#[link_name = "sentry_set_user"]
pub fn set_user(user: Value);
#[link_name = "sentry_remove_user"]
pub fn remove_user();
#[link_name = "sentry_set_tag"]
pub fn set_tag(key: *const c_char, value: *const c_char);
#[link_name = "sentry_remove_tag"]
pub fn remove_tag(key: *const c_char);
#[link_name = "sentry_set_extra"]
pub fn set_extra(key: *const c_char, value: Value);
#[link_name = "sentry_remove_extra"]
pub fn remove_extra(key: *const c_char);
#[link_name = "sentry_set_context"]
pub fn set_context(key: *const c_char, value: Value);
#[link_name = "sentry_remove_context"]
pub fn remove_context(key: *const c_char);
#[link_name = "sentry_set_fingerprint"]
pub fn set_fingerprint(fingerprint: *const c_char, ...);
#[link_name = "sentry_remove_fingerprint"]
pub fn remove_fingerprint();
#[link_name = "sentry_set_transaction"]
pub fn set_transaction(transaction: *const c_char);
#[link_name = "sentry_remove_transaction"]
pub fn remove_transaction();
#[link_name = "sentry_set_level"]
pub fn set_level(level: i32);
#[link_name = "sentry_start_session"]
pub fn start_session();
#[link_name = "sentry_end_session"]
pub fn end_session();
}