diff --git a/.gitignore b/.gitignore index 96ef6c0b..c640ca53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target Cargo.lock +.vscode diff --git a/FRIDA_VERSION b/FRIDA_VERSION index 781b9682..b5b922b0 100644 --- a/FRIDA_VERSION +++ b/FRIDA_VERSION @@ -1 +1 @@ -16.5.2 +16.5.6 diff --git a/examples/gum/linux_no_std/src/main.rs b/examples/gum/linux_no_std/src/main.rs index 57db8c85..65a71f22 100644 --- a/examples/gum/linux_no_std/src/main.rs +++ b/examples/gum/linux_no_std/src/main.rs @@ -44,7 +44,7 @@ static ALLOC: Bump<[u8; HEAP_SIZE]> = Bump::uninit(); #[no_mangle] extern "C" fn main() { println!("NOSTD START"); - let gum = unsafe { Gum::obtain() }; + let gum = Gum::obtain(); println!("gum: {:p}", &gum); println!("NOSTD DONE"); unsafe { _exit(0) }; diff --git a/frida-gum-sys/FRIDA_VERSION b/frida-gum-sys/FRIDA_VERSION index 781b9682..b5b922b0 100644 --- a/frida-gum-sys/FRIDA_VERSION +++ b/frida-gum-sys/FRIDA_VERSION @@ -1 +1 @@ -16.5.2 +16.5.6 diff --git a/frida-gum-sys/build.rs b/frida-gum-sys/build.rs index 0e662585..236704df 100644 --- a/frida-gum-sys/build.rs +++ b/frida-gum-sys/build.rs @@ -14,6 +14,18 @@ fn main() { let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap(); let target_vendor = env::var("CARGO_CFG_TARGET_VENDOR").unwrap(); + + let docs = std::env::var("DOCS_RS").is_ok(); + // We always use frida-gumjs.h for docs to not have to ship two big header files in this repo. + let use_gum_js = cfg!(feature = "js") || (!cfg!(feature = "auto-download") && docs); + #[cfg(any( + feature = "event-sink", + feature = "invocation-listener", + feature = "stalker-observer", + feature = "stalker-params" + ))] + let use_gum_js_env = if use_gum_js { "1" } else { "0" }; + #[cfg(feature = "event-sink")] { println!("cargo:rerun-if-changed=event_sink.c"); @@ -72,13 +84,13 @@ fn main() { let bindings = bindings.clang_arg(format!("-I{include_dir}")); #[cfg(not(feature = "auto-download"))] - let bindings = if std::env::var("DOCS_RS").is_ok() { + let bindings = if docs { bindings.clang_arg("-Iinclude") } else { bindings }; - let bindings = if cfg!(feature = "js") { + let bindings = if use_gum_js { bindings .clang_arg("-DUSE_GUM_JS=1") .header_contents("gum.h", "#include \"frida-gumjs.h\"") @@ -109,14 +121,6 @@ fn main() { .write_to_file(out_path.join("bindings.rs")) .unwrap(); - #[cfg(any( - feature = "event-sink", - feature = "invocation-listener", - feature = "stalker-observer", - feature = "stalker-params" - ))] - let use_gum_js = if cfg!(feature = "js") { "1" } else { "0" }; - #[cfg(feature = "event-sink")] { let mut builder = cc::Build::new(); @@ -126,7 +130,7 @@ fn main() { let mut builder = builder.include(include_dir.clone()); #[cfg(not(feature = "auto-download"))] - let builder = if std::env::var("DOCS_RS").is_ok() { + let builder = if docs { builder.include("include") } else { &mut builder @@ -135,7 +139,7 @@ fn main() { builder .file("event_sink.c") .opt_level(3) - .define("USE_GUM_JS", use_gum_js) + .define("USE_GUM_JS", use_gum_js_env) .compile("event_sink"); } @@ -148,7 +152,7 @@ fn main() { let mut builder = builder.include(include_dir.clone()); #[cfg(not(feature = "auto-download"))] - let builder = if std::env::var("DOCS_RS").is_ok() { + let builder = if docs { builder.include("include") } else { &mut builder @@ -157,7 +161,7 @@ fn main() { builder .file("invocation_listener.c") .opt_level(3) - .define("USE_GUM_JS", use_gum_js) + .define("USE_GUM_JS", use_gum_js_env) .compile("invocation_listener"); let mut builder = cc::Build::new(); @@ -167,7 +171,7 @@ fn main() { let mut builder = builder.include(include_dir.clone()); #[cfg(not(feature = "auto-download"))] - let builder = if std::env::var("DOCS_RS").is_ok() { + let builder = if docs { builder.include("include") } else { &mut builder @@ -175,7 +179,7 @@ fn main() { builder .file("probe_listener.c") .opt_level(3) - .define("USE_GUM_JS", use_gum_js) + .define("USE_GUM_JS", use_gum_js_env) .compile("probe_listener"); } @@ -188,7 +192,7 @@ fn main() { let mut builder = builder.include(include_dir.clone()); #[cfg(not(feature = "auto-download"))] - let builder = if std::env::var("DOCS_RS").is_ok() { + let builder = if docs { builder.include("include") } else { &mut builder @@ -197,7 +201,7 @@ fn main() { builder .file("stalker_observer.c") .opt_level(3) - .define("USE_GUM_JS", use_gum_js) + .define("USE_GUM_JS", use_gum_js_env) .compile("stalker_observer"); } @@ -210,7 +214,7 @@ fn main() { let mut builder = builder.include(include_dir); #[cfg(not(feature = "auto-download"))] - let builder = if std::env::var("DOCS_RS").is_ok() { + let builder = if docs { builder.include("include") } else { &mut builder @@ -219,7 +223,7 @@ fn main() { builder .file("stalker_params.c") .opt_level(3) - .define("USE_GUM_JS", use_gum_js) + .define("USE_GUM_JS", use_gum_js_env) .compile("stalker_params"); } diff --git a/frida-gum-sys/include/frida-gum.h b/frida-gum-sys/include/frida-gumjs.h similarity index 61% rename from frida-gum-sys/include/frida-gum.h rename to frida-gum-sys/include/frida-gumjs.h index b9449ca4..35652026 100644 --- a/frida-gum-sys/include/frida-gum.h +++ b/frida-gum-sys/include/frida-gumjs.h @@ -1,3 +1,7 @@ +#ifndef GUM_STATIC +# define GUM_STATIC +#endif + #ifndef __FRIDA_SYMBOL_MAPPINGS__ #define __FRIDA_SYMBOL_MAPPINGS__ @@ -4615,28 +4619,418 @@ #define glib_shutdown _frida_glib_shutdown #define glib_thread_callbacks _frida_glib_thread_callbacks #define gobject_init _frida_gobject_init +#define json_array_add_array_element _frida_json_array_add_array_element +#define json_array_add_boolean_element _frida_json_array_add_boolean_element +#define json_array_add_double_element _frida_json_array_add_double_element +#define json_array_add_element _frida_json_array_add_element +#define json_array_add_int_element _frida_json_array_add_int_element +#define json_array_add_null_element _frida_json_array_add_null_element +#define json_array_add_object_element _frida_json_array_add_object_element +#define json_array_add_string_element _frida_json_array_add_string_element +#define json_array_copy _frida_json_array_copy +#define json_array_dup_element _frida_json_array_dup_element +#define json_array_equal _frida_json_array_equal +#define json_array_foreach_element _frida_json_array_foreach_element +#define json_array_get_array_element _frida_json_array_get_array_element +#define json_array_get_boolean_element _frida_json_array_get_boolean_element +#define json_array_get_double_element _frida_json_array_get_double_element +#define json_array_get_element _frida_json_array_get_element +#define json_array_get_elements _frida_json_array_get_elements +#define json_array_get_int_element _frida_json_array_get_int_element +#define json_array_get_length _frida_json_array_get_length +#define json_array_get_null_element _frida_json_array_get_null_element +#define json_array_get_object_element _frida_json_array_get_object_element +#define json_array_get_string_element _frida_json_array_get_string_element +#define json_array_get_type _frida_json_array_get_type +#define json_array_hash _frida_json_array_hash +#define json_array_is_immutable _frida_json_array_is_immutable +#define json_array_new _frida_json_array_new +#define json_array_ref _frida_json_array_ref +#define json_array_remove_element _frida_json_array_remove_element +#define json_array_seal _frida_json_array_seal +#define json_array_sized_new _frida_json_array_sized_new +#define json_array_unref _frida_json_array_unref +#define json_boxed_can_deserialize _frida_json_boxed_can_deserialize +#define json_boxed_can_serialize _frida_json_boxed_can_serialize +#define json_boxed_deserialize _frida_json_boxed_deserialize +#define json_boxed_register_deserialize_func _frida_json_boxed_register_deserialize_func +#define json_boxed_register_serialize_func _frida_json_boxed_register_serialize_func +#define json_boxed_serialize _frida_json_boxed_serialize +#define json_builder_add_boolean_value _frida_json_builder_add_boolean_value +#define json_builder_add_double_value _frida_json_builder_add_double_value +#define json_builder_add_int_value _frida_json_builder_add_int_value +#define json_builder_add_null_value _frida_json_builder_add_null_value +#define json_builder_add_string_value _frida_json_builder_add_string_value +#define json_builder_add_value _frida_json_builder_add_value +#define json_builder_begin_array _frida_json_builder_begin_array +#define json_builder_begin_object _frida_json_builder_begin_object +#define json_builder_end_array _frida_json_builder_end_array +#define json_builder_end_object _frida_json_builder_end_object +#define json_builder_get_root _frida_json_builder_get_root +#define json_builder_get_type _frida_json_builder_get_type +#define json_builder_new _frida_json_builder_new +#define json_builder_new_immutable _frida_json_builder_new_immutable +#define json_builder_reset _frida_json_builder_reset +#define json_builder_set_member_name _frida_json_builder_set_member_name +#define json_construct_gobject _frida_json_construct_gobject +#define json_deserialize_pspec _frida_json_deserialize_pspec +#define json_from_string _frida_json_from_string +#define json_generator_get_indent _frida_json_generator_get_indent +#define json_generator_get_indent_char _frida_json_generator_get_indent_char +#define json_generator_get_pretty _frida_json_generator_get_pretty +#define json_generator_get_root _frida_json_generator_get_root +#define json_generator_get_type _frida_json_generator_get_type +#define json_generator_new _frida_json_generator_new +#define json_generator_set_indent _frida_json_generator_set_indent +#define json_generator_set_indent_char _frida_json_generator_set_indent_char +#define json_generator_set_pretty _frida_json_generator_set_pretty +#define json_generator_set_root _frida_json_generator_set_root +#define json_generator_to_data _frida_json_generator_to_data +#define json_generator_to_file _frida_json_generator_to_file +#define json_generator_to_gstring _frida_json_generator_to_gstring +#define json_generator_to_stream _frida_json_generator_to_stream +#define json_get_debug_flags _frida_json_get_debug_flags +#define json_gobject_deserialize _frida_json_gobject_deserialize +#define json_gobject_from_data _frida_json_gobject_from_data +#define json_gobject_serialize _frida_json_gobject_serialize +#define json_gobject_to_data _frida_json_gobject_to_data +#define json_gvariant_deserialize _frida_json_gvariant_deserialize +#define json_gvariant_deserialize_data _frida_json_gvariant_deserialize_data +#define json_gvariant_serialize _frida_json_gvariant_serialize +#define json_gvariant_serialize_data _frida_json_gvariant_serialize_data +#define json_node_alloc _frida_json_node_alloc +#define json_node_copy _frida_json_node_copy +#define json_node_dup_array _frida_json_node_dup_array +#define json_node_dup_object _frida_json_node_dup_object +#define json_node_dup_string _frida_json_node_dup_string +#define json_node_equal _frida_json_node_equal +#define json_node_free _frida_json_node_free +#define json_node_get_array _frida_json_node_get_array +#define json_node_get_boolean _frida_json_node_get_boolean +#define json_node_get_double _frida_json_node_get_double +#define json_node_get_int _frida_json_node_get_int +#define json_node_get_node_type _frida_json_node_get_node_type +#define json_node_get_object _frida_json_node_get_object +#define json_node_get_parent _frida_json_node_get_parent +#define json_node_get_string _frida_json_node_get_string +#define json_node_get_type _frida_json_node_get_type +#define json_node_get_value _frida_json_node_get_value +#define json_node_get_value_type _frida_json_node_get_value_type +#define json_node_hash _frida_json_node_hash +#define json_node_init _frida_json_node_init +#define json_node_init_array _frida_json_node_init_array +#define json_node_init_boolean _frida_json_node_init_boolean +#define json_node_init_double _frida_json_node_init_double +#define json_node_init_int _frida_json_node_init_int +#define json_node_init_null _frida_json_node_init_null +#define json_node_init_object _frida_json_node_init_object +#define json_node_init_string _frida_json_node_init_string +#define json_node_is_immutable _frida_json_node_is_immutable +#define json_node_is_null _frida_json_node_is_null +#define json_node_new _frida_json_node_new +#define json_node_ref _frida_json_node_ref +#define json_node_seal _frida_json_node_seal +#define json_node_set_array _frida_json_node_set_array +#define json_node_set_boolean _frida_json_node_set_boolean +#define json_node_set_double _frida_json_node_set_double +#define json_node_set_int _frida_json_node_set_int +#define json_node_set_object _frida_json_node_set_object +#define json_node_set_parent _frida_json_node_set_parent +#define json_node_set_string _frida_json_node_set_string +#define json_node_set_value _frida_json_node_set_value +#define json_node_take_array _frida_json_node_take_array +#define json_node_take_object _frida_json_node_take_object +#define json_node_type_get_name _frida_json_node_type_get_name +#define json_node_type_get_type _frida_json_node_type_get_type +#define json_node_type_name _frida_json_node_type_name +#define json_node_unref _frida_json_node_unref +#define json_object_add_member _frida_json_object_add_member +#define json_object_copy _frida_json_object_copy +#define json_object_dup_member _frida_json_object_dup_member +#define json_object_equal _frida_json_object_equal +#define json_object_foreach_member _frida_json_object_foreach_member +#define json_object_get_array_member _frida_json_object_get_array_member +#define json_object_get_boolean_member _frida_json_object_get_boolean_member +#define json_object_get_boolean_member_with_default _frida_json_object_get_boolean_member_with_default +#define json_object_get_double_member _frida_json_object_get_double_member +#define json_object_get_double_member_with_default _frida_json_object_get_double_member_with_default +#define json_object_get_int_member _frida_json_object_get_int_member +#define json_object_get_int_member_with_default _frida_json_object_get_int_member_with_default +#define json_object_get_member _frida_json_object_get_member +#define json_object_get_members _frida_json_object_get_members +#define json_object_get_members_internal _frida_json_object_get_members_internal +#define json_object_get_null_member _frida_json_object_get_null_member +#define json_object_get_object_member _frida_json_object_get_object_member +#define json_object_get_size _frida_json_object_get_size +#define json_object_get_string_member _frida_json_object_get_string_member +#define json_object_get_string_member_with_default _frida_json_object_get_string_member_with_default +#define json_object_get_type _frida_json_object_get_type +#define json_object_get_values _frida_json_object_get_values +#define json_object_has_member _frida_json_object_has_member +#define json_object_hash _frida_json_object_hash +#define json_object_is_immutable _frida_json_object_is_immutable +#define json_object_iter_init _frida_json_object_iter_init +#define json_object_iter_init_ordered _frida_json_object_iter_init_ordered +#define json_object_iter_next _frida_json_object_iter_next +#define json_object_iter_next_ordered _frida_json_object_iter_next_ordered +#define json_object_new _frida_json_object_new +#define json_object_ref _frida_json_object_ref +#define json_object_remove_member _frida_json_object_remove_member +#define json_object_seal _frida_json_object_seal +#define json_object_set_array_member _frida_json_object_set_array_member +#define json_object_set_boolean_member _frida_json_object_set_boolean_member +#define json_object_set_double_member _frida_json_object_set_double_member +#define json_object_set_int_member _frida_json_object_set_int_member +#define json_object_set_member _frida_json_object_set_member +#define json_object_set_null_member _frida_json_object_set_null_member +#define json_object_set_object_member _frida_json_object_set_object_member +#define json_object_set_string_member _frida_json_object_set_string_member +#define json_object_unref _frida_json_object_unref +#define json_parser_error_get_type _frida_json_parser_error_get_type +#define json_parser_error_quark _frida_json_parser_error_quark +#define json_parser_get_current_line _frida_json_parser_get_current_line +#define json_parser_get_current_pos _frida_json_parser_get_current_pos +#define json_parser_get_root _frida_json_parser_get_root +#define json_parser_get_type _frida_json_parser_get_type +#define json_parser_has_assignment _frida_json_parser_has_assignment +#define json_parser_load_from_data _frida_json_parser_load_from_data +#define json_parser_load_from_file _frida_json_parser_load_from_file +#define json_parser_load_from_mapped_file _frida_json_parser_load_from_mapped_file +#define json_parser_load_from_stream _frida_json_parser_load_from_stream +#define json_parser_load_from_stream_async _frida_json_parser_load_from_stream_async +#define json_parser_load_from_stream_finish _frida_json_parser_load_from_stream_finish +#define json_parser_new _frida_json_parser_new +#define json_parser_new_immutable _frida_json_parser_new_immutable +#define json_parser_steal_root _frida_json_parser_steal_root +#define json_path_compile _frida_json_path_compile +#define json_path_error_get_type _frida_json_path_error_get_type +#define json_path_error_quark _frida_json_path_error_quark +#define json_path_get_type _frida_json_path_get_type +#define json_path_match _frida_json_path_match +#define json_path_new _frida_json_path_new +#define json_path_query _frida_json_path_query +#define json_reader_count_elements _frida_json_reader_count_elements +#define json_reader_count_members _frida_json_reader_count_members +#define json_reader_end_element _frida_json_reader_end_element +#define json_reader_end_member _frida_json_reader_end_member +#define json_reader_error_get_type _frida_json_reader_error_get_type +#define json_reader_error_quark _frida_json_reader_error_quark +#define json_reader_get_boolean_value _frida_json_reader_get_boolean_value +#define json_reader_get_current_node _frida_json_reader_get_current_node +#define json_reader_get_double_value _frida_json_reader_get_double_value +#define json_reader_get_error _frida_json_reader_get_error +#define json_reader_get_int_value _frida_json_reader_get_int_value +#define json_reader_get_member_name _frida_json_reader_get_member_name +#define json_reader_get_null_value _frida_json_reader_get_null_value +#define json_reader_get_string_value _frida_json_reader_get_string_value +#define json_reader_get_type _frida_json_reader_get_type +#define json_reader_get_value _frida_json_reader_get_value +#define json_reader_is_array _frida_json_reader_is_array +#define json_reader_is_object _frida_json_reader_is_object +#define json_reader_is_value _frida_json_reader_is_value +#define json_reader_list_members _frida_json_reader_list_members +#define json_reader_new _frida_json_reader_new +#define json_reader_read_element _frida_json_reader_read_element +#define json_reader_read_member _frida_json_reader_read_member +#define json_reader_set_root _frida_json_reader_set_root +#define json_scanner_destroy _frida_json_scanner_destroy +#define json_scanner_error _frida_json_scanner_error +#define json_scanner_get_next_token _frida_json_scanner_get_next_token +#define json_scanner_input_text _frida_json_scanner_input_text +#define json_scanner_new _frida_json_scanner_new +#define json_scanner_peek_next_token _frida_json_scanner_peek_next_token +#define json_scanner_scope_add_symbol _frida_json_scanner_scope_add_symbol +#define json_scanner_unexp_token _frida_json_scanner_unexp_token +#define json_serializable_default_deserialize_property _frida_json_serializable_default_deserialize_property +#define json_serializable_default_serialize_property _frida_json_serializable_default_serialize_property +#define json_serializable_deserialize_property _frida_json_serializable_deserialize_property +#define json_serializable_find_property _frida_json_serializable_find_property +#define json_serializable_get_property _frida_json_serializable_get_property +#define json_serializable_get_type _frida_json_serializable_get_type +#define json_serializable_list_properties _frida_json_serializable_list_properties +#define json_serializable_serialize_property _frida_json_serializable_serialize_property +#define json_serializable_set_property _frida_json_serializable_set_property +#define json_serialize_gobject _frida_json_serialize_gobject +#define json_serialize_pspec _frida_json_serialize_pspec +#define json_string_compare _frida_json_string_compare +#define json_string_equal _frida_json_string_equal +#define json_string_hash _frida_json_string_hash +#define json_to_string _frida_json_to_string +#define json_value_alloc _frida_json_value_alloc +#define json_value_free _frida_json_value_free +#define json_value_get_boolean _frida_json_value_get_boolean +#define json_value_get_double _frida_json_value_get_double +#define json_value_get_int _frida_json_value_get_int +#define json_value_get_string _frida_json_value_get_string +#define json_value_hash _frida_json_value_hash +#define json_value_init _frida_json_value_init +#define json_value_ref _frida_json_value_ref +#define json_value_seal _frida_json_value_seal +#define json_value_set_boolean _frida_json_value_set_boolean +#define json_value_set_double _frida_json_value_set_double +#define json_value_set_int _frida_json_value_set_int +#define json_value_set_string _frida_json_value_set_string +#define json_value_type _frida_json_value_type +#define json_value_type_get_name _frida_json_value_type_get_name +#define json_value_unref _frida_json_value_unref +#define json_value_unset _frida_json_value_unset #endif /* - * Copyright (C) 2008-2023 Ole André Vadla Ravnås + * Copyright (C) 2010-2022 Ole André Vadla Ravnås * * Licence: wxWindows Library Licence, Version 3.1 */ -#ifndef __GUM_H__ -#define __GUM_H__ +#ifndef __GUM_SCRIPT_BACKEND_H__ +#define __GUM_SCRIPT_BACKEND_H__ /* - * Copyright (C) 2008-2023 Ole André Vadla Ravnås - * Copyright (C) 2023 Håvard Sørbø - * Copyright (C) 2024 Yannis Juglaret + * Copyright (C) 2010-2022 Ole André Vadla Ravnås * * Licence: wxWindows Library Licence, Version 3.1 */ -#ifndef __GUMDEFS_H__ -#define __GUMDEFS_H__ +#ifndef __GUM_SCRIPT_H__ +#define __GUM_SCRIPT_H__ + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_IO_H__ +#define __G_IO_H__ + +#define __GIO_GIO_H_INSIDE__ + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __GIO_TYPES_H__ +#define __GIO_TYPES_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __GIO_ENUMS_H__ +#define __GIO_ENUMS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GObject - GLib Type, Object, Parameter and Signal Library + * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ +#ifndef __GLIB_GOBJECT_H__ +#define __GLIB_GOBJECT_H__ + +#define __GLIB_GOBJECT_H_INSIDE__ + +/* gbinding.h: Binding for object properties + * + * Copyright (C) 2010 Intel Corp. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Emmanuele Bassi + */ + +#ifndef __G_BINDING_H__ +#define __G_BINDING_H__ + +#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) +#error "Only can be included directly." +#endif /* GLIB - Library of useful routines for C programming * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald @@ -6238,7 +6632,6 @@ typedef unsigned long guintptr; #define G_VA_COPY va_copy -#define G_VA_COPY_AS_ARRAY 1 #define G_HAVE_ISO_VARARGS 1 @@ -25482,66 +25875,6 @@ void glib_recover_from_fork_in_child (void); G_END_DECLS #endif /* __G_LIB_H__ */ - -/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ - -#ifndef __GUM_ENUM_TYPES_H__ -#define __GUM_ENUM_TYPES_H__ - -#ifndef GUM_DIET - -/* GObject - GLib Type, Object, Parameter and Signal Library - * Copyright (C) 1998, 1999, 2000 Tim Janik and Red Hat, Inc. - * - * SPDX-License-Identifier: LGPL-2.1-or-later - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - */ -#ifndef __GLIB_GOBJECT_H__ -#define __GLIB_GOBJECT_H__ - -#define __GLIB_GOBJECT_H_INSIDE__ - -/* gbinding.h: Binding for object properties - * - * Copyright (C) 2010 Intel Corp. - * - * SPDX-License-Identifier: LGPL-2.1-or-later - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, see . - * - * Author: Emmanuele Bassi - */ - -#ifndef __G_BINDING_H__ -#define __G_BINDING_H__ - -#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION) -#error "Only can be included directly." -#endif - /* GObject - GLib Type, Object, Parameter and Signal Library * Copyright (C) 1998-1999, 2000-2001 Tim Janik and Red Hat, Inc. * @@ -35383,5769 +35716,31750 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset) #undef __GLIB_GOBJECT_H_INSIDE__ #endif /* __GLIB_GOBJECT_H__ */ +#pragma once -G_BEGIN_DECLS +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(GIO_STATIC_COMPILATION) +# define _GIO_EXPORT __declspec(dllexport) +# define _GIO_IMPORT __declspec(dllimport) +#elif __GNUC__ >= 4 +# define _GIO_EXPORT __attribute__((visibility("default"))) +# define _GIO_IMPORT +#else +# define _GIO_EXPORT +# define _GIO_IMPORT +#endif +#ifdef GIO_COMPILATION +# define _GIO_API _GIO_EXPORT +#else +# define _GIO_API _GIO_IMPORT +#endif -/* Enumerations from "gumdarwingrafter.h" */ -GType gum_darwin_grafter_flags_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_DARWIN_GRAFTER_FLAGS (gum_darwin_grafter_flags_get_type ()) +#define _GIO_EXTERN _GIO_API extern -/* Enumerations from "gumdarwinmodule.h" */ -GType gum_darwin_module_flags_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_DARWIN_MODULE_FLAGS (gum_darwin_module_flags_get_type ()) +#define GIO_VAR _GIO_EXTERN +#define GIO_AVAILABLE_IN_ALL _GIO_EXTERN -/* Enumerations from "gumdefs.h" */ -GType gum_error_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ERROR (gum_error_get_type ()) -GType gum_cpu_type_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_CPU_TYPE (gum_cpu_type_get_type ()) -GType gum_memory_access_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_MEMORY_ACCESS (gum_memory_access_get_type ()) +#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS +#define GIO_DEPRECATED _GIO_EXTERN +#define GIO_DEPRECATED_FOR(f) _GIO_EXTERN +#define GIO_UNAVAILABLE(maj,min) _GIO_EXTERN +#define GIO_UNAVAILABLE_STATIC_INLINE(maj,min) +#else +#define GIO_DEPRECATED G_DEPRECATED _GIO_EXTERN +#define GIO_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GIO_EXTERN +#define GIO_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GIO_EXTERN +#define GIO_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) +#endif -/* Enumerations from "gumelfmodule.h" */ -GType gum_elf_type_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_TYPE (gum_elf_type_get_type ()) -GType gum_elf_osabi_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_OSABI (gum_elf_osabi_get_type ()) -GType gum_elf_machine_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_MACHINE (gum_elf_machine_get_type ()) -GType gum_elf_source_mode_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_SOURCE_MODE (gum_elf_source_mode_get_type ()) -GType gum_elf_section_type_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_SECTION_TYPE (gum_elf_section_type_get_type ()) -GType gum_elf_dynamic_tag_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_DYNAMIC_TAG (gum_elf_dynamic_tag_get_type ()) -GType gum_elf_shdr_index_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_SHDR_INDEX (gum_elf_shdr_index_get_type ()) -GType gum_elf_symbol_type_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_SYMBOL_TYPE (gum_elf_symbol_type_get_type ()) -GType gum_elf_symbol_bind_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_SYMBOL_BIND (gum_elf_symbol_bind_get_type ()) -GType gum_elf_ia32_relocation_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_IA32_RELOCATION (gum_elf_ia32_relocation_get_type ()) -GType gum_elf_x64_relocation_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_X64_RELOCATION (gum_elf_x64_relocation_get_type ()) -GType gum_elf_arm_relocation_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_ARM_RELOCATION (gum_elf_arm_relocation_get_type ()) -GType gum_elf_arm64_relocation_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_ARM64_RELOCATION (gum_elf_arm64_relocation_get_type ()) -GType gum_elf_mips_relocation_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ELF_MIPS_RELOCATION (gum_elf_mips_relocation_get_type ()) +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26 +#define GIO_DEPRECATED_IN_2_26 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_26_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_26 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_26 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_26 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_26_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_26 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_26_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_26 +#define GIO_DEPRECATED_MACRO_IN_2_26_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_26 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_26 +#define GIO_DEPRECATED_TYPE_IN_2_26_FOR(f) +#endif -/* Enumerations from "guminterceptor.h" */ -GType gum_attach_return_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_ATTACH_RETURN (gum_attach_return_get_type ()) -GType gum_replace_return_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_REPLACE_RETURN (gum_replace_return_get_type ()) +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26 +#define GIO_AVAILABLE_IN_2_26 GIO_UNAVAILABLE (2, 26) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_26 GLIB_UNAVAILABLE_STATIC_INLINE (2, 26) +#define GIO_AVAILABLE_MACRO_IN_2_26 GLIB_UNAVAILABLE_MACRO (2, 26) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_26 GLIB_UNAVAILABLE_ENUMERATOR (2, 26) +#define GIO_AVAILABLE_TYPE_IN_2_26 GLIB_UNAVAILABLE_TYPE (2, 26) +#else +#define GIO_AVAILABLE_IN_2_26 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_26 +#define GIO_AVAILABLE_MACRO_IN_2_26 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_26 +#define GIO_AVAILABLE_TYPE_IN_2_26 +#endif -/* Enumerations from "gumprocess.h" */ -GType gum_teardown_requirement_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_TEARDOWN_REQUIREMENT (gum_teardown_requirement_get_type ()) -GType gum_code_signing_policy_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_CODE_SIGNING_POLICY (gum_code_signing_policy_get_type ()) -GType gum_modify_thread_flags_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_MODIFY_THREAD_FLAGS (gum_modify_thread_flags_get_type ()) -GType gum_thread_state_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_THREAD_STATE (gum_thread_state_get_type ()) -GType gum_watch_conditions_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_WATCH_CONDITIONS (gum_watch_conditions_get_type ()) -GType gum_dependency_type_get_type (void) G_GNUC_CONST; -#define GUM_TYPE_DEPENDENCY_TYPE (gum_dependency_type_get_type ()) -G_END_DECLS +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28 +#define GIO_DEPRECATED_IN_2_28 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_28_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_28 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_28_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_28 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_28 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_28_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_28 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_28_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_28 +#define GIO_DEPRECATED_MACRO_IN_2_28_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_28 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_28 +#define GIO_DEPRECATED_TYPE_IN_2_28_FOR(f) +#endif +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28 +#define GIO_AVAILABLE_IN_2_28 GIO_UNAVAILABLE (2, 28) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_28 GLIB_UNAVAILABLE_STATIC_INLINE (2, 28) +#define GIO_AVAILABLE_MACRO_IN_2_28 GLIB_UNAVAILABLE_MACRO (2, 28) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_28 GLIB_UNAVAILABLE_ENUMERATOR (2, 28) +#define GIO_AVAILABLE_TYPE_IN_2_28 GLIB_UNAVAILABLE_TYPE (2, 28) +#else +#define GIO_AVAILABLE_IN_2_28 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_28 +#define GIO_AVAILABLE_MACRO_IN_2_28 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_28 +#define GIO_AVAILABLE_TYPE_IN_2_28 #endif -#endif /* __GUM_ENUM_TYPES_H__ */ +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30 +#define GIO_DEPRECATED_IN_2_30 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_30_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_30 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_30 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_30 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_30_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_30 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_30_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_30 +#define GIO_DEPRECATED_MACRO_IN_2_30_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_30 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_30 +#define GIO_DEPRECATED_TYPE_IN_2_30_FOR(f) +#endif -/* Generated data ends here */ +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30 +#define GIO_AVAILABLE_IN_2_30 GIO_UNAVAILABLE (2, 30) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_30 GLIB_UNAVAILABLE_STATIC_INLINE (2, 30) +#define GIO_AVAILABLE_MACRO_IN_2_30 GLIB_UNAVAILABLE_MACRO (2, 30) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_30 GLIB_UNAVAILABLE_ENUMERATOR (2, 30) +#define GIO_AVAILABLE_TYPE_IN_2_30 GLIB_UNAVAILABLE_TYPE (2, 30) +#else +#define GIO_AVAILABLE_IN_2_30 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_30 +#define GIO_AVAILABLE_MACRO_IN_2_30 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_30 +#define GIO_AVAILABLE_TYPE_IN_2_30 +#endif +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32 +#define GIO_DEPRECATED_IN_2_32 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_32_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_32_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_32 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_32 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_32_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_32 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_32_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_32 +#define GIO_DEPRECATED_MACRO_IN_2_32_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_32 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_32 +#define GIO_DEPRECATED_TYPE_IN_2_32_FOR(f) +#endif -#if !defined (GUM_STATIC) && defined (G_OS_WIN32) -# ifdef GUM_EXPORTS -# define GUM_API __declspec(dllexport) -# else -# define GUM_API __declspec(dllimport) -# endif +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32 +#define GIO_AVAILABLE_IN_2_32 GIO_UNAVAILABLE (2, 32) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_32 GLIB_UNAVAILABLE_STATIC_INLINE (2, 32) +#define GIO_AVAILABLE_MACRO_IN_2_32 GLIB_UNAVAILABLE_MACRO (2, 32) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_32 GLIB_UNAVAILABLE_ENUMERATOR (2, 32) +#define GIO_AVAILABLE_TYPE_IN_2_32 GLIB_UNAVAILABLE_TYPE (2, 32) #else -# define GUM_API +#define GIO_AVAILABLE_IN_2_32 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_32 +#define GIO_AVAILABLE_MACRO_IN_2_32 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_32 +#define GIO_AVAILABLE_TYPE_IN_2_32 #endif -G_BEGIN_DECLS +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34 +#define GIO_DEPRECATED_IN_2_34 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_34_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_34 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_34_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_34 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_34 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_34_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_34 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_34_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_34 +#define GIO_DEPRECATED_MACRO_IN_2_34_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_34 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_34 +#define GIO_DEPRECATED_TYPE_IN_2_34_FOR(f) +#endif -#define GUM_ERROR gum_error_quark () +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34 +#define GIO_AVAILABLE_IN_2_34 GIO_UNAVAILABLE (2, 34) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_34 GLIB_UNAVAILABLE_STATIC_INLINE (2, 34) +#define GIO_AVAILABLE_MACRO_IN_2_34 GLIB_UNAVAILABLE_MACRO (2, 34) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_34 GLIB_UNAVAILABLE_ENUMERATOR (2, 34) +#define GIO_AVAILABLE_TYPE_IN_2_34 GLIB_UNAVAILABLE_TYPE (2, 34) +#else +#define GIO_AVAILABLE_IN_2_34 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_34 +#define GIO_AVAILABLE_MACRO_IN_2_34 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_34 +#define GIO_AVAILABLE_TYPE_IN_2_34 +#endif -typedef enum { - GUM_ERROR_FAILED, - GUM_ERROR_NOT_FOUND, - GUM_ERROR_EXISTS, - GUM_ERROR_PERMISSION_DENIED, - GUM_ERROR_INVALID_ARGUMENT, - GUM_ERROR_NOT_SUPPORTED, - GUM_ERROR_INVALID_DATA, -} GumError; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36 +#define GIO_DEPRECATED_IN_2_36 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_36_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_36 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_36_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_36 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_36 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_36_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_36 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_36_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_36 +#define GIO_DEPRECATED_MACRO_IN_2_36_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_36 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_36 +#define GIO_DEPRECATED_TYPE_IN_2_36_FOR(f) +#endif -typedef guint64 GumAddress; -#define GUM_ADDRESS(a) ((GumAddress) (guintptr) (a)) -#define GUM_TYPE_ADDRESS (gum_address_get_type ()) -typedef guint GumOS; -typedef guint GumCallingConvention; -typedef guint GumAbiType; -typedef guint GumCpuFeatures; -typedef guint GumInstructionEncoding; -typedef guint GumArgType; -typedef struct _GumArgument GumArgument; -typedef guint GumBranchHint; -typedef struct _GumIA32CpuContext GumIA32CpuContext; -typedef struct _GumX64CpuContext GumX64CpuContext; -typedef struct _GumArmCpuContext GumArmCpuContext; -typedef union _GumArmVectorReg GumArmVectorReg; -typedef struct _GumArm64CpuContext GumArm64CpuContext; -typedef union _GumArm64VectorReg GumArm64VectorReg; -typedef struct _GumMipsCpuContext GumMipsCpuContext; -typedef guint GumRelocationScenario; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36 +#define GIO_AVAILABLE_IN_2_36 GIO_UNAVAILABLE (2, 36) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_36 GLIB_UNAVAILABLE_STATIC_INLINE (2, 36) +#define GIO_AVAILABLE_MACRO_IN_2_36 GLIB_UNAVAILABLE_MACRO (2, 36) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_36 GLIB_UNAVAILABLE_ENUMERATOR (2, 36) +#define GIO_AVAILABLE_TYPE_IN_2_36 GLIB_UNAVAILABLE_TYPE (2, 36) +#else +#define GIO_AVAILABLE_IN_2_36 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_36 +#define GIO_AVAILABLE_MACRO_IN_2_36 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_36 +#define GIO_AVAILABLE_TYPE_IN_2_36 +#endif -#if defined (_M_IX86) || defined (__i386__) -# define GUM_NATIVE_CPU GUM_CPU_IA32 -# define GUM_DEFAULT_CS_ARCH CS_ARCH_X86 -# define gum_cs_arch_register_native cs_arch_register_x86 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE CS_MODE_32 -typedef GumIA32CpuContext GumCpuContext; -#elif defined (_M_X64) || defined (__x86_64__) -# define GUM_NATIVE_CPU GUM_CPU_AMD64 -# define GUM_DEFAULT_CS_ARCH CS_ARCH_X86 -# define gum_cs_arch_register_native cs_arch_register_x86 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE CS_MODE_64 -typedef GumX64CpuContext GumCpuContext; -#elif defined (_M_ARM) || defined (__arm__) -# define GUM_NATIVE_CPU GUM_CPU_ARM -# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM -# define gum_cs_arch_register_native cs_arch_register_arm -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE \ - ((cs_mode) (CS_MODE_ARM | CS_MODE_V8 | GUM_DEFAULT_CS_ENDIAN)) -# define GUM_PSR_T_BIT 0x20 -typedef GumArmCpuContext GumCpuContext; -#elif defined (_M_ARM64) || defined (__aarch64__) -# define GUM_NATIVE_CPU GUM_CPU_ARM64 -# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM64 -# define gum_cs_arch_register_native cs_arch_register_arm64 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE GUM_DEFAULT_CS_ENDIAN -typedef GumArm64CpuContext GumCpuContext; -#elif defined (__mips__) -# define GUM_NATIVE_CPU GUM_CPU_MIPS -# define GUM_DEFAULT_CS_ARCH CS_ARCH_MIPS -# define gum_cs_arch_register_native cs_arch_register_mips -# if GLIB_SIZEOF_VOID_P == 4 -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE ((cs_mode) \ - (CS_MODE_MIPS32 | GUM_DEFAULT_CS_ENDIAN)) -# else -/** - * GUM_DEFAULT_CS_MODE: (skip) - */ -# define GUM_DEFAULT_CS_MODE ((cs_mode) \ - (CS_MODE_MIPS64 | GUM_DEFAULT_CS_ENDIAN)) -# endif -typedef GumMipsCpuContext GumCpuContext; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38 +#define GIO_DEPRECATED_IN_2_38 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_38_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_38 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_38_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_38 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_38 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_38_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) #else -# error Unsupported architecture. +#define GIO_DEPRECATED_IN_2_38 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_38_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_38 +#define GIO_DEPRECATED_MACRO_IN_2_38_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_38 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_38 +#define GIO_DEPRECATED_TYPE_IN_2_38_FOR(f) #endif -/* - * The only non-legacy big-endian configuration on 32-bit ARM systems is BE8. - * In this configuration, whilst the data is in big-endian, the code stream is - * still in little-endian. Since Capstone is disassembling the code stream, it - * should work in little-endian even on BE8 systems. - */ -#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined (__arm__) -# define GUM_DEFAULT_CS_ENDIAN CS_MODE_LITTLE_ENDIAN + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 +#define GIO_AVAILABLE_IN_2_38 GIO_UNAVAILABLE (2, 38) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_38 GLIB_UNAVAILABLE_STATIC_INLINE (2, 38) +#define GIO_AVAILABLE_MACRO_IN_2_38 GLIB_UNAVAILABLE_MACRO (2, 38) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_38 GLIB_UNAVAILABLE_ENUMERATOR (2, 38) +#define GIO_AVAILABLE_TYPE_IN_2_38 GLIB_UNAVAILABLE_TYPE (2, 38) #else -# define GUM_DEFAULT_CS_ENDIAN CS_MODE_BIG_ENDIAN +#define GIO_AVAILABLE_IN_2_38 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_38 +#define GIO_AVAILABLE_MACRO_IN_2_38 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_38 +#define GIO_AVAILABLE_TYPE_IN_2_38 #endif -#ifdef G_OS_WIN32 -# define GUM_NATIVE_ABI GUM_ABI_WINDOWS -# define GUM_NATIVE_ABI_IS_WINDOWS 1 -# define GUM_NATIVE_ABI_IS_UNIX 0 + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40 +#define GIO_DEPRECATED_IN_2_40 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_40_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_40 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_40_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_40 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_40 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_40_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) #else -# define GUM_NATIVE_ABI GUM_ABI_UNIX -# define GUM_NATIVE_ABI_IS_WINDOWS 0 -# define GUM_NATIVE_ABI_IS_UNIX 1 +#define GIO_DEPRECATED_IN_2_40 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_40_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_40 +#define GIO_DEPRECATED_MACRO_IN_2_40_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_40 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_40 +#define GIO_DEPRECATED_TYPE_IN_2_40_FOR(f) #endif -enum _GumOS -{ - GUM_OS_WINDOWS, - GUM_OS_MACOS, - GUM_OS_LINUX, - GUM_OS_IOS, - GUM_OS_WATCHOS, - GUM_OS_TVOS, - GUM_OS_ANDROID, - GUM_OS_FREEBSD, - GUM_OS_QNX -}; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40 +#define GIO_AVAILABLE_IN_2_40 GIO_UNAVAILABLE (2, 40) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_40 GLIB_UNAVAILABLE_STATIC_INLINE (2, 40) +#define GIO_AVAILABLE_MACRO_IN_2_40 GLIB_UNAVAILABLE_MACRO (2, 40) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_40 GLIB_UNAVAILABLE_ENUMERATOR (2, 40) +#define GIO_AVAILABLE_TYPE_IN_2_40 GLIB_UNAVAILABLE_TYPE (2, 40) +#else +#define GIO_AVAILABLE_IN_2_40 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_40 +#define GIO_AVAILABLE_MACRO_IN_2_40 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_40 +#define GIO_AVAILABLE_TYPE_IN_2_40 +#endif -enum _GumCallingConvention -{ - GUM_CALL_CAPI, - GUM_CALL_SYSAPI -}; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42 +#define GIO_DEPRECATED_IN_2_42 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_42_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_42 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_42_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_42 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_42 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_42_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_42 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_42_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_42 +#define GIO_DEPRECATED_MACRO_IN_2_42_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_42 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_42 +#define GIO_DEPRECATED_TYPE_IN_2_42_FOR(f) +#endif -enum _GumAbiType -{ - GUM_ABI_UNIX, - GUM_ABI_WINDOWS -}; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42 +#define GIO_AVAILABLE_IN_2_42 GIO_UNAVAILABLE (2, 42) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_42 GLIB_UNAVAILABLE_STATIC_INLINE (2, 42) +#define GIO_AVAILABLE_MACRO_IN_2_42 GLIB_UNAVAILABLE_MACRO (2, 42) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_42 GLIB_UNAVAILABLE_ENUMERATOR (2, 42) +#define GIO_AVAILABLE_TYPE_IN_2_42 GLIB_UNAVAILABLE_TYPE (2, 42) +#else +#define GIO_AVAILABLE_IN_2_42 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_42 +#define GIO_AVAILABLE_MACRO_IN_2_42 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_42 +#define GIO_AVAILABLE_TYPE_IN_2_42 +#endif -typedef enum { - GUM_CPU_INVALID, - GUM_CPU_IA32, - GUM_CPU_AMD64, - GUM_CPU_ARM, - GUM_CPU_ARM64, - GUM_CPU_MIPS -} GumCpuType; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44 +#define GIO_DEPRECATED_IN_2_44 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_44_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_44 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_44_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_44 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_44 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_44_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_44 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_44_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_44 +#define GIO_DEPRECATED_MACRO_IN_2_44_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_44 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_44 +#define GIO_DEPRECATED_TYPE_IN_2_44_FOR(f) +#endif -enum _GumCpuFeatures -{ - GUM_CPU_AVX2 = 1 << 0, - GUM_CPU_CET_SS = 1 << 1, - GUM_CPU_THUMB_INTERWORK = 1 << 2, - GUM_CPU_VFP2 = 1 << 3, - GUM_CPU_VFP3 = 1 << 4, - GUM_CPU_VFPD32 = 1 << 5, - GUM_CPU_PTRAUTH = 1 << 6, -}; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44 +#define GIO_AVAILABLE_IN_2_44 GIO_UNAVAILABLE (2, 44) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_44 GLIB_UNAVAILABLE_STATIC_INLINE (2, 44) +#define GIO_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO (2, 44) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR (2, 44) +#define GIO_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE (2, 44) +#else +#define GIO_AVAILABLE_IN_2_44 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_44 +#define GIO_AVAILABLE_MACRO_IN_2_44 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_44 +#define GIO_AVAILABLE_TYPE_IN_2_44 +#endif -typedef enum { - GUM_MEMORY_ACCESS_OPEN, - GUM_MEMORY_ACCESS_EXCLUSIVE, -} GumMemoryAccess; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46 +#define GIO_DEPRECATED_IN_2_46 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_46_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_46 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_46_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_46 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_46 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_46_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_46 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_46_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_46 +#define GIO_DEPRECATED_MACRO_IN_2_46_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_46 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_46 +#define GIO_DEPRECATED_TYPE_IN_2_46_FOR(f) +#endif -enum _GumInstructionEncoding -{ - GUM_INSTRUCTION_DEFAULT, - GUM_INSTRUCTION_SPECIAL -}; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46 +#define GIO_AVAILABLE_IN_2_46 GIO_UNAVAILABLE (2, 46) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_46 GLIB_UNAVAILABLE_STATIC_INLINE (2, 46) +#define GIO_AVAILABLE_MACRO_IN_2_46 GLIB_UNAVAILABLE_MACRO (2, 46) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_46 GLIB_UNAVAILABLE_ENUMERATOR (2, 46) +#define GIO_AVAILABLE_TYPE_IN_2_46 GLIB_UNAVAILABLE_TYPE (2, 46) +#else +#define GIO_AVAILABLE_IN_2_46 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_46 +#define GIO_AVAILABLE_MACRO_IN_2_46 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_46 +#define GIO_AVAILABLE_TYPE_IN_2_46 +#endif -enum _GumArgType -{ - GUM_ARG_ADDRESS, - GUM_ARG_REGISTER -}; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48 +#define GIO_DEPRECATED_IN_2_48 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_48_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_48 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_48_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_48 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_48 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_48_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_48 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_48_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_48 +#define GIO_DEPRECATED_MACRO_IN_2_48_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_48 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_48 +#define GIO_DEPRECATED_TYPE_IN_2_48_FOR(f) +#endif -struct _GumArgument -{ - GumArgType type; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48 +#define GIO_AVAILABLE_IN_2_48 GIO_UNAVAILABLE (2, 48) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_48 GLIB_UNAVAILABLE_STATIC_INLINE (2, 48) +#define GIO_AVAILABLE_MACRO_IN_2_48 GLIB_UNAVAILABLE_MACRO (2, 48) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_48 GLIB_UNAVAILABLE_ENUMERATOR (2, 48) +#define GIO_AVAILABLE_TYPE_IN_2_48 GLIB_UNAVAILABLE_TYPE (2, 48) +#else +#define GIO_AVAILABLE_IN_2_48 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_48 +#define GIO_AVAILABLE_MACRO_IN_2_48 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_48 +#define GIO_AVAILABLE_TYPE_IN_2_48 +#endif - union - { - GumAddress address; - gint reg; - } value; -}; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50 +#define GIO_DEPRECATED_IN_2_50 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_50_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_50 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_50_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_50 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_50 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_50_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_50 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_50_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_50 +#define GIO_DEPRECATED_MACRO_IN_2_50_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_50 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_50 +#define GIO_DEPRECATED_TYPE_IN_2_50_FOR(f) +#endif -enum _GumBranchHint -{ - GUM_NO_HINT, - GUM_LIKELY, - GUM_UNLIKELY -}; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50 +#define GIO_AVAILABLE_IN_2_50 GIO_UNAVAILABLE (2, 50) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_50 GLIB_UNAVAILABLE_STATIC_INLINE (2, 50) +#define GIO_AVAILABLE_MACRO_IN_2_50 GLIB_UNAVAILABLE_MACRO (2, 50) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_50 GLIB_UNAVAILABLE_ENUMERATOR (2, 50) +#define GIO_AVAILABLE_TYPE_IN_2_50 GLIB_UNAVAILABLE_TYPE (2, 50) +#else +#define GIO_AVAILABLE_IN_2_50 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_50 +#define GIO_AVAILABLE_MACRO_IN_2_50 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_50 +#define GIO_AVAILABLE_TYPE_IN_2_50 +#endif -struct _GumIA32CpuContext -{ - guint32 eip; - - guint32 edi; - guint32 esi; - guint32 ebp; - guint32 esp; - guint32 ebx; - guint32 edx; - guint32 ecx; - guint32 eax; -}; - -struct _GumX64CpuContext -{ - guint64 rip; - - guint64 r15; - guint64 r14; - guint64 r13; - guint64 r12; - guint64 r11; - guint64 r10; - guint64 r9; - guint64 r8; - - guint64 rdi; - guint64 rsi; - guint64 rbp; - guint64 rsp; - guint64 rbx; - guint64 rdx; - guint64 rcx; - guint64 rax; -}; - -union _GumArmVectorReg -{ - guint8 q[16]; - gdouble d[2]; - gfloat s[4]; -}; - -struct _GumArmCpuContext -{ - guint32 pc; - guint32 sp; - guint32 cpsr; - - guint32 r8; - guint32 r9; - guint32 r10; - guint32 r11; - guint32 r12; - - GumArmVectorReg v[16]; - - guint32 _padding; - - guint32 r[8]; - guint32 lr; -}; - -union _GumArm64VectorReg -{ - guint8 q[16]; - gdouble d; - gfloat s; - guint16 h; - guint8 b; -}; - -struct _GumArm64CpuContext -{ - guint64 pc; - guint64 sp; - guint64 nzcv; - - guint64 x[29]; - guint64 fp; - guint64 lr; - - GumArm64VectorReg v[32]; -}; - -struct _GumMipsCpuContext -{ - /* - * This structure represents the register state pushed onto the stack by the - * trampoline which allows us to vector from the original minimal assembly - * hook to architecture agnostic C code inside frida-gum. These registers are - * natively sized. Even if some have not been expanded to 64-bits from the - * MIPS32 architecture MIPS can only perform aligned data access and as such - * pushing zero extended values is simpler than attempting to push minimally - * sized data types. - */ - gsize pc; - - gsize gp; - gsize sp; - gsize fp; - gsize ra; - - gsize hi; - gsize lo; - - gsize at; - - gsize v0; - gsize v1; - - gsize a0; - gsize a1; - gsize a2; - gsize a3; - - gsize t0; - gsize t1; - gsize t2; - gsize t3; - gsize t4; - gsize t5; - gsize t6; - gsize t7; - gsize t8; - gsize t9; - - gsize s0; - gsize s1; - gsize s2; - gsize s3; - gsize s4; - gsize s5; - gsize s6; - gsize s7; - - gsize k0; - gsize k1; -}; - -enum _GumRelocationScenario -{ - GUM_SCENARIO_OFFLINE, - GUM_SCENARIO_ONLINE -}; - -#ifndef __arm__ -# if GLIB_SIZEOF_VOID_P == 8 -# define GUM_CPU_CONTEXT_XAX(c) ((c)->rax) -# define GUM_CPU_CONTEXT_XCX(c) ((c)->rcx) -# define GUM_CPU_CONTEXT_XDX(c) ((c)->rdx) -# define GUM_CPU_CONTEXT_XBX(c) ((c)->rbx) -# define GUM_CPU_CONTEXT_XSP(c) ((c)->rsp) -# define GUM_CPU_CONTEXT_XBP(c) ((c)->rbp) -# define GUM_CPU_CONTEXT_XSI(c) ((c)->rsi) -# define GUM_CPU_CONTEXT_XDI(c) ((c)->rdi) -# define GUM_CPU_CONTEXT_XIP(c) ((c)->rip) -# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, rax)) -# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, rcx)) -# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, rdx)) -# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, rbx)) -# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, rsp)) -# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, rbp)) -# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, rsi)) -# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, rdi)) -# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, rip)) -# else -# define GUM_CPU_CONTEXT_XAX(c) ((c)->eax) -# define GUM_CPU_CONTEXT_XCX(c) ((c)->ecx) -# define GUM_CPU_CONTEXT_XDX(c) ((c)->edx) -# define GUM_CPU_CONTEXT_XBX(c) ((c)->ebx) -# define GUM_CPU_CONTEXT_XSP(c) ((c)->esp) -# define GUM_CPU_CONTEXT_XBP(c) ((c)->ebp) -# define GUM_CPU_CONTEXT_XSI(c) ((c)->esi) -# define GUM_CPU_CONTEXT_XDI(c) ((c)->edi) -# define GUM_CPU_CONTEXT_XIP(c) ((c)->eip) -# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, eax)) -# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, ecx)) -# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, edx)) -# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, ebx)) -# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, esp)) -# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, ebp)) -# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, esi)) -# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, edi)) -# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, eip)) -# endif +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52 +#define GIO_DEPRECATED_IN_2_52 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_52_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_52 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_52_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_52 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_52 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_52_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_52 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_52_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_52 +#define GIO_DEPRECATED_MACRO_IN_2_52_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_52 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_52 +#define GIO_DEPRECATED_TYPE_IN_2_52_FOR(f) #endif -#define GUM_MAX_PATH 260 -#define GUM_MAX_TYPE_NAME 16 -#define GUM_MAX_SYMBOL_NAME 2048 - -#define GUM_MAX_THREADS 768 -#define GUM_MAX_CALL_DEPTH 32 -#define GUM_MAX_BACKTRACE_DEPTH 16 -#define GUM_MAX_WORST_CASE_INFO_SIZE 128 +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52 +#define GIO_AVAILABLE_IN_2_52 GIO_UNAVAILABLE (2, 52) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_52 GLIB_UNAVAILABLE_STATIC_INLINE (2, 52) +#define GIO_AVAILABLE_MACRO_IN_2_52 GLIB_UNAVAILABLE_MACRO (2, 52) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_52 GLIB_UNAVAILABLE_ENUMERATOR (2, 52) +#define GIO_AVAILABLE_TYPE_IN_2_52 GLIB_UNAVAILABLE_TYPE (2, 52) +#else +#define GIO_AVAILABLE_IN_2_52 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_52 +#define GIO_AVAILABLE_MACRO_IN_2_52 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_52 +#define GIO_AVAILABLE_TYPE_IN_2_52 +#endif -#define GUM_MAX_LISTENERS_PER_FUNCTION 2 -#define GUM_MAX_LISTENER_DATA 1024 +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54 +#define GIO_DEPRECATED_IN_2_54 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_54_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_54 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_54_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_54 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_54 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_54_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_54 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_54_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_54 +#define GIO_DEPRECATED_MACRO_IN_2_54_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_54 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_54 +#define GIO_DEPRECATED_TYPE_IN_2_54_FOR(f) +#endif -#define GUM_MAX_THREAD_RANGES 2 +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54 +#define GIO_AVAILABLE_IN_2_54 GIO_UNAVAILABLE (2, 54) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_54 GLIB_UNAVAILABLE_STATIC_INLINE (2, 54) +#define GIO_AVAILABLE_MACRO_IN_2_54 GLIB_UNAVAILABLE_MACRO (2, 54) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_54 GLIB_UNAVAILABLE_ENUMERATOR (2, 54) +#define GIO_AVAILABLE_TYPE_IN_2_54 GLIB_UNAVAILABLE_TYPE (2, 54) +#else +#define GIO_AVAILABLE_IN_2_54 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_54 +#define GIO_AVAILABLE_MACRO_IN_2_54 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_54 +#define GIO_AVAILABLE_TYPE_IN_2_54 +#endif -#if defined (HAVE_I386) -# if GLIB_SIZEOF_VOID_P == 8 -# define GUM_CPU_MODE CS_MODE_64 -# define GUM_X86_THUNK -# else -# define GUM_CPU_MODE CS_MODE_32 -# define GUM_X86_THUNK GUM_FASTCALL -# endif +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56 +#define GIO_DEPRECATED_IN_2_56 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_56_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_56 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_56_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_56 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_56 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_56_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) #else -# if G_BYTE_ORDER == G_LITTLE_ENDIAN -# define GUM_CPU_MODE CS_MODE_LITTLE_ENDIAN -# else -# define GUM_CPU_MODE CS_MODE_BIG_ENDIAN -# endif +#define GIO_DEPRECATED_IN_2_56 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_56_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_56 +#define GIO_DEPRECATED_MACRO_IN_2_56_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_56 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_56 +#define GIO_DEPRECATED_TYPE_IN_2_56_FOR(f) #endif -#if !defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 -# define GUM_X86_THUNK_REG_ARG0 GUM_X86_XDI -# define GUM_X86_THUNK_REG_ARG1 GUM_X86_XSI + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56 +#define GIO_AVAILABLE_IN_2_56 GIO_UNAVAILABLE (2, 56) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_56 GLIB_UNAVAILABLE_STATIC_INLINE (2, 56) +#define GIO_AVAILABLE_MACRO_IN_2_56 GLIB_UNAVAILABLE_MACRO (2, 56) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_56 GLIB_UNAVAILABLE_ENUMERATOR (2, 56) +#define GIO_AVAILABLE_TYPE_IN_2_56 GLIB_UNAVAILABLE_TYPE (2, 56) #else -# define GUM_X86_THUNK_REG_ARG0 GUM_X86_XCX -# define GUM_X86_THUNK_REG_ARG1 GUM_X86_XDX +#define GIO_AVAILABLE_IN_2_56 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_56 +#define GIO_AVAILABLE_MACRO_IN_2_56 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_56 +#define GIO_AVAILABLE_TYPE_IN_2_56 #endif -#define GUM_RED_ZONE_SIZE 128 -#if defined (_M_IX86) || defined (__i386__) -# ifdef _MSC_VER -# define GUM_CDECL __cdecl -# define GUM_STDCALL __stdcall -# define GUM_FASTCALL __fastcall -# else -# define GUM_CDECL __attribute__ ((cdecl)) -# define GUM_STDCALL __attribute__ ((stdcall)) -# define GUM_FASTCALL __attribute__ ((fastcall)) -# endif +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_58 +#define GIO_DEPRECATED_IN_2_58 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_58_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_58 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_58_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_58 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_58 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_58_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) #else -# define GUM_CDECL -# define GUM_STDCALL -# define GUM_FASTCALL +#define GIO_DEPRECATED_IN_2_58 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_58_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_58 +#define GIO_DEPRECATED_MACRO_IN_2_58_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_58 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_58 +#define GIO_DEPRECATED_TYPE_IN_2_58_FOR(f) #endif -#ifdef _MSC_VER -# define GUM_NOINLINE __declspec (noinline) +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_58 +#define GIO_AVAILABLE_IN_2_58 GIO_UNAVAILABLE (2, 58) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_58 GLIB_UNAVAILABLE_STATIC_INLINE (2, 58) +#define GIO_AVAILABLE_MACRO_IN_2_58 GLIB_UNAVAILABLE_MACRO (2, 58) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_58 GLIB_UNAVAILABLE_ENUMERATOR (2, 58) +#define GIO_AVAILABLE_TYPE_IN_2_58 GLIB_UNAVAILABLE_TYPE (2, 58) #else -# define GUM_NOINLINE __attribute__ ((noinline)) +#define GIO_AVAILABLE_IN_2_58 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_58 +#define GIO_AVAILABLE_MACRO_IN_2_58 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_58 +#define GIO_AVAILABLE_TYPE_IN_2_58 #endif -#define GUM_ALIGN_POINTER(t, p, b) \ - ((t) GSIZE_TO_POINTER (((GPOINTER_TO_SIZE (p) + ((gsize) (b - 1))) & \ - ~((gsize) (b - 1))))) -#define GUM_ALIGN_SIZE(s, b) \ - ((((gsize) s) + ((gsize) (b - 1))) & ~((gsize) (b - 1))) +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_60 +#define GIO_DEPRECATED_IN_2_60 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_60_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_60 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_60_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_60 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_60 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_60_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_60 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_60_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_60 +#define GIO_DEPRECATED_MACRO_IN_2_60_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_60 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_60 +#define GIO_DEPRECATED_TYPE_IN_2_60_FOR(f) +#endif -#define GUM_FUNCPTR_TO_POINTER(f) (GSIZE_TO_POINTER (f)) -#define GUM_POINTER_TO_FUNCPTR(t, p) ((t) GPOINTER_TO_SIZE (p)) +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60 +#define GIO_AVAILABLE_IN_2_60 GIO_UNAVAILABLE (2, 60) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_60 GLIB_UNAVAILABLE_STATIC_INLINE (2, 60) +#define GIO_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO (2, 60) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR (2, 60) +#define GIO_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE (2, 60) +#else +#define GIO_AVAILABLE_IN_2_60 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_60 +#define GIO_AVAILABLE_MACRO_IN_2_60 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_60 +#define GIO_AVAILABLE_TYPE_IN_2_60 +#endif -#define GUM_INT2_MASK 0x00000003U -#define GUM_INT3_MASK 0x00000007U -#define GUM_INT4_MASK 0x0000000fU -#define GUM_INT5_MASK 0x0000001fU -#define GUM_INT6_MASK 0x0000003fU -#define GUM_INT8_MASK 0x000000ffU -#define GUM_INT10_MASK 0x000003ffU -#define GUM_INT11_MASK 0x000007ffU -#define GUM_INT12_MASK 0x00000fffU -#define GUM_INT14_MASK 0x00003fffU -#define GUM_INT16_MASK 0x0000ffffU -#define GUM_INT18_MASK 0x0003ffffU -#define GUM_INT19_MASK 0x0007ffffU -#define GUM_INT24_MASK 0x00ffffffU -#define GUM_INT26_MASK 0x03ffffffU -#define GUM_INT28_MASK 0x0fffffffU -#define GUM_INT32_MASK 0xffffffffU +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_62 +#define GIO_DEPRECATED_IN_2_62 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_62_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_62 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_62_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_62 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_62 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_62_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_62 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_62_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_62 +#define GIO_DEPRECATED_MACRO_IN_2_62_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_62 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_62 +#define GIO_DEPRECATED_TYPE_IN_2_62_FOR(f) +#endif -#define GUM_IS_WITHIN_UINT7_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (127)) -#define GUM_IS_WITHIN_UINT8_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (255)) -#define GUM_IS_WITHIN_INT8_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-128) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (127)) -#define GUM_IS_WITHIN_INT11_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-1024) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (1023)) -#define GUM_IS_WITHIN_INT14_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-8192) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (8191)) -#define GUM_IS_WITHIN_INT16_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-32768) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (32767)) -#define GUM_IS_WITHIN_INT18_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-131072) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (131071)) -#define GUM_IS_WITHIN_INT19_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-262144) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (262143)) -#define GUM_IS_WITHIN_INT20_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-524288) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (524287)) -#define GUM_IS_WITHIN_INT21_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-1048576) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (1048575)) -#define GUM_IS_WITHIN_INT24_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-8388608) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (8388607)) -#define GUM_IS_WITHIN_INT26_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-33554432) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (33554431)) -#define GUM_IS_WITHIN_INT28_RANGE(i) \ - (((gint64) (i)) >= G_GINT64_CONSTANT (-134217728) && \ - ((gint64) (i)) <= G_GINT64_CONSTANT (134217727)) -#define GUM_IS_WITHIN_INT32_RANGE(i) \ - (((gint64) (i)) >= (gint64) G_MININT32 && \ - ((gint64) (i)) <= (gint64) G_MAXINT32) +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62 +#define GIO_AVAILABLE_IN_2_62 GIO_UNAVAILABLE (2, 62) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_62 GLIB_UNAVAILABLE_STATIC_INLINE (2, 62) +#define GIO_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO (2, 62) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR (2, 62) +#define GIO_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE (2, 62) +#else +#define GIO_AVAILABLE_IN_2_62 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_62 +#define GIO_AVAILABLE_MACRO_IN_2_62 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_62 +#define GIO_AVAILABLE_TYPE_IN_2_62 +#endif -#ifndef GUM_DIET +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64 +#define GIO_DEPRECATED_IN_2_64 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_64_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_64 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_64_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_64 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_64 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_64_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_64 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_64_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_64 +#define GIO_DEPRECATED_MACRO_IN_2_64_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_64 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_64 +#define GIO_DEPRECATED_TYPE_IN_2_64_FOR(f) +#endif -# define GUM_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, \ - OBJ_NAME, ParentName) \ - G_DECLARE_FINAL_TYPE (ModuleObjName, module_obj_name, MODULE, OBJ_NAME, \ - ParentName) -# define GUM_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, \ - OBJ_NAME, PrerequisiteName) \ - G_DECLARE_INTERFACE (ModuleObjName, module_obj_name, MODULE, OBJ_NAME, \ - PrerequisiteName) -# define GUM_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) \ - G_DEFINE_BOXED_TYPE (TypeName, type_name, copy_func, free_func) -# define gum_object_ref(object) g_object_ref (object) -# define gum_object_unref(object) g_object_unref (object) -# define gum_clear_object(object_ptr) \ - g_clear_pointer ((object_ptr), g_object_unref) +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64 +#define GIO_AVAILABLE_IN_2_64 GIO_UNAVAILABLE (2, 64) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_64 GLIB_UNAVAILABLE_STATIC_INLINE (2, 64) +#define GIO_AVAILABLE_MACRO_IN_2_64 GLIB_UNAVAILABLE_MACRO (2, 64) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_64 GLIB_UNAVAILABLE_ENUMERATOR (2, 64) +#define GIO_AVAILABLE_TYPE_IN_2_64 GLIB_UNAVAILABLE_TYPE (2, 64) +#else +#define GIO_AVAILABLE_IN_2_64 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_64 +#define GIO_AVAILABLE_MACRO_IN_2_64 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_64 +#define GIO_AVAILABLE_TYPE_IN_2_64 +#endif +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_66 +#define GIO_DEPRECATED_IN_2_66 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_66_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_66 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_66_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_66 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_66 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_66_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) #else +#define GIO_DEPRECATED_IN_2_66 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_66_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_66 +#define GIO_DEPRECATED_MACRO_IN_2_66_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_66 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_66 +#define GIO_DEPRECATED_TYPE_IN_2_66_FOR(f) +#endif -# define GUM_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, \ - OBJ_NAME, ParentName) \ - typedef struct _##ModuleObjName ModuleObjName; \ - \ - G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME ( \ - gpointer obj) \ - { \ - return obj; \ - } -# define GUM_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, \ - OBJ_NAME, PrerequisiteName) \ - typedef struct _##ModuleObjName ModuleObjName; \ - \ - G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME ( \ - gpointer obj) \ - { \ - return obj; \ - } -# define GUM_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) -# define gum_clear_object(object_ptr) \ - g_clear_pointer ((object_ptr), gum_object_unref) +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66 +#define GIO_AVAILABLE_IN_2_66 GIO_UNAVAILABLE (2, 66) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_66 GLIB_UNAVAILABLE_STATIC_INLINE (2, 66) +#define GIO_AVAILABLE_MACRO_IN_2_66 GLIB_UNAVAILABLE_MACRO (2, 66) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_66 GLIB_UNAVAILABLE_ENUMERATOR (2, 66) +#define GIO_AVAILABLE_TYPE_IN_2_66 GLIB_UNAVAILABLE_TYPE (2, 66) +#else +#define GIO_AVAILABLE_IN_2_66 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_66 +#define GIO_AVAILABLE_MACRO_IN_2_66 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_66 +#define GIO_AVAILABLE_TYPE_IN_2_66 +#endif -typedef struct _GumObject GumObject; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68 +#define GIO_DEPRECATED_IN_2_68 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_68_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_68 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_68_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_68 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_68 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_68_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_68 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_68_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_68 +#define GIO_DEPRECATED_MACRO_IN_2_68_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_68 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_68 +#define GIO_DEPRECATED_TYPE_IN_2_68_FOR(f) +#endif -struct _GumObject -{ - gint ref_count; - void (* finalize) (GumObject * object); -}; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_68 +#define GIO_AVAILABLE_IN_2_68 GIO_UNAVAILABLE (2, 68) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_68 GLIB_UNAVAILABLE_STATIC_INLINE (2, 68) +#define GIO_AVAILABLE_MACRO_IN_2_68 GLIB_UNAVAILABLE_MACRO (2, 68) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_68 GLIB_UNAVAILABLE_ENUMERATOR (2, 68) +#define GIO_AVAILABLE_TYPE_IN_2_68 GLIB_UNAVAILABLE_TYPE (2, 68) +#else +#define GIO_AVAILABLE_IN_2_68 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_68 +#define GIO_AVAILABLE_MACRO_IN_2_68 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_68 +#define GIO_AVAILABLE_TYPE_IN_2_68 +#endif -GUM_API gpointer gum_object_ref (gpointer object); -GUM_API void gum_object_unref (gpointer object); +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_70 +#define GIO_DEPRECATED_IN_2_70 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_70_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_70 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_70_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_70 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_70_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_70 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_70_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_70 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_70_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_70 +#define GIO_DEPRECATED_MACRO_IN_2_70_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_70 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_70_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_70 +#define GIO_DEPRECATED_TYPE_IN_2_70_FOR(f) +#endif +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_70 +#define GIO_AVAILABLE_IN_2_70 GIO_UNAVAILABLE (2, 70) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_70 GLIB_UNAVAILABLE_STATIC_INLINE (2, 70) +#define GIO_AVAILABLE_MACRO_IN_2_70 GLIB_UNAVAILABLE_MACRO (2, 70) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_70 GLIB_UNAVAILABLE_ENUMERATOR (2, 70) +#define GIO_AVAILABLE_TYPE_IN_2_70 GLIB_UNAVAILABLE_TYPE (2, 70) +#else +#define GIO_AVAILABLE_IN_2_70 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_70 +#define GIO_AVAILABLE_MACRO_IN_2_70 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_70 +#define GIO_AVAILABLE_TYPE_IN_2_70 #endif -#ifdef G_NORETURN -# define GUM_NORETURN G_NORETURN +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_72 +#define GIO_DEPRECATED_IN_2_72 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_72_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_72 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_72_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_72 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_72_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_72 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_72_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) #else -# define GUM_NORETURN +#define GIO_DEPRECATED_IN_2_72 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_72_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_72 +#define GIO_DEPRECATED_MACRO_IN_2_72_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_72 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_72_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_72 +#define GIO_DEPRECATED_TYPE_IN_2_72_FOR(f) #endif -GUM_API GQuark gum_error_quark (void); +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_72 +#define GIO_AVAILABLE_IN_2_72 GIO_UNAVAILABLE (2, 72) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_72 GLIB_UNAVAILABLE_STATIC_INLINE (2, 72) +#define GIO_AVAILABLE_MACRO_IN_2_72 GLIB_UNAVAILABLE_MACRO (2, 72) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_72 GLIB_UNAVAILABLE_ENUMERATOR (2, 72) +#define GIO_AVAILABLE_TYPE_IN_2_72 GLIB_UNAVAILABLE_TYPE (2, 72) +#else +#define GIO_AVAILABLE_IN_2_72 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_72 +#define GIO_AVAILABLE_MACRO_IN_2_72 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_72 +#define GIO_AVAILABLE_TYPE_IN_2_72 +#endif -GUM_API GUM_NORETURN void gum_panic (const gchar * format, ...) - G_ANALYZER_NORETURN; +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_74 +#define GIO_DEPRECATED_IN_2_74 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_74_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_74 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_74_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_74 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_74 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_74_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_74 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_74_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_74 +#define GIO_DEPRECATED_MACRO_IN_2_74_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_74 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_74 +#define GIO_DEPRECATED_TYPE_IN_2_74_FOR(f) +#endif -GUM_API GumCpuFeatures gum_query_cpu_features (void); +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_74 +#define GIO_AVAILABLE_IN_2_74 GIO_UNAVAILABLE (2, 74) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_74 GLIB_UNAVAILABLE_STATIC_INLINE (2, 74) +#define GIO_AVAILABLE_MACRO_IN_2_74 GLIB_UNAVAILABLE_MACRO (2, 74) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_74 GLIB_UNAVAILABLE_ENUMERATOR (2, 74) +#define GIO_AVAILABLE_TYPE_IN_2_74 GLIB_UNAVAILABLE_TYPE (2, 74) +#else +#define GIO_AVAILABLE_IN_2_74 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_74 +#define GIO_AVAILABLE_MACRO_IN_2_74 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_74 +#define GIO_AVAILABLE_TYPE_IN_2_74 +#endif -GUM_API gpointer gum_cpu_context_get_nth_argument (GumCpuContext * self, - guint n); -GUM_API void gum_cpu_context_replace_nth_argument (GumCpuContext * self, - guint n, gpointer value); -GUM_API gpointer gum_cpu_context_get_return_value (GumCpuContext * self); -GUM_API void gum_cpu_context_replace_return_value (GumCpuContext * self, - gpointer value); +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_76 +#define GIO_DEPRECATED_IN_2_76 GIO_DEPRECATED +#define GIO_DEPRECATED_IN_2_76_FOR(f) GIO_DEPRECATED_FOR (f) +#define GIO_DEPRECATED_MACRO_IN_2_76 GLIB_DEPRECATED_MACRO +#define GIO_DEPRECATED_MACRO_IN_2_76_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_76 GLIB_DEPRECATED_ENUMERATOR +#define GIO_DEPRECATED_ENUMERATOR_IN_2_76_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GIO_DEPRECATED_TYPE_IN_2_76 GLIB_DEPRECATED_TYPE +#define GIO_DEPRECATED_TYPE_IN_2_76_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GIO_DEPRECATED_IN_2_76 _GIO_EXTERN +#define GIO_DEPRECATED_IN_2_76_FOR(f) _GIO_EXTERN +#define GIO_DEPRECATED_MACRO_IN_2_76 +#define GIO_DEPRECATED_MACRO_IN_2_76_FOR(f) +#define GIO_DEPRECATED_ENUMERATOR_IN_2_76 +#define GIO_DEPRECATED_ENUMERATOR_IN_2_76_FOR(f) +#define GIO_DEPRECATED_TYPE_IN_2_76 +#define GIO_DEPRECATED_TYPE_IN_2_76_FOR(f) +#endif -#ifndef GUM_DIET -GUM_API GType gum_address_get_type (void) G_GNUC_CONST; +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_76 +#define GIO_AVAILABLE_IN_2_76 GIO_UNAVAILABLE (2, 76) +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_76 GLIB_UNAVAILABLE_STATIC_INLINE (2, 76) +#define GIO_AVAILABLE_MACRO_IN_2_76 GLIB_UNAVAILABLE_MACRO (2, 76) +#define GIO_AVAILABLE_ENUMERATOR_IN_2_76 GLIB_UNAVAILABLE_ENUMERATOR (2, 76) +#define GIO_AVAILABLE_TYPE_IN_2_76 GLIB_UNAVAILABLE_TYPE (2, 76) +#else +#define GIO_AVAILABLE_IN_2_76 _GIO_EXTERN +#define GIO_AVAILABLE_STATIC_INLINE_IN_2_76 +#define GIO_AVAILABLE_MACRO_IN_2_76 +#define GIO_AVAILABLE_ENUMERATOR_IN_2_76 +#define GIO_AVAILABLE_TYPE_IN_2_76 #endif -G_END_DECLS +G_BEGIN_DECLS -#endif -/* - * Copyright (C) 2016-2023 Ole André Vadla Ravnås +/** + * GAppInfoCreateFlags: + * @G_APP_INFO_CREATE_NONE: No flags. + * @G_APP_INFO_CREATE_NEEDS_TERMINAL: Application opens in a terminal window. + * @G_APP_INFO_CREATE_SUPPORTS_URIS: Application supports URI arguments. + * @G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION: Application supports startup notification. Since 2.26 * - * Licence: wxWindows Library Licence, Version 3.1 + * Flags used when creating a #GAppInfo. */ +typedef enum { + G_APP_INFO_CREATE_NONE = 0, /*< nick=none >*/ + G_APP_INFO_CREATE_NEEDS_TERMINAL = (1 << 0), /*< nick=needs-terminal >*/ + G_APP_INFO_CREATE_SUPPORTS_URIS = (1 << 1), /*< nick=supports-uris >*/ + G_APP_INFO_CREATE_SUPPORTS_STARTUP_NOTIFICATION = (1 << 2) /*< nick=supports-startup-notification >*/ +} GAppInfoCreateFlags; -#ifndef __GUM_API_RESOLVER_H__ -#define __GUM_API_RESOLVER_H__ - +/** + * GConverterFlags: + * @G_CONVERTER_NO_FLAGS: No flags. + * @G_CONVERTER_INPUT_AT_END: At end of input data + * @G_CONVERTER_FLUSH: Flush data + * + * Flags used when calling a g_converter_convert(). + * + * Since: 2.24 + */ +typedef enum { + G_CONVERTER_NO_FLAGS = 0, /*< nick=none >*/ + G_CONVERTER_INPUT_AT_END = (1 << 0), /*< nick=input-at-end >*/ + G_CONVERTER_FLUSH = (1 << 1) /*< nick=flush >*/ +} GConverterFlags; -G_BEGIN_DECLS +/** + * GConverterResult: + * @G_CONVERTER_ERROR: There was an error during conversion. + * @G_CONVERTER_CONVERTED: Some data was consumed or produced + * @G_CONVERTER_FINISHED: The conversion is finished + * @G_CONVERTER_FLUSHED: Flushing is finished + * + * Results returned from g_converter_convert(). + * + * Since: 2.24 + */ +typedef enum { + G_CONVERTER_ERROR = 0, /*< nick=error >*/ + G_CONVERTER_CONVERTED = 1, /*< nick=converted >*/ + G_CONVERTER_FINISHED = 2, /*< nick=finished >*/ + G_CONVERTER_FLUSHED = 3 /*< nick=flushed >*/ +} GConverterResult; -#define GUM_API_SIZE_NONE -1 -#define GUM_TYPE_API_RESOLVER (gum_api_resolver_get_type ()) -GUM_DECLARE_INTERFACE (GumApiResolver, gum_api_resolver, GUM, API_RESOLVER, - GObject) +/** + * GDataStreamByteOrder: + * @G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: Selects Big Endian byte order. + * @G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: Selects Little Endian byte order. + * @G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN: Selects endianness based on host machine's architecture. + * + * #GDataStreamByteOrder is used to ensure proper endianness of streaming data sources + * across various machine architectures. + * + **/ +typedef enum { + G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN, + G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN, + G_DATA_STREAM_BYTE_ORDER_HOST_ENDIAN +} GDataStreamByteOrder; -typedef struct _GumApiDetails GumApiDetails; -typedef gboolean (* GumFoundApiFunc) (const GumApiDetails * details, - gpointer user_data); +/** + * GDataStreamNewlineType: + * @G_DATA_STREAM_NEWLINE_TYPE_LF: Selects "LF" line endings, common on most modern UNIX platforms. + * @G_DATA_STREAM_NEWLINE_TYPE_CR: Selects "CR" line endings. + * @G_DATA_STREAM_NEWLINE_TYPE_CR_LF: Selects "CR, LF" line ending, common on Microsoft Windows. + * @G_DATA_STREAM_NEWLINE_TYPE_ANY: Automatically try to handle any line ending type. + * + * #GDataStreamNewlineType is used when checking for or setting the line endings for a given file. + **/ +typedef enum { + G_DATA_STREAM_NEWLINE_TYPE_LF, + G_DATA_STREAM_NEWLINE_TYPE_CR, + G_DATA_STREAM_NEWLINE_TYPE_CR_LF, + G_DATA_STREAM_NEWLINE_TYPE_ANY +} GDataStreamNewlineType; + + +/** + * GFileAttributeType: + * @G_FILE_ATTRIBUTE_TYPE_INVALID: indicates an invalid or uninitialized type. + * @G_FILE_ATTRIBUTE_TYPE_STRING: a null terminated UTF8 string. + * @G_FILE_ATTRIBUTE_TYPE_BYTE_STRING: a zero terminated string of non-zero bytes. + * @G_FILE_ATTRIBUTE_TYPE_BOOLEAN: a boolean value. + * @G_FILE_ATTRIBUTE_TYPE_UINT32: an unsigned 4-byte/32-bit integer. + * @G_FILE_ATTRIBUTE_TYPE_INT32: a signed 4-byte/32-bit integer. + * @G_FILE_ATTRIBUTE_TYPE_UINT64: an unsigned 8-byte/64-bit integer. + * @G_FILE_ATTRIBUTE_TYPE_INT64: a signed 8-byte/64-bit integer. + * @G_FILE_ATTRIBUTE_TYPE_OBJECT: a #GObject. + * @G_FILE_ATTRIBUTE_TYPE_STRINGV: a %NULL terminated char **. Since 2.22 + * + * The data types for file attributes. + **/ +typedef enum { + G_FILE_ATTRIBUTE_TYPE_INVALID = 0, + G_FILE_ATTRIBUTE_TYPE_STRING, + G_FILE_ATTRIBUTE_TYPE_BYTE_STRING, /* zero terminated string of non-zero bytes */ + G_FILE_ATTRIBUTE_TYPE_BOOLEAN, + G_FILE_ATTRIBUTE_TYPE_UINT32, + G_FILE_ATTRIBUTE_TYPE_INT32, + G_FILE_ATTRIBUTE_TYPE_UINT64, + G_FILE_ATTRIBUTE_TYPE_INT64, + G_FILE_ATTRIBUTE_TYPE_OBJECT, + G_FILE_ATTRIBUTE_TYPE_STRINGV +} GFileAttributeType; + + +/** + * GFileAttributeInfoFlags: + * @G_FILE_ATTRIBUTE_INFO_NONE: no flags set. + * @G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE: copy the attribute values when the file is copied. + * @G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED: copy the attribute values when the file is moved. + * + * Flags specifying the behaviour of an attribute. + **/ +typedef enum { + G_FILE_ATTRIBUTE_INFO_NONE = 0, + G_FILE_ATTRIBUTE_INFO_COPY_WITH_FILE = (1 << 0), + G_FILE_ATTRIBUTE_INFO_COPY_WHEN_MOVED = (1 << 1) +} GFileAttributeInfoFlags; -#ifndef GUM_DIET -struct _GumApiResolverInterface -{ - GTypeInterface parent; +/** + * GFileAttributeStatus: + * @G_FILE_ATTRIBUTE_STATUS_UNSET: Attribute value is unset (empty). + * @G_FILE_ATTRIBUTE_STATUS_SET: Attribute value is set. + * @G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING: Indicates an error in setting the value. + * + * Used by g_file_set_attributes_from_info() when setting file attributes. + **/ +typedef enum { + G_FILE_ATTRIBUTE_STATUS_UNSET = 0, + G_FILE_ATTRIBUTE_STATUS_SET, + G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING +} GFileAttributeStatus; - void (* enumerate_matches) (GumApiResolver * self, const gchar * query, - GumFoundApiFunc func, gpointer user_data, GError ** error); -}; -#endif +/** + * GFileQueryInfoFlags: + * @G_FILE_QUERY_INFO_NONE: No flags set. + * @G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS: Don't follow symlinks. + * + * Flags used when querying a #GFileInfo. + */ +typedef enum { + G_FILE_QUERY_INFO_NONE = 0, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS = (1 << 0) /*< nick=nofollow-symlinks >*/ +} GFileQueryInfoFlags; -struct _GumApiDetails -{ - const gchar * name; - GumAddress address; - gssize size; -}; -GUM_API GumApiResolver * gum_api_resolver_make (const gchar * type); +/** + * GFileCreateFlags: + * @G_FILE_CREATE_NONE: No flags set. + * @G_FILE_CREATE_PRIVATE: Create a file that can only be + * accessed by the current user. + * @G_FILE_CREATE_REPLACE_DESTINATION: Replace the destination + * as if it didn't exist before. Don't try to keep any old + * permissions, replace instead of following links. This + * is generally useful if you're doing a "copy over" + * rather than a "save new version of" replace operation. + * You can think of it as "unlink destination" before + * writing to it, although the implementation may not + * be exactly like that. This flag can only be used with + * g_file_replace() and its variants, including g_file_replace_contents(). + * Since 2.20 + * + * Flags used when an operation may create a file. + */ +typedef enum { + G_FILE_CREATE_NONE = 0, + G_FILE_CREATE_PRIVATE = (1 << 0), + G_FILE_CREATE_REPLACE_DESTINATION = (1 << 1) +} GFileCreateFlags; + +/** + * GFileMeasureFlags: + * @G_FILE_MEASURE_NONE: No flags set. + * @G_FILE_MEASURE_REPORT_ANY_ERROR: Report any error encountered + * while traversing the directory tree. Normally errors are only + * reported for the toplevel file. + * @G_FILE_MEASURE_APPARENT_SIZE: Tally usage based on apparent file + * sizes. Normally, the block-size is used, if available, as this is a + * more accurate representation of disk space used. + * Compare with `du --apparent-size`. + * @G_FILE_MEASURE_NO_XDEV: Do not cross mount point boundaries. + * Compare with `du -x`. + * + * Flags that can be used with g_file_measure_disk_usage(). + * + * Since: 2.38 + **/ +typedef enum { + G_FILE_MEASURE_NONE = 0, + G_FILE_MEASURE_REPORT_ANY_ERROR = (1 << 1), + G_FILE_MEASURE_APPARENT_SIZE = (1 << 2), + G_FILE_MEASURE_NO_XDEV = (1 << 3) +} GFileMeasureFlags; -GUM_API void gum_api_resolver_enumerate_matches (GumApiResolver * self, - const gchar * query, GumFoundApiFunc func, gpointer user_data, - GError ** error); +/** + * GMountMountFlags: + * @G_MOUNT_MOUNT_NONE: No flags set. + * + * Flags used when mounting a mount. + */ +typedef enum /*< flags >*/ { + G_MOUNT_MOUNT_NONE = 0 +} GMountMountFlags; -G_END_DECLS -#endif -/* - * Copyright (C) 2008-2022 Ole André Vadla Ravnås - * Copyright (C) 2021 Francesco Tamagni +/** + * GMountUnmountFlags: + * @G_MOUNT_UNMOUNT_NONE: No flags set. + * @G_MOUNT_UNMOUNT_FORCE: Unmount even if there are outstanding + * file operations on the mount. * - * Licence: wxWindows Library Licence, Version 3.1 + * Flags used when an unmounting a mount. */ +typedef enum { + G_MOUNT_UNMOUNT_NONE = 0, + G_MOUNT_UNMOUNT_FORCE = (1 << 0) +} GMountUnmountFlags; -#ifndef __GUM_BACKTRACER_H__ -#define __GUM_BACKTRACER_H__ - -/* - * Copyright (C) 2008-2010 Ole André Vadla Ravnås +/** + * GDriveStartFlags: + * @G_DRIVE_START_NONE: No flags set. * - * Licence: wxWindows Library Licence, Version 3.1 + * Flags used when starting a drive. + * + * Since: 2.22 */ +typedef enum /*< flags >*/ { + G_DRIVE_START_NONE = 0 +} GDriveStartFlags; -#ifndef __GUM_RETURN_ADDRESS_H__ -#define __GUM_RETURN_ADDRESS_H__ +/** + * GDriveStartStopType: + * @G_DRIVE_START_STOP_TYPE_UNKNOWN: Unknown or drive doesn't support + * start/stop. + * @G_DRIVE_START_STOP_TYPE_SHUTDOWN: The stop method will physically + * shut down the drive and e.g. power down the port the drive is + * attached to. + * @G_DRIVE_START_STOP_TYPE_NETWORK: The start/stop methods are used + * for connecting/disconnect to the drive over the network. + * @G_DRIVE_START_STOP_TYPE_MULTIDISK: The start/stop methods will + * assemble/disassemble a virtual drive from several physical + * drives. + * @G_DRIVE_START_STOP_TYPE_PASSWORD: The start/stop methods will + * unlock/lock the disk (for example using the ATA SECURITY + * UNLOCK DEVICE command) + * + * Enumeration describing how a drive can be started/stopped. + * + * Since: 2.22 + */ +typedef enum { + G_DRIVE_START_STOP_TYPE_UNKNOWN, + G_DRIVE_START_STOP_TYPE_SHUTDOWN, + G_DRIVE_START_STOP_TYPE_NETWORK, + G_DRIVE_START_STOP_TYPE_MULTIDISK, + G_DRIVE_START_STOP_TYPE_PASSWORD +} GDriveStartStopType; +/** + * GFileCopyFlags: + * @G_FILE_COPY_NONE: No flags set. + * @G_FILE_COPY_OVERWRITE: Overwrite any existing files + * @G_FILE_COPY_BACKUP: Make a backup of any existing files. + * @G_FILE_COPY_NOFOLLOW_SYMLINKS: Don't follow symlinks. + * @G_FILE_COPY_ALL_METADATA: Copy all file metadata instead of just default set used for copy (see #GFileInfo). + * @G_FILE_COPY_NO_FALLBACK_FOR_MOVE: Don't use copy and delete fallback if native move not supported. + * @G_FILE_COPY_TARGET_DEFAULT_PERMS: Leaves target file with default perms, instead of setting the source file perms. + * + * Flags used when copying or moving files. + */ +typedef enum { + G_FILE_COPY_NONE = 0, /*< nick=none >*/ + G_FILE_COPY_OVERWRITE = (1 << 0), + G_FILE_COPY_BACKUP = (1 << 1), + G_FILE_COPY_NOFOLLOW_SYMLINKS = (1 << 2), + G_FILE_COPY_ALL_METADATA = (1 << 3), + G_FILE_COPY_NO_FALLBACK_FOR_MOVE = (1 << 4), + G_FILE_COPY_TARGET_DEFAULT_PERMS = (1 << 5) +} GFileCopyFlags; + + +/** + * GFileMonitorFlags: + * @G_FILE_MONITOR_NONE: No flags set. + * @G_FILE_MONITOR_WATCH_MOUNTS: Watch for mount events. + * @G_FILE_MONITOR_SEND_MOVED: Pair DELETED and CREATED events caused + * by file renames (moves) and send a single G_FILE_MONITOR_EVENT_MOVED + * event instead (NB: not supported on all backends; the default + * behaviour -without specifying this flag- is to send single DELETED + * and CREATED events). Deprecated since 2.46: use + * %G_FILE_MONITOR_WATCH_MOVES instead. + * @G_FILE_MONITOR_WATCH_HARD_LINKS: Watch for changes to the file made + * via another hard link. Since 2.36. + * @G_FILE_MONITOR_WATCH_MOVES: Watch for rename operations on a + * monitored directory. This causes %G_FILE_MONITOR_EVENT_RENAMED, + * %G_FILE_MONITOR_EVENT_MOVED_IN and %G_FILE_MONITOR_EVENT_MOVED_OUT + * events to be emitted when possible. Since: 2.46. + * + * Flags used to set what a #GFileMonitor will watch for. + */ +typedef enum { + G_FILE_MONITOR_NONE = 0, + G_FILE_MONITOR_WATCH_MOUNTS = (1 << 0), + G_FILE_MONITOR_SEND_MOVED = (1 << 1), + G_FILE_MONITOR_WATCH_HARD_LINKS = (1 << 2), + G_FILE_MONITOR_WATCH_MOVES = (1 << 3) +} GFileMonitorFlags; + + +/** + * GFileType: + * @G_FILE_TYPE_UNKNOWN: File's type is unknown. + * @G_FILE_TYPE_REGULAR: File handle represents a regular file. + * @G_FILE_TYPE_DIRECTORY: File handle represents a directory. + * @G_FILE_TYPE_SYMBOLIC_LINK: File handle represents a symbolic link + * (Unix systems). + * @G_FILE_TYPE_SPECIAL: File is a "special" file, such as a socket, fifo, + * block device, or character device. + * @G_FILE_TYPE_SHORTCUT: File is a shortcut (Windows systems). + * @G_FILE_TYPE_MOUNTABLE: File is a mountable location. + * + * Indicates the file's on-disk type. + * + * On Windows systems a file will never have %G_FILE_TYPE_SYMBOLIC_LINK type; + * use #GFileInfo and %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK to determine + * whether a file is a symlink or not. This is due to the fact that NTFS does + * not have a single filesystem object type for symbolic links - it has + * files that symlink to files, and directories that symlink to directories. + * #GFileType enumeration cannot precisely represent this important distinction, + * which is why all Windows symlinks will continue to be reported as + * %G_FILE_TYPE_REGULAR or %G_FILE_TYPE_DIRECTORY. + **/ +typedef enum { + G_FILE_TYPE_UNKNOWN = 0, + G_FILE_TYPE_REGULAR, + G_FILE_TYPE_DIRECTORY, + G_FILE_TYPE_SYMBOLIC_LINK, + G_FILE_TYPE_SPECIAL, /* socket, fifo, blockdev, chardev */ + G_FILE_TYPE_SHORTCUT, + G_FILE_TYPE_MOUNTABLE +} GFileType; -typedef struct _GumReturnAddressDetails GumReturnAddressDetails; -typedef gpointer GumReturnAddress; -typedef struct _GumReturnAddressArray GumReturnAddressArray; -struct _GumReturnAddressDetails -{ - GumReturnAddress address; - gchar module_name[GUM_MAX_PATH + 1]; - gchar function_name[GUM_MAX_SYMBOL_NAME + 1]; - gchar file_name[GUM_MAX_PATH + 1]; - guint line_number; - guint column; -}; +/** + * GFilesystemPreviewType: + * @G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS: Only preview files if user has explicitly requested it. + * @G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL: Preview files if user has requested preview of "local" files. + * @G_FILESYSTEM_PREVIEW_TYPE_NEVER: Never preview files. + * + * Indicates a hint from the file system whether files should be + * previewed in a file manager. Returned as the value of the key + * %G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW. + **/ +typedef enum { + G_FILESYSTEM_PREVIEW_TYPE_IF_ALWAYS = 0, + G_FILESYSTEM_PREVIEW_TYPE_IF_LOCAL, + G_FILESYSTEM_PREVIEW_TYPE_NEVER +} GFilesystemPreviewType; + + +/** + * GFileMonitorEvent: + * @G_FILE_MONITOR_EVENT_CHANGED: a file changed. + * @G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: a hint that this was probably the last change in a set of changes. + * @G_FILE_MONITOR_EVENT_DELETED: a file was deleted. + * @G_FILE_MONITOR_EVENT_CREATED: a file was created. + * @G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: a file attribute was changed. + * @G_FILE_MONITOR_EVENT_PRE_UNMOUNT: the file location will soon be unmounted. + * @G_FILE_MONITOR_EVENT_UNMOUNTED: the file location was unmounted. + * @G_FILE_MONITOR_EVENT_MOVED: the file was moved -- only sent if the + * (deprecated) %G_FILE_MONITOR_SEND_MOVED flag is set + * @G_FILE_MONITOR_EVENT_RENAMED: the file was renamed within the + * current directory -- only sent if the %G_FILE_MONITOR_WATCH_MOVES + * flag is set. Since: 2.46. + * @G_FILE_MONITOR_EVENT_MOVED_IN: the file was moved into the + * monitored directory from another location -- only sent if the + * %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46. + * @G_FILE_MONITOR_EVENT_MOVED_OUT: the file was moved out of the + * monitored directory to another location -- only sent if the + * %G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46 + * + * Specifies what type of event a monitor event is. + **/ +typedef enum { + G_FILE_MONITOR_EVENT_CHANGED, + G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT, + G_FILE_MONITOR_EVENT_DELETED, + G_FILE_MONITOR_EVENT_CREATED, + G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED, + G_FILE_MONITOR_EVENT_PRE_UNMOUNT, + G_FILE_MONITOR_EVENT_UNMOUNTED, + G_FILE_MONITOR_EVENT_MOVED, + G_FILE_MONITOR_EVENT_RENAMED, + G_FILE_MONITOR_EVENT_MOVED_IN, + G_FILE_MONITOR_EVENT_MOVED_OUT +} GFileMonitorEvent; + + +/* This enumeration conflicts with GIOError in giochannel.h. However, + * that is only used as a return value in some deprecated functions. + * So, we reuse the same prefix for the enumeration values, but call + * the actual enumeration (which is rarely used) GIOErrorEnum. + */ +/** + * GIOErrorEnum: + * @G_IO_ERROR_FAILED: Generic error condition for when an operation fails + * and no more specific #GIOErrorEnum value is defined. + * @G_IO_ERROR_NOT_FOUND: File not found. + * @G_IO_ERROR_EXISTS: File already exists. + * @G_IO_ERROR_IS_DIRECTORY: File is a directory. + * @G_IO_ERROR_NOT_DIRECTORY: File is not a directory. + * @G_IO_ERROR_NOT_EMPTY: File is a directory that isn't empty. + * @G_IO_ERROR_NOT_REGULAR_FILE: File is not a regular file. + * @G_IO_ERROR_NOT_SYMBOLIC_LINK: File is not a symbolic link. + * @G_IO_ERROR_NOT_MOUNTABLE_FILE: File cannot be mounted. + * @G_IO_ERROR_FILENAME_TOO_LONG: Filename is too many characters. + * @G_IO_ERROR_INVALID_FILENAME: Filename is invalid or contains invalid characters. + * @G_IO_ERROR_TOO_MANY_LINKS: File contains too many symbolic links. + * @G_IO_ERROR_NO_SPACE: No space left on drive. + * @G_IO_ERROR_INVALID_ARGUMENT: Invalid argument. + * @G_IO_ERROR_PERMISSION_DENIED: Permission denied. + * @G_IO_ERROR_NOT_SUPPORTED: Operation (or one of its parameters) not supported + * @G_IO_ERROR_NOT_MOUNTED: File isn't mounted. + * @G_IO_ERROR_ALREADY_MOUNTED: File is already mounted. + * @G_IO_ERROR_CLOSED: File was closed. + * @G_IO_ERROR_CANCELLED: Operation was cancelled. See #GCancellable. + * @G_IO_ERROR_PENDING: Operations are still pending. + * @G_IO_ERROR_READ_ONLY: File is read only. + * @G_IO_ERROR_CANT_CREATE_BACKUP: Backup couldn't be created. + * @G_IO_ERROR_WRONG_ETAG: File's Entity Tag was incorrect. + * @G_IO_ERROR_TIMED_OUT: Operation timed out. + * @G_IO_ERROR_WOULD_RECURSE: Operation would be recursive. + * @G_IO_ERROR_BUSY: File is busy. + * @G_IO_ERROR_WOULD_BLOCK: Operation would block. + * @G_IO_ERROR_HOST_NOT_FOUND: Host couldn't be found (remote operations). + * @G_IO_ERROR_WOULD_MERGE: Operation would merge files. + * @G_IO_ERROR_FAILED_HANDLED: Operation failed and a helper program has + * already interacted with the user. Do not display any error dialog. + * @G_IO_ERROR_TOO_MANY_OPEN_FILES: The current process has too many files + * open and can't open any more. Duplicate descriptors do count toward + * this limit. Since 2.20 + * @G_IO_ERROR_NOT_INITIALIZED: The object has not been initialized. Since 2.22 + * @G_IO_ERROR_ADDRESS_IN_USE: The requested address is already in use. Since 2.22 + * @G_IO_ERROR_PARTIAL_INPUT: Need more input to finish operation. Since 2.24 + * @G_IO_ERROR_INVALID_DATA: The input data was invalid. Since 2.24 + * @G_IO_ERROR_DBUS_ERROR: A remote object generated an error that + * doesn't correspond to a locally registered #GError error + * domain. Use g_dbus_error_get_remote_error() to extract the D-Bus + * error name and g_dbus_error_strip_remote_error() to fix up the + * message so it matches what was received on the wire. Since 2.26. + * @G_IO_ERROR_HOST_UNREACHABLE: Host unreachable. Since 2.26 + * @G_IO_ERROR_NETWORK_UNREACHABLE: Network unreachable. Since 2.26 + * @G_IO_ERROR_CONNECTION_REFUSED: Connection refused. Since 2.26 + * @G_IO_ERROR_PROXY_FAILED: Connection to proxy server failed. Since 2.26 + * @G_IO_ERROR_PROXY_AUTH_FAILED: Proxy authentication failed. Since 2.26 + * @G_IO_ERROR_PROXY_NEED_AUTH: Proxy server needs authentication. Since 2.26 + * @G_IO_ERROR_PROXY_NOT_ALLOWED: Proxy connection is not allowed by ruleset. + * Since 2.26 + * @G_IO_ERROR_BROKEN_PIPE: Broken pipe. Since 2.36 + * @G_IO_ERROR_CONNECTION_CLOSED: Connection closed by peer. Note that this + * is the same code as %G_IO_ERROR_BROKEN_PIPE; before 2.44 some + * "connection closed" errors returned %G_IO_ERROR_BROKEN_PIPE, but others + * returned %G_IO_ERROR_FAILED. Now they should all return the same + * value, which has this more logical name. Since 2.44. + * @G_IO_ERROR_NOT_CONNECTED: Transport endpoint is not connected. Since 2.44 + * @G_IO_ERROR_MESSAGE_TOO_LARGE: Message too large. Since 2.48. + * @G_IO_ERROR_NO_SUCH_DEVICE: No such device found. Since 2.74 + * + * Error codes returned by GIO functions. + * + * Note that this domain may be extended in future GLib releases. In + * general, new error codes either only apply to new APIs, or else + * replace %G_IO_ERROR_FAILED in cases that were not explicitly + * distinguished before. You should therefore avoid writing code like + * |[ + * if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED)) + * { + * // Assume that this is EPRINTERONFIRE + * ... + * } + * ]| + * but should instead treat all unrecognized error codes the same as + * %G_IO_ERROR_FAILED. + * + * See also #GPollableReturn for a cheaper way of returning + * %G_IO_ERROR_WOULD_BLOCK to callers without allocating a #GError. + **/ +typedef enum { + G_IO_ERROR_FAILED, + G_IO_ERROR_NOT_FOUND, + G_IO_ERROR_EXISTS, + G_IO_ERROR_IS_DIRECTORY, + G_IO_ERROR_NOT_DIRECTORY, + G_IO_ERROR_NOT_EMPTY, + G_IO_ERROR_NOT_REGULAR_FILE, + G_IO_ERROR_NOT_SYMBOLIC_LINK, + G_IO_ERROR_NOT_MOUNTABLE_FILE, + G_IO_ERROR_FILENAME_TOO_LONG, + G_IO_ERROR_INVALID_FILENAME, + G_IO_ERROR_TOO_MANY_LINKS, + G_IO_ERROR_NO_SPACE, + G_IO_ERROR_INVALID_ARGUMENT, + G_IO_ERROR_PERMISSION_DENIED, + G_IO_ERROR_NOT_SUPPORTED, + G_IO_ERROR_NOT_MOUNTED, + G_IO_ERROR_ALREADY_MOUNTED, + G_IO_ERROR_CLOSED, + G_IO_ERROR_CANCELLED, + G_IO_ERROR_PENDING, + G_IO_ERROR_READ_ONLY, + G_IO_ERROR_CANT_CREATE_BACKUP, + G_IO_ERROR_WRONG_ETAG, + G_IO_ERROR_TIMED_OUT, + G_IO_ERROR_WOULD_RECURSE, + G_IO_ERROR_BUSY, + G_IO_ERROR_WOULD_BLOCK, + G_IO_ERROR_HOST_NOT_FOUND, + G_IO_ERROR_WOULD_MERGE, + G_IO_ERROR_FAILED_HANDLED, + G_IO_ERROR_TOO_MANY_OPEN_FILES, + G_IO_ERROR_NOT_INITIALIZED, + G_IO_ERROR_ADDRESS_IN_USE, + G_IO_ERROR_PARTIAL_INPUT, + G_IO_ERROR_INVALID_DATA, + G_IO_ERROR_DBUS_ERROR, + G_IO_ERROR_HOST_UNREACHABLE, + G_IO_ERROR_NETWORK_UNREACHABLE, + G_IO_ERROR_CONNECTION_REFUSED, + G_IO_ERROR_PROXY_FAILED, + G_IO_ERROR_PROXY_AUTH_FAILED, + G_IO_ERROR_PROXY_NEED_AUTH, + G_IO_ERROR_PROXY_NOT_ALLOWED, + G_IO_ERROR_BROKEN_PIPE, + G_IO_ERROR_CONNECTION_CLOSED = G_IO_ERROR_BROKEN_PIPE, + G_IO_ERROR_NOT_CONNECTED, + G_IO_ERROR_MESSAGE_TOO_LARGE, + G_IO_ERROR_NO_SUCH_DEVICE GIO_AVAILABLE_ENUMERATOR_IN_2_74, +} GIOErrorEnum; + + +/** + * GAskPasswordFlags: + * @G_ASK_PASSWORD_NEED_PASSWORD: operation requires a password. + * @G_ASK_PASSWORD_NEED_USERNAME: operation requires a username. + * @G_ASK_PASSWORD_NEED_DOMAIN: operation requires a domain. + * @G_ASK_PASSWORD_SAVING_SUPPORTED: operation supports saving settings. + * @G_ASK_PASSWORD_ANONYMOUS_SUPPORTED: operation supports anonymous users. + * @G_ASK_PASSWORD_TCRYPT: operation takes TCRYPT parameters (Since: 2.58) + * + * #GAskPasswordFlags are used to request specific information from the + * user, or to notify the user of their choices in an authentication + * situation. + **/ +typedef enum { + G_ASK_PASSWORD_NEED_PASSWORD = (1 << 0), + G_ASK_PASSWORD_NEED_USERNAME = (1 << 1), + G_ASK_PASSWORD_NEED_DOMAIN = (1 << 2), + G_ASK_PASSWORD_SAVING_SUPPORTED = (1 << 3), + G_ASK_PASSWORD_ANONYMOUS_SUPPORTED = (1 << 4), + G_ASK_PASSWORD_TCRYPT = (1 << 5), +} GAskPasswordFlags; -struct _GumReturnAddressArray -{ - guint len; - GumReturnAddress items[GUM_MAX_BACKTRACE_DEPTH]; -}; -G_BEGIN_DECLS +/** + * GPasswordSave: + * @G_PASSWORD_SAVE_NEVER: never save a password. + * @G_PASSWORD_SAVE_FOR_SESSION: save a password for the session. + * @G_PASSWORD_SAVE_PERMANENTLY: save a password permanently. + * + * #GPasswordSave is used to indicate the lifespan of a saved password. + * + * #Gvfs stores passwords in the Gnome keyring when this flag allows it + * to, and later retrieves it again from there. + **/ +typedef enum { + G_PASSWORD_SAVE_NEVER, + G_PASSWORD_SAVE_FOR_SESSION, + G_PASSWORD_SAVE_PERMANENTLY +} GPasswordSave; -GUM_API gboolean gum_return_address_details_from_address ( - GumReturnAddress address, GumReturnAddressDetails * details); -GUM_API gboolean gum_return_address_array_is_equal ( - const GumReturnAddressArray * array1, - const GumReturnAddressArray * array2); +/** + * GMountOperationResult: + * @G_MOUNT_OPERATION_HANDLED: The request was fulfilled and the + * user specified data is now available + * @G_MOUNT_OPERATION_ABORTED: The user requested the mount operation + * to be aborted + * @G_MOUNT_OPERATION_UNHANDLED: The request was unhandled (i.e. not + * implemented) + * + * #GMountOperationResult is returned as a result when a request for + * information is send by the mounting operation. + **/ +typedef enum { + G_MOUNT_OPERATION_HANDLED, + G_MOUNT_OPERATION_ABORTED, + G_MOUNT_OPERATION_UNHANDLED +} GMountOperationResult; -G_END_DECLS -#endif +/** + * GOutputStreamSpliceFlags: + * @G_OUTPUT_STREAM_SPLICE_NONE: Do not close either stream. + * @G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE: Close the source stream after + * the splice. + * @G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET: Close the target stream after + * the splice. + * + * GOutputStreamSpliceFlags determine how streams should be spliced. + **/ +typedef enum { + G_OUTPUT_STREAM_SPLICE_NONE = 0, + G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE = (1 << 0), + G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET = (1 << 1) +} GOutputStreamSpliceFlags; -G_BEGIN_DECLS -#define GUM_TYPE_BACKTRACER (gum_backtracer_get_type ()) -GUM_DECLARE_INTERFACE (GumBacktracer, gum_backtracer, GUM, BACKTRACER, GObject) +/** + * GIOStreamSpliceFlags: + * @G_IO_STREAM_SPLICE_NONE: Do not close either stream. + * @G_IO_STREAM_SPLICE_CLOSE_STREAM1: Close the first stream after + * the splice. + * @G_IO_STREAM_SPLICE_CLOSE_STREAM2: Close the second stream after + * the splice. + * @G_IO_STREAM_SPLICE_WAIT_FOR_BOTH: Wait for both splice operations to finish + * before calling the callback. + * + * GIOStreamSpliceFlags determine how streams should be spliced. + * + * Since: 2.28 + **/ +typedef enum { + G_IO_STREAM_SPLICE_NONE = 0, + G_IO_STREAM_SPLICE_CLOSE_STREAM1 = (1 << 0), + G_IO_STREAM_SPLICE_CLOSE_STREAM2 = (1 << 1), + G_IO_STREAM_SPLICE_WAIT_FOR_BOTH = (1 << 2) +} GIOStreamSpliceFlags; -#ifndef GUM_DIET +/** + * GEmblemOrigin: + * @G_EMBLEM_ORIGIN_UNKNOWN: Emblem of unknown origin + * @G_EMBLEM_ORIGIN_DEVICE: Emblem adds device-specific information + * @G_EMBLEM_ORIGIN_LIVEMETADATA: Emblem depicts live metadata, such as "readonly" + * @G_EMBLEM_ORIGIN_TAG: Emblem comes from a user-defined tag, e.g. set by nautilus (in the future) + * + * GEmblemOrigin is used to add information about the origin of the emblem + * to #GEmblem. + * + * Since: 2.18 + */ +typedef enum { + G_EMBLEM_ORIGIN_UNKNOWN, + G_EMBLEM_ORIGIN_DEVICE, + G_EMBLEM_ORIGIN_LIVEMETADATA, + G_EMBLEM_ORIGIN_TAG +} GEmblemOrigin; -struct _GumBacktracerInterface -{ - GTypeInterface parent; +/** + * GResolverError: + * @G_RESOLVER_ERROR_NOT_FOUND: the requested name/address/service was not + * found + * @G_RESOLVER_ERROR_TEMPORARY_FAILURE: the requested information could not + * be looked up due to a network error or similar problem + * @G_RESOLVER_ERROR_INTERNAL: unknown error + * + * An error code used with %G_RESOLVER_ERROR in a #GError returned + * from a #GResolver routine. + * + * Since: 2.22 + */ +typedef enum { + G_RESOLVER_ERROR_NOT_FOUND, + G_RESOLVER_ERROR_TEMPORARY_FAILURE, + G_RESOLVER_ERROR_INTERNAL +} GResolverError; + +/** + * GResolverRecordType: + * @G_RESOLVER_RECORD_SRV: look up DNS SRV records for a domain + * @G_RESOLVER_RECORD_MX: look up DNS MX records for a domain + * @G_RESOLVER_RECORD_TXT: look up DNS TXT records for a name + * @G_RESOLVER_RECORD_SOA: look up DNS SOA records for a zone + * @G_RESOLVER_RECORD_NS: look up DNS NS records for a domain + * + * The type of record that g_resolver_lookup_records() or + * g_resolver_lookup_records_async() should retrieve. The records are returned + * as lists of #GVariant tuples. Each record type has different values in + * the variant tuples returned. + * + * %G_RESOLVER_RECORD_SRV records are returned as variants with the signature + * `(qqqs)`, containing a `guint16` with the priority, a `guint16` with the + * weight, a `guint16` with the port, and a string of the hostname. + * + * %G_RESOLVER_RECORD_MX records are returned as variants with the signature + * `(qs)`, representing a `guint16` with the preference, and a string containing + * the mail exchanger hostname. + * + * %G_RESOLVER_RECORD_TXT records are returned as variants with the signature + * `(as)`, representing an array of the strings in the text record. Note: Most TXT + * records only contain a single string, but + * [RFC 1035](https://tools.ietf.org/html/rfc1035#section-3.3.14) does allow a + * record to contain multiple strings. The RFC which defines the interpretation + * of a specific TXT record will likely require concatenation of multiple + * strings if they are present, as with + * [RFC 7208](https://tools.ietf.org/html/rfc7208#section-3.3). + * + * %G_RESOLVER_RECORD_SOA records are returned as variants with the signature + * `(ssuuuuu)`, representing a string containing the primary name server, a + * string containing the administrator, the serial as a `guint32`, the refresh + * interval as a `guint32`, the retry interval as a `guint32`, the expire timeout + * as a `guint32`, and the TTL as a `guint32`. + * + * %G_RESOLVER_RECORD_NS records are returned as variants with the signature + * `(s)`, representing a string of the hostname of the name server. + * + * Since: 2.34 + */ +typedef enum { + G_RESOLVER_RECORD_SRV = 1, + G_RESOLVER_RECORD_MX, + G_RESOLVER_RECORD_TXT, + G_RESOLVER_RECORD_SOA, + G_RESOLVER_RECORD_NS +} GResolverRecordType; - void (* generate) (GumBacktracer * self, const GumCpuContext * cpu_context, - GumReturnAddressArray * return_addresses, guint limit); -}; +/** + * GResourceError: + * @G_RESOURCE_ERROR_NOT_FOUND: no file was found at the requested path + * @G_RESOURCE_ERROR_INTERNAL: unknown error + * + * An error code used with %G_RESOURCE_ERROR in a #GError returned + * from a #GResource routine. + * + * Since: 2.32 + */ +typedef enum { + G_RESOURCE_ERROR_NOT_FOUND, + G_RESOURCE_ERROR_INTERNAL +} GResourceError; -#endif +/** + * GResourceFlags: + * @G_RESOURCE_FLAGS_NONE: No flags set. + * @G_RESOURCE_FLAGS_COMPRESSED: The file is compressed. + * + * GResourceFlags give information about a particular file inside a resource + * bundle. + * + * Since: 2.32 + **/ +typedef enum { + G_RESOURCE_FLAGS_NONE = 0, + G_RESOURCE_FLAGS_COMPRESSED = (1<<0) +} GResourceFlags; -GUM_API GumBacktracer * gum_backtracer_make_accurate (void); -GUM_API GumBacktracer * gum_backtracer_make_fuzzy (void); +/** + * GResourceLookupFlags: + * @G_RESOURCE_LOOKUP_FLAGS_NONE: No flags set. + * + * GResourceLookupFlags determine how resource path lookups are handled. + * + * Since: 2.32 + **/ +typedef enum /*< flags >*/ { + G_RESOURCE_LOOKUP_FLAGS_NONE = 0 +} GResourceLookupFlags; -GUM_API void gum_backtracer_generate (GumBacktracer * self, - const GumCpuContext * cpu_context, - GumReturnAddressArray * return_addresses); -GUM_API void gum_backtracer_generate_with_limit (GumBacktracer * self, - const GumCpuContext * cpu_context, - GumReturnAddressArray * return_addresses, guint limit); +/** + * GSocketFamily: + * @G_SOCKET_FAMILY_INVALID: no address family + * @G_SOCKET_FAMILY_IPV4: the IPv4 family + * @G_SOCKET_FAMILY_IPV6: the IPv6 family + * @G_SOCKET_FAMILY_UNIX: the UNIX domain family + * + * The protocol family of a #GSocketAddress. (These values are + * identical to the system defines %AF_INET, %AF_INET6 and %AF_UNIX, + * if available.) + * + * Since: 2.22 + */ +typedef enum { + G_SOCKET_FAMILY_INVALID, + G_SOCKET_FAMILY_UNIX = GLIB_SYSDEF_AF_UNIX, + G_SOCKET_FAMILY_IPV4 = GLIB_SYSDEF_AF_INET, + G_SOCKET_FAMILY_IPV6 = GLIB_SYSDEF_AF_INET6 +} GSocketFamily; -G_END_DECLS +/** + * GSocketType: + * @G_SOCKET_TYPE_INVALID: Type unknown or wrong + * @G_SOCKET_TYPE_STREAM: Reliable connection-based byte streams (e.g. TCP). + * @G_SOCKET_TYPE_DATAGRAM: Connectionless, unreliable datagram passing. + * (e.g. UDP) + * @G_SOCKET_TYPE_SEQPACKET: Reliable connection-based passing of datagrams + * of fixed maximum length (e.g. SCTP). + * + * Flags used when creating a #GSocket. Some protocols may not implement + * all the socket types. + * + * Since: 2.22 + */ +typedef enum +{ + G_SOCKET_TYPE_INVALID, + G_SOCKET_TYPE_STREAM, + G_SOCKET_TYPE_DATAGRAM, + G_SOCKET_TYPE_SEQPACKET +} GSocketType; + +/** + * GSocketMsgFlags: + * @G_SOCKET_MSG_NONE: No flags. + * @G_SOCKET_MSG_OOB: Request to send/receive out of band data. + * @G_SOCKET_MSG_PEEK: Read data from the socket without removing it from + * the queue. + * @G_SOCKET_MSG_DONTROUTE: Don't use a gateway to send out the packet, + * only send to hosts on directly connected networks. + * + * Flags used in g_socket_receive_message() and g_socket_send_message(). + * The flags listed in the enum are some commonly available flags, but the + * values used for them are the same as on the platform, and any other flags + * are passed in/out as is. So to use a platform specific flag, just include + * the right system header and pass in the flag. + * + * Since: 2.22 + */ +typedef enum /*< flags >*/ +{ + G_SOCKET_MSG_NONE, + G_SOCKET_MSG_OOB = GLIB_SYSDEF_MSG_OOB, + G_SOCKET_MSG_PEEK = GLIB_SYSDEF_MSG_PEEK, + G_SOCKET_MSG_DONTROUTE = GLIB_SYSDEF_MSG_DONTROUTE +} GSocketMsgFlags; -#endif -/* - * Copyright (C) 2017-2023 Ole André Vadla Ravnås - * Copyright (C) 2024 Francesco Tamagni +/** + * GSocketProtocol: + * @G_SOCKET_PROTOCOL_UNKNOWN: The protocol type is unknown + * @G_SOCKET_PROTOCOL_DEFAULT: The default protocol for the family/type + * @G_SOCKET_PROTOCOL_TCP: TCP over IP + * @G_SOCKET_PROTOCOL_UDP: UDP over IP + * @G_SOCKET_PROTOCOL_SCTP: SCTP over IP * - * Licence: wxWindows Library Licence, Version 3.1 + * A protocol identifier is specified when creating a #GSocket, which is a + * family/type specific identifier, where 0 means the default protocol for + * the particular family/type. + * + * This enum contains a set of commonly available and used protocols. You + * can also pass any other identifiers handled by the platform in order to + * use protocols not listed here. + * + * Since: 2.22 */ +typedef enum { + G_SOCKET_PROTOCOL_UNKNOWN = -1, + G_SOCKET_PROTOCOL_DEFAULT = 0, + G_SOCKET_PROTOCOL_TCP = 6, + G_SOCKET_PROTOCOL_UDP = 17, + G_SOCKET_PROTOCOL_SCTP = 132 +} GSocketProtocol; -#ifndef __GUM_CLOAK_H__ -#define __GUM_CLOAK_H__ +/** + * GZlibCompressorFormat: + * @G_ZLIB_COMPRESSOR_FORMAT_ZLIB: deflate compression with zlib header + * @G_ZLIB_COMPRESSOR_FORMAT_GZIP: gzip file format + * @G_ZLIB_COMPRESSOR_FORMAT_RAW: deflate compression with no header + * + * Used to select the type of data format to use for #GZlibDecompressor + * and #GZlibCompressor. + * + * Since: 2.24 + */ +typedef enum { + G_ZLIB_COMPRESSOR_FORMAT_ZLIB, + G_ZLIB_COMPRESSOR_FORMAT_GZIP, + G_ZLIB_COMPRESSOR_FORMAT_RAW +} GZlibCompressorFormat; + +/** + * GUnixSocketAddressType: + * @G_UNIX_SOCKET_ADDRESS_INVALID: invalid + * @G_UNIX_SOCKET_ADDRESS_ANONYMOUS: anonymous + * @G_UNIX_SOCKET_ADDRESS_PATH: a filesystem path + * @G_UNIX_SOCKET_ADDRESS_ABSTRACT: an abstract name + * @G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED: an abstract name, 0-padded + * to the full length of a unix socket name + * + * The type of name used by a #GUnixSocketAddress. + * %G_UNIX_SOCKET_ADDRESS_PATH indicates a traditional unix domain + * socket bound to a filesystem path. %G_UNIX_SOCKET_ADDRESS_ANONYMOUS + * indicates a socket not bound to any name (eg, a client-side socket, + * or a socket created with socketpair()). + * + * For abstract sockets, there are two incompatible ways of naming + * them; the man pages suggest using the entire `struct sockaddr_un` + * as the name, padding the unused parts of the %sun_path field with + * zeroes; this corresponds to %G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED. + * However, many programs instead just use a portion of %sun_path, and + * pass an appropriate smaller length to bind() or connect(). This is + * %G_UNIX_SOCKET_ADDRESS_ABSTRACT. + * + * Since: 2.26 + */ +typedef enum { + G_UNIX_SOCKET_ADDRESS_INVALID, + G_UNIX_SOCKET_ADDRESS_ANONYMOUS, + G_UNIX_SOCKET_ADDRESS_PATH, + G_UNIX_SOCKET_ADDRESS_ABSTRACT, + G_UNIX_SOCKET_ADDRESS_ABSTRACT_PADDED +} GUnixSocketAddressType; -/* - * Copyright (C) 2008-2022 Ole André Vadla Ravnås - * Copyright (C) 2008 Christian Berentsen +/** + * GBusType: + * @G_BUS_TYPE_STARTER: An alias for the message bus that activated the process, if any. + * @G_BUS_TYPE_NONE: Not a message bus. + * @G_BUS_TYPE_SYSTEM: The system-wide message bus. + * @G_BUS_TYPE_SESSION: The login session message bus. * - * Licence: wxWindows Library Licence, Version 3.1 + * An enumeration for well-known message buses. + * + * Since: 2.26 */ +typedef enum +{ + G_BUS_TYPE_STARTER = -1, + G_BUS_TYPE_NONE = 0, + G_BUS_TYPE_SYSTEM = 1, + G_BUS_TYPE_SESSION = 2 +} GBusType; -#ifndef __GUM_MEMORY_H__ -#define __GUM_MEMORY_H__ +/** + * GBusNameOwnerFlags: + * @G_BUS_NAME_OWNER_FLAGS_NONE: No flags set. + * @G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT: Allow another message bus connection to claim the name. + * @G_BUS_NAME_OWNER_FLAGS_REPLACE: If another message bus connection owns the name and have + * specified %G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection. + * @G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE: If another message bus connection owns the name, immediately + * return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54) + * + * Flags used in g_bus_own_name(). + * + * Since: 2.26 + */ +typedef enum +{ + G_BUS_NAME_OWNER_FLAGS_NONE = 0, /*< nick=none >*/ + G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT = (1<<0), /*< nick=allow-replacement >*/ + G_BUS_NAME_OWNER_FLAGS_REPLACE = (1<<1), /*< nick=replace >*/ + G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE = (1<<2) /*< nick=do-not-queue >*/ +} GBusNameOwnerFlags; +/* When adding new flags, their numeric values must currently match those + * used in the D-Bus Specification. */ +/** + * GBusNameWatcherFlags: + * @G_BUS_NAME_WATCHER_FLAGS_NONE: No flags set. + * @G_BUS_NAME_WATCHER_FLAGS_AUTO_START: If no-one owns the name when + * beginning to watch the name, ask the bus to launch an owner for the + * name. + * + * Flags used in g_bus_watch_name(). + * + * Since: 2.26 + */ +typedef enum +{ + G_BUS_NAME_WATCHER_FLAGS_NONE = 0, + G_BUS_NAME_WATCHER_FLAGS_AUTO_START = (1<<0) +} GBusNameWatcherFlags; + +/** + * GDBusProxyFlags: + * @G_DBUS_PROXY_FLAGS_NONE: No flags set. + * @G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES: Don't load properties. + * @G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS: Don't connect to signals on the remote object. + * @G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START: If the proxy is for a well-known name, + * do not ask the bus to launch an owner during proxy initialization or a method call. + * This flag is only meaningful in proxies for well-known names. + * @G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES: If set, the property value for any __invalidated property__ will be (asynchronously) retrieved upon receiving the [`PropertiesChanged`](http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties) D-Bus signal and the property will not cause emission of the #GDBusProxy::g-properties-changed signal. When the value is received the #GDBusProxy::g-properties-changed signal is emitted for the property along with the retrieved value. Since 2.32. + * @G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION: If the proxy is for a well-known name, + * do not ask the bus to launch an owner during proxy initialization, but allow it to be + * autostarted by a method call. This flag is only meaningful in proxies for well-known names, + * and only if %G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is not also specified. + * @G_DBUS_PROXY_FLAGS_NO_MATCH_RULE: Don't actually send the AddMatch D-Bus + * call for this signal subscription. This gives you more control + * over which match rules you add (but you must add them manually). (Since: 2.72) + * + * Flags used when constructing an instance of a #GDBusProxy derived class. + * + * Since: 2.26 + */ +typedef enum +{ + G_DBUS_PROXY_FLAGS_NONE = 0, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES = (1<<0), + G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS = (1<<1), + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START = (1<<2), + G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES = (1<<3), + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION = (1<<4), + G_DBUS_PROXY_FLAGS_NO_MATCH_RULE GIO_AVAILABLE_ENUMERATOR_IN_2_72 = (1<<5) +} GDBusProxyFlags; + +/** + * GDBusError: + * @G_DBUS_ERROR_FAILED: + * A generic error; "something went wrong" - see the error message for + * more. + * @G_DBUS_ERROR_NO_MEMORY: + * There was not enough memory to complete an operation. + * @G_DBUS_ERROR_SERVICE_UNKNOWN: + * The bus doesn't know how to launch a service to supply the bus name + * you wanted. + * @G_DBUS_ERROR_NAME_HAS_NO_OWNER: + * The bus name you referenced doesn't exist (i.e. no application owns + * it). + * @G_DBUS_ERROR_NO_REPLY: + * No reply to a message expecting one, usually means a timeout occurred. + * @G_DBUS_ERROR_IO_ERROR: + * Something went wrong reading or writing to a socket, for example. + * @G_DBUS_ERROR_BAD_ADDRESS: + * A D-Bus bus address was malformed. + * @G_DBUS_ERROR_NOT_SUPPORTED: + * Requested operation isn't supported (like ENOSYS on UNIX). + * @G_DBUS_ERROR_LIMITS_EXCEEDED: + * Some limited resource is exhausted. + * @G_DBUS_ERROR_ACCESS_DENIED: + * Security restrictions don't allow doing what you're trying to do. + * @G_DBUS_ERROR_AUTH_FAILED: + * Authentication didn't work. + * @G_DBUS_ERROR_NO_SERVER: + * Unable to connect to server (probably caused by ECONNREFUSED on a + * socket). + * @G_DBUS_ERROR_TIMEOUT: + * Certain timeout errors, possibly ETIMEDOUT on a socket. Note that + * %G_DBUS_ERROR_NO_REPLY is used for message reply timeouts. Warning: + * this is confusingly-named given that %G_DBUS_ERROR_TIMED_OUT also + * exists. We can't fix it for compatibility reasons so just be + * careful. + * @G_DBUS_ERROR_NO_NETWORK: + * No network access (probably ENETUNREACH on a socket). + * @G_DBUS_ERROR_ADDRESS_IN_USE: + * Can't bind a socket since its address is in use (i.e. EADDRINUSE). + * @G_DBUS_ERROR_DISCONNECTED: + * The connection is disconnected and you're trying to use it. + * @G_DBUS_ERROR_INVALID_ARGS: + * Invalid arguments passed to a method call. + * @G_DBUS_ERROR_FILE_NOT_FOUND: + * Missing file. + * @G_DBUS_ERROR_FILE_EXISTS: + * Existing file and the operation you're using does not silently overwrite. + * @G_DBUS_ERROR_UNKNOWN_METHOD: + * Method name you invoked isn't known by the object you invoked it on. + * @G_DBUS_ERROR_UNKNOWN_OBJECT: + * Object you invoked a method on isn't known. Since 2.42 + * @G_DBUS_ERROR_UNKNOWN_INTERFACE: + * Interface you invoked a method on isn't known by the object. Since 2.42 + * @G_DBUS_ERROR_UNKNOWN_PROPERTY: + * Property you tried to access isn't known by the object. Since 2.42 + * @G_DBUS_ERROR_PROPERTY_READ_ONLY: + * Property you tried to set is read-only. Since 2.42 + * @G_DBUS_ERROR_TIMED_OUT: + * Certain timeout errors, e.g. while starting a service. Warning: this is + * confusingly-named given that %G_DBUS_ERROR_TIMEOUT also exists. We + * can't fix it for compatibility reasons so just be careful. + * @G_DBUS_ERROR_MATCH_RULE_NOT_FOUND: + * Tried to remove or modify a match rule that didn't exist. + * @G_DBUS_ERROR_MATCH_RULE_INVALID: + * The match rule isn't syntactically valid. + * @G_DBUS_ERROR_SPAWN_EXEC_FAILED: + * While starting a new process, the exec() call failed. + * @G_DBUS_ERROR_SPAWN_FORK_FAILED: + * While starting a new process, the fork() call failed. + * @G_DBUS_ERROR_SPAWN_CHILD_EXITED: + * While starting a new process, the child exited with a status code. + * @G_DBUS_ERROR_SPAWN_CHILD_SIGNALED: + * While starting a new process, the child exited on a signal. + * @G_DBUS_ERROR_SPAWN_FAILED: + * While starting a new process, something went wrong. + * @G_DBUS_ERROR_SPAWN_SETUP_FAILED: + * We failed to setup the environment correctly. + * @G_DBUS_ERROR_SPAWN_CONFIG_INVALID: + * We failed to setup the config parser correctly. + * @G_DBUS_ERROR_SPAWN_SERVICE_INVALID: + * Bus name was not valid. + * @G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND: + * Service file not found in system-services directory. + * @G_DBUS_ERROR_SPAWN_PERMISSIONS_INVALID: + * Permissions are incorrect on the setuid helper. + * @G_DBUS_ERROR_SPAWN_FILE_INVALID: + * Service file invalid (Name, User or Exec missing). + * @G_DBUS_ERROR_SPAWN_NO_MEMORY: + * Tried to get a UNIX process ID and it wasn't available. + * @G_DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN: + * Tried to get a UNIX process ID and it wasn't available. + * @G_DBUS_ERROR_INVALID_SIGNATURE: + * A type signature is not valid. + * @G_DBUS_ERROR_INVALID_FILE_CONTENT: + * A file contains invalid syntax or is otherwise broken. + * @G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN: + * Asked for SELinux security context and it wasn't available. + * @G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN: + * Asked for ADT audit data and it wasn't available. + * @G_DBUS_ERROR_OBJECT_PATH_IN_USE: + * There's already an object with the requested object path. + * + * Error codes for the %G_DBUS_ERROR error domain. + * + * Since: 2.26 + */ +typedef enum +{ + /* Well-known errors in the org.freedesktop.DBus.Error namespace */ + G_DBUS_ERROR_FAILED, /* org.freedesktop.DBus.Error.Failed */ + G_DBUS_ERROR_NO_MEMORY, /* org.freedesktop.DBus.Error.NoMemory */ + G_DBUS_ERROR_SERVICE_UNKNOWN, /* org.freedesktop.DBus.Error.ServiceUnknown */ + G_DBUS_ERROR_NAME_HAS_NO_OWNER, /* org.freedesktop.DBus.Error.NameHasNoOwner */ + G_DBUS_ERROR_NO_REPLY, /* org.freedesktop.DBus.Error.NoReply */ + G_DBUS_ERROR_IO_ERROR, /* org.freedesktop.DBus.Error.IOError */ + G_DBUS_ERROR_BAD_ADDRESS, /* org.freedesktop.DBus.Error.BadAddress */ + G_DBUS_ERROR_NOT_SUPPORTED, /* org.freedesktop.DBus.Error.NotSupported */ + G_DBUS_ERROR_LIMITS_EXCEEDED, /* org.freedesktop.DBus.Error.LimitsExceeded */ + G_DBUS_ERROR_ACCESS_DENIED, /* org.freedesktop.DBus.Error.AccessDenied */ + G_DBUS_ERROR_AUTH_FAILED, /* org.freedesktop.DBus.Error.AuthFailed */ + G_DBUS_ERROR_NO_SERVER, /* org.freedesktop.DBus.Error.NoServer */ + G_DBUS_ERROR_TIMEOUT, /* org.freedesktop.DBus.Error.Timeout */ + G_DBUS_ERROR_NO_NETWORK, /* org.freedesktop.DBus.Error.NoNetwork */ + G_DBUS_ERROR_ADDRESS_IN_USE, /* org.freedesktop.DBus.Error.AddressInUse */ + G_DBUS_ERROR_DISCONNECTED, /* org.freedesktop.DBus.Error.Disconnected */ + G_DBUS_ERROR_INVALID_ARGS, /* org.freedesktop.DBus.Error.InvalidArgs */ + G_DBUS_ERROR_FILE_NOT_FOUND, /* org.freedesktop.DBus.Error.FileNotFound */ + G_DBUS_ERROR_FILE_EXISTS, /* org.freedesktop.DBus.Error.FileExists */ + G_DBUS_ERROR_UNKNOWN_METHOD, /* org.freedesktop.DBus.Error.UnknownMethod */ + G_DBUS_ERROR_TIMED_OUT, /* org.freedesktop.DBus.Error.TimedOut */ + G_DBUS_ERROR_MATCH_RULE_NOT_FOUND, /* org.freedesktop.DBus.Error.MatchRuleNotFound */ + G_DBUS_ERROR_MATCH_RULE_INVALID, /* org.freedesktop.DBus.Error.MatchRuleInvalid */ + G_DBUS_ERROR_SPAWN_EXEC_FAILED, /* org.freedesktop.DBus.Error.Spawn.ExecFailed */ + G_DBUS_ERROR_SPAWN_FORK_FAILED, /* org.freedesktop.DBus.Error.Spawn.ForkFailed */ + G_DBUS_ERROR_SPAWN_CHILD_EXITED, /* org.freedesktop.DBus.Error.Spawn.ChildExited */ + G_DBUS_ERROR_SPAWN_CHILD_SIGNALED, /* org.freedesktop.DBus.Error.Spawn.ChildSignaled */ + G_DBUS_ERROR_SPAWN_FAILED, /* org.freedesktop.DBus.Error.Spawn.Failed */ + G_DBUS_ERROR_SPAWN_SETUP_FAILED, /* org.freedesktop.DBus.Error.Spawn.FailedToSetup */ + G_DBUS_ERROR_SPAWN_CONFIG_INVALID, /* org.freedesktop.DBus.Error.Spawn.ConfigInvalid */ + G_DBUS_ERROR_SPAWN_SERVICE_INVALID, /* org.freedesktop.DBus.Error.Spawn.ServiceNotValid */ + G_DBUS_ERROR_SPAWN_SERVICE_NOT_FOUND, /* org.freedesktop.DBus.Error.Spawn.ServiceNotFound */ + G_DBUS_ERROR_SPAWN_PERMISSIONS_INVALID, /* org.freedesktop.DBus.Error.Spawn.PermissionsInvalid */ + G_DBUS_ERROR_SPAWN_FILE_INVALID, /* org.freedesktop.DBus.Error.Spawn.FileInvalid */ + G_DBUS_ERROR_SPAWN_NO_MEMORY, /* org.freedesktop.DBus.Error.Spawn.NoMemory */ + G_DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN, /* org.freedesktop.DBus.Error.UnixProcessIdUnknown */ + G_DBUS_ERROR_INVALID_SIGNATURE, /* org.freedesktop.DBus.Error.InvalidSignature */ + G_DBUS_ERROR_INVALID_FILE_CONTENT, /* org.freedesktop.DBus.Error.InvalidFileContent */ + G_DBUS_ERROR_SELINUX_SECURITY_CONTEXT_UNKNOWN, /* org.freedesktop.DBus.Error.SELinuxSecurityContextUnknown */ + G_DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN, /* org.freedesktop.DBus.Error.AdtAuditDataUnknown */ + G_DBUS_ERROR_OBJECT_PATH_IN_USE, /* org.freedesktop.DBus.Error.ObjectPathInUse */ + G_DBUS_ERROR_UNKNOWN_OBJECT, /* org.freedesktop.DBus.Error.UnknownObject */ + G_DBUS_ERROR_UNKNOWN_INTERFACE, /* org.freedesktop.DBus.Error.UnknownInterface */ + G_DBUS_ERROR_UNKNOWN_PROPERTY, /* org.freedesktop.DBus.Error.UnknownProperty */ + G_DBUS_ERROR_PROPERTY_READ_ONLY /* org.freedesktop.DBus.Error.PropertyReadOnly */ +} GDBusError; +/* Remember to update g_dbus_error_quark() in gdbuserror.c if you extend this enumeration */ + +/** + * GDBusConnectionFlags: + * @G_DBUS_CONNECTION_FLAGS_NONE: No flags set. + * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT: Perform authentication against server. + * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER: Perform authentication against client. + * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS: When + * authenticating as a server, allow the anonymous authentication + * method. + * @G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION: Pass this flag if connecting to a peer that is a + * message bus. This means that the Hello() method will be invoked as part of the connection setup. + * @G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING: If set, processing of D-Bus messages is + * delayed until g_dbus_connection_start_message_processing() is called. + * @G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER: When authenticating + * as a server, require the UID of the peer to be the same as the UID of the server. (Since: 2.68) + * @G_DBUS_CONNECTION_FLAGS_CROSS_NAMESPACE: When authenticating, try to use + * protocols that work across a Linux user namespace boundary, even if this + * reduces interoperability with older D-Bus implementations. This currently + * affects client-side `EXTERNAL` authentication, for which this flag makes + * connections to a server in another user namespace succeed, but causes + * a deadlock when connecting to a GDBus server older than 2.73.3. Since: 2.74 + * + * Flags used when creating a new #GDBusConnection. + * + * Since: 2.26 + */ +typedef enum { + G_DBUS_CONNECTION_FLAGS_NONE = 0, + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT = (1<<0), + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER = (1<<1), + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<2), + G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION = (1<<3), + G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING = (1<<4), + G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GIO_AVAILABLE_ENUMERATOR_IN_2_68 = (1<<5), + G_DBUS_CONNECTION_FLAGS_CROSS_NAMESPACE GIO_AVAILABLE_ENUMERATOR_IN_2_74 = (1<<6) +} GDBusConnectionFlags; -#define GUM_TYPE_MATCH_PATTERN (gum_match_pattern_get_type ()) -#define GUM_TYPE_MEMORY_RANGE (gum_memory_range_get_type ()) -#define GUM_MEMORY_RANGE_INCLUDES(r, a) ((a) >= (r)->base_address && \ - (a) < ((r)->base_address + (r)->size)) +/** + * GDBusCapabilityFlags: + * @G_DBUS_CAPABILITY_FLAGS_NONE: No flags set. + * @G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING: The connection + * supports exchanging UNIX file descriptors with the remote peer. + * + * Capabilities negotiated with the remote peer. + * + * Since: 2.26 + */ +typedef enum { + G_DBUS_CAPABILITY_FLAGS_NONE = 0, + G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING = (1<<0) +} GDBusCapabilityFlags; -#define GUM_PAGE_RW ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE)) -#define GUM_PAGE_RX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_EXECUTE)) -#define GUM_PAGE_RWX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE | \ - GUM_PAGE_EXECUTE)) +/** + * GDBusCallFlags: + * @G_DBUS_CALL_FLAGS_NONE: No flags set. + * @G_DBUS_CALL_FLAGS_NO_AUTO_START: The bus must not launch + * an owner for the destination name in response to this method + * invocation. + * @G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION: the caller is prepared to + * wait for interactive authorization. Since 2.46. + * + * Flags used in g_dbus_connection_call() and similar APIs. + * + * Since: 2.26 + */ +typedef enum { + G_DBUS_CALL_FLAGS_NONE = 0, + G_DBUS_CALL_FLAGS_NO_AUTO_START = (1<<0), + G_DBUS_CALL_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION = (1<<1) +} GDBusCallFlags; +/* (1<<31) is reserved for internal use by GDBusConnection, do not use it. */ -G_BEGIN_DECLS +/** + * GDBusMessageType: + * @G_DBUS_MESSAGE_TYPE_INVALID: Message is of invalid type. + * @G_DBUS_MESSAGE_TYPE_METHOD_CALL: Method call. + * @G_DBUS_MESSAGE_TYPE_METHOD_RETURN: Method reply. + * @G_DBUS_MESSAGE_TYPE_ERROR: Error reply. + * @G_DBUS_MESSAGE_TYPE_SIGNAL: Signal emission. + * + * Message types used in #GDBusMessage. + * + * Since: 2.26 + */ +typedef enum { + G_DBUS_MESSAGE_TYPE_INVALID, + G_DBUS_MESSAGE_TYPE_METHOD_CALL, + G_DBUS_MESSAGE_TYPE_METHOD_RETURN, + G_DBUS_MESSAGE_TYPE_ERROR, + G_DBUS_MESSAGE_TYPE_SIGNAL +} GDBusMessageType; -typedef guint GumPtrauthSupport; -typedef guint GumRwxSupport; -typedef guint GumMemoryOperation; -typedef guint GumPageProtection; -typedef struct _GumAddressSpec GumAddressSpec; -typedef struct _GumMemoryRange GumMemoryRange; -typedef struct _GumMatchPattern GumMatchPattern; +/** + * GDBusMessageFlags: + * @G_DBUS_MESSAGE_FLAGS_NONE: No flags set. + * @G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED: A reply is not expected. + * @G_DBUS_MESSAGE_FLAGS_NO_AUTO_START: The bus must not launch an + * owner for the destination name in response to this message. + * @G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION: If set on a method + * call, this flag means that the caller is prepared to wait for interactive + * authorization. Since 2.46. + * + * Message flags used in #GDBusMessage. + * + * Since: 2.26 + */ +typedef enum { + G_DBUS_MESSAGE_FLAGS_NONE = 0, + G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED = (1<<0), + G_DBUS_MESSAGE_FLAGS_NO_AUTO_START = (1<<1), + G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION = (1<<2) +} GDBusMessageFlags; + +/** + * GDBusMessageHeaderField: + * @G_DBUS_MESSAGE_HEADER_FIELD_INVALID: Not a valid header field. + * @G_DBUS_MESSAGE_HEADER_FIELD_PATH: The object path. + * @G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE: The interface name. + * @G_DBUS_MESSAGE_HEADER_FIELD_MEMBER: The method or signal name. + * @G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME: The name of the error that occurred. + * @G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL: The serial number the message is a reply to. + * @G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION: The name the message is intended for. + * @G_DBUS_MESSAGE_HEADER_FIELD_SENDER: Unique name of the sender of the message (filled in by the bus). + * @G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE: The signature of the message body. + * @G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS: The number of UNIX file descriptors that accompany the message. + * + * Header fields used in #GDBusMessage. + * + * Since: 2.26 + */ +typedef enum { + G_DBUS_MESSAGE_HEADER_FIELD_INVALID, + G_DBUS_MESSAGE_HEADER_FIELD_PATH, + G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE, + G_DBUS_MESSAGE_HEADER_FIELD_MEMBER, + G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME, + G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL, + G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION, + G_DBUS_MESSAGE_HEADER_FIELD_SENDER, + G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE, + G_DBUS_MESSAGE_HEADER_FIELD_NUM_UNIX_FDS +} GDBusMessageHeaderField; + +/** + * GDBusPropertyInfoFlags: + * @G_DBUS_PROPERTY_INFO_FLAGS_NONE: No flags set. + * @G_DBUS_PROPERTY_INFO_FLAGS_READABLE: Property is readable. + * @G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE: Property is writable. + * + * Flags describing the access control of a D-Bus property. + * + * Since: 2.26 + */ +typedef enum +{ + G_DBUS_PROPERTY_INFO_FLAGS_NONE = 0, + G_DBUS_PROPERTY_INFO_FLAGS_READABLE = (1<<0), + G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE = (1<<1) +} GDBusPropertyInfoFlags; -typedef gboolean (* GumMemoryIsNearFunc) (gpointer memory, gpointer address); +/** + * GDBusSubtreeFlags: + * @G_DBUS_SUBTREE_FLAGS_NONE: No flags set. + * @G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES: Method calls to objects not in the enumerated range + * will still be dispatched. This is useful if you want + * to dynamically spawn objects in the subtree. + * + * Flags passed to g_dbus_connection_register_subtree(). + * + * Since: 2.26 + */ +typedef enum +{ + G_DBUS_SUBTREE_FLAGS_NONE = 0, + G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES = (1<<0) +} GDBusSubtreeFlags; -enum _GumPtrauthSupport +/** + * GDBusServerFlags: + * @G_DBUS_SERVER_FLAGS_NONE: No flags set. + * @G_DBUS_SERVER_FLAGS_RUN_IN_THREAD: All #GDBusServer::new-connection + * signals will run in separated dedicated threads (see signal for + * details). + * @G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS: Allow the anonymous + * authentication method. + * @G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER: Require the UID of the + * peer to be the same as the UID of the server when authenticating. (Since: 2.68) + * + * Flags used when creating a #GDBusServer. + * + * Since: 2.26 + */ +typedef enum { - GUM_PTRAUTH_INVALID, - GUM_PTRAUTH_UNSUPPORTED, - GUM_PTRAUTH_SUPPORTED -}; + G_DBUS_SERVER_FLAGS_NONE = 0, + G_DBUS_SERVER_FLAGS_RUN_IN_THREAD = (1<<0), + G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1), + G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER GIO_AVAILABLE_ENUMERATOR_IN_2_68 = (1<<2) +} GDBusServerFlags; + +/** + * GDBusSignalFlags: + * @G_DBUS_SIGNAL_FLAGS_NONE: No flags set. + * @G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE: Don't actually send the AddMatch + * D-Bus call for this signal subscription. This gives you more control + * over which match rules you add (but you must add them manually). + * @G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE: Match first arguments that + * contain a bus or interface name with the given namespace. + * @G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH: Match first arguments that + * contain an object path that is either equivalent to the given path, + * or one of the paths is a subpath of the other. + * + * Flags used when subscribing to signals via g_dbus_connection_signal_subscribe(). + * + * Since: 2.26 + */ +typedef enum /*< flags >*/ +{ + G_DBUS_SIGNAL_FLAGS_NONE = 0, + G_DBUS_SIGNAL_FLAGS_NO_MATCH_RULE = (1<<0), + G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE = (1<<1), + G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH = (1<<2) +} GDBusSignalFlags; -enum _GumRwxSupport +/** + * GDBusSendMessageFlags: + * @G_DBUS_SEND_MESSAGE_FLAGS_NONE: No flags set. + * @G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL: Do not automatically + * assign a serial number from the #GDBusConnection object when + * sending a message. + * + * Flags used when sending #GDBusMessages on a #GDBusConnection. + * + * Since: 2.26 + */ +typedef enum { - GUM_RWX_NONE, - GUM_RWX_ALLOCATIONS_ONLY, - GUM_RWX_FULL -}; + G_DBUS_SEND_MESSAGE_FLAGS_NONE = 0, + G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL = (1<<0) +} GDBusSendMessageFlags; +/* (1<<31) is reserved for internal use by GDBusConnection, do not use it. */ -enum _GumMemoryOperation +/** + * GCredentialsType: + * @G_CREDENTIALS_TYPE_INVALID: Indicates an invalid native credential type. + * @G_CREDENTIALS_TYPE_LINUX_UCRED: The native credentials type is a `struct ucred`. + * @G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED: The native credentials type is a `struct cmsgcred`. + * @G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED: The native credentials type is a `struct sockpeercred`. Added in 2.30. + * @G_CREDENTIALS_TYPE_SOLARIS_UCRED: The native credentials type is a `ucred_t`. Added in 2.40. + * @G_CREDENTIALS_TYPE_NETBSD_UNPCBID: The native credentials type is a `struct unpcbid`. Added in 2.42. + * @G_CREDENTIALS_TYPE_APPLE_XUCRED: The native credentials type is a `struct xucred`. Added in 2.66. + * @G_CREDENTIALS_TYPE_WIN32_PID: The native credentials type is a PID `DWORD`. Added in 2.72. + * + * Enumeration describing different kinds of native credential types. + * + * Since: 2.26 + */ +typedef enum { - GUM_MEMOP_INVALID, - GUM_MEMOP_READ, - GUM_MEMOP_WRITE, - GUM_MEMOP_EXECUTE -}; + G_CREDENTIALS_TYPE_INVALID, + G_CREDENTIALS_TYPE_LINUX_UCRED, + G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED, + G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED, + G_CREDENTIALS_TYPE_SOLARIS_UCRED, + G_CREDENTIALS_TYPE_NETBSD_UNPCBID, + G_CREDENTIALS_TYPE_APPLE_XUCRED, + G_CREDENTIALS_TYPE_WIN32_PID, +} GCredentialsType; -enum _GumPageProtection +/** + * GDBusMessageByteOrder: + * @G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN: The byte order is big endian. + * @G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN: The byte order is little endian. + * + * Enumeration used to describe the byte order of a D-Bus message. + * + * Since: 2.26 + */ +typedef enum { - GUM_PAGE_NO_ACCESS = 0, - GUM_PAGE_READ = (1 << 0), - GUM_PAGE_WRITE = (1 << 1), - GUM_PAGE_EXECUTE = (1 << 2), -}; + G_DBUS_MESSAGE_BYTE_ORDER_BIG_ENDIAN = 'B', + G_DBUS_MESSAGE_BYTE_ORDER_LITTLE_ENDIAN = 'l' +} GDBusMessageByteOrder; + +/** + * GApplicationFlags: + * @G_APPLICATION_FLAGS_NONE: Default. Deprecated in 2.74, use + * %G_APPLICATION_DEFAULT_FLAGS instead + * @G_APPLICATION_DEFAULT_FLAGS: Default flags. Since: 2.74 + * @G_APPLICATION_IS_SERVICE: Run as a service. In this mode, registration + * fails if the service is already running, and the application + * will initially wait up to 10 seconds for an initial activation + * message to arrive. + * @G_APPLICATION_IS_LAUNCHER: Don't try to become the primary instance. + * @G_APPLICATION_HANDLES_OPEN: This application handles opening files (in + * the primary instance). Note that this flag only affects the default + * implementation of local_command_line(), and has no effect if + * %G_APPLICATION_HANDLES_COMMAND_LINE is given. + * See g_application_run() for details. + * @G_APPLICATION_HANDLES_COMMAND_LINE: This application handles command line + * arguments (in the primary instance). Note that this flag only affect + * the default implementation of local_command_line(). + * See g_application_run() for details. + * @G_APPLICATION_SEND_ENVIRONMENT: Send the environment of the + * launching process to the primary instance. Set this flag if your + * application is expected to behave differently depending on certain + * environment variables. For instance, an editor might be expected + * to use the `GIT_COMMITTER_NAME` environment variable + * when editing a git commit message. The environment is available + * to the #GApplication::command-line signal handler, via + * g_application_command_line_getenv(). + * @G_APPLICATION_NON_UNIQUE: Make no attempts to do any of the typical + * single-instance application negotiation, even if the application + * ID is given. The application neither attempts to become the + * owner of the application ID nor does it check if an existing + * owner already exists. Everything occurs in the local process. + * Since: 2.30. + * @G_APPLICATION_CAN_OVERRIDE_APP_ID: Allow users to override the + * application ID from the command line with `--gapplication-app-id`. + * Since: 2.48 + * @G_APPLICATION_ALLOW_REPLACEMENT: Allow another instance to take over + * the bus name. Since: 2.60 + * @G_APPLICATION_REPLACE: Take over from another instance. This flag is + * usually set by passing `--gapplication-replace` on the commandline. + * Since: 2.60 + * + * Flags used to define the behaviour of a #GApplication. + * + * Since: 2.28 + **/ +typedef enum /*< prefix=G_APPLICATION >*/ +{ + G_APPLICATION_FLAGS_NONE GIO_DEPRECATED_ENUMERATOR_IN_2_74_FOR(G_APPLICATION_DEFAULT_FLAGS), + G_APPLICATION_DEFAULT_FLAGS GIO_AVAILABLE_ENUMERATOR_IN_2_74 = 0, + G_APPLICATION_IS_SERVICE = (1 << 0), + G_APPLICATION_IS_LAUNCHER = (1 << 1), + + G_APPLICATION_HANDLES_OPEN = (1 << 2), + G_APPLICATION_HANDLES_COMMAND_LINE = (1 << 3), + G_APPLICATION_SEND_ENVIRONMENT = (1 << 4), + + G_APPLICATION_NON_UNIQUE = (1 << 5), + + G_APPLICATION_CAN_OVERRIDE_APP_ID = (1 << 6), + G_APPLICATION_ALLOW_REPLACEMENT = (1 << 7), + G_APPLICATION_REPLACE = (1 << 8) +} GApplicationFlags; + +/** + * GTlsError: + * @G_TLS_ERROR_UNAVAILABLE: No TLS provider is available + * @G_TLS_ERROR_MISC: Miscellaneous TLS error + * @G_TLS_ERROR_BAD_CERTIFICATE: The certificate presented could not + * be parsed or failed validation. + * @G_TLS_ERROR_NOT_TLS: The TLS handshake failed because the + * peer does not seem to be a TLS server. + * @G_TLS_ERROR_HANDSHAKE: The TLS handshake failed because the + * peer's certificate was not acceptable. + * @G_TLS_ERROR_CERTIFICATE_REQUIRED: The TLS handshake failed because + * the server requested a client-side certificate, but none was + * provided. See g_tls_connection_set_certificate(). + * @G_TLS_ERROR_EOF: The TLS connection was closed without proper + * notice, which may indicate an attack. See + * g_tls_connection_set_require_close_notify(). + * @G_TLS_ERROR_INAPPROPRIATE_FALLBACK: The TLS handshake failed + * because the client sent the fallback SCSV, indicating a protocol + * downgrade attack. Since: 2.60 + * @G_TLS_ERROR_BAD_CERTIFICATE_PASSWORD: The certificate failed + * to load because a password was incorrect. Since: 2.72 + * + * An error code used with %G_TLS_ERROR in a #GError returned from a + * TLS-related routine. + * + * Since: 2.28 + */ +typedef enum { + G_TLS_ERROR_UNAVAILABLE, + G_TLS_ERROR_MISC, + G_TLS_ERROR_BAD_CERTIFICATE, + G_TLS_ERROR_NOT_TLS, + G_TLS_ERROR_HANDSHAKE, + G_TLS_ERROR_CERTIFICATE_REQUIRED, + G_TLS_ERROR_EOF, + G_TLS_ERROR_INAPPROPRIATE_FALLBACK, + G_TLS_ERROR_BAD_CERTIFICATE_PASSWORD +} GTlsError; + +/** + * GTlsCertificateFlags: + * @G_TLS_CERTIFICATE_NO_FLAGS: No flags set. Since: 2.74 + * @G_TLS_CERTIFICATE_UNKNOWN_CA: The signing certificate authority is + * not known. + * @G_TLS_CERTIFICATE_BAD_IDENTITY: The certificate does not match the + * expected identity of the site that it was retrieved from. + * @G_TLS_CERTIFICATE_NOT_ACTIVATED: The certificate's activation time + * is still in the future + * @G_TLS_CERTIFICATE_EXPIRED: The certificate has expired + * @G_TLS_CERTIFICATE_REVOKED: The certificate has been revoked + * according to the #GTlsConnection's certificate revocation list. + * @G_TLS_CERTIFICATE_INSECURE: The certificate's algorithm is + * considered insecure. + * @G_TLS_CERTIFICATE_GENERIC_ERROR: Some other error occurred validating + * the certificate + * @G_TLS_CERTIFICATE_VALIDATE_ALL: the combination of all of the above + * flags + * + * A set of flags describing TLS certification validation. This can be + * used to describe why a particular certificate was rejected (for + * example, in #GTlsConnection::accept-certificate). + * + * GLib guarantees that if certificate verification fails, at least one + * flag will be set, but it does not guarantee that all possible flags + * will be set. Accordingly, you may not safely decide to ignore any + * particular type of error. For example, it would be incorrect to mask + * %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates, + * because this could potentially be the only error flag set even if + * other problems exist with the certificate. + * + * Since: 2.28 + */ +typedef enum { + G_TLS_CERTIFICATE_NO_FLAGS GIO_AVAILABLE_ENUMERATOR_IN_2_74 = 0, + G_TLS_CERTIFICATE_UNKNOWN_CA = (1 << 0), + G_TLS_CERTIFICATE_BAD_IDENTITY = (1 << 1), + G_TLS_CERTIFICATE_NOT_ACTIVATED = (1 << 2), + G_TLS_CERTIFICATE_EXPIRED = (1 << 3), + G_TLS_CERTIFICATE_REVOKED = (1 << 4), + G_TLS_CERTIFICATE_INSECURE = (1 << 5), + G_TLS_CERTIFICATE_GENERIC_ERROR = (1 << 6), -struct _GumAddressSpec + G_TLS_CERTIFICATE_VALIDATE_ALL = 0x007f +} GTlsCertificateFlags; + +/** + * GTlsAuthenticationMode: + * @G_TLS_AUTHENTICATION_NONE: client authentication not required + * @G_TLS_AUTHENTICATION_REQUESTED: client authentication is requested + * @G_TLS_AUTHENTICATION_REQUIRED: client authentication is required + * + * The client authentication mode for a #GTlsServerConnection. + * + * Since: 2.28 + */ +typedef enum { + G_TLS_AUTHENTICATION_NONE, + G_TLS_AUTHENTICATION_REQUESTED, + G_TLS_AUTHENTICATION_REQUIRED +} GTlsAuthenticationMode; + +/** + * GTlsChannelBindingType: + * @G_TLS_CHANNEL_BINDING_TLS_UNIQUE: + * [`tls-unique`](https://tools.ietf.org/html/rfc5929#section-3) binding + * type + * @G_TLS_CHANNEL_BINDING_TLS_SERVER_END_POINT: + * [`tls-server-end-point`](https://tools.ietf.org/html/rfc5929#section-4) + * binding type + * @G_TLS_CHANNEL_BINDING_TLS_EXPORTER: + * [`tls-exporter`](https://www.rfc-editor.org/rfc/rfc9266.html) binding + * type. Since: 2.74 + * + * The type of TLS channel binding data to retrieve from #GTlsConnection + * or #GDtlsConnection, as documented by RFC 5929 or RFC 9266. The + * [`tls-unique-for-telnet`](https://tools.ietf.org/html/rfc5929#section-5) + * binding type is not currently implemented. + * + * Since: 2.66 + */ +GIO_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_TLS_CHANNEL_BINDING_TLS_UNIQUE, + G_TLS_CHANNEL_BINDING_TLS_SERVER_END_POINT, + G_TLS_CHANNEL_BINDING_TLS_EXPORTER GIO_AVAILABLE_ENUMERATOR_IN_2_74, +} GTlsChannelBindingType; + +/** + * GTlsChannelBindingError: + * @G_TLS_CHANNEL_BINDING_ERROR_NOT_IMPLEMENTED: Either entire binding + * retrieval facility or specific binding type is not implemented in the + * TLS backend. + * @G_TLS_CHANNEL_BINDING_ERROR_INVALID_STATE: The handshake is not yet + * complete on the connection which is a strong requirement for any existing + * binding type. + * @G_TLS_CHANNEL_BINDING_ERROR_NOT_AVAILABLE: Handshake is complete but + * binding data is not available. That normally indicates the TLS + * implementation failed to provide the binding data. For example, some + * implementations do not provide a peer certificate for resumed connections. + * @G_TLS_CHANNEL_BINDING_ERROR_NOT_SUPPORTED: Binding type is not supported + * on the current connection. This error could be triggered when requesting + * `tls-server-end-point` binding data for a certificate which has no hash + * function or uses multiple hash functions. + * @G_TLS_CHANNEL_BINDING_ERROR_GENERAL_ERROR: Any other backend error + * preventing binding data retrieval. + * + * An error code used with %G_TLS_CHANNEL_BINDING_ERROR in a #GError to + * indicate a TLS channel binding retrieval error. + * + * Since: 2.66 + */ +GIO_AVAILABLE_TYPE_IN_2_66 +typedef enum { + G_TLS_CHANNEL_BINDING_ERROR_NOT_IMPLEMENTED, + G_TLS_CHANNEL_BINDING_ERROR_INVALID_STATE, + G_TLS_CHANNEL_BINDING_ERROR_NOT_AVAILABLE, + G_TLS_CHANNEL_BINDING_ERROR_NOT_SUPPORTED, + G_TLS_CHANNEL_BINDING_ERROR_GENERAL_ERROR +} GTlsChannelBindingError; + +/** + * GTlsRehandshakeMode: + * @G_TLS_REHANDSHAKE_NEVER: Never allow rehandshaking + * @G_TLS_REHANDSHAKE_SAFELY: Allow safe rehandshaking only + * @G_TLS_REHANDSHAKE_UNSAFELY: Allow unsafe rehandshaking + * + * When to allow rehandshaking. See + * g_tls_connection_set_rehandshake_mode(). + * + * Since: 2.28 + * + * Deprecated: 2.60. Changing the rehandshake mode is no longer + * required for compatibility. Also, rehandshaking has been removed + * from the TLS protocol in TLS 1.3. + */ +typedef enum { + G_TLS_REHANDSHAKE_NEVER, + G_TLS_REHANDSHAKE_SAFELY, + G_TLS_REHANDSHAKE_UNSAFELY +} GTlsRehandshakeMode GIO_DEPRECATED_TYPE_IN_2_60; + +/** + * GTlsPasswordFlags: + * @G_TLS_PASSWORD_NONE: No flags + * @G_TLS_PASSWORD_RETRY: The password was wrong, and the user should retry. + * @G_TLS_PASSWORD_MANY_TRIES: Hint to the user that the password has been + * wrong many times, and the user may not have many chances left. + * @G_TLS_PASSWORD_FINAL_TRY: Hint to the user that this is the last try to get + * this password right. + * @G_TLS_PASSWORD_PKCS11_USER: For PKCS #11, the user PIN is required. + * Since: 2.70. + * @G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER: For PKCS #11, the security officer + * PIN is required. Since: 2.70. + * @G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC: For PKCS #11, the context-specific + * PIN is required. Since: 2.70. + * + * Various flags for the password. + * + * Since: 2.30 + */ + +typedef enum _GTlsPasswordFlags { - gpointer near_address; - gsize max_distance; -}; + G_TLS_PASSWORD_NONE = 0, + G_TLS_PASSWORD_RETRY = 1 << 1, + G_TLS_PASSWORD_MANY_TRIES = 1 << 2, + G_TLS_PASSWORD_FINAL_TRY = 1 << 3, + G_TLS_PASSWORD_PKCS11_USER = 1 << 4, + G_TLS_PASSWORD_PKCS11_SECURITY_OFFICER = 1 << 5, + G_TLS_PASSWORD_PKCS11_CONTEXT_SPECIFIC = 1 << 6 +} GTlsPasswordFlags; + +/** + * GTlsInteractionResult: + * @G_TLS_INTERACTION_UNHANDLED: The interaction was unhandled (i.e. not + * implemented). + * @G_TLS_INTERACTION_HANDLED: The interaction completed, and resulting data + * is available. + * @G_TLS_INTERACTION_FAILED: The interaction has failed, or was cancelled. + * and the operation should be aborted. + * + * #GTlsInteractionResult is returned by various functions in #GTlsInteraction + * when finishing an interaction request. + * + * Since: 2.30 + */ +typedef enum { + G_TLS_INTERACTION_UNHANDLED, + G_TLS_INTERACTION_HANDLED, + G_TLS_INTERACTION_FAILED +} GTlsInteractionResult; -struct _GumMemoryRange +/** + * GDBusInterfaceSkeletonFlags: + * @G_DBUS_INTERFACE_SKELETON_FLAGS_NONE: No flags set. + * @G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD: Each method invocation is handled in + * a thread dedicated to the invocation. This means that the method implementation can use blocking IO + * without blocking any other part of the process. It also means that the method implementation must + * use locking to access data structures used by other threads. + * + * Flags describing the behavior of a #GDBusInterfaceSkeleton instance. + * + * Since: 2.30 + */ +typedef enum { - GumAddress base_address; - gsize size; -}; + G_DBUS_INTERFACE_SKELETON_FLAGS_NONE = 0, + G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD = (1<<0) +} GDBusInterfaceSkeletonFlags; -typedef void (* GumMemoryPatchApplyFunc) (gpointer mem, gpointer user_data); -typedef gboolean (* GumMemoryScanMatchFunc) (GumAddress address, gsize size, - gpointer user_data); +/** + * GDBusObjectManagerClientFlags: + * @G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE: No flags set. + * @G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START: If not set and the + * manager is for a well-known name, then request the bus to launch + * an owner for the name if no-one owns the name. This flag can only + * be used in managers for well-known names. + * + * Flags used when constructing a #GDBusObjectManagerClient. + * + * Since: 2.30 + */ +typedef enum +{ + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE = 0, + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START = (1<<0) +} GDBusObjectManagerClientFlags; -GUM_API void gum_internal_heap_ref (void); -GUM_API void gum_internal_heap_unref (void); +/** + * GTlsDatabaseVerifyFlags: + * @G_TLS_DATABASE_VERIFY_NONE: No verification flags + * + * Flags for g_tls_database_verify_chain(). + * + * Since: 2.30 + */ +typedef enum /*< flags >*/ { + G_TLS_DATABASE_VERIFY_NONE = 0 +} GTlsDatabaseVerifyFlags; -GUM_API gpointer gum_sign_code_pointer (gpointer value); -GUM_API gpointer gum_strip_code_pointer (gpointer value); -GUM_API GumAddress gum_sign_code_address (GumAddress value); -GUM_API GumAddress gum_strip_code_address (GumAddress value); -GUM_API GumPtrauthSupport gum_query_ptrauth_support (void); -GUM_API guint gum_query_page_size (void); -GUM_API gboolean gum_query_is_rwx_supported (void); -GUM_API GumRwxSupport gum_query_rwx_support (void); -GUM_API gboolean gum_memory_is_readable (gconstpointer address, gsize len); -GUM_API gboolean gum_memory_query_protection (gconstpointer address, - GumPageProtection * prot); -GUM_API guint8 * gum_memory_read (gconstpointer address, gsize len, - gsize * n_bytes_read); -GUM_API gboolean gum_memory_write (gpointer address, const guint8 * bytes, - gsize len); -GUM_API gboolean gum_memory_patch_code (gpointer address, gsize size, - GumMemoryPatchApplyFunc apply, gpointer apply_data); -GUM_API gboolean gum_memory_mark_code (gpointer address, gsize size); +/** + * GTlsDatabaseLookupFlags: + * @G_TLS_DATABASE_LOOKUP_NONE: No lookup flags + * @G_TLS_DATABASE_LOOKUP_KEYPAIR: Restrict lookup to certificates that have + * a private key. + * + * Flags for g_tls_database_lookup_certificate_for_handle(), + * g_tls_database_lookup_certificate_issuer(), + * and g_tls_database_lookup_certificates_issued_by(). + * + * Since: 2.30 + */ +typedef enum { + G_TLS_DATABASE_LOOKUP_NONE = 0, + G_TLS_DATABASE_LOOKUP_KEYPAIR = 1 +} GTlsDatabaseLookupFlags; -GUM_API void gum_memory_scan (const GumMemoryRange * range, - const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, - gpointer user_data); +/** + * GTlsCertificateRequestFlags: + * @G_TLS_CERTIFICATE_REQUEST_NONE: No flags + * + * Flags for g_tls_interaction_request_certificate(), + * g_tls_interaction_request_certificate_async(), and + * g_tls_interaction_invoke_request_certificate(). + * + * Since: 2.40 + */ +typedef enum { + G_TLS_CERTIFICATE_REQUEST_NONE = 0 +} GTlsCertificateRequestFlags; + +/** + * GTlsProtocolVersion: + * @G_TLS_PROTOCOL_VERSION_UNKNOWN: No protocol version or unknown protocol version + * @G_TLS_PROTOCOL_VERSION_SSL_3_0: SSL 3.0, which is insecure and should not be used + * @G_TLS_PROTOCOL_VERSION_TLS_1_0: TLS 1.0, which is insecure and should not be used + * @G_TLS_PROTOCOL_VERSION_TLS_1_1: TLS 1.1, which is insecure and should not be used + * @G_TLS_PROTOCOL_VERSION_TLS_1_2: TLS 1.2, defined by [RFC 5246](https://datatracker.ietf.org/doc/html/rfc5246) + * @G_TLS_PROTOCOL_VERSION_TLS_1_3: TLS 1.3, defined by [RFC 8446](https://datatracker.ietf.org/doc/html/rfc8446) + * @G_TLS_PROTOCOL_VERSION_DTLS_1_0: DTLS 1.0, which is insecure and should not be used + * @G_TLS_PROTOCOL_VERSION_DTLS_1_2: DTLS 1.2, defined by [RFC 6347](https://datatracker.ietf.org/doc/html/rfc6347) + * + * The TLS or DTLS protocol version used by a #GTlsConnection or + * #GDtlsConnection. The integer values of these versions are sequential + * to ensure newer known protocol versions compare greater than older + * known versions. Any known DTLS protocol version will compare greater + * than any SSL or TLS protocol version. The protocol version may be + * %G_TLS_PROTOCOL_VERSION_UNKNOWN if the TLS backend supports a newer + * protocol version that GLib does not yet know about. This means that + * it's possible for an unknown DTLS protocol version to compare less + * than the TLS protocol versions. + * + * Since: 2.70 + */ +typedef enum { + G_TLS_PROTOCOL_VERSION_UNKNOWN = 0, + G_TLS_PROTOCOL_VERSION_SSL_3_0 = 1, + G_TLS_PROTOCOL_VERSION_TLS_1_0 = 2, + G_TLS_PROTOCOL_VERSION_TLS_1_1 = 3, + G_TLS_PROTOCOL_VERSION_TLS_1_2 = 4, + G_TLS_PROTOCOL_VERSION_TLS_1_3 = 5, + G_TLS_PROTOCOL_VERSION_DTLS_1_0 = 201, + G_TLS_PROTOCOL_VERSION_DTLS_1_2 = 202, +} GTlsProtocolVersion; -#ifndef GUM_DIET -GUM_API GType gum_match_pattern_get_type (void) G_GNUC_CONST; -#endif -GUM_API GumMatchPattern * gum_match_pattern_new_from_string ( - const gchar * pattern_str); -GUM_API GumMatchPattern * gum_match_pattern_ref (GumMatchPattern * pattern); -GUM_API void gum_match_pattern_unref (GumMatchPattern * pattern); -GUM_API guint gum_match_pattern_get_size (const GumMatchPattern * pattern); -GUM_API GPtrArray * gum_match_pattern_get_tokens ( - const GumMatchPattern * pattern); +/** + * GIOModuleScopeFlags: + * @G_IO_MODULE_SCOPE_NONE: No module scan flags + * @G_IO_MODULE_SCOPE_BLOCK_DUPLICATES: When using this scope to load or + * scan modules, automatically block a modules which has the same base + * basename as previously loaded module. + * + * Flags for use with g_io_module_scope_new(). + * + * Since: 2.30 + */ +typedef enum { + G_IO_MODULE_SCOPE_NONE, + G_IO_MODULE_SCOPE_BLOCK_DUPLICATES +} GIOModuleScopeFlags; + +/** + * GSocketClientEvent: + * @G_SOCKET_CLIENT_RESOLVING: The client is doing a DNS lookup. + * @G_SOCKET_CLIENT_RESOLVED: The client has completed a DNS lookup. + * @G_SOCKET_CLIENT_CONNECTING: The client is connecting to a remote + * host (either a proxy or the destination server). + * @G_SOCKET_CLIENT_CONNECTED: The client has connected to a remote + * host. + * @G_SOCKET_CLIENT_PROXY_NEGOTIATING: The client is negotiating + * with a proxy to connect to the destination server. + * @G_SOCKET_CLIENT_PROXY_NEGOTIATED: The client has negotiated + * with the proxy server. + * @G_SOCKET_CLIENT_TLS_HANDSHAKING: The client is performing a + * TLS handshake. + * @G_SOCKET_CLIENT_TLS_HANDSHAKED: The client has performed a + * TLS handshake. + * @G_SOCKET_CLIENT_COMPLETE: The client is done with a particular + * #GSocketConnectable. + * + * Describes an event occurring on a #GSocketClient. See the + * #GSocketClient::event signal for more details. + * + * Additional values may be added to this type in the future. + * + * Since: 2.32 + */ +typedef enum { + G_SOCKET_CLIENT_RESOLVING, + G_SOCKET_CLIENT_RESOLVED, + G_SOCKET_CLIENT_CONNECTING, + G_SOCKET_CLIENT_CONNECTED, + G_SOCKET_CLIENT_PROXY_NEGOTIATING, + G_SOCKET_CLIENT_PROXY_NEGOTIATED, + G_SOCKET_CLIENT_TLS_HANDSHAKING, + G_SOCKET_CLIENT_TLS_HANDSHAKED, + G_SOCKET_CLIENT_COMPLETE +} GSocketClientEvent; -GUM_API void gum_ensure_code_readable (gconstpointer address, gsize size); +/** + * GSocketListenerEvent: + * @G_SOCKET_LISTENER_BINDING: The listener is about to bind a socket. + * @G_SOCKET_LISTENER_BOUND: The listener has bound a socket. + * @G_SOCKET_LISTENER_LISTENING: The listener is about to start + * listening on this socket. + * @G_SOCKET_LISTENER_LISTENED: The listener is now listening on + * this socket. + * + * Describes an event occurring on a #GSocketListener. See the + * #GSocketListener::event signal for more details. + * + * Additional values may be added to this type in the future. + * + * Since: 2.46 + */ +typedef enum { + G_SOCKET_LISTENER_BINDING, + G_SOCKET_LISTENER_BOUND, + G_SOCKET_LISTENER_LISTENING, + G_SOCKET_LISTENER_LISTENED +} GSocketListenerEvent; -GUM_API void gum_mprotect (gpointer address, gsize size, - GumPageProtection prot); -GUM_API gboolean gum_try_mprotect (gpointer address, gsize size, - GumPageProtection prot); +/** + * GTestDBusFlags: + * @G_TEST_DBUS_NONE: No flags. + * + * Flags to define future #GTestDBus behaviour. + * + * Since: 2.34 + */ +typedef enum /*< flags >*/ { + G_TEST_DBUS_NONE = 0 +} GTestDBusFlags; + +/** + * GSubprocessFlags: + * @G_SUBPROCESS_FLAGS_NONE: No flags. + * @G_SUBPROCESS_FLAGS_STDIN_PIPE: create a pipe for the stdin of the + * spawned process that can be accessed with + * g_subprocess_get_stdin_pipe(). + * @G_SUBPROCESS_FLAGS_STDIN_INHERIT: stdin is inherited from the + * calling process. + * @G_SUBPROCESS_FLAGS_STDOUT_PIPE: create a pipe for the stdout of the + * spawned process that can be accessed with + * g_subprocess_get_stdout_pipe(). + * @G_SUBPROCESS_FLAGS_STDOUT_SILENCE: silence the stdout of the spawned + * process (ie: redirect to `/dev/null`). + * @G_SUBPROCESS_FLAGS_STDERR_PIPE: create a pipe for the stderr of the + * spawned process that can be accessed with + * g_subprocess_get_stderr_pipe(). + * @G_SUBPROCESS_FLAGS_STDERR_SILENCE: silence the stderr of the spawned + * process (ie: redirect to `/dev/null`). + * @G_SUBPROCESS_FLAGS_STDERR_MERGE: merge the stderr of the spawned + * process with whatever the stdout happens to be. This is a good way + * of directing both streams to a common log file, for example. + * @G_SUBPROCESS_FLAGS_INHERIT_FDS: spawned processes will inherit the + * file descriptors of their parent, unless those descriptors have + * been explicitly marked as close-on-exec. This flag has no effect + * over the "standard" file descriptors (stdin, stdout, stderr). + * @G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP: if path searching is + * needed when spawning the subprocess, use the `PATH` in the launcher + * environment. (Since: 2.72) + * + * Flags to define the behaviour of a #GSubprocess. + * + * Note that the default for stdin is to redirect from `/dev/null`. For + * stdout and stderr the default are for them to inherit the + * corresponding descriptor from the calling process. + * + * Note that it is a programmer error to mix 'incompatible' flags. For + * example, you may not request both %G_SUBPROCESS_FLAGS_STDOUT_PIPE and + * %G_SUBPROCESS_FLAGS_STDOUT_SILENCE. + * + * Since: 2.40 + **/ +typedef enum { + G_SUBPROCESS_FLAGS_NONE = 0, + G_SUBPROCESS_FLAGS_STDIN_PIPE = (1u << 0), + G_SUBPROCESS_FLAGS_STDIN_INHERIT = (1u << 1), + G_SUBPROCESS_FLAGS_STDOUT_PIPE = (1u << 2), + G_SUBPROCESS_FLAGS_STDOUT_SILENCE = (1u << 3), + G_SUBPROCESS_FLAGS_STDERR_PIPE = (1u << 4), + G_SUBPROCESS_FLAGS_STDERR_SILENCE = (1u << 5), + G_SUBPROCESS_FLAGS_STDERR_MERGE = (1u << 6), + G_SUBPROCESS_FLAGS_INHERIT_FDS = (1u << 7), + G_SUBPROCESS_FLAGS_SEARCH_PATH_FROM_ENVP = (1u << 8) +} GSubprocessFlags; + +/** + * GNotificationPriority: + * @G_NOTIFICATION_PRIORITY_LOW: for notifications that do not require + * immediate attention - typically used for contextual background + * information, such as contact birthdays or local weather + * @G_NOTIFICATION_PRIORITY_NORMAL: the default priority, to be used for the + * majority of notifications (for example email messages, software updates, + * completed download/sync operations) + * @G_NOTIFICATION_PRIORITY_HIGH: for events that require more attention, + * usually because responses are time-sensitive (for example chat and SMS + * messages or alarms) + * @G_NOTIFICATION_PRIORITY_URGENT: for urgent notifications, or notifications + * that require a response in a short space of time (for example phone calls + * or emergency warnings) + * + * Priority levels for #GNotifications. + * + * Since: 2.42 + */ +typedef enum { + G_NOTIFICATION_PRIORITY_NORMAL, + G_NOTIFICATION_PRIORITY_LOW, + G_NOTIFICATION_PRIORITY_HIGH, + G_NOTIFICATION_PRIORITY_URGENT +} GNotificationPriority; + +/** + * GNetworkConnectivity: + * @G_NETWORK_CONNECTIVITY_LOCAL: The host is not configured with a + * route to the Internet; it may or may not be connected to a local + * network. + * @G_NETWORK_CONNECTIVITY_LIMITED: The host is connected to a network, but + * does not appear to be able to reach the full Internet, perhaps + * due to upstream network problems. + * @G_NETWORK_CONNECTIVITY_PORTAL: The host is behind a captive portal and + * cannot reach the full Internet. + * @G_NETWORK_CONNECTIVITY_FULL: The host is connected to a network, and + * appears to be able to reach the full Internet. + * + * The host's network connectivity state, as reported by #GNetworkMonitor. + * + * Since: 2.44 + */ +typedef enum { + G_NETWORK_CONNECTIVITY_LOCAL = 1, + G_NETWORK_CONNECTIVITY_LIMITED = 2, + G_NETWORK_CONNECTIVITY_PORTAL = 3, + G_NETWORK_CONNECTIVITY_FULL = 4 +} GNetworkConnectivity; -GUM_API void gum_clear_cache (gpointer address, gsize size); +/** + * GPollableReturn: + * @G_POLLABLE_RETURN_FAILED: Generic error condition for when an operation fails. + * @G_POLLABLE_RETURN_OK: The operation was successfully finished. + * @G_POLLABLE_RETURN_WOULD_BLOCK: The operation would block. + * + * Return value for various IO operations that signal errors via the + * return value and not necessarily via a #GError. + * + * This enum exists to be able to return errors to callers without having to + * allocate a #GError. Allocating #GErrors can be quite expensive for + * regularly happening errors like %G_IO_ERROR_WOULD_BLOCK. + * + * In case of %G_POLLABLE_RETURN_FAILED a #GError should be set for the + * operation to give details about the error that happened. + * + * Since: 2.60 + */ +typedef enum { + G_POLLABLE_RETURN_FAILED = 0, + G_POLLABLE_RETURN_OK = 1, + G_POLLABLE_RETURN_WOULD_BLOCK = -G_IO_ERROR_WOULD_BLOCK +} GPollableReturn; + +/** + * GMemoryMonitorWarningLevel: + * @G_MEMORY_MONITOR_WARNING_LEVEL_LOW: Memory on the device is low, processes + * should free up unneeded resources (for example, in-memory caches) so they can + * be used elsewhere. + * @G_MEMORY_MONITOR_WARNING_LEVEL_MEDIUM: Same as @G_MEMORY_MONITOR_WARNING_LEVEL_LOW + * but the device has even less free memory, so processes should try harder to free + * up unneeded resources. If your process does not need to stay running, it is a + * good time for it to quit. + * @G_MEMORY_MONITOR_WARNING_LEVEL_CRITICAL: The system will soon start terminating + * processes to reclaim memory, including background processes. + * + * Memory availability warning levels. + * + * Note that because new values might be added, it is recommended that applications check + * #GMemoryMonitorWarningLevel as ranges, for example: + * |[ + * if (warning_level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW) + * drop_caches (); + * ]| + * + * Since: 2.64 + */ +typedef enum { + G_MEMORY_MONITOR_WARNING_LEVEL_LOW = 50, + G_MEMORY_MONITOR_WARNING_LEVEL_MEDIUM = 100, + G_MEMORY_MONITOR_WARNING_LEVEL_CRITICAL = 255 +} GMemoryMonitorWarningLevel; -#define gum_new(struct_type, n_structs) \ - ((struct_type *) gum_malloc (n_structs * sizeof (struct_type))) -#define gum_new0(struct_type, n_structs) \ - ((struct_type *) gum_malloc0 (n_structs * sizeof (struct_type))) +G_END_DECLS -GUM_API guint gum_peek_private_memory_usage (void); +#endif /* __GIO_ENUMS_H__ */ -GUM_API gpointer gum_malloc (gsize size); -GUM_API gpointer gum_malloc0 (gsize size); -GUM_API gsize gum_malloc_usable_size (gconstpointer mem); -GUM_API gpointer gum_calloc (gsize count, gsize size); -GUM_API gpointer gum_realloc (gpointer mem, gsize size); -GUM_API gpointer gum_memalign (gsize alignment, gsize size); -GUM_API gpointer gum_memdup (gconstpointer mem, gsize byte_size); -GUM_API void gum_free (gpointer mem); +G_BEGIN_DECLS -GUM_API gpointer gum_alloc_n_pages (guint n_pages, GumPageProtection prot); -GUM_API gpointer gum_try_alloc_n_pages (guint n_pages, GumPageProtection prot); -GUM_API gpointer gum_alloc_n_pages_near (guint n_pages, GumPageProtection prot, - const GumAddressSpec * spec); -GUM_API gpointer gum_try_alloc_n_pages_near (guint n_pages, - GumPageProtection prot, const GumAddressSpec * spec); -GUM_API void gum_query_page_allocation_range (gconstpointer mem, guint size, - GumMemoryRange * range); -GUM_API void gum_free_pages (gpointer mem); +typedef struct _GAppLaunchContext GAppLaunchContext; +typedef struct _GAppInfo GAppInfo; /* Dummy typedef */ +typedef struct _GAsyncResult GAsyncResult; /* Dummy typedef */ +typedef struct _GAsyncInitable GAsyncInitable; +typedef struct _GBufferedInputStream GBufferedInputStream; +typedef struct _GBufferedOutputStream GBufferedOutputStream; +typedef struct _GCancellable GCancellable; +typedef struct _GCharsetConverter GCharsetConverter; +typedef struct _GConverter GConverter; +typedef struct _GConverterInputStream GConverterInputStream; +typedef struct _GConverterOutputStream GConverterOutputStream; +typedef struct _GDatagramBased GDatagramBased; +typedef struct _GDataInputStream GDataInputStream; +typedef struct _GSimplePermission GSimplePermission; +typedef struct _GZlibCompressor GZlibCompressor; +typedef struct _GZlibDecompressor GZlibDecompressor; + +typedef struct _GSimpleActionGroup GSimpleActionGroup; +typedef struct _GRemoteActionGroup GRemoteActionGroup; +typedef struct _GDBusActionGroup GDBusActionGroup; +typedef struct _GActionMap GActionMap; +typedef struct _GActionGroup GActionGroup; +typedef struct _GPropertyAction GPropertyAction; +typedef struct _GSimpleAction GSimpleAction; +typedef struct _GAction GAction; +typedef struct _GApplication GApplication; +typedef struct _GApplicationCommandLine GApplicationCommandLine; +typedef struct _GSettingsBackend GSettingsBackend; +typedef struct _GSettings GSettings; +typedef struct _GPermission GPermission; + +typedef struct _GMenuModel GMenuModel; +typedef struct _GNotification GNotification; + +/** + * GDrive: + * + * Opaque drive object. + **/ +typedef struct _GDrive GDrive; /* Dummy typedef */ +typedef struct _GFileEnumerator GFileEnumerator; +typedef struct _GFileMonitor GFileMonitor; +typedef struct _GFilterInputStream GFilterInputStream; +typedef struct _GFilterOutputStream GFilterOutputStream; -GUM_API gpointer gum_memory_allocate (gpointer address, gsize size, - gsize alignment, GumPageProtection prot); -GUM_API gpointer gum_memory_allocate_near (const GumAddressSpec * spec, - gsize size, gsize alignment, GumPageProtection prot); -GUM_API gboolean gum_memory_free (gpointer address, gsize size); -GUM_API gboolean gum_memory_release (gpointer address, gsize size); -GUM_API gboolean gum_memory_recommit (gpointer address, gsize size, - GumPageProtection prot); -GUM_API gboolean gum_memory_discard (gpointer address, gsize size); -GUM_API gboolean gum_memory_decommit (gpointer address, gsize size); - -GUM_API gboolean gum_address_spec_is_satisfied_by (const GumAddressSpec * spec, - gconstpointer address); +/** + * GFile: + * + * A handle to an object implementing the #GFileIface interface. + * Generally stores a location within the file system. Handles do not + * necessarily represent files or directories that currently exist. + **/ +typedef struct _GFile GFile; /* Dummy typedef */ +typedef struct _GFileInfo GFileInfo; -#ifndef GUM_DIET -GUM_API GType gum_memory_range_get_type (void) G_GNUC_CONST; -#endif -GUM_API GumMemoryRange * gum_memory_range_copy (const GumMemoryRange * range); -GUM_API void gum_memory_range_free (GumMemoryRange * range); +/** + * GFileAttributeMatcher: + * + * Determines if a string matches a file attribute. + **/ +typedef struct _GFileAttributeMatcher GFileAttributeMatcher; +typedef struct _GFileAttributeInfo GFileAttributeInfo; +typedef struct _GFileAttributeInfoList GFileAttributeInfoList; +typedef struct _GFileDescriptorBased GFileDescriptorBased; +typedef struct _GFileInputStream GFileInputStream; +typedef struct _GFileOutputStream GFileOutputStream; +typedef struct _GFileIOStream GFileIOStream; +typedef struct _GFileIcon GFileIcon; +typedef struct _GFilenameCompleter GFilenameCompleter; + + +typedef struct _GIcon GIcon; /* Dummy typedef */ +typedef struct _GInetAddress GInetAddress; +typedef struct _GInetAddressMask GInetAddressMask; +typedef struct _GInetSocketAddress GInetSocketAddress; +typedef struct _GNativeSocketAddress GNativeSocketAddress; +typedef struct _GInputStream GInputStream; +typedef struct _GInitable GInitable; +typedef struct _GIOModule GIOModule; +typedef struct _GIOExtensionPoint GIOExtensionPoint; +typedef struct _GIOExtension GIOExtension; + +/** + * GIOSchedulerJob: + * + * Opaque class for defining and scheduling IO jobs. + **/ +typedef struct _GIOSchedulerJob GIOSchedulerJob; +typedef struct _GIOStreamAdapter GIOStreamAdapter; +typedef struct _GLoadableIcon GLoadableIcon; /* Dummy typedef */ +typedef struct _GBytesIcon GBytesIcon; +typedef struct _GMemoryInputStream GMemoryInputStream; +typedef struct _GMemoryOutputStream GMemoryOutputStream; -G_END_DECLS +/** + * GMount: + * + * A handle to an object implementing the #GMountIface interface. + **/ +typedef struct _GMount GMount; /* Dummy typedef */ +typedef struct _GMountOperation GMountOperation; +typedef struct _GNetworkAddress GNetworkAddress; +typedef struct _GNetworkMonitor GNetworkMonitor; +typedef struct _GNetworkService GNetworkService; +typedef struct _GOutputStream GOutputStream; +typedef struct _GIOStream GIOStream; +typedef struct _GSimpleIOStream GSimpleIOStream; +typedef struct _GPollableInputStream GPollableInputStream; /* Dummy typedef */ +typedef struct _GPollableOutputStream GPollableOutputStream; /* Dummy typedef */ +typedef struct _GResolver GResolver; -#endif -/* - * Copyright (C) 2008-2023 Ole André Vadla Ravnås - * Copyright (C) 2020-2024 Francesco Tamagni - * Copyright (C) 2023 Grant Douglas - * Copyright (C) 2024 Håvard Sørbø +/** + * GResource: * - * Licence: wxWindows Library Licence, Version 3.1 + * A resource bundle. + * + * Since: 2.32 */ +typedef struct _GResource GResource; +typedef struct _GSeekable GSeekable; +typedef struct _GSimpleAsyncResult GSimpleAsyncResult; -#ifndef __GUM_PROCESS_H__ -#define __GUM_PROCESS_H__ - +/** + * GSocket: + * + * A lowlevel network socket object. + * + * Since: 2.22 + **/ +typedef struct _GSocket GSocket; -#define GUM_THREAD_ID_INVALID ((GumThreadId) -1) +/** + * GSocketControlMessage: + * + * Base class for socket-type specific control messages that can be sent and + * received over #GSocket. + **/ +typedef struct _GSocketControlMessage GSocketControlMessage; +/** + * GSocketClient: + * + * A helper class for network clients to make connections. + * + * Since: 2.22 + **/ +typedef struct _GSocketClient GSocketClient; +/** + * GSocketConnection: + * + * A socket connection GIOStream object for connection-oriented sockets. + * + * Since: 2.22 + **/ +typedef struct _GSocketConnection GSocketConnection; +/** + * GSocketListener: + * + * A helper class for network servers to listen for and accept connections. + * + * Since: 2.22 + **/ +typedef struct _GSocketListener GSocketListener; +/** + * GSocketService: + * + * A helper class for handling accepting incoming connections in the + * glib mainloop. + * + * Since: 2.22 + **/ +typedef struct _GSocketService GSocketService; +typedef struct _GSocketAddress GSocketAddress; +typedef struct _GSocketAddressEnumerator GSocketAddressEnumerator; +typedef struct _GSocketConnectable GSocketConnectable; +typedef struct _GSrvTarget GSrvTarget; +typedef struct _GTask GTask; +/** + * GTcpConnection: + * + * A #GSocketConnection for TCP/IP connections. + * + * Since: 2.22 + **/ +typedef struct _GTcpConnection GTcpConnection; +typedef struct _GTcpWrapperConnection GTcpWrapperConnection; +/** + * GThreadedSocketService: + * + * A helper class for handling accepting incoming connections in the + * glib mainloop and handling them in a thread. + * + * Since: 2.22 + **/ +typedef struct _GThreadedSocketService GThreadedSocketService; +typedef struct _GDtlsConnection GDtlsConnection; +typedef struct _GDtlsClientConnection GDtlsClientConnection; /* Dummy typedef */ +typedef struct _GDtlsServerConnection GDtlsServerConnection; /* Dummy typedef */ +typedef struct _GThemedIcon GThemedIcon; +typedef struct _GTlsCertificate GTlsCertificate; +typedef struct _GTlsClientConnection GTlsClientConnection; /* Dummy typedef */ +typedef struct _GTlsConnection GTlsConnection; +typedef struct _GTlsDatabase GTlsDatabase; +typedef struct _GTlsFileDatabase GTlsFileDatabase; +typedef struct _GTlsInteraction GTlsInteraction; +typedef struct _GTlsPassword GTlsPassword; +typedef struct _GTlsServerConnection GTlsServerConnection; /* Dummy typedef */ +typedef struct _GVfs GVfs; /* Dummy typedef */ + +/** + * GProxyResolver: + * + * A helper class to enumerate proxies base on URI. + * + * Since: 2.26 + **/ +typedef struct _GProxyResolver GProxyResolver; +typedef struct _GProxy GProxy; +typedef struct _GProxyAddress GProxyAddress; +typedef struct _GProxyAddressEnumerator GProxyAddressEnumerator; -#define GUM_TYPE_MODULE_DETAILS (gum_module_details_get_type ()) +/** + * GVolume: + * + * Opaque mountable volume object. + **/ +typedef struct _GVolume GVolume; /* Dummy typedef */ +typedef struct _GVolumeMonitor GVolumeMonitor; + +/** + * GAsyncReadyCallback: + * @source_object: (nullable): the object the asynchronous operation was started with. + * @res: a #GAsyncResult. + * @user_data: user data passed to the callback. + * + * Type definition for a function that will be called back when an asynchronous + * operation within GIO has been completed. #GAsyncReadyCallback + * callbacks from #GTask are guaranteed to be invoked in a later + * iteration of the + * [thread-default main context][g-main-context-push-thread-default] + * where the #GTask was created. All other users of + * #GAsyncReadyCallback must likewise call it asynchronously in a + * later iteration of the main context. + * + * The asynchronous operation is guaranteed to have held a reference to + * @source_object from the time when the `*_async()` function was called, until + * after this callback returns. + **/ +typedef void (*GAsyncReadyCallback) (GObject *source_object, + GAsyncResult *res, + gpointer user_data); -G_BEGIN_DECLS +/** + * GFileProgressCallback: + * @current_num_bytes: the current number of bytes in the operation. + * @total_num_bytes: the total number of bytes in the operation. + * @user_data: user data passed to the callback. + * + * When doing file operations that may take a while, such as moving + * a file or copying a file, a progress callback is used to pass how + * far along that operation is to the application. + **/ +typedef void (*GFileProgressCallback) (goffset current_num_bytes, + goffset total_num_bytes, + gpointer user_data); -typedef guint GumProcessId; -typedef gsize GumThreadId; -typedef struct _GumThreadDetails GumThreadDetails; -typedef struct _GumModuleDetails GumModuleDetails; -typedef guint GumImportType; -typedef guint GumExportType; -typedef guint GumSymbolType; -typedef struct _GumImportDetails GumImportDetails; -typedef struct _GumExportDetails GumExportDetails; -typedef struct _GumSymbolDetails GumSymbolDetails; -typedef struct _GumSymbolSection GumSymbolSection; -typedef struct _GumRangeDetails GumRangeDetails; -typedef struct _GumFileMapping GumFileMapping; -typedef struct _GumSectionDetails GumSectionDetails; -typedef struct _GumDependencyDetails GumDependencyDetails; -typedef struct _GumMallocRangeDetails GumMallocRangeDetails; +/** + * GFileReadMoreCallback: + * @file_contents: the data as currently read. + * @file_size: the size of the data currently read. + * @user_data: data passed to the callback. + * + * When loading the partial contents of a file with g_file_load_partial_contents_async(), + * it may become necessary to determine if any more data from the file should be loaded. + * A #GFileReadMoreCallback function facilitates this by returning %TRUE if more data + * should be read, or %FALSE otherwise. + * + * Returns: %TRUE if more data should be read back. %FALSE otherwise. + **/ +typedef gboolean (* GFileReadMoreCallback) (const char *file_contents, + goffset file_size, + gpointer user_data); -typedef enum { - GUM_TEARDOWN_REQUIREMENT_FULL, - GUM_TEARDOWN_REQUIREMENT_MINIMAL -} GumTeardownRequirement; +/** + * GFileMeasureProgressCallback: + * @reporting: %TRUE if more reports will come + * @current_size: the current cumulative size measurement + * @num_dirs: the number of directories visited so far + * @num_files: the number of non-directory files encountered + * @user_data: the data passed to the original request for this callback + * + * This callback type is used by g_file_measure_disk_usage() to make + * periodic progress reports when measuring the amount of disk spaced + * used by a directory. + * + * These calls are made on a best-effort basis and not all types of + * #GFile will support them. At the minimum, however, one call will + * always be made immediately. + * + * In the case that there is no support, @reporting will be set to + * %FALSE (and the other values undefined) and no further calls will be + * made. Otherwise, the @reporting will be %TRUE and the other values + * all-zeros during the first (immediate) call. In this way, you can + * know which type of progress UI to show without a delay. + * + * For g_file_measure_disk_usage() the callback is made directly. For + * g_file_measure_disk_usage_async() the callback is made via the + * default main context of the calling thread (ie: the same way that the + * final async result would be reported). + * + * @current_size is in the same units as requested by the operation (see + * %G_FILE_MEASURE_APPARENT_SIZE). + * + * The frequency of the updates is implementation defined, but is + * ideally about once every 200ms. + * + * The last progress callback may or may not be equal to the final + * result. Always check the async result to get the final value. + * + * Since: 2.38 + **/ +typedef void (* GFileMeasureProgressCallback) (gboolean reporting, + guint64 current_size, + guint64 num_dirs, + guint64 num_files, + gpointer user_data); -typedef enum { - GUM_CODE_SIGNING_OPTIONAL, - GUM_CODE_SIGNING_REQUIRED -} GumCodeSigningPolicy; +/** + * GIOSchedulerJobFunc: + * @job: a #GIOSchedulerJob. + * @cancellable: optional #GCancellable object, %NULL to ignore. + * @user_data: the data to pass to callback function + * + * I/O Job function. + * + * Long-running jobs should periodically check the @cancellable + * to see if they have been cancelled. + * + * Returns: %TRUE if this function should be called again to + * complete the job, %FALSE if the job is complete (or cancelled) + **/ +typedef gboolean (*GIOSchedulerJobFunc) (GIOSchedulerJob *job, + GCancellable *cancellable, + gpointer user_data); -typedef enum { - GUM_MODIFY_THREAD_FLAGS_NONE = 0, - GUM_MODIFY_THREAD_FLAGS_ABORT_SAFELY = (1 << 0), -} GumModifyThreadFlags; +/** + * GSimpleAsyncThreadFunc: + * @res: a #GSimpleAsyncResult. + * @object: a #GObject. + * @cancellable: optional #GCancellable object, %NULL to ignore. + * + * Simple thread function that runs an asynchronous operation and + * checks for cancellation. + **/ +typedef void (*GSimpleAsyncThreadFunc) (GSimpleAsyncResult *res, + GObject *object, + GCancellable *cancellable); -typedef enum { - GUM_THREAD_RUNNING = 1, - GUM_THREAD_STOPPED, - GUM_THREAD_WAITING, - GUM_THREAD_UNINTERRUPTIBLE, - GUM_THREAD_HALTED -} GumThreadState; +/** + * GSocketSourceFunc: + * @socket: the #GSocket + * @condition: the current condition at the source fired. + * @user_data: data passed in by the user. + * + * This is the function type of the callback used for the #GSource + * returned by g_socket_create_source(). + * + * Returns: it should return %FALSE if the source should be removed. + * + * Since: 2.22 + */ +typedef gboolean (*GSocketSourceFunc) (GSocket *socket, + GIOCondition condition, + gpointer user_data); -struct _GumThreadDetails -{ - GumThreadId id; - const gchar * name; - GumThreadState state; - GumCpuContext cpu_context; -}; +/** + * GDatagramBasedSourceFunc: + * @datagram_based: the #GDatagramBased + * @condition: the current condition at the source fired + * @user_data: data passed in by the user + * + * This is the function type of the callback used for the #GSource + * returned by g_datagram_based_create_source(). + * + * Returns: %G_SOURCE_REMOVE if the source should be removed, + * %G_SOURCE_CONTINUE otherwise + * + * Since: 2.48 + */ +typedef gboolean (*GDatagramBasedSourceFunc) (GDatagramBased *datagram_based, + GIOCondition condition, + gpointer user_data); -typedef enum { - GUM_WATCH_READ = (1 << 0), - GUM_WATCH_WRITE = (1 << 1), -} GumWatchConditions; +/** + * GInputVector: + * @buffer: Pointer to a buffer where data will be written. + * @size: the available size in @buffer. + * + * Structure used for scatter/gather data input. + * You generally pass in an array of #GInputVectors + * and the operation will store the read data starting in the + * first buffer, switching to the next as needed. + * + * Since: 2.22 + */ +typedef struct _GInputVector GInputVector; -struct _GumModuleDetails -{ - const gchar * name; - const GumMemoryRange * range; - const gchar * path; +struct _GInputVector { + gpointer buffer; + gsize size; }; -enum _GumImportType -{ - GUM_IMPORT_UNKNOWN, - GUM_IMPORT_FUNCTION, - GUM_IMPORT_VARIABLE -}; +/** + * GInputMessage: + * @address: (optional) (out) (transfer full): return location + * for a #GSocketAddress, or %NULL + * @vectors: (array length=num_vectors) (out): pointer to an + * array of input vectors + * @num_vectors: the number of input vectors pointed to by @vectors + * @bytes_received: (out): will be set to the number of bytes that have been + * received + * @flags: (out): collection of #GSocketMsgFlags for the received message, + * outputted by the call + * @control_messages: (array length=num_control_messages) (optional) + * (out) (transfer full): return location for a + * caller-allocated array of #GSocketControlMessages, or %NULL + * @num_control_messages: (out) (optional): return location for the number of + * elements in @control_messages + * + * Structure used for scatter/gather data input when receiving multiple + * messages or packets in one go. You generally pass in an array of empty + * #GInputVectors and the operation will use all the buffers as if they + * were one buffer, and will set @bytes_received to the total number of bytes + * received across all #GInputVectors. + * + * This structure closely mirrors `struct mmsghdr` and `struct msghdr` from + * the POSIX sockets API (see `man 2 recvmmsg`). + * + * If @address is non-%NULL then it is set to the source address the message + * was received from, and the caller must free it afterwards. + * + * If @control_messages is non-%NULL then it is set to an array of control + * messages received with the message (if any), and the caller must free it + * afterwards. @num_control_messages is set to the number of elements in + * this array, which may be zero. + * + * Flags relevant to this message will be returned in @flags. For example, + * `MSG_EOR` or `MSG_TRUNC`. + * + * Since: 2.48 + */ +typedef struct _GInputMessage GInputMessage; -enum _GumExportType -{ - GUM_EXPORT_FUNCTION = 1, - GUM_EXPORT_VARIABLE -}; +struct _GInputMessage { + GSocketAddress **address; -enum _GumSymbolType -{ - /* Common */ - GUM_SYMBOL_UNKNOWN, - GUM_SYMBOL_SECTION, + GInputVector *vectors; + guint num_vectors; - /* Mach-O */ - GUM_SYMBOL_UNDEFINED, - GUM_SYMBOL_ABSOLUTE, - GUM_SYMBOL_PREBOUND_UNDEFINED, - GUM_SYMBOL_INDIRECT, + gsize bytes_received; + gint flags; - /* ELF */ - GUM_SYMBOL_OBJECT, - GUM_SYMBOL_FUNCTION, - GUM_SYMBOL_FILE, - GUM_SYMBOL_COMMON, - GUM_SYMBOL_TLS, + GSocketControlMessage ***control_messages; + guint *num_control_messages; }; -struct _GumImportDetails -{ - GumImportType type; - const gchar * name; - const gchar * module; - GumAddress address; - GumAddress slot; -}; +/** + * GOutputVector: + * @buffer: Pointer to a buffer of data to read. + * @size: the size of @buffer. + * + * Structure used for scatter/gather data output. + * You generally pass in an array of #GOutputVectors + * and the operation will use all the buffers as if they were + * one buffer. + * + * Since: 2.22 + */ +typedef struct _GOutputVector GOutputVector; -struct _GumExportDetails -{ - GumExportType type; - const gchar * name; - GumAddress address; +struct _GOutputVector { + gconstpointer buffer; + gsize size; }; -struct _GumSymbolDetails -{ - gboolean is_global; - GumSymbolType type; - const GumSymbolSection * section; - const gchar * name; - GumAddress address; - gssize size; -}; +/** + * GOutputMessage: + * @address: (nullable): a #GSocketAddress, or %NULL + * @vectors: pointer to an array of output vectors + * @num_vectors: the number of output vectors pointed to by @vectors. + * @bytes_sent: initialize to 0. Will be set to the number of bytes + * that have been sent + * @control_messages: (array length=num_control_messages) (nullable): a pointer + * to an array of #GSocketControlMessages, or %NULL. + * @num_control_messages: number of elements in @control_messages. + * + * Structure used for scatter/gather data output when sending multiple + * messages or packets in one go. You generally pass in an array of + * #GOutputVectors and the operation will use all the buffers as if they + * were one buffer. + * + * If @address is %NULL then the message is sent to the default receiver + * (as previously set by g_socket_connect()). + * + * Since: 2.44 + */ +typedef struct _GOutputMessage GOutputMessage; -struct _GumSymbolSection -{ - const gchar * id; - GumPageProtection protection; -}; +struct _GOutputMessage { + GSocketAddress *address; -struct _GumRangeDetails -{ - const GumMemoryRange * range; - GumPageProtection protection; - const GumFileMapping * file; -}; + GOutputVector *vectors; + guint num_vectors; -struct _GumFileMapping -{ - const gchar * path; - guint64 offset; - gsize size; -}; + guint bytes_sent; -struct _GumSectionDetails -{ - const gchar * id; - const gchar * name; - GumAddress address; - gsize size; + GSocketControlMessage **control_messages; + guint num_control_messages; }; -typedef enum { - GUM_DEPENDENCY_REGULAR, - GUM_DEPENDENCY_WEAK, - GUM_DEPENDENCY_REEXPORT, - GUM_DEPENDENCY_UPWARD, -} GumDependencyType; - -struct _GumDependencyDetails -{ - const gchar * name; - GumDependencyType type; -}; +typedef struct _GCredentials GCredentials; +typedef struct _GUnixCredentialsMessage GUnixCredentialsMessage; +typedef struct _GUnixFDList GUnixFDList; +typedef struct _GDBusMessage GDBusMessage; +typedef struct _GDBusConnection GDBusConnection; +typedef struct _GDBusProxy GDBusProxy; +typedef struct _GDBusMethodInvocation GDBusMethodInvocation; +typedef struct _GDBusServer GDBusServer; +typedef struct _GDBusAuthObserver GDBusAuthObserver; +typedef struct _GDBusErrorEntry GDBusErrorEntry; +typedef struct _GDBusInterfaceVTable GDBusInterfaceVTable; +typedef struct _GDBusSubtreeVTable GDBusSubtreeVTable; +typedef struct _GDBusAnnotationInfo GDBusAnnotationInfo; +typedef struct _GDBusArgInfo GDBusArgInfo; +typedef struct _GDBusMethodInfo GDBusMethodInfo; +typedef struct _GDBusSignalInfo GDBusSignalInfo; +typedef struct _GDBusPropertyInfo GDBusPropertyInfo; +typedef struct _GDBusInterfaceInfo GDBusInterfaceInfo; +typedef struct _GDBusNodeInfo GDBusNodeInfo; -struct _GumMallocRangeDetails -{ - const GumMemoryRange * range; -}; +/** + * GCancellableSourceFunc: + * @cancellable: the #GCancellable + * @user_data: data passed in by the user. + * + * This is the function type of the callback used for the #GSource + * returned by g_cancellable_source_new(). + * + * Returns: it should return %FALSE if the source should be removed. + * + * Since: 2.28 + */ +typedef gboolean (*GCancellableSourceFunc) (GCancellable *cancellable, + gpointer user_data); -typedef void (* GumModifyThreadFunc) (GumThreadId thread_id, - GumCpuContext * cpu_context, gpointer user_data); -typedef gboolean (* GumFoundThreadFunc) (const GumThreadDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundModuleFunc) (const GumModuleDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundImportFunc) (const GumImportDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundExportFunc) (const GumExportDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundSymbolFunc) (const GumSymbolDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundRangeFunc) (const GumRangeDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundSectionFunc) (const GumSectionDetails * details, - gpointer user_data); -typedef gboolean (* GumFoundDependencyFunc) ( - const GumDependencyDetails * details, gpointer user_data); -typedef gboolean (* GumFoundMallocRangeFunc) ( - const GumMallocRangeDetails * details, gpointer user_data); -typedef GumAddress (* GumResolveExportFunc) (const char * module_name, - const char * symbol_name, gpointer user_data); +/** + * GPollableSourceFunc: + * @pollable_stream: the #GPollableInputStream or #GPollableOutputStream + * @user_data: data passed in by the user. + * + * This is the function type of the callback used for the #GSource + * returned by g_pollable_input_stream_create_source() and + * g_pollable_output_stream_create_source(). + * + * Returns: it should return %FALSE if the source should be removed. + * + * Since: 2.28 + */ +typedef gboolean (*GPollableSourceFunc) (GObject *pollable_stream, + gpointer user_data); -GUM_API GumOS gum_process_get_native_os (void); -GUM_API GumTeardownRequirement gum_process_get_teardown_requirement (void); -GUM_API void gum_process_set_teardown_requirement ( - GumTeardownRequirement requirement); -GUM_API GumCodeSigningPolicy gum_process_get_code_signing_policy (void); -GUM_API void gum_process_set_code_signing_policy (GumCodeSigningPolicy policy); -GUM_API const gchar * gum_process_query_libc_name (void); -GUM_API gboolean gum_process_is_debugger_attached (void); -GUM_API GumProcessId gum_process_get_id (void); -GUM_API GumThreadId gum_process_get_current_thread_id (void); -GUM_API gboolean gum_process_has_thread (GumThreadId thread_id); -GUM_API gboolean gum_process_modify_thread (GumThreadId thread_id, - GumModifyThreadFunc func, gpointer user_data, GumModifyThreadFlags flags); -GUM_API void gum_process_enumerate_threads (GumFoundThreadFunc func, - gpointer user_data); -GUM_API const GumModuleDetails * gum_process_get_main_module (void); -GUM_API gboolean gum_process_resolve_module_pointer (gconstpointer ptr, - gchar ** path, GumMemoryRange * range); -GUM_API void gum_process_enumerate_modules (GumFoundModuleFunc func, - gpointer user_data); -GUM_API void gum_process_enumerate_ranges (GumPageProtection prot, - GumFoundRangeFunc func, gpointer user_data); -GUM_API void gum_process_enumerate_malloc_ranges ( - GumFoundMallocRangeFunc func, gpointer user_data); -GUM_API guint gum_thread_try_get_ranges (GumMemoryRange * ranges, - guint max_length); -GUM_API gint gum_thread_get_system_error (void); -GUM_API void gum_thread_set_system_error (gint value); -GUM_API gboolean gum_thread_suspend (GumThreadId thread_id, GError ** error); -GUM_API gboolean gum_thread_resume (GumThreadId thread_id, GError ** error); -GUM_API gboolean gum_thread_set_hardware_breakpoint (GumThreadId thread_id, - guint breakpoint_id, GumAddress address, GError ** error); -GUM_API gboolean gum_thread_unset_hardware_breakpoint (GumThreadId thread_id, - guint breakpoint_id, GError ** error); -GUM_API gboolean gum_thread_set_hardware_watchpoint (GumThreadId thread_id, - guint watchpoint_id, GumAddress address, gsize size, GumWatchConditions wc, - GError ** error); -GUM_API gboolean gum_thread_unset_hardware_watchpoint (GumThreadId thread_id, - guint watchpoint_id, GError ** error); -GUM_API gboolean gum_module_load (const gchar * module_name, GError ** error); -GUM_API gboolean gum_module_ensure_initialized (const gchar * module_name); -GUM_API void gum_module_enumerate_imports (const gchar * module_name, - GumFoundImportFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_exports (const gchar * module_name, - GumFoundExportFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_symbols (const gchar * module_name, - GumFoundSymbolFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_ranges (const gchar * module_name, - GumPageProtection prot, GumFoundRangeFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_sections (const gchar * module_name, - GumFoundSectionFunc func, gpointer user_data); -GUM_API void gum_module_enumerate_dependencies (const gchar * module_name, - GumFoundDependencyFunc func, gpointer user_data); -GUM_API GumAddress gum_module_find_base_address (const gchar * module_name); -GUM_API GumAddress gum_module_find_export_by_name (const gchar * module_name, - const gchar * symbol_name); -GUM_API GumAddress gum_module_find_symbol_by_name (const gchar * module_name, - const gchar * symbol_name); +typedef struct _GDBusInterface GDBusInterface; /* Dummy typedef */ +typedef struct _GDBusInterfaceSkeleton GDBusInterfaceSkeleton; +typedef struct _GDBusObject GDBusObject; /* Dummy typedef */ +typedef struct _GDBusObjectSkeleton GDBusObjectSkeleton; +typedef struct _GDBusObjectProxy GDBusObjectProxy; +typedef struct _GDBusObjectManager GDBusObjectManager; /* Dummy typedef */ +typedef struct _GDBusObjectManagerClient GDBusObjectManagerClient; +typedef struct _GDBusObjectManagerServer GDBusObjectManagerServer; -GUM_API const gchar * gum_code_signing_policy_to_string ( - GumCodeSigningPolicy policy); +/** + * GDBusProxyTypeFunc: + * @manager: A #GDBusObjectManagerClient. + * @object_path: The object path of the remote object. + * @interface_name: (nullable): The interface name of the remote object or %NULL if a #GDBusObjectProxy #GType is requested. + * @user_data: User data. + * + * Function signature for a function used to determine the #GType to + * use for an interface proxy (if @interface_name is not %NULL) or + * object proxy (if @interface_name is %NULL). + * + * This function is called in the + * [thread-default main loop][g-main-context-push-thread-default] + * that @manager was constructed in. + * + * Returns: A #GType to use for the remote object. The returned type + * must be a #GDBusProxy or #GDBusObjectProxy -derived + * type. + * + * Since: 2.30 + */ +typedef GType (*GDBusProxyTypeFunc) (GDBusObjectManagerClient *manager, + const gchar *object_path, + const gchar *interface_name, + gpointer user_data); -#ifndef GUM_DIET -GUM_API GType gum_module_details_get_type (void) G_GNUC_CONST; -#endif -GUM_API GumModuleDetails * gum_module_details_copy ( - const GumModuleDetails * module); -GUM_API void gum_module_details_free (GumModuleDetails * module); +typedef struct _GTestDBus GTestDBus; -GUM_API const gchar * gum_symbol_type_to_string (GumSymbolType type); +/** + * GSubprocess: + * + * A child process. + * + * Since: 2.40 + */ +typedef struct _GSubprocess GSubprocess; +/** + * GSubprocessLauncher: + * + * Options for launching a child process. + * + * Since: 2.40 + */ +typedef struct _GSubprocessLauncher GSubprocessLauncher; G_END_DECLS +#endif /* __GIO_TYPES_H__ */ + +/* + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_ACTION_H__ +#define __G_ACTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif + G_BEGIN_DECLS -typedef struct _GumCloak GumCloak; +#define G_TYPE_ACTION (g_action_get_type ()) +#define G_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_ACTION, GAction)) +#define G_IS_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_ACTION)) +#define G_ACTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \ + G_TYPE_ACTION, GActionInterface)) -typedef gboolean (* GumCloakFoundThreadFunc) (GumThreadId id, - gpointer user_data); -typedef gboolean (* GumCloakFoundRangeFunc) (const GumMemoryRange * range, - gpointer user_data); -typedef gboolean (* GumCloakFoundFDFunc) (gint fd, gpointer user_data); -typedef void (* GumCloakLockedFunc) (gpointer user_data); +typedef struct _GActionInterface GActionInterface; -GUM_API void gum_cloak_add_thread (GumThreadId id); -GUM_API void gum_cloak_remove_thread (GumThreadId id); -GUM_API gboolean gum_cloak_has_thread (GumThreadId id); -GUM_API void gum_cloak_enumerate_threads (GumCloakFoundThreadFunc func, - gpointer user_data); +struct _GActionInterface +{ + GTypeInterface g_iface; -GUM_API void gum_cloak_add_range (const GumMemoryRange * range); -GUM_API void gum_cloak_remove_range (const GumMemoryRange * range); -GUM_API gboolean gum_cloak_has_range_containing (GumAddress address); -GUM_API GArray * gum_cloak_clip_range (const GumMemoryRange * range); -GUM_API void gum_cloak_enumerate_ranges (GumCloakFoundRangeFunc func, - gpointer user_data); + /* virtual functions */ + const gchar * (* get_name) (GAction *action); + const GVariantType * (* get_parameter_type) (GAction *action); + const GVariantType * (* get_state_type) (GAction *action); + GVariant * (* get_state_hint) (GAction *action); -GUM_API void gum_cloak_add_file_descriptor (gint fd); -GUM_API void gum_cloak_remove_file_descriptor (gint fd); -GUM_API gboolean gum_cloak_has_file_descriptor (gint fd); -GUM_API void gum_cloak_enumerate_file_descriptors (GumCloakFoundFDFunc func, - gpointer user_data); + gboolean (* get_enabled) (GAction *action); + GVariant * (* get_state) (GAction *action); -GUM_API void gum_cloak_with_lock_held (GumCloakLockedFunc func, - gpointer user_data); -GUM_API gboolean gum_cloak_is_locked (void); + void (* change_state) (GAction *action, + GVariant *value); + void (* activate) (GAction *action, + GVariant *parameter); +}; + +GIO_AVAILABLE_IN_2_30 +GType g_action_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +const gchar * g_action_get_name (GAction *action); +GIO_AVAILABLE_IN_ALL +const GVariantType * g_action_get_parameter_type (GAction *action); +GIO_AVAILABLE_IN_ALL +const GVariantType * g_action_get_state_type (GAction *action); +GIO_AVAILABLE_IN_ALL +GVariant * g_action_get_state_hint (GAction *action); + +GIO_AVAILABLE_IN_ALL +gboolean g_action_get_enabled (GAction *action); +GIO_AVAILABLE_IN_ALL +GVariant * g_action_get_state (GAction *action); + +GIO_AVAILABLE_IN_ALL +void g_action_change_state (GAction *action, + GVariant *value); +GIO_AVAILABLE_IN_ALL +void g_action_activate (GAction *action, + GVariant *parameter); + +GIO_AVAILABLE_IN_2_28 +gboolean g_action_name_is_valid (const gchar *action_name); + +GIO_AVAILABLE_IN_2_38 +gboolean g_action_parse_detailed_name (const gchar *detailed_name, + gchar **action_name, + GVariant **target_value, + GError **error); + +GIO_AVAILABLE_IN_2_38 +gchar * g_action_print_detailed_name (const gchar *action_name, + GVariant *target_value); G_END_DECLS -#endif +#endif /* __G_ACTION_H__ */ /* - * Copyright (C) 2010-2021 Ole André Vadla Ravnås + * Copyright © 2010 Codethink Limited * - * Licence: wxWindows Library Licence, Version 3.1 + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie */ -#ifndef __GUM_CODE_ALLOCATOR_H__ -#define __GUM_CODE_ALLOCATOR_H__ +#ifndef __G_ACTION_GROUP_H__ +#define __G_ACTION_GROUP_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -#define GUM_TYPE_CODE_SLICE (gum_code_slice_get_type ()) -#define GUM_TYPE_CODE_DEFLECTOR (gum_code_deflector_get_type ()) G_BEGIN_DECLS -typedef struct _GumCodeAllocator GumCodeAllocator; -typedef struct _GumCodeSlice GumCodeSlice; -typedef struct _GumCodeDeflector GumCodeDeflector; -struct _GumCodeAllocator +#define G_TYPE_ACTION_GROUP (g_action_group_get_type ()) +#define G_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_ACTION_GROUP, GActionGroup)) +#define G_IS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_ACTION_GROUP)) +#define G_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \ + G_TYPE_ACTION_GROUP, GActionGroupInterface)) + +typedef struct _GActionGroupInterface GActionGroupInterface; + +struct _GActionGroupInterface { - gsize slice_size; - gsize pages_per_batch; - gsize slices_per_batch; - gsize pages_metadata_size; + GTypeInterface g_iface; - GSList * uncommitted_pages; - GHashTable * dirty_pages; - GList * free_slices; + /* virtual functions */ + gboolean (* has_action) (GActionGroup *action_group, + const gchar *action_name); - GSList * dispatchers; -}; + gchar ** (* list_actions) (GActionGroup *action_group); -struct _GumCodeSlice -{ - gpointer data; - guint size; + gboolean (* get_action_enabled) (GActionGroup *action_group, + const gchar *action_name); - /*< private >*/ - gint ref_count; -}; + const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group, + const gchar *action_name); -struct _GumCodeDeflector -{ - gpointer return_address; - gpointer target; - gpointer trampoline; + const GVariantType * (* get_action_state_type) (GActionGroup *action_group, + const gchar *action_name); - /*< private >*/ - gint ref_count; -}; + GVariant * (* get_action_state_hint) (GActionGroup *action_group, + const gchar *action_name); -GUM_API void gum_code_allocator_init (GumCodeAllocator * allocator, - gsize slice_size); -GUM_API void gum_code_allocator_free (GumCodeAllocator * allocator); + GVariant * (* get_action_state) (GActionGroup *action_group, + const gchar *action_name); -GUM_API GumCodeSlice * gum_code_allocator_alloc_slice (GumCodeAllocator * self); -GUM_API GumCodeSlice * gum_code_allocator_try_alloc_slice_near ( - GumCodeAllocator * self, const GumAddressSpec * spec, gsize alignment); -GUM_API void gum_code_allocator_commit (GumCodeAllocator * self); -#ifndef GUM_DIET -GUM_API GType gum_code_slice_get_type (void) G_GNUC_CONST; -#endif -GUM_API GumCodeSlice * gum_code_slice_ref (GumCodeSlice * slice); -GUM_API void gum_code_slice_unref (GumCodeSlice * slice); + void (* change_action_state) (GActionGroup *action_group, + const gchar *action_name, + GVariant *value); -GUM_API GumCodeDeflector * gum_code_allocator_alloc_deflector ( - GumCodeAllocator * self, const GumAddressSpec * caller, - gpointer return_address, gpointer target, gboolean dedicated); -#ifndef GUM_DIET -GUM_API GType gum_code_deflector_get_type (void) G_GNUC_CONST; -#endif -GUM_API GumCodeDeflector * gum_code_deflector_ref ( - GumCodeDeflector * deflector); -GUM_API void gum_code_deflector_unref (GumCodeDeflector * deflector); + void (* activate_action) (GActionGroup *action_group, + const gchar *action_name, + GVariant *parameter); + + /* signals */ + void (* action_added) (GActionGroup *action_group, + const gchar *action_name); + void (* action_removed) (GActionGroup *action_group, + const gchar *action_name); + void (* action_enabled_changed) (GActionGroup *action_group, + const gchar *action_name, + gboolean enabled); + void (* action_state_changed) (GActionGroup *action_group, + const gchar *action_name, + GVariant *state); + + /* more virtual functions */ + gboolean (* query_action) (GActionGroup *action_group, + const gchar *action_name, + gboolean *enabled, + const GVariantType **parameter_type, + const GVariantType **state_type, + GVariant **state_hint, + GVariant **state); +}; + +GIO_AVAILABLE_IN_ALL +GType g_action_group_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_action_group_has_action (GActionGroup *action_group, + const gchar *action_name); +GIO_AVAILABLE_IN_ALL +gchar ** g_action_group_list_actions (GActionGroup *action_group); + +GIO_AVAILABLE_IN_ALL +const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group, + const gchar *action_name); +GIO_AVAILABLE_IN_ALL +const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group, + const gchar *action_name); +GIO_AVAILABLE_IN_ALL +GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group, + const gchar *action_name); + +GIO_AVAILABLE_IN_ALL +gboolean g_action_group_get_action_enabled (GActionGroup *action_group, + const gchar *action_name); + +GIO_AVAILABLE_IN_ALL +GVariant * g_action_group_get_action_state (GActionGroup *action_group, + const gchar *action_name); +GIO_AVAILABLE_IN_ALL +void g_action_group_change_action_state (GActionGroup *action_group, + const gchar *action_name, + GVariant *value); + +GIO_AVAILABLE_IN_ALL +void g_action_group_activate_action (GActionGroup *action_group, + const gchar *action_name, + GVariant *parameter); + +/* signals */ +GIO_AVAILABLE_IN_ALL +void g_action_group_action_added (GActionGroup *action_group, + const gchar *action_name); +GIO_AVAILABLE_IN_ALL +void g_action_group_action_removed (GActionGroup *action_group, + const gchar *action_name); +GIO_AVAILABLE_IN_ALL +void g_action_group_action_enabled_changed (GActionGroup *action_group, + const gchar *action_name, + gboolean enabled); + +GIO_AVAILABLE_IN_ALL +void g_action_group_action_state_changed (GActionGroup *action_group, + const gchar *action_name, + GVariant *state); + +GIO_AVAILABLE_IN_2_32 +gboolean g_action_group_query_action (GActionGroup *action_group, + const gchar *action_name, + gboolean *enabled, + const GVariantType **parameter_type, + const GVariantType **state_type, + GVariant **state_hint, + GVariant **state); G_END_DECLS -#endif +#endif /* __G_ACTION_GROUP_H__ */ /* - * Copyright (C) 2016-2019 Ole André Vadla Ravnås + * Copyright © 2010 Codethink Limited + * Copyright © 2011 Canonical Limited * - * Licence: wxWindows Library Licence, Version 3.1 + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie */ -#ifndef __GUM_CODE_SEGMENT_H__ -#define __GUM_CODE_SEGMENT_H__ - - -G_BEGIN_DECLS -typedef struct _GumCodeSegment GumCodeSegment; +#ifndef __G_ACTION_GROUP_EXPORTER_H__ +#define __G_ACTION_GROUP_EXPORTER_H__ -GUM_API gboolean gum_code_segment_is_supported (void); +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -GUM_API GumCodeSegment * gum_code_segment_new (gsize size, - const GumAddressSpec * spec); -GUM_API void gum_code_segment_free (GumCodeSegment * segment); -GUM_API gpointer gum_code_segment_get_address (GumCodeSegment * self); -GUM_API gsize gum_code_segment_get_size (GumCodeSegment * self); -GUM_API gsize gum_code_segment_get_virtual_size (GumCodeSegment * self); +G_BEGIN_DECLS -GUM_API void gum_code_segment_realize (GumCodeSegment * self); -GUM_API void gum_code_segment_map (GumCodeSegment * self, gsize source_offset, - gsize source_size, gpointer target_address); +GIO_AVAILABLE_IN_2_32 +guint g_dbus_connection_export_action_group (GDBusConnection *connection, + const gchar *object_path, + GActionGroup *action_group, + GError **error); -GUM_API gboolean gum_code_segment_mark (gpointer code, gsize size, - GError ** error); +GIO_AVAILABLE_IN_2_32 +void g_dbus_connection_unexport_action_group (GDBusConnection *connection, + guint export_id); G_END_DECLS -#endif +#endif /* __G_ACTION_GROUP_EXPORTER_H__ */ /* - * Copyright (C) 2021-2022 Ole André Vadla Ravnås + * Copyright © 2010 Codethink Limited * - * Licence: wxWindows Library Licence, Version 3.1 + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie */ -#ifndef __GUM_DARWIN_GRAFTER_H__ -#define __GUM_DARWIN_GRAFTER_H__ +#ifndef __G_ACTION_MAP_H__ +#define __G_ACTION_MAP_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif G_BEGIN_DECLS -typedef enum { - GUM_DARWIN_GRAFTER_FLAGS_NONE = 0, - GUM_DARWIN_GRAFTER_FLAGS_INGEST_FUNCTION_STARTS = (1 << 0), - GUM_DARWIN_GRAFTER_FLAGS_INGEST_IMPORTS = (1 << 1), - GUM_DARWIN_GRAFTER_FLAGS_TRANSFORM_LAZY_BINDS = (1 << 2), -} GumDarwinGrafterFlags; -#define GUM_TYPE_DARWIN_GRAFTER (gum_darwin_grafter_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumDarwinGrafter, gum_darwin_grafter, GUM, - DARWIN_GRAFTER, GObject) +#define G_TYPE_ACTION_MAP (g_action_map_get_type ()) +#define G_ACTION_MAP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_ACTION_MAP, GActionMap)) +#define G_IS_ACTION_MAP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_ACTION_MAP)) +#define G_ACTION_MAP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \ + G_TYPE_ACTION_MAP, GActionMapInterface)) -GUM_API GumDarwinGrafter * gum_darwin_grafter_new_from_file ( - const gchar * path, GumDarwinGrafterFlags flags); +typedef struct _GActionMapInterface GActionMapInterface; +typedef struct _GActionEntry GActionEntry; -GUM_API void gum_darwin_grafter_add (GumDarwinGrafter * self, - guint32 code_offset); +struct _GActionMapInterface +{ + GTypeInterface g_iface; + + GAction * (* lookup_action) (GActionMap *action_map, + const gchar *action_name); + void (* add_action) (GActionMap *action_map, + GAction *action); + void (* remove_action) (GActionMap *action_map, + const gchar *action_name); +}; -GUM_API gboolean gum_darwin_grafter_graft (GumDarwinGrafter * self, - GError ** error); +struct _GActionEntry +{ + const gchar *name; -G_END_DECLS + void (* activate) (GSimpleAction *action, + GVariant *parameter, + gpointer user_data); -#endif -/* - * Copyright (C) 2015-2023 Ole André Vadla Ravnås - * Copyright (C) 2023 Fabian Freyer - * - * Licence: wxWindows Library Licence, Version 3.1 - */ + const gchar *parameter_type; -#ifndef __GUM_DARWIN_MODULE_H__ -#define __GUM_DARWIN_MODULE_H__ + const gchar *state; + void (* change_state) (GSimpleAction *action, + GVariant *value, + gpointer user_data); -G_BEGIN_DECLS + /*< private >*/ + gsize padding[3]; +}; -#define GUM_TYPE_DARWIN_MODULE (gum_darwin_module_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumDarwinModule, gum_darwin_module, GUM, DARWIN_MODULE, - GObject) +GIO_AVAILABLE_IN_2_32 +GType g_action_map_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +GAction * g_action_map_lookup_action (GActionMap *action_map, + const gchar *action_name); +GIO_AVAILABLE_IN_2_32 +void g_action_map_add_action (GActionMap *action_map, + GAction *action); +GIO_AVAILABLE_IN_2_32 +void g_action_map_remove_action (GActionMap *action_map, + const gchar *action_name); +GIO_AVAILABLE_IN_2_32 +void g_action_map_add_action_entries (GActionMap *action_map, + const GActionEntry *entries, + gint n_entries, + gpointer user_data); -#define GUM_TYPE_DARWIN_MODULE_IMAGE (gum_darwin_module_image_get_type ()) +G_END_DECLS -#define GUM_DARWIN_PORT_NULL 0 -#define GUM_DARWIN_EXPORT_KIND_MASK 3 +#endif /* __G_ACTION_MAP_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ -typedef guint GumDarwinModuleFiletype; -typedef gint GumDarwinCpuType; -typedef gint GumDarwinCpuSubtype; +#ifndef __G_APP_INFO_H__ +#define __G_APP_INFO_H__ -typedef struct _GumDarwinModuleImage GumDarwinModuleImage; +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -typedef struct _GumDarwinModuleImageSegment GumDarwinModuleImageSegment; -typedef struct _GumDarwinSectionDetails GumDarwinSectionDetails; -typedef struct _GumDarwinChainedFixupsDetails GumDarwinChainedFixupsDetails; -typedef struct _GumDarwinRebaseDetails GumDarwinRebaseDetails; -typedef struct _GumDarwinBindDetails GumDarwinBindDetails; -typedef struct _GumDarwinThreadedItem GumDarwinThreadedItem; -typedef struct _GumDarwinTlvParameters GumDarwinTlvParameters; -typedef struct _GumDarwinTlvDescriptorDetails GumDarwinTlvDescriptorDetails; -typedef struct _GumDarwinInitPointersDetails GumDarwinInitPointersDetails; -typedef struct _GumDarwinInitOffsetsDetails GumDarwinInitOffsetsDetails; -typedef struct _GumDarwinTermPointersDetails GumDarwinTermPointersDetails; -typedef struct _GumDarwinFunctionStartsDetails GumDarwinFunctionStartsDetails; -typedef struct _GumDarwinSegment GumDarwinSegment; -typedef struct _GumDarwinExportDetails GumDarwinExportDetails; -typedef struct _GumDarwinSymbolDetails GumDarwinSymbolDetails; -typedef guint8 GumDarwinRebaseType; -typedef guint8 GumDarwinBindType; -typedef guint8 GumDarwinThreadedItemType; -typedef gint GumDarwinBindOrdinal; -typedef guint8 GumDarwinBindSymbolFlags; -typedef guint8 GumDarwinExportSymbolKind; -typedef guint8 GumDarwinExportSymbolFlags; +G_BEGIN_DECLS -typedef guint GumDarwinPort; -typedef gint GumDarwinPageProtection; +#define G_TYPE_APP_INFO (g_app_info_get_type ()) +#define G_APP_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APP_INFO, GAppInfo)) +#define G_IS_APP_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APP_INFO)) +#define G_APP_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_APP_INFO, GAppInfoIface)) + +#define G_TYPE_APP_LAUNCH_CONTEXT (g_app_launch_context_get_type ()) +#define G_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContext)) +#define G_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass)) +#define G_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_APP_LAUNCH_CONTEXT)) +#define G_IS_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_APP_LAUNCH_CONTEXT)) +#define G_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass)) + +typedef struct _GAppLaunchContextClass GAppLaunchContextClass; +typedef struct _GAppLaunchContextPrivate GAppLaunchContextPrivate; + +/** + * GAppInfo: + * + * Information about an installed application and methods to launch + * it (with file arguments). + */ + +/** + * GAppInfoIface: + * @g_iface: The parent interface. + * @dup: Copies a #GAppInfo. + * @equal: Checks two #GAppInfos for equality. + * @get_id: Gets a string identifier for a #GAppInfo. + * @get_name: Gets the name of the application for a #GAppInfo. + * @get_description: Gets a short description for the application described by the #GAppInfo. + * @get_executable: Gets the executable name for the #GAppInfo. + * @get_icon: Gets the #GIcon for the #GAppInfo. + * @launch: Launches an application specified by the #GAppInfo. + * @supports_uris: Indicates whether the application specified supports launching URIs. + * @supports_files: Indicates whether the application specified accepts filename arguments. + * @launch_uris: Launches an application with a list of URIs. + * @should_show: Returns whether an application should be shown (e.g. when getting a list of installed applications). + * [FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt). + * @set_as_default_for_type: Sets an application as default for a given content type. + * @set_as_default_for_extension: Sets an application as default for a given file extension. + * @add_supports_type: Adds to the #GAppInfo information about supported file types. + * @can_remove_supports_type: Checks for support for removing supported file types from a #GAppInfo. + * @remove_supports_type: Removes a supported application type from a #GAppInfo. + * @can_delete: Checks if a #GAppInfo can be deleted. Since 2.20 + * @do_delete: Deletes a #GAppInfo. Since 2.20 + * @get_commandline: Gets the commandline for the #GAppInfo. Since 2.20 + * @get_display_name: Gets the display name for the #GAppInfo. Since 2.24 + * @set_as_last_used_for_type: Sets the application as the last used. See g_app_info_set_as_last_used_for_type(). + * @get_supported_types: Retrieves the list of content types that @app_info claims to support. + * @launch_uris_async: Asynchronously launches an application with a list of URIs. (Since: 2.60) + * @launch_uris_finish: Finishes an operation started with @launch_uris_async. (Since: 2.60) + + * Application Information interface, for operating system portability. + */ +typedef struct _GAppInfoIface GAppInfoIface; + +struct _GAppInfoIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + GAppInfo * (* dup) (GAppInfo *appinfo); + gboolean (* equal) (GAppInfo *appinfo1, + GAppInfo *appinfo2); + const char * (* get_id) (GAppInfo *appinfo); + const char * (* get_name) (GAppInfo *appinfo); + const char * (* get_description) (GAppInfo *appinfo); + const char * (* get_executable) (GAppInfo *appinfo); + GIcon * (* get_icon) (GAppInfo *appinfo); + gboolean (* launch) (GAppInfo *appinfo, + GList *files, + GAppLaunchContext *context, + GError **error); + gboolean (* supports_uris) (GAppInfo *appinfo); + gboolean (* supports_files) (GAppInfo *appinfo); + gboolean (* launch_uris) (GAppInfo *appinfo, + GList *uris, + GAppLaunchContext *context, + GError **error); + gboolean (* should_show) (GAppInfo *appinfo); + + /* For changing associations */ + gboolean (* set_as_default_for_type) (GAppInfo *appinfo, + const char *content_type, + GError **error); + gboolean (* set_as_default_for_extension) (GAppInfo *appinfo, + const char *extension, + GError **error); + gboolean (* add_supports_type) (GAppInfo *appinfo, + const char *content_type, + GError **error); + gboolean (* can_remove_supports_type) (GAppInfo *appinfo); + gboolean (* remove_supports_type) (GAppInfo *appinfo, + const char *content_type, + GError **error); + gboolean (* can_delete) (GAppInfo *appinfo); + gboolean (* do_delete) (GAppInfo *appinfo); + const char * (* get_commandline) (GAppInfo *appinfo); + const char * (* get_display_name) (GAppInfo *appinfo); + gboolean (* set_as_last_used_for_type) (GAppInfo *appinfo, + const char *content_type, + GError **error); + const char ** (* get_supported_types) (GAppInfo *appinfo); + void (* launch_uris_async) (GAppInfo *appinfo, + GList *uris, + GAppLaunchContext *context, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* launch_uris_finish) (GAppInfo *appinfo, + GAsyncResult *result, + GError **error); +}; -typedef gboolean (* GumFoundDarwinExportFunc) ( - const GumDarwinExportDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinSymbolFunc) ( - const GumDarwinSymbolDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinSectionFunc) ( - const GumDarwinSectionDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinChainedFixupsFunc) ( - const GumDarwinChainedFixupsDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinRebaseFunc) ( - const GumDarwinRebaseDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinBindFunc) ( - const GumDarwinBindDetails * details, gpointer user_data); +GIO_AVAILABLE_IN_ALL +GType g_app_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GAppInfo * g_app_info_create_from_commandline (const char *commandline, + const char *application_name, + GAppInfoCreateFlags flags, + GError **error); +GIO_AVAILABLE_IN_ALL +GAppInfo * g_app_info_dup (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_equal (GAppInfo *appinfo1, + GAppInfo *appinfo2); +GIO_AVAILABLE_IN_ALL +const char *g_app_info_get_id (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +const char *g_app_info_get_name (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +const char *g_app_info_get_display_name (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +const char *g_app_info_get_description (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +const char *g_app_info_get_executable (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +const char *g_app_info_get_commandline (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +GIcon * g_app_info_get_icon (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_launch (GAppInfo *appinfo, + GList *files, + GAppLaunchContext *context, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_supports_uris (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_supports_files (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_launch_uris (GAppInfo *appinfo, + GList *uris, + GAppLaunchContext *context, + GError **error); +GIO_AVAILABLE_IN_2_60 +void g_app_info_launch_uris_async (GAppInfo *appinfo, + GList *uris, + GAppLaunchContext *context, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_60 +gboolean g_app_info_launch_uris_finish (GAppInfo *appinfo, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_should_show (GAppInfo *appinfo); + +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_set_as_default_for_type (GAppInfo *appinfo, + const char *content_type, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_set_as_default_for_extension (GAppInfo *appinfo, + const char *extension, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_add_supports_type (GAppInfo *appinfo, + const char *content_type, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_can_remove_supports_type (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_remove_supports_type (GAppInfo *appinfo, + const char *content_type, + GError **error); +GIO_AVAILABLE_IN_2_34 +const char **g_app_info_get_supported_types (GAppInfo *appinfo); + +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_can_delete (GAppInfo *appinfo); +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_delete (GAppInfo *appinfo); + +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_set_as_last_used_for_type (GAppInfo *appinfo, + const char *content_type, + GError **error); + +GIO_AVAILABLE_IN_ALL +GList * g_app_info_get_all (void); +GIO_AVAILABLE_IN_ALL +GList * g_app_info_get_all_for_type (const char *content_type); +GIO_AVAILABLE_IN_ALL +GList * g_app_info_get_recommended_for_type (const gchar *content_type); +GIO_AVAILABLE_IN_ALL +GList * g_app_info_get_fallback_for_type (const gchar *content_type); + +GIO_AVAILABLE_IN_ALL +void g_app_info_reset_type_associations (const char *content_type); +GIO_AVAILABLE_IN_ALL +GAppInfo *g_app_info_get_default_for_type (const char *content_type, + gboolean must_support_uris); +GIO_AVAILABLE_IN_2_74 +void g_app_info_get_default_for_type_async (const char *content_type, + gboolean must_support_uris, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_74 +GAppInfo *g_app_info_get_default_for_type_finish (GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +GAppInfo *g_app_info_get_default_for_uri_scheme (const char *uri_scheme); + +GIO_AVAILABLE_IN_2_74 +void g_app_info_get_default_for_uri_scheme_async (const char *uri_scheme, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_74 +GAppInfo *g_app_info_get_default_for_uri_scheme_finish (GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_app_info_launch_default_for_uri (const char *uri, + GAppLaunchContext *context, + GError **error); + +GIO_AVAILABLE_IN_2_50 +void g_app_info_launch_default_for_uri_async (const char *uri, + GAppLaunchContext *context, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_50 +gboolean g_app_info_launch_default_for_uri_finish (GAsyncResult *result, + GError **error); + + +/** + * GAppLaunchContext: + * + * Integrating the launch with the launching application. This is used to + * handle for instance startup notification and launching the new application + * on the same screen as the launching window. + */ +struct _GAppLaunchContext +{ + GObject parent_instance; -typedef gboolean (* GumFoundDarwinTlvDescriptorFunc) ( - const GumDarwinTlvDescriptorDetails * details, gpointer user_data); + /*< private >*/ + GAppLaunchContextPrivate *priv; +}; -typedef gboolean (* GumFoundDarwinInitPointersFunc) ( - const GumDarwinInitPointersDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinInitOffsetsFunc) ( - const GumDarwinInitOffsetsDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinTermPointersFunc) ( - const GumDarwinTermPointersDetails * details, gpointer user_data); -typedef gboolean (* GumFoundDarwinFunctionStartsFunc) ( - const GumDarwinFunctionStartsDetails * details, gpointer user_data); +struct _GAppLaunchContextClass +{ + GObjectClass parent_class; -typedef struct _GumDyldInfoCommand GumDyldInfoCommand; -typedef struct _GumSymtabCommand GumSymtabCommand; -typedef struct _GumDysymtabCommand GumDysymtabCommand; + char * (* get_display) (GAppLaunchContext *context, + GAppInfo *info, + GList *files); + char * (* get_startup_notify_id) (GAppLaunchContext *context, + GAppInfo *info, + GList *files); + void (* launch_failed) (GAppLaunchContext *context, + const char *startup_notify_id); + void (* launched) (GAppLaunchContext *context, + GAppInfo *info, + GVariant *platform_data); + void (* launch_started) (GAppLaunchContext *context, + GAppInfo *info, + GVariant *platform_data); -typedef enum { - GUM_DARWIN_MODULE_FLAGS_NONE = 0, - GUM_DARWIN_MODULE_FLAGS_HEADER_ONLY = (1 << 0), -} GumDarwinModuleFlags; + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); +}; -typedef struct _GumChainedFixupsHeader GumChainedFixupsHeader; -typedef struct _GumChainedStartsInImage GumChainedStartsInImage; -typedef struct _GumChainedStartsInSegment GumChainedStartsInSegment; +GIO_AVAILABLE_IN_ALL +GType g_app_launch_context_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GAppLaunchContext *g_app_launch_context_new (void); + +GIO_AVAILABLE_IN_2_32 +void g_app_launch_context_setenv (GAppLaunchContext *context, + const char *variable, + const char *value); +GIO_AVAILABLE_IN_2_32 +void g_app_launch_context_unsetenv (GAppLaunchContext *context, + const char *variable); +GIO_AVAILABLE_IN_2_32 +char ** g_app_launch_context_get_environment (GAppLaunchContext *context); + +GIO_AVAILABLE_IN_ALL +char * g_app_launch_context_get_display (GAppLaunchContext *context, + GAppInfo *info, + GList *files); +GIO_AVAILABLE_IN_ALL +char * g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context, + GAppInfo *info, + GList *files); +GIO_AVAILABLE_IN_ALL +void g_app_launch_context_launch_failed (GAppLaunchContext *context, + const char * startup_notify_id); + +#define G_TYPE_APP_INFO_MONITOR (g_app_info_monitor_get_type ()) +#define G_APP_INFO_MONITOR(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_APP_INFO_MONITOR, GAppInfoMonitor)) +#define G_IS_APP_INFO_MONITOR(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_APP_INFO_MONITOR)) + +typedef struct _GAppInfoMonitor GAppInfoMonitor; + +GIO_AVAILABLE_IN_2_40 +GType g_app_info_monitor_get_type (void); + +GIO_AVAILABLE_IN_2_40 +GAppInfoMonitor * g_app_info_monitor_get (void); -typedef guint32 GumChainedImportFormat; -typedef guint32 GumChainedSymbolFormat; -typedef guint16 GumChainedPtrFormat; +G_END_DECLS -typedef struct _GumChainedImport GumChainedImport; -typedef struct _GumChainedImportAddend GumChainedImportAddend; -typedef struct _GumChainedImportAddend64 GumChainedImportAddend64; +#endif /* __G_APP_INFO_H__ */ +/* + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ -typedef struct _GumChainedPtr64Rebase GumChainedPtr64Rebase; -typedef struct _GumChainedPtr64Bind GumChainedPtr64Bind; -typedef struct _GumChainedPtrArm64eRebase GumChainedPtrArm64eRebase; -typedef struct _GumChainedPtrArm64eBind GumChainedPtrArm64eBind; -typedef struct _GumChainedPtrArm64eBind24 GumChainedPtrArm64eBind24; -typedef struct _GumChainedPtrArm64eAuthRebase GumChainedPtrArm64eAuthRebase; -typedef struct _GumChainedPtrArm64eAuthBind GumChainedPtrArm64eAuthBind; -typedef struct _GumChainedPtrArm64eAuthBind24 GumChainedPtrArm64eAuthBind24; +#ifndef __G_APPLICATION_H__ +#define __G_APPLICATION_H__ -struct _GumDarwinModule -{ -#ifndef GUM_DIET - GObject parent; -#else - GumObject parent; +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif - GumDarwinModuleFiletype filetype; - gchar * name; - gchar * uuid; - GumDarwinPort task; - gboolean is_local; - gboolean is_kernel; - GumCpuType cpu_type; - GumPtrauthSupport ptrauth_support; - gsize pointer_size; - GumAddress base_address; - gchar * source_path; - GBytes * source_blob; - GumDarwinModuleFlags flags; +G_BEGIN_DECLS - GumDarwinModuleImage * image; +#define G_TYPE_APPLICATION (g_application_get_type ()) +#define G_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_APPLICATION, GApplication)) +#define G_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_APPLICATION, GApplicationClass)) +#define G_IS_APPLICATION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_APPLICATION)) +#define G_IS_APPLICATION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_APPLICATION)) +#define G_APPLICATION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_APPLICATION, GApplicationClass)) - const GumDyldInfoCommand * info; - const GumSymtabCommand * symtab; - const GumDysymtabCommand * dysymtab; +typedef struct _GApplicationPrivate GApplicationPrivate; +typedef struct _GApplicationClass GApplicationClass; - GumAddress preferred_address; +struct _GApplication +{ + /*< private >*/ + GObject parent_instance; - GArray * segments; - GArray * text_ranges; + GApplicationPrivate *priv; +}; - const guint8 * rebases; - const guint8 * rebases_end; - gpointer rebases_malloc_data; +struct _GApplicationClass +{ + /*< private >*/ + GObjectClass parent_class; - const guint8 * binds; - const guint8 * binds_end; - gpointer binds_malloc_data; + /*< public >*/ + /* signals */ + void (* startup) (GApplication *application); - const guint8 * lazy_binds; - const guint8 * lazy_binds_end; - gpointer lazy_binds_malloc_data; + void (* activate) (GApplication *application); - const guint8 * exports; - const guint8 * exports_end; - gpointer exports_malloc_data; + void (* open) (GApplication *application, + GFile **files, + gint n_files, + const gchar *hint); - GArray * dependencies; - GPtrArray * reexports; -}; + int (* command_line) (GApplication *application, + GApplicationCommandLine *command_line); -enum _GumDarwinModuleFiletype -{ - GUM_DARWIN_MODULE_FILETYPE_OBJECT = 1, - GUM_DARWIN_MODULE_FILETYPE_EXECUTE, - GUM_DARWIN_MODULE_FILETYPE_FVMLIB, - GUM_DARWIN_MODULE_FILETYPE_CORE, - GUM_DARWIN_MODULE_FILETYPE_PRELOAD, - GUM_DARWIN_MODULE_FILETYPE_DYLIB, - GUM_DARWIN_MODULE_FILETYPE_DYLINKER, - GUM_DARWIN_MODULE_FILETYPE_BUNDLE, - GUM_DARWIN_MODULE_FILETYPE_DYLIB_STUB, - GUM_DARWIN_MODULE_FILETYPE_DSYM, - GUM_DARWIN_MODULE_FILETYPE_KEXT_BUNDLE, - GUM_DARWIN_MODULE_FILETYPE_FILESET, -}; + /* vfuncs */ -enum _GumDarwinCpuArchType -{ - GUM_DARWIN_CPU_ARCH_ABI64 = 0x01000000, - GUM_DARWIN_CPU_ARCH_ABI64_32 = 0x02000000, -}; + /** + * GApplicationClass::local_command_line: + * @application: a #GApplication + * @arguments: (inout) (array zero-terminated=1): array of command line arguments + * @exit_status: (out): exit status to fill after processing the command line. + * + * This virtual function is always invoked in the local instance. It + * gets passed a pointer to a %NULL-terminated copy of @argv and is + * expected to remove arguments that it handled (shifting up remaining + * arguments). + * + * The last argument to local_command_line() is a pointer to the @status + * variable which can used to set the exit status that is returned from + * g_application_run(). + * + * See g_application_run() for more details on #GApplication startup. + * + * Returns: %TRUE if the commandline has been completely handled + */ + gboolean (* local_command_line) (GApplication *application, + gchar ***arguments, + int *exit_status); + + void (* before_emit) (GApplication *application, + GVariant *platform_data); + void (* after_emit) (GApplication *application, + GVariant *platform_data); + void (* add_platform_data) (GApplication *application, + GVariantBuilder *builder); + void (* quit_mainloop) (GApplication *application); + void (* run_mainloop) (GApplication *application); + void (* shutdown) (GApplication *application); + + gboolean (* dbus_register) (GApplication *application, + GDBusConnection *connection, + const gchar *object_path, + GError **error); + void (* dbus_unregister) (GApplication *application, + GDBusConnection *connection, + const gchar *object_path); + gint (* handle_local_options)(GApplication *application, + GVariantDict *options); + gboolean (* name_lost) (GApplication *application); -enum _GumDarwinCpuType -{ - GUM_DARWIN_CPU_X86 = 7, - GUM_DARWIN_CPU_X86_64 = 7 | GUM_DARWIN_CPU_ARCH_ABI64, - GUM_DARWIN_CPU_ARM = 12, - GUM_DARWIN_CPU_ARM64 = 12 | GUM_DARWIN_CPU_ARCH_ABI64, - GUM_DARWIN_CPU_ARM64_32 = 12 | GUM_DARWIN_CPU_ARCH_ABI64_32, + /*< private >*/ + gpointer padding[7]; }; -enum _GumDarwinCpuSubtype -{ - GUM_DARWIN_CPU_SUBTYPE_ARM64E = 2, - - GUM_DARWIN_CPU_SUBTYPE_MASK = 0x00ffffff, -}; +GIO_AVAILABLE_IN_ALL +GType g_application_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_application_id_is_valid (const gchar *application_id); + +GIO_AVAILABLE_IN_ALL +GApplication * g_application_new (const gchar *application_id, + GApplicationFlags flags); + +GIO_AVAILABLE_IN_ALL +const gchar * g_application_get_application_id (GApplication *application); +GIO_AVAILABLE_IN_ALL +void g_application_set_application_id (GApplication *application, + const gchar *application_id); + +GIO_AVAILABLE_IN_2_34 +GDBusConnection * g_application_get_dbus_connection (GApplication *application); +GIO_AVAILABLE_IN_2_34 +const gchar * g_application_get_dbus_object_path (GApplication *application); + +GIO_AVAILABLE_IN_ALL +guint g_application_get_inactivity_timeout (GApplication *application); +GIO_AVAILABLE_IN_ALL +void g_application_set_inactivity_timeout (GApplication *application, + guint inactivity_timeout); + +GIO_AVAILABLE_IN_ALL +GApplicationFlags g_application_get_flags (GApplication *application); +GIO_AVAILABLE_IN_ALL +void g_application_set_flags (GApplication *application, + GApplicationFlags flags); + +GIO_AVAILABLE_IN_2_42 +const gchar * g_application_get_resource_base_path (GApplication *application); +GIO_AVAILABLE_IN_2_42 +void g_application_set_resource_base_path (GApplication *application, + const gchar *resource_path); + +GIO_DEPRECATED +void g_application_set_action_group (GApplication *application, + GActionGroup *action_group); + +GIO_AVAILABLE_IN_2_40 +void g_application_add_main_option_entries (GApplication *application, + const GOptionEntry *entries); + +GIO_AVAILABLE_IN_2_42 +void g_application_add_main_option (GApplication *application, + const char *long_name, + char short_name, + GOptionFlags flags, + GOptionArg arg, + const char *description, + const char *arg_description); +GIO_AVAILABLE_IN_2_40 +void g_application_add_option_group (GApplication *application, + GOptionGroup *group); +GIO_AVAILABLE_IN_2_56 +void g_application_set_option_context_parameter_string (GApplication *application, + const gchar *parameter_string); +GIO_AVAILABLE_IN_2_56 +void g_application_set_option_context_summary (GApplication *application, + const gchar *summary); +GIO_AVAILABLE_IN_2_56 +void g_application_set_option_context_description (GApplication *application, + const gchar *description); +GIO_AVAILABLE_IN_ALL +gboolean g_application_get_is_registered (GApplication *application); +GIO_AVAILABLE_IN_ALL +gboolean g_application_get_is_remote (GApplication *application); + +GIO_AVAILABLE_IN_ALL +gboolean g_application_register (GApplication *application, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_application_hold (GApplication *application); +GIO_AVAILABLE_IN_ALL +void g_application_release (GApplication *application); + +GIO_AVAILABLE_IN_ALL +void g_application_activate (GApplication *application); + +GIO_AVAILABLE_IN_ALL +void g_application_open (GApplication *application, + GFile **files, + gint n_files, + const gchar *hint); + +GIO_AVAILABLE_IN_ALL +int g_application_run (GApplication *application, + int argc, + char **argv); + +GIO_AVAILABLE_IN_2_32 +void g_application_quit (GApplication *application); + +GIO_AVAILABLE_IN_2_32 +GApplication * g_application_get_default (void); +GIO_AVAILABLE_IN_2_32 +void g_application_set_default (GApplication *application); + +GIO_AVAILABLE_IN_2_38 +void g_application_mark_busy (GApplication *application); +GIO_AVAILABLE_IN_2_38 +void g_application_unmark_busy (GApplication *application); +GIO_AVAILABLE_IN_2_44 +gboolean g_application_get_is_busy (GApplication *application); + +GIO_AVAILABLE_IN_2_40 +void g_application_send_notification (GApplication *application, + const gchar *id, + GNotification *notification); +GIO_AVAILABLE_IN_2_40 +void g_application_withdraw_notification (GApplication *application, + const gchar *id); + +GIO_AVAILABLE_IN_2_44 +void g_application_bind_busy_property (GApplication *application, + gpointer object, + const gchar *property); + +GIO_AVAILABLE_IN_2_44 +void g_application_unbind_busy_property (GApplication *application, + gpointer object, + const gchar *property); -struct _GumDarwinModuleImage -{ - gpointer data; - guint64 size; - gconstpointer linkedit; +G_END_DECLS - guint64 source_offset; - guint64 source_size; - guint64 shared_offset; - guint64 shared_size; - GArray * shared_segments; +#endif /* __G_APPLICATION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ - GBytes * bytes; - gpointer malloc_data; -}; +#ifndef __G_APPLICATION_COMMAND_LINE_H__ +#define __G_APPLICATION_COMMAND_LINE_H__ -struct _GumDarwinModuleImageSegment -{ - guint64 offset; - guint64 size; - GumDarwinPageProtection protection; -}; +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -struct _GumDarwinSectionDetails -{ - gchar segment_name[17]; - gchar section_name[17]; - GumAddress vm_address; - guint64 size; - GumDarwinPageProtection protection; - guint32 file_offset; - guint32 flags; -}; -struct _GumDarwinChainedFixupsDetails -{ - GumAddress vm_address; - guint64 file_offset; - guint32 size; -}; +G_BEGIN_DECLS -struct _GumDarwinRebaseDetails +#define G_TYPE_APPLICATION_COMMAND_LINE (g_application_command_line_get_type ()) +#define G_APPLICATION_COMMAND_LINE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_APPLICATION_COMMAND_LINE, \ + GApplicationCommandLine)) +#define G_APPLICATION_COMMAND_LINE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_APPLICATION_COMMAND_LINE, \ + GApplicationCommandLineClass)) +#define G_IS_APPLICATION_COMMAND_LINE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_APPLICATION_COMMAND_LINE)) +#define G_IS_APPLICATION_COMMAND_LINE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_APPLICATION_COMMAND_LINE)) +#define G_APPLICATION_COMMAND_LINE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_APPLICATION_COMMAND_LINE, \ + GApplicationCommandLineClass)) + +typedef struct _GApplicationCommandLinePrivate GApplicationCommandLinePrivate; +typedef struct _GApplicationCommandLineClass GApplicationCommandLineClass; + +struct _GApplicationCommandLine { - const GumDarwinSegment * segment; - guint64 offset; - GumDarwinRebaseType type; - GumAddress slide; -}; + /*< private >*/ + GObject parent_instance; -struct _GumDarwinBindDetails -{ - const GumDarwinSegment * segment; - guint64 offset; - GumDarwinBindType type; - GumDarwinBindOrdinal library_ordinal; - const gchar * symbol_name; - GumDarwinBindSymbolFlags symbol_flags; - gint64 addend; - guint16 threaded_table_size; + GApplicationCommandLinePrivate *priv; }; -struct _GumDarwinThreadedItem +struct _GApplicationCommandLineClass { - gboolean is_authenticated; - GumDarwinThreadedItemType type; - guint16 delta; - guint8 key; - gboolean has_address_diversity; - guint16 diversity; + /*< private >*/ + GObjectClass parent_class; - guint16 bind_ordinal; + void (* print_literal) (GApplicationCommandLine *cmdline, + const gchar *message); + void (* printerr_literal) (GApplicationCommandLine *cmdline, + const gchar *message); + GInputStream * (* get_stdin) (GApplicationCommandLine *cmdline); - GumAddress rebase_address; + gpointer padding[11]; }; -struct _GumDarwinTlvParameters -{ - guint num_descriptors; - guint descriptors_offset; - guint data_offset; - gsize data_size; - gsize bss_size; -}; +GIO_AVAILABLE_IN_ALL +GType g_application_command_line_get_type (void) G_GNUC_CONST; -struct _GumDarwinTlvDescriptorDetails -{ - guint64 file_offset; - GumAddress thunk; - guint64 key; - gsize offset; -}; +GIO_AVAILABLE_IN_ALL +gchar ** g_application_command_line_get_arguments (GApplicationCommandLine *cmdline, + int *argc); -struct _GumDarwinInitPointersDetails -{ - GumAddress address; - guint64 count; -}; +GIO_AVAILABLE_IN_2_40 +GVariantDict * g_application_command_line_get_options_dict (GApplicationCommandLine *cmdline); -struct _GumDarwinInitOffsetsDetails -{ - GumAddress address; - guint64 count; -}; +GIO_AVAILABLE_IN_2_36 +GInputStream * g_application_command_line_get_stdin (GApplicationCommandLine *cmdline); -struct _GumDarwinTermPointersDetails -{ - GumAddress address; - guint64 count; -}; +GIO_AVAILABLE_IN_ALL +const gchar * const * g_application_command_line_get_environ (GApplicationCommandLine *cmdline); -struct _GumDarwinFunctionStartsDetails -{ - GumAddress vm_address; - guint64 file_offset; - guint32 size; -}; +GIO_AVAILABLE_IN_ALL +const gchar * g_application_command_line_getenv (GApplicationCommandLine *cmdline, + const gchar *name); -struct _GumDarwinSegment -{ - gchar name[17]; - GumAddress vm_address; - guint64 vm_size; - guint64 file_offset; - guint64 file_size; - GumDarwinPageProtection protection; -}; +GIO_AVAILABLE_IN_ALL +const gchar * g_application_command_line_get_cwd (GApplicationCommandLine *cmdline); -struct _GumDarwinExportDetails -{ - const gchar * name; - guint64 flags; +GIO_AVAILABLE_IN_ALL +gboolean g_application_command_line_get_is_remote (GApplicationCommandLine *cmdline); - union - { - struct - { - guint64 offset; - }; +GIO_AVAILABLE_IN_ALL +void g_application_command_line_print (GApplicationCommandLine *cmdline, + const gchar *format, + ...) G_GNUC_PRINTF(2, 3); +GIO_AVAILABLE_IN_ALL +void g_application_command_line_printerr (GApplicationCommandLine *cmdline, + const gchar *format, + ...) G_GNUC_PRINTF(2, 3); - struct - { - guint64 stub; - guint64 resolver; - }; +GIO_AVAILABLE_IN_ALL +int g_application_command_line_get_exit_status (GApplicationCommandLine *cmdline); +GIO_AVAILABLE_IN_ALL +void g_application_command_line_set_exit_status (GApplicationCommandLine *cmdline, + int exit_status); - struct - { - gint reexport_library_ordinal; - const gchar * reexport_symbol; - }; - }; -}; +GIO_AVAILABLE_IN_ALL +GVariant * g_application_command_line_get_platform_data (GApplicationCommandLine *cmdline); -struct _GumDarwinSymbolDetails -{ - const gchar * name; - GumAddress address; +GIO_AVAILABLE_IN_2_36 +GFile * g_application_command_line_create_file_for_arg (GApplicationCommandLine *cmdline, + const gchar *arg); - /* These map 1:1 to their struct nlist / nlist_64 equivalents. */ - guint8 type; - guint8 section; - guint16 description; -}; +G_END_DECLS -enum _GumDarwinRebaseType -{ - GUM_DARWIN_REBASE_POINTER = 1, - GUM_DARWIN_REBASE_TEXT_ABSOLUTE32, - GUM_DARWIN_REBASE_TEXT_PCREL32, -}; +#endif /* __G_APPLICATION_COMMAND_LINE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ -enum _GumDarwinBindType -{ - GUM_DARWIN_BIND_POINTER = 1, - GUM_DARWIN_BIND_TEXT_ABSOLUTE32, - GUM_DARWIN_BIND_TEXT_PCREL32, - GUM_DARWIN_BIND_THREADED_TABLE, - GUM_DARWIN_BIND_THREADED_ITEMS, -}; +#ifndef __G_ASYNC_INITABLE_H__ +#define __G_ASYNC_INITABLE_H__ -enum _GumDarwinThreadedItemType -{ - GUM_DARWIN_THREADED_REBASE, - GUM_DARWIN_THREADED_BIND -}; +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -enum _GumDarwinBindOrdinal -{ - GUM_DARWIN_BIND_SELF = 0, - GUM_DARWIN_BIND_MAIN_EXECUTABLE = -1, - GUM_DARWIN_BIND_FLAT_LOOKUP = -2, - GUM_DARWIN_BIND_WEAK_LOOKUP = -3, -}; +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ -enum _GumDarwinBindSymbolFlags -{ - GUM_DARWIN_BIND_WEAK_IMPORT = 0x1, - GUM_DARWIN_BIND_NON_WEAK_DEFINITION = 0x8, -}; +#ifndef __G_INITABLE_H__ +#define __G_INITABLE_H__ -enum _GumDarwinExportSymbolKind +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_INITABLE (g_initable_get_type ()) +#define G_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_INITABLE, GInitable)) +#define G_IS_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_INITABLE)) +#define G_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_INITABLE, GInitableIface)) +#define G_TYPE_IS_INITABLE(type) (g_type_is_a ((type), G_TYPE_INITABLE)) + +/** + * GInitable: + * + * Interface for initializable objects. + * + * Since: 2.22 + **/ +typedef struct _GInitableIface GInitableIface; + +/** + * GInitableIface: + * @g_iface: The parent interface. + * @init: Initializes the object. + * + * Provides an interface for initializing object such that initialization + * may fail. + * + * Since: 2.22 + **/ +struct _GInitableIface { - GUM_DARWIN_EXPORT_REGULAR, - GUM_DARWIN_EXPORT_THREAD_LOCAL, - GUM_DARWIN_EXPORT_ABSOLUTE + GTypeInterface g_iface; + + /* Virtual Table */ + + gboolean (* init) (GInitable *initable, + GCancellable *cancellable, + GError **error); }; -enum _GumDarwinExportSymbolFlags + +GIO_AVAILABLE_IN_ALL +GType g_initable_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_initable_init (GInitable *initable, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +gpointer g_initable_new (GType object_type, + GCancellable *cancellable, + GError **error, + const gchar *first_property_name, + ...); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +GIO_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_initable_init) +gpointer g_initable_newv (GType object_type, + guint n_parameters, + GParameter *parameters, + GCancellable *cancellable, + GError **error); + +G_GNUC_END_IGNORE_DEPRECATIONS + +GIO_AVAILABLE_IN_ALL +GObject* g_initable_new_valist (GType object_type, + const gchar *first_property_name, + va_list var_args, + GCancellable *cancellable, + GError **error); + +G_END_DECLS + + +#endif /* __G_INITABLE_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_ASYNC_INITABLE (g_async_initable_get_type ()) +#define G_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitable)) +#define G_IS_ASYNC_INITABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_INITABLE)) +#define G_ASYNC_INITABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_INITABLE, GAsyncInitableIface)) +#define G_TYPE_IS_ASYNC_INITABLE(type) (g_type_is_a ((type), G_TYPE_ASYNC_INITABLE)) + +/** + * GAsyncInitable: + * + * Interface for asynchronously initializable objects. + * + * Since: 2.22 + **/ +typedef struct _GAsyncInitableIface GAsyncInitableIface; + +/** + * GAsyncInitableIface: + * @g_iface: The parent interface. + * @init_async: Starts initialization of the object. + * @init_finish: Finishes initialization of the object. + * + * Provides an interface for asynchronous initializing object such that + * initialization may fail. + * + * Since: 2.22 + **/ +struct _GAsyncInitableIface { - GUM_DARWIN_EXPORT_WEAK_DEFINITION = 0x04, - GUM_DARWIN_EXPORT_REEXPORT = 0x08, - GUM_DARWIN_EXPORT_STUB_AND_RESOLVER = 0x10, + GTypeInterface g_iface; + + /* Virtual Table */ + + void (* init_async) (GAsyncInitable *initable, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* init_finish) (GAsyncInitable *initable, + GAsyncResult *res, + GError **error); }; -#ifdef _MSC_VER -# pragma warning (push) -# pragma warning (disable: 4214) +GIO_AVAILABLE_IN_ALL +GType g_async_initable_get_type (void) G_GNUC_CONST; + + +GIO_AVAILABLE_IN_ALL +void g_async_initable_init_async (GAsyncInitable *initable, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_async_initable_init_finish (GAsyncInitable *initable, + GAsyncResult *res, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_async_initable_new_async (GType object_type, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data, + const gchar *first_property_name, + ...); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + +GIO_DEPRECATED_IN_2_54_FOR(g_object_new_with_properties and g_async_initable_init_async) +void g_async_initable_newv_async (GType object_type, + guint n_parameters, + GParameter *parameters, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +G_GNUC_END_IGNORE_DEPRECATIONS + +GIO_AVAILABLE_IN_ALL +void g_async_initable_new_valist_async (GType object_type, + const gchar *first_property_name, + va_list var_args, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GObject *g_async_initable_new_finish (GAsyncInitable *initable, + GAsyncResult *res, + GError **error); + + + +G_END_DECLS + + +#endif /* __G_ASYNC_INITABLE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_ASYNC_RESULT_H__ +#define __G_ASYNC_RESULT_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif -struct _GumChainedFixupsHeader -{ - guint32 fixups_version; - guint32 starts_offset; - guint32 imports_offset; - guint32 symbols_offset; - guint32 imports_count; - GumChainedImportFormat imports_format; - GumChainedSymbolFormat symbols_format; -}; -enum _GumChainedImportFormat -{ - GUM_CHAINED_IMPORT = 1, - GUM_CHAINED_IMPORT_ADDEND = 2, - GUM_CHAINED_IMPORT_ADDEND64 = 3, -}; +G_BEGIN_DECLS -struct _GumChainedImport -{ - guint32 lib_ordinal : 8, - weak_import : 1, - name_offset : 23; -}; +#define G_TYPE_ASYNC_RESULT (g_async_result_get_type ()) +#define G_ASYNC_RESULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ASYNC_RESULT, GAsyncResult)) +#define G_IS_ASYNC_RESULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ASYNC_RESULT)) +#define G_ASYNC_RESULT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ASYNC_RESULT, GAsyncResultIface)) -struct _GumChainedImportAddend -{ - guint32 lib_ordinal : 8, - weak_import : 1, - name_offset : 23; - gint32 addend; -}; +/** + * GAsyncResult: + * + * Holds results information for an asynchronous operation, + * usually passed directly to an asynchronous _finish() operation. + **/ +typedef struct _GAsyncResultIface GAsyncResultIface; -struct _GumChainedImportAddend64 -{ - guint64 lib_ordinal : 16, - weak_import : 1, - reserved : 15, - name_offset : 32; - guint64 addend; -}; -struct _GumChainedStartsInImage +/** + * GAsyncResultIface: + * @g_iface: The parent interface. + * @get_user_data: Gets the user data passed to the callback. + * @get_source_object: Gets the source object that issued the asynchronous operation. + * @is_tagged: Checks if a result is tagged with a particular source. + * + * Interface definition for #GAsyncResult. + **/ +struct _GAsyncResultIface { - guint32 seg_count; - guint32 seg_info_offset[1]; -}; + GTypeInterface g_iface; -struct _GumChainedStartsInSegment -{ - guint32 size; - guint16 page_size; - GumChainedPtrFormat pointer_format; - guint64 segment_offset; - guint32 max_valid_pointer; - guint16 page_count; - guint16 page_start[1]; -}; + /* Virtual Table */ -enum _GumChainedPtrStart -{ - GUM_CHAINED_PTR_START_NONE = 0xffff, - GUM_CHAINED_PTR_START_MULTI = 0x8000, - GUM_CHAINED_PTR_START_LAST = 0x8000, -}; + gpointer (* get_user_data) (GAsyncResult *res); + GObject * (* get_source_object) (GAsyncResult *res); -enum _GumChainedPtrFormat -{ - GUM_CHAINED_PTR_ARM64E = 1, - GUM_CHAINED_PTR_64 = 2, - GUM_CHAINED_PTR_32 = 3, - GUM_CHAINED_PTR_32_CACHE = 4, - GUM_CHAINED_PTR_32_FIRMWARE = 5, - GUM_CHAINED_PTR_64_OFFSET = 6, - GUM_CHAINED_PTR_ARM64E_OFFSET = 7, - GUM_CHAINED_PTR_ARM64E_KERNEL = 7, - GUM_CHAINED_PTR_64_KERNEL_CACHE = 8, - GUM_CHAINED_PTR_ARM64E_USERLAND = 9, - GUM_CHAINED_PTR_ARM64E_FIRMWARE = 10, - GUM_CHAINED_PTR_X86_64_KERNEL_CACHE = 11, - GUM_CHAINED_PTR_ARM64E_USERLAND24 = 12, + gboolean (* is_tagged) (GAsyncResult *res, + gpointer source_tag); }; -struct _GumChainedPtr64Rebase -{ - guint64 target : 36, - high8 : 8, - reserved : 7, - next : 12, - bind : 1; -}; +GIO_AVAILABLE_IN_ALL +GType g_async_result_get_type (void) G_GNUC_CONST; -struct _GumChainedPtr64Bind -{ - guint64 ordinal : 24, - addend : 8, - reserved : 19, - next : 12, - bind : 1; -}; +GIO_AVAILABLE_IN_ALL +gpointer g_async_result_get_user_data (GAsyncResult *res); +GIO_AVAILABLE_IN_ALL +GObject *g_async_result_get_source_object (GAsyncResult *res); -struct _GumChainedPtrArm64eRebase -{ - guint64 target : 43, - high8 : 8, - next : 11, - bind : 1, - auth : 1; -}; +GIO_AVAILABLE_IN_2_34 +gboolean g_async_result_legacy_propagate_error (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_2_34 +gboolean g_async_result_is_tagged (GAsyncResult *res, + gpointer source_tag); -struct _GumChainedPtrArm64eBind -{ - guint64 ordinal : 16, - zero : 16, - addend : 19, - next : 11, - bind : 1, - auth : 1; -}; +G_END_DECLS -struct _GumChainedPtrArm64eBind24 +#endif /* __G_ASYNC_RESULT_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Christian Kellner + */ + +#ifndef __G_BUFFERED_INPUT_STREAM_H__ +#define __G_BUFFERED_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Christian Kellner + */ + +#ifndef __G_FILTER_INPUT_STREAM_H__ +#define __G_FILTER_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_INPUT_STREAM_H__ +#define __G_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_INPUT_STREAM (g_input_stream_get_type ()) +#define G_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INPUT_STREAM, GInputStream)) +#define G_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INPUT_STREAM, GInputStreamClass)) +#define G_IS_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INPUT_STREAM)) +#define G_IS_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INPUT_STREAM)) +#define G_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INPUT_STREAM, GInputStreamClass)) + +/** + * GInputStream: + * + * Base class for streaming input operations. + **/ +typedef struct _GInputStreamClass GInputStreamClass; +typedef struct _GInputStreamPrivate GInputStreamPrivate; + +struct _GInputStream { - guint64 ordinal : 24, - zero : 8, - addend : 19, - next : 11, - bind : 1, - auth : 1; + GObject parent_instance; + + /*< private >*/ + GInputStreamPrivate *priv; }; -struct _GumChainedPtrArm64eAuthRebase +struct _GInputStreamClass { - guint64 target : 32, - diversity : 16, - addr_div : 1, - key : 2, - next : 11, - bind : 1, - auth : 1; + GObjectClass parent_class; + + /* Sync ops: */ + + gssize (* read_fn) (GInputStream *stream, + void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); + gssize (* skip) (GInputStream *stream, + gsize count, + GCancellable *cancellable, + GError **error); + gboolean (* close_fn) (GInputStream *stream, + GCancellable *cancellable, + GError **error); + + /* Async ops: (optional in derived classes) */ + void (* read_async) (GInputStream *stream, + void *buffer, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gssize (* read_finish) (GInputStream *stream, + GAsyncResult *result, + GError **error); + void (* skip_async) (GInputStream *stream, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gssize (* skip_finish) (GInputStream *stream, + GAsyncResult *result, + GError **error); + void (* close_async) (GInputStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* close_finish) (GInputStream *stream, + GAsyncResult *result, + GError **error); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); }; -struct _GumChainedPtrArm64eAuthBind +GIO_AVAILABLE_IN_ALL +GType g_input_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gssize g_input_stream_read (GInputStream *stream, + void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_input_stream_read_all (GInputStream *stream, + void *buffer, + gsize count, + gsize *bytes_read, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_34 +GBytes *g_input_stream_read_bytes (GInputStream *stream, + gsize count, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_input_stream_skip (GInputStream *stream, + gsize count, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_input_stream_close (GInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_input_stream_read_async (GInputStream *stream, + void *buffer, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gssize g_input_stream_read_finish (GInputStream *stream, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_44 +void g_input_stream_read_all_async (GInputStream *stream, + void *buffer, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_44 +gboolean g_input_stream_read_all_finish (GInputStream *stream, + GAsyncResult *result, + gsize *bytes_read, + GError **error); + +GIO_AVAILABLE_IN_2_34 +void g_input_stream_read_bytes_async (GInputStream *stream, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_34 +GBytes *g_input_stream_read_bytes_finish (GInputStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_input_stream_skip_async (GInputStream *stream, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gssize g_input_stream_skip_finish (GInputStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_input_stream_close_async (GInputStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_input_stream_close_finish (GInputStream *stream, + GAsyncResult *result, + GError **error); + +/* For implementations: */ + +GIO_AVAILABLE_IN_ALL +gboolean g_input_stream_is_closed (GInputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_input_stream_has_pending (GInputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_input_stream_set_pending (GInputStream *stream, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_input_stream_clear_pending (GInputStream *stream); + +G_END_DECLS + +#endif /* __G_INPUT_STREAM_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_FILTER_INPUT_STREAM (g_filter_input_stream_get_type ()) +#define G_FILTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILTER_INPUT_STREAM, GFilterInputStream)) +#define G_FILTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILTER_INPUT_STREAM, GFilterInputStreamClass)) +#define G_IS_FILTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILTER_INPUT_STREAM)) +#define G_IS_FILTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILTER_INPUT_STREAM)) +#define G_FILTER_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILTER_INPUT_STREAM, GFilterInputStreamClass)) + +/** + * GFilterInputStream: + * + * A base class for all input streams that work on an underlying stream. + **/ +typedef struct _GFilterInputStreamClass GFilterInputStreamClass; + +struct _GFilterInputStream { - guint64 ordinal : 16, - zero : 16, - diversity : 16, - addr_div : 1, - key : 2, - next : 11, - bind : 1, - auth : 1; + GInputStream parent_instance; + + /**/ + GInputStream *base_stream; }; -struct _GumChainedPtrArm64eAuthBind24 +struct _GFilterInputStreamClass { - guint64 ordinal : 24, - zero : 8, - diversity : 16, - addr_div : 1, - key : 2, - next : 11, - bind : 1, - auth : 1; -}; + GInputStreamClass parent_class; -#ifdef _MSC_VER -# pragma warning (pop) -#endif + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); +}; -GUM_API GumDarwinModule * gum_darwin_module_new_from_file (const gchar * path, - GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, - GumDarwinModuleFlags flags, GError ** error); -GUM_API GumDarwinModule * gum_darwin_module_new_from_blob (GBytes * blob, - GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, - GumDarwinModuleFlags flags, GError ** error); -GUM_API GumDarwinModule * gum_darwin_module_new_from_memory (const gchar * name, - GumDarwinPort task, GumAddress base_address, GumDarwinModuleFlags flags, - GError ** error); -GUM_API gboolean gum_darwin_module_load (GumDarwinModule * self, - GError ** error); +GIO_AVAILABLE_IN_ALL +GType g_filter_input_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GInputStream * g_filter_input_stream_get_base_stream (GFilterInputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_filter_input_stream_get_close_base_stream (GFilterInputStream *stream); +GIO_AVAILABLE_IN_ALL +void g_filter_input_stream_set_close_base_stream (GFilterInputStream *stream, + gboolean close_base); -GUM_API gboolean gum_darwin_module_resolve_export (GumDarwinModule * self, - const gchar * symbol, GumDarwinExportDetails * details); -GUM_API GumAddress gum_darwin_module_resolve_symbol_address ( - GumDarwinModule * self, const gchar * symbol); -GUM_API gboolean gum_darwin_module_get_lacks_exports_for_reexports ( - GumDarwinModule * self); -GUM_API void gum_darwin_module_enumerate_imports (GumDarwinModule * self, - GumFoundImportFunc func, GumResolveExportFunc resolver, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_exports (GumDarwinModule * self, - GumFoundDarwinExportFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_symbols (GumDarwinModule * self, - GumFoundDarwinSymbolFunc func, gpointer user_data); -GUM_API GumAddress gum_darwin_module_get_slide (GumDarwinModule * self); -GUM_API const GumDarwinSegment * gum_darwin_module_get_nth_segment ( - GumDarwinModule * self, gsize index); -GUM_API void gum_darwin_module_enumerate_sections (GumDarwinModule * self, - GumFoundDarwinSectionFunc func, gpointer user_data); -GUM_API gboolean gum_darwin_module_is_address_in_text_section ( - GumDarwinModule * self, GumAddress address); -GUM_API void gum_darwin_module_enumerate_chained_fixups (GumDarwinModule * self, - GumFoundDarwinChainedFixupsFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_rebases (GumDarwinModule * self, - GumFoundDarwinRebaseFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_binds (GumDarwinModule * self, - GumFoundDarwinBindFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_lazy_binds (GumDarwinModule * self, - GumFoundDarwinBindFunc func, gpointer user_data); -GUM_API void gum_darwin_module_query_tlv_parameters (GumDarwinModule * self, - GumDarwinTlvParameters * params); -GUM_API void gum_darwin_module_enumerate_tlv_descriptors ( - GumDarwinModule * self, GumFoundDarwinTlvDescriptorFunc func, - gpointer user_data); -GUM_API void gum_darwin_module_enumerate_init_pointers (GumDarwinModule * self, - GumFoundDarwinInitPointersFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_init_offsets (GumDarwinModule * self, - GumFoundDarwinInitOffsetsFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_term_pointers (GumDarwinModule * self, - GumFoundDarwinTermPointersFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_dependencies (GumDarwinModule * self, - GumFoundDependencyFunc func, gpointer user_data); -GUM_API void gum_darwin_module_enumerate_function_starts ( - GumDarwinModule * self, GumFoundDarwinFunctionStartsFunc func, - gpointer user_data); -GUM_API const gchar * gum_darwin_module_get_dependency_by_ordinal ( - GumDarwinModule * self, gint ordinal); -GUM_API gboolean gum_darwin_module_ensure_image_loaded (GumDarwinModule * self, - GError ** error); +G_END_DECLS -GUM_API void gum_darwin_threaded_item_parse (guint64 value, - GumDarwinThreadedItem * result); +#endif /* __G_FILTER_INPUT_STREAM_H__ */ -#ifndef GUM_DIET -GUM_API GType gum_darwin_module_image_get_type (void) G_GNUC_CONST; -#endif -GUM_API GumDarwinModuleImage * gum_darwin_module_image_new (void); -GUM_API GumDarwinModuleImage * gum_darwin_module_image_dup ( - const GumDarwinModuleImage * other); -GUM_API void gum_darwin_module_image_free (GumDarwinModuleImage * image); +G_BEGIN_DECLS -G_END_DECLS +#define G_TYPE_BUFFERED_INPUT_STREAM (g_buffered_input_stream_get_type ()) +#define G_BUFFERED_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStream)) +#define G_BUFFERED_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStreamClass)) +#define G_IS_BUFFERED_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_BUFFERED_INPUT_STREAM)) +#define G_IS_BUFFERED_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_BUFFERED_INPUT_STREAM)) +#define G_BUFFERED_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_BUFFERED_INPUT_STREAM, GBufferedInputStreamClass)) -#endif -/* - * Copyright (C) 2010-2023 Ole André Vadla Ravnås +/** + * GBufferedInputStream: * - * Licence: wxWindows Library Licence, Version 3.1 - */ + * Implements #GFilterInputStream with a sized input buffer. + **/ +typedef struct _GBufferedInputStreamClass GBufferedInputStreamClass; +typedef struct _GBufferedInputStreamPrivate GBufferedInputStreamPrivate; -#ifndef __GUM_ELF_MODULE_H__ -#define __GUM_ELF_MODULE_H__ +struct _GBufferedInputStream +{ + GFilterInputStream parent_instance; + /*< private >*/ + GBufferedInputStreamPrivate *priv; +}; -G_BEGIN_DECLS +struct _GBufferedInputStreamClass +{ + GFilterInputStreamClass parent_class; + + gssize (* fill) (GBufferedInputStream *stream, + gssize count, + GCancellable *cancellable, + GError **error); + + /* Async ops: (optional in derived classes) */ + void (* fill_async) (GBufferedInputStream *stream, + gssize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gssize (* fill_finish) (GBufferedInputStream *stream, + GAsyncResult *result, + GError **error); -#define GUM_ELF_TYPE_MODULE (gum_elf_module_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumElfModule, gum_elf_module, GUM_ELF, MODULE, GObject) + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; -typedef enum { - GUM_ELF_NONE, - GUM_ELF_REL, - GUM_ELF_EXEC, - GUM_ELF_DYN, - GUM_ELF_CORE, -} GumElfType; -typedef enum { - GUM_ELF_OS_SYSV, - GUM_ELF_OS_HPUX, - GUM_ELF_OS_NETBSD, - GUM_ELF_OS_LINUX, - GUM_ELF_OS_SOLARIS = 6, - GUM_ELF_OS_AIX, - GUM_ELF_OS_IRIX, - GUM_ELF_OS_FREEBSD, - GUM_ELF_OS_TRU64, - GUM_ELF_OS_MODESTO, - GUM_ELF_OS_OPENBSD, - GUM_ELF_OS_ARM_AEABI = 64, - GUM_ELF_OS_ARM = 97, - GUM_ELF_OS_STANDALONE = 255, -} GumElfOSABI; +GIO_AVAILABLE_IN_ALL +GType g_buffered_input_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GInputStream* g_buffered_input_stream_new (GInputStream *base_stream); +GIO_AVAILABLE_IN_ALL +GInputStream* g_buffered_input_stream_new_sized (GInputStream *base_stream, + gsize size); + +GIO_AVAILABLE_IN_ALL +gsize g_buffered_input_stream_get_buffer_size (GBufferedInputStream *stream); +GIO_AVAILABLE_IN_ALL +void g_buffered_input_stream_set_buffer_size (GBufferedInputStream *stream, + gsize size); +GIO_AVAILABLE_IN_ALL +gsize g_buffered_input_stream_get_available (GBufferedInputStream *stream); +GIO_AVAILABLE_IN_ALL +gsize g_buffered_input_stream_peek (GBufferedInputStream *stream, + void *buffer, + gsize offset, + gsize count); +GIO_AVAILABLE_IN_ALL +const void* g_buffered_input_stream_peek_buffer (GBufferedInputStream *stream, + gsize *count); + +GIO_AVAILABLE_IN_ALL +gssize g_buffered_input_stream_fill (GBufferedInputStream *stream, + gssize count, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_buffered_input_stream_fill_async (GBufferedInputStream *stream, + gssize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gssize g_buffered_input_stream_fill_finish (GBufferedInputStream *stream, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +int g_buffered_input_stream_read_byte (GBufferedInputStream *stream, + GCancellable *cancellable, + GError **error); -typedef enum { - GUM_ELF_MACHINE_NONE, - GUM_ELF_MACHINE_M32, - GUM_ELF_MACHINE_SPARC, - GUM_ELF_MACHINE_386, - GUM_ELF_MACHINE_68K, - GUM_ELF_MACHINE_88K, - GUM_ELF_MACHINE_IAMCU, - GUM_ELF_MACHINE_860, - GUM_ELF_MACHINE_MIPS, - GUM_ELF_MACHINE_S370, - GUM_ELF_MACHINE_MIPS_RS3_LE, +G_END_DECLS - GUM_ELF_MACHINE_PARISC = 15, +#endif /* __G_BUFFERED_INPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Christian Kellner + */ - GUM_ELF_MACHINE_VPP500 = 17, - GUM_ELF_MACHINE_SPARC32PLUS, - GUM_ELF_MACHINE_960, - GUM_ELF_MACHINE_PPC, - GUM_ELF_MACHINE_PPC64, - GUM_ELF_MACHINE_S390, - GUM_ELF_MACHINE_SPU, +#ifndef __G_BUFFERED_OUTPUT_STREAM_H__ +#define __G_BUFFERED_OUTPUT_STREAM_H__ - GUM_ELF_MACHINE_V800 = 36, - GUM_ELF_MACHINE_FR20, - GUM_ELF_MACHINE_RH32, - GUM_ELF_MACHINE_RCE, - GUM_ELF_MACHINE_ARM, - GUM_ELF_MACHINE_FAKE_ALPHA, - GUM_ELF_MACHINE_SH, - GUM_ELF_MACHINE_SPARCV9, - GUM_ELF_MACHINE_TRICORE, - GUM_ELF_MACHINE_ARC, - GUM_ELF_MACHINE_H8_300, - GUM_ELF_MACHINE_H8_300H, - GUM_ELF_MACHINE_H8S, - GUM_ELF_MACHINE_H8_500, - GUM_ELF_MACHINE_IA_64, - GUM_ELF_MACHINE_MIPS_X, - GUM_ELF_MACHINE_COLDFIRE, - GUM_ELF_MACHINE_68HC12, - GUM_ELF_MACHINE_MMA, - GUM_ELF_MACHINE_PCP, - GUM_ELF_MACHINE_NCPU, - GUM_ELF_MACHINE_NDR1, - GUM_ELF_MACHINE_STARCORE, - GUM_ELF_MACHINE_ME16, - GUM_ELF_MACHINE_ST100, - GUM_ELF_MACHINE_TINYJ, - GUM_ELF_MACHINE_X86_64, - GUM_ELF_MACHINE_PDSP, - GUM_ELF_MACHINE_PDP10, - GUM_ELF_MACHINE_PDP11, - GUM_ELF_MACHINE_FX66, - GUM_ELF_MACHINE_ST9PLUS, - GUM_ELF_MACHINE_ST7, - GUM_ELF_MACHINE_68HC16, - GUM_ELF_MACHINE_68HC11, - GUM_ELF_MACHINE_68HC08, - GUM_ELF_MACHINE_68HC05, - GUM_ELF_MACHINE_SVX, - GUM_ELF_MACHINE_ST19, - GUM_ELF_MACHINE_VAX, - GUM_ELF_MACHINE_CRIS, - GUM_ELF_MACHINE_JAVELIN, - GUM_ELF_MACHINE_FIREPATH, - GUM_ELF_MACHINE_ZSP, - GUM_ELF_MACHINE_MMIX, - GUM_ELF_MACHINE_HUANY, - GUM_ELF_MACHINE_PRISM, - GUM_ELF_MACHINE_AVR, - GUM_ELF_MACHINE_FR30, - GUM_ELF_MACHINE_D10V, - GUM_ELF_MACHINE_D30V, - GUM_ELF_MACHINE_V850, - GUM_ELF_MACHINE_M32R, - GUM_ELF_MACHINE_MN10300, - GUM_ELF_MACHINE_MN10200, - GUM_ELF_MACHINE_PJ, - GUM_ELF_MACHINE_OPENRISC, - GUM_ELF_MACHINE_ARC_COMPACT, - GUM_ELF_MACHINE_XTENSA, - GUM_ELF_MACHINE_VIDEOCORE, - GUM_ELF_MACHINE_TMM_GPP, - GUM_ELF_MACHINE_NS32K, - GUM_ELF_MACHINE_TPC, - GUM_ELF_MACHINE_SNP1K, - GUM_ELF_MACHINE_ST200, - GUM_ELF_MACHINE_IP2K, - GUM_ELF_MACHINE_MAX, - GUM_ELF_MACHINE_CR, - GUM_ELF_MACHINE_F2MC16, - GUM_ELF_MACHINE_MSP430, - GUM_ELF_MACHINE_BLACKFIN, - GUM_ELF_MACHINE_SE_C33, - GUM_ELF_MACHINE_SEP, - GUM_ELF_MACHINE_ARCA, - GUM_ELF_MACHINE_UNICORE, - GUM_ELF_MACHINE_EXCESS, - GUM_ELF_MACHINE_DXP, - GUM_ELF_MACHINE_ALTERA_NIOS2, - GUM_ELF_MACHINE_CRX, - GUM_ELF_MACHINE_XGATE, - GUM_ELF_MACHINE_C166, - GUM_ELF_MACHINE_M16C, - GUM_ELF_MACHINE_DSPIC30F, - GUM_ELF_MACHINE_CE, - GUM_ELF_MACHINE_M32C, +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif - GUM_ELF_MACHINE_TSK3000 = 131, - GUM_ELF_MACHINE_RS08, - GUM_ELF_MACHINE_SHARC, - GUM_ELF_MACHINE_ECOG2, - GUM_ELF_MACHINE_SCORE7, - GUM_ELF_MACHINE_DSP24, - GUM_ELF_MACHINE_VIDEOCORE3, - GUM_ELF_MACHINE_LATTICEMICO32, - GUM_ELF_MACHINE_SE_C17, - GUM_ELF_MACHINE_TI_C6000, - GUM_ELF_MACHINE_TI_C2000, - GUM_ELF_MACHINE_TI_C5500, - GUM_ELF_MACHINE_TI_ARP32, - GUM_ELF_MACHINE_TI_PRU, +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Christian Kellner + */ - GUM_ELF_MACHINE_MMDSP_PLUS = 160, - GUM_ELF_MACHINE_CYPRESS_M8C, - GUM_ELF_MACHINE_R32C, - GUM_ELF_MACHINE_TRIMEDIA, - GUM_ELF_MACHINE_QDSP6, - GUM_ELF_MACHINE_8051, - GUM_ELF_MACHINE_STXP7X, - GUM_ELF_MACHINE_NDS32, - GUM_ELF_MACHINE_ECOG1X, - GUM_ELF_MACHINE_MAXQ30, - GUM_ELF_MACHINE_XIMO16, - GUM_ELF_MACHINE_MANIK, - GUM_ELF_MACHINE_CRAYNV2, - GUM_ELF_MACHINE_RX, - GUM_ELF_MACHINE_METAG, - GUM_ELF_MACHINE_MCST_ELBRUS, - GUM_ELF_MACHINE_ECOG16, - GUM_ELF_MACHINE_CR16, - GUM_ELF_MACHINE_ETPU, - GUM_ELF_MACHINE_SLE9X, - GUM_ELF_MACHINE_L10M, - GUM_ELF_MACHINE_K10M, +#ifndef __G_FILTER_OUTPUT_STREAM_H__ +#define __G_FILTER_OUTPUT_STREAM_H__ - GUM_ELF_MACHINE_AARCH64 = 183, +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif - GUM_ELF_MACHINE_AVR32 = 185, - GUM_ELF_MACHINE_STM8, - GUM_ELF_MACHINE_TILE64, - GUM_ELF_MACHINE_TILEPRO, - GUM_ELF_MACHINE_MICROBLAZE, - GUM_ELF_MACHINE_CUDA, - GUM_ELF_MACHINE_TILEGX, - GUM_ELF_MACHINE_CLOUDSHIELD, - GUM_ELF_MACHINE_COREA_1ST, - GUM_ELF_MACHINE_COREA_2ND, - GUM_ELF_MACHINE_ARCV2, - GUM_ELF_MACHINE_OPEN8, - GUM_ELF_MACHINE_RL78, - GUM_ELF_MACHINE_VIDEOCORE5, - GUM_ELF_MACHINE_78KOR, - GUM_ELF_MACHINE_56800EX, - GUM_ELF_MACHINE_BA1, - GUM_ELF_MACHINE_BA2, - GUM_ELF_MACHINE_XCORE, - GUM_ELF_MACHINE_MCHP_PIC, +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ - GUM_ELF_MACHINE_KM32 = 210, - GUM_ELF_MACHINE_KMX32, - GUM_ELF_MACHINE_EMX16, - GUM_ELF_MACHINE_EMX8, - GUM_ELF_MACHINE_KVARC, - GUM_ELF_MACHINE_CDP, - GUM_ELF_MACHINE_COGE, - GUM_ELF_MACHINE_COOL, - GUM_ELF_MACHINE_NORC, - GUM_ELF_MACHINE_CSR_KALIMBA, - GUM_ELF_MACHINE_Z80, - GUM_ELF_MACHINE_VISIUM, - GUM_ELF_MACHINE_FT32, - GUM_ELF_MACHINE_MOXIE, - GUM_ELF_MACHINE_AMDGPU, +#ifndef __G_OUTPUT_STREAM_H__ +#define __G_OUTPUT_STREAM_H__ - GUM_ELF_MACHINE_RISCV = 243, +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif - GUM_ELF_MACHINE_BPF = 247, - GUM_ELF_MACHINE_CSKY = 252, +G_BEGIN_DECLS - GUM_ELF_MACHINE_ALPHA = 0x9026, -} GumElfMachine; +#define G_TYPE_OUTPUT_STREAM (g_output_stream_get_type ()) +#define G_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_OUTPUT_STREAM, GOutputStream)) +#define G_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_OUTPUT_STREAM, GOutputStreamClass)) +#define G_IS_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_OUTPUT_STREAM)) +#define G_IS_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_OUTPUT_STREAM)) +#define G_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_OUTPUT_STREAM, GOutputStreamClass)) -typedef enum { - GUM_ELF_SOURCE_MODE_OFFLINE, - GUM_ELF_SOURCE_MODE_ONLINE, -} GumElfSourceMode; +/** + * GOutputStream: + * + * Base class for writing output. + * + * All classes derived from GOutputStream should implement synchronous + * writing, splicing, flushing and closing streams, but may implement + * asynchronous versions. + **/ +typedef struct _GOutputStreamClass GOutputStreamClass; +typedef struct _GOutputStreamPrivate GOutputStreamPrivate; -typedef enum { - GUM_ELF_SECTION_NULL, - GUM_ELF_SECTION_PROGBITS, - GUM_ELF_SECTION_SYMTAB, - GUM_ELF_SECTION_STRTAB, - GUM_ELF_SECTION_RELA, - GUM_ELF_SECTION_HASH, - GUM_ELF_SECTION_DYNAMIC, - GUM_ELF_SECTION_NOTE, - GUM_ELF_SECTION_NOBITS, - GUM_ELF_SECTION_REL, - GUM_ELF_SECTION_SHLIB, - GUM_ELF_SECTION_DYNSYM, - GUM_ELF_SECTION_INIT_ARRAY = 14, - GUM_ELF_SECTION_FINI_ARRAY, - GUM_ELF_SECTION_PREINIT_ARRAY, - GUM_ELF_SECTION_GROUP, - GUM_ELF_SECTION_SYMTAB_SHNDX, - GUM_ELF_SECTION_RELR, - GUM_ELF_SECTION_NUM, - GUM_ELF_SECTION_GNU_ATTRIBUTES = 0x6ffffff5, - GUM_ELF_SECTION_GNU_HASH = 0x6ffffff6, - GUM_ELF_SECTION_GNU_LIBLIST = 0x6ffffff7, - GUM_ELF_SECTION_CHECKSUM = 0x6ffffff8, - GUM_ELF_SECTION_SUNW_MOVE = 0x6ffffffa, - GUM_ELF_SECTION_SUNW_COMDAT = 0x6ffffffb, - GUM_ELF_SECTION_SUNW_SYMINFO = 0x6ffffffc, - GUM_ELF_SECTION_GNU_VERDEF = 0x6ffffffd, - GUM_ELF_SECTION_GNU_VERNEED = 0x6ffffffe, - GUM_ELF_SECTION_GNU_VERSYM = 0x6fffffff, -} GumElfSectionType; +struct _GOutputStream +{ + GObject parent_instance; -typedef enum { - GUM_ELF_DYNAMIC_NULL, - GUM_ELF_DYNAMIC_NEEDED, - GUM_ELF_DYNAMIC_PLTRELSZ, - GUM_ELF_DYNAMIC_PLTGOT, - GUM_ELF_DYNAMIC_HASH, - GUM_ELF_DYNAMIC_STRTAB, - GUM_ELF_DYNAMIC_SYMTAB, - GUM_ELF_DYNAMIC_RELA, - GUM_ELF_DYNAMIC_RELASZ, - GUM_ELF_DYNAMIC_RELAENT, - GUM_ELF_DYNAMIC_STRSZ, - GUM_ELF_DYNAMIC_SYMENT, - GUM_ELF_DYNAMIC_INIT, - GUM_ELF_DYNAMIC_FINI, - GUM_ELF_DYNAMIC_SONAME, - GUM_ELF_DYNAMIC_RPATH, - GUM_ELF_DYNAMIC_SYMBOLIC, - GUM_ELF_DYNAMIC_REL, - GUM_ELF_DYNAMIC_RELSZ, - GUM_ELF_DYNAMIC_RELENT, - GUM_ELF_DYNAMIC_PLTREL, - GUM_ELF_DYNAMIC_DEBUG, - GUM_ELF_DYNAMIC_TEXTREL, - GUM_ELF_DYNAMIC_JMPREL, - GUM_ELF_DYNAMIC_BIND_NOW, - GUM_ELF_DYNAMIC_INIT_ARRAY, - GUM_ELF_DYNAMIC_FINI_ARRAY, - GUM_ELF_DYNAMIC_INIT_ARRAYSZ, - GUM_ELF_DYNAMIC_FINI_ARRAYSZ, - GUM_ELF_DYNAMIC_RUNPATH, - GUM_ELF_DYNAMIC_FLAGS, - GUM_ELF_DYNAMIC_ENCODING = 32, - GUM_ELF_DYNAMIC_PREINIT_ARRAY = 32, - GUM_ELF_DYNAMIC_PREINIT_ARRAYSZ, - GUM_ELF_DYNAMIC_MAXPOSTAGS, + /*< private >*/ + GOutputStreamPrivate *priv; +}; - GUM_ELF_DYNAMIC_LOOS = 0x6000000d, - GUM_ELF_DYNAMIC_SUNW_AUXILIARY = 0x6000000d, - GUM_ELF_DYNAMIC_SUNW_RTLDINF = 0x6000000e, - GUM_ELF_DYNAMIC_SUNW_FILTER = 0x6000000f, - GUM_ELF_DYNAMIC_SUNW_CAP = 0x60000010, - GUM_ELF_DYNAMIC_SUNW_ASLR = 0x60000023, - GUM_ELF_DYNAMIC_HIOS = 0x6ffff000, - GUM_ELF_DYNAMIC_VALRNGLO = 0x6ffffd00, - GUM_ELF_DYNAMIC_GNU_PRELINKED = 0x6ffffdf5, - GUM_ELF_DYNAMIC_GNU_CONFLICTSZ = 0x6ffffdf6, - GUM_ELF_DYNAMIC_GNU_LIBLISTSZ = 0x6ffffdf7, - GUM_ELF_DYNAMIC_CHECKSUM = 0x6ffffdf8, - GUM_ELF_DYNAMIC_PLTPADSZ = 0x6ffffdf9, - GUM_ELF_DYNAMIC_MOVEENT = 0x6ffffdfa, - GUM_ELF_DYNAMIC_MOVESZ = 0x6ffffdfb, - GUM_ELF_DYNAMIC_FEATURE = 0x6ffffdfc, - GUM_ELF_DYNAMIC_FEATURE_1 = 0x6ffffdfc, - GUM_ELF_DYNAMIC_POSFLAG_1 = 0x6ffffdfd, +struct _GOutputStreamClass +{ + GObjectClass parent_class; - GUM_ELF_DYNAMIC_SYMINSZ = 0x6ffffdfe, - GUM_ELF_DYNAMIC_SYMINENT = 0x6ffffdff, - GUM_ELF_DYNAMIC_VALRNGHI = 0x6ffffdff, + /* Sync ops: */ + + gssize (* write_fn) (GOutputStream *stream, + const void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); + gssize (* splice) (GOutputStream *stream, + GInputStream *source, + GOutputStreamSpliceFlags flags, + GCancellable *cancellable, + GError **error); + gboolean (* flush) (GOutputStream *stream, + GCancellable *cancellable, + GError **error); + gboolean (* close_fn) (GOutputStream *stream, + GCancellable *cancellable, + GError **error); + + /* Async ops: (optional in derived classes) */ + + void (* write_async) (GOutputStream *stream, + const void *buffer, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gssize (* write_finish) (GOutputStream *stream, + GAsyncResult *result, + GError **error); + void (* splice_async) (GOutputStream *stream, + GInputStream *source, + GOutputStreamSpliceFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gssize (* splice_finish) (GOutputStream *stream, + GAsyncResult *result, + GError **error); + void (* flush_async) (GOutputStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* flush_finish) (GOutputStream *stream, + GAsyncResult *result, + GError **error); + void (* close_async) (GOutputStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* close_finish) (GOutputStream *stream, + GAsyncResult *result, + GError **error); + + gboolean (* writev_fn) (GOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); + + void (* writev_async) (GOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + gboolean (* writev_finish) (GOutputStream *stream, + GAsyncResult *result, + gsize *bytes_written, + GError **error); - GUM_ELF_DYNAMIC_ADDRRNGLO = 0x6ffffe00, - GUM_ELF_DYNAMIC_GNU_HASH = 0x6ffffef5, - GUM_ELF_DYNAMIC_TLSDESC_PLT = 0x6ffffef6, - GUM_ELF_DYNAMIC_TLSDESC_GOT = 0x6ffffef7, - GUM_ELF_DYNAMIC_GNU_CONFLICT = 0x6ffffef8, - GUM_ELF_DYNAMIC_GNU_LIBLIST = 0x6ffffef9, - GUM_ELF_DYNAMIC_CONFIG = 0x6ffffefa, - GUM_ELF_DYNAMIC_DEPAUDIT = 0x6ffffefb, - GUM_ELF_DYNAMIC_AUDIT = 0x6ffffefc, - GUM_ELF_DYNAMIC_PLTPAD = 0x6ffffefd, - GUM_ELF_DYNAMIC_MOVETAB = 0x6ffffefe, - GUM_ELF_DYNAMIC_SYMINFO = 0x6ffffeff, - GUM_ELF_DYNAMIC_ADDRRNGHI = 0x6ffffeff, + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); + void (*_g_reserved7) (void); + void (*_g_reserved8) (void); +}; - GUM_ELF_DYNAMIC_VERSYM = 0x6ffffff0, - GUM_ELF_DYNAMIC_RELACOUNT = 0x6ffffff9, - GUM_ELF_DYNAMIC_RELCOUNT = 0x6ffffffa, - GUM_ELF_DYNAMIC_FLAGS_1 = 0x6ffffffb, - GUM_ELF_DYNAMIC_VERDEF = 0x6ffffffc, - GUM_ELF_DYNAMIC_VERDEFNUM = 0x6ffffffd, - GUM_ELF_DYNAMIC_VERNEED = 0x6ffffffe, - GUM_ELF_DYNAMIC_VERNEEDNUM = 0x6fffffff, +GIO_AVAILABLE_IN_ALL +GType g_output_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gssize g_output_stream_write (GOutputStream *stream, + const void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_write_all (GOutputStream *stream, + const void *buffer, + gsize count, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_60 +gboolean g_output_stream_writev (GOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_60 +gboolean g_output_stream_writev_all (GOutputStream *stream, + GOutputVector *vectors, + gsize n_vectors, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_40 +gboolean g_output_stream_printf (GOutputStream *stream, + gsize *bytes_written, + GCancellable *cancellable, + GError **error, + const gchar *format, + ...) G_GNUC_PRINTF (5, 6); +GIO_AVAILABLE_IN_2_40 +gboolean g_output_stream_vprintf (GOutputStream *stream, + gsize *bytes_written, + GCancellable *cancellable, + GError **error, + const gchar *format, + va_list args) G_GNUC_PRINTF (5, 0); +GIO_AVAILABLE_IN_2_34 +gssize g_output_stream_write_bytes (GOutputStream *stream, + GBytes *bytes, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_output_stream_splice (GOutputStream *stream, + GInputStream *source, + GOutputStreamSpliceFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_flush (GOutputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_close (GOutputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_output_stream_write_async (GOutputStream *stream, + const void *buffer, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gssize g_output_stream_write_finish (GOutputStream *stream, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_44 +void g_output_stream_write_all_async (GOutputStream *stream, + const void *buffer, + gsize count, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_44 +gboolean g_output_stream_write_all_finish (GOutputStream *stream, + GAsyncResult *result, + gsize *bytes_written, + GError **error); + +GIO_AVAILABLE_IN_2_60 +void g_output_stream_writev_async (GOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_60 +gboolean g_output_stream_writev_finish (GOutputStream *stream, + GAsyncResult *result, + gsize *bytes_written, + GError **error); + +GIO_AVAILABLE_IN_2_60 +void g_output_stream_writev_all_async (GOutputStream *stream, + GOutputVector *vectors, + gsize n_vectors, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_60 +gboolean g_output_stream_writev_all_finish (GOutputStream *stream, + GAsyncResult *result, + gsize *bytes_written, + GError **error); + +GIO_AVAILABLE_IN_2_34 +void g_output_stream_write_bytes_async (GOutputStream *stream, + GBytes *bytes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_34 +gssize g_output_stream_write_bytes_finish (GOutputStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_output_stream_splice_async (GOutputStream *stream, + GInputStream *source, + GOutputStreamSpliceFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gssize g_output_stream_splice_finish (GOutputStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_output_stream_flush_async (GOutputStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_flush_finish (GOutputStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_output_stream_close_async (GOutputStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_close_finish (GOutputStream *stream, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_is_closed (GOutputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_is_closing (GOutputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_has_pending (GOutputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_output_stream_set_pending (GOutputStream *stream, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_output_stream_clear_pending (GOutputStream *stream); - GUM_ELF_DYNAMIC_LOPROC = 0x70000000, - GUM_ELF_DYNAMIC_ARM_SYMTABSZ = 0x70000001, - GUM_ELF_DYNAMIC_ARM_PREEMPTMAP = 0x70000002, +G_END_DECLS - GUM_ELF_DYNAMIC_SPARC_REGISTER = 0x70000001, - GUM_ELF_DYNAMIC_DEPRECATED_SPARC_REGISTER = 0x7000001, +#endif /* __G_OUTPUT_STREAM_H__ */ - GUM_ELF_DYNAMIC_MIPS_RLD_VERSION = 0x70000001, - GUM_ELF_DYNAMIC_MIPS_TIME_STAMP = 0x70000002, - GUM_ELF_DYNAMIC_MIPS_ICHECKSUM = 0x70000003, - GUM_ELF_DYNAMIC_MIPS_IVERSION = 0x70000004, - GUM_ELF_DYNAMIC_MIPS_FLAGS = 0x70000005, - GUM_ELF_DYNAMIC_MIPS_BASE_ADDRESS = 0x70000006, - GUM_ELF_DYNAMIC_MIPS_CONFLICT = 0x70000008, - GUM_ELF_DYNAMIC_MIPS_LIBLIST = 0x70000009, - GUM_ELF_DYNAMIC_MIPS_LOCAL_GOTNO = 0x7000000a, - GUM_ELF_DYNAMIC_MIPS_CONFLICTNO = 0x7000000b, - GUM_ELF_DYNAMIC_MIPS_LIBLISTNO = 0x70000010, - GUM_ELF_DYNAMIC_MIPS_SYMTABNO = 0x70000011, - GUM_ELF_DYNAMIC_MIPS_UNREFEXTNO = 0x70000012, - GUM_ELF_DYNAMIC_MIPS_GOTSYM = 0x70000013, - GUM_ELF_DYNAMIC_MIPS_HIPAGENO = 0x70000014, - GUM_ELF_DYNAMIC_MIPS_RLD_MAP = 0x70000016, - GUM_ELF_DYNAMIC_MIPS_DELTA_CLASS = 0x70000017, - GUM_ELF_DYNAMIC_MIPS_DELTA_CLASS_NO = 0x70000018, - GUM_ELF_DYNAMIC_MIPS_DELTA_INSTANCE = 0x70000019, - GUM_ELF_DYNAMIC_MIPS_DELTA_INSTANCE_NO = 0x7000001a, - GUM_ELF_DYNAMIC_MIPS_DELTA_RELOC = 0x7000001b, - GUM_ELF_DYNAMIC_MIPS_DELTA_RELOC_NO = 0x7000001c, - GUM_ELF_DYNAMIC_MIPS_DELTA_SYM = 0x7000001d, - GUM_ELF_DYNAMIC_MIPS_DELTA_SYM_NO = 0x7000001e, - GUM_ELF_DYNAMIC_MIPS_DELTA_CLASSSYM = 0x70000020, - GUM_ELF_DYNAMIC_MIPS_DELTA_CLASSSYM_NO = 0x70000021, - GUM_ELF_DYNAMIC_MIPS_CXX_FLAGS = 0x70000022, - GUM_ELF_DYNAMIC_MIPS_PIXIE_INIT = 0x70000023, - GUM_ELF_DYNAMIC_MIPS_SYMBOL_LIB = 0x70000024, - GUM_ELF_DYNAMIC_MIPS_LOCALPAGE_GOTIDX = 0x70000025, - GUM_ELF_DYNAMIC_MIPS_LOCAL_GOTIDX = 0x70000026, - GUM_ELF_DYNAMIC_MIPS_HIDDEN_GOTIDX = 0x70000027, - GUM_ELF_DYNAMIC_MIPS_PROTECTED_GOTIDX = 0x70000028, - GUM_ELF_DYNAMIC_MIPS_OPTIONS = 0x70000029, - GUM_ELF_DYNAMIC_MIPS_INTERFACE = 0x7000002a, - GUM_ELF_DYNAMIC_MIPS_DYNSTR_ALIGN = 0x7000002b, - GUM_ELF_DYNAMIC_MIPS_INTERFACE_SIZE = 0x7000002c, - GUM_ELF_DYNAMIC_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d, - GUM_ELF_DYNAMIC_MIPS_PERF_SUFFIX = 0x7000002e, - GUM_ELF_DYNAMIC_MIPS_COMPACT_SIZE = 0x7000002f, - GUM_ELF_DYNAMIC_MIPS_GP_VALUE = 0x70000030, - GUM_ELF_DYNAMIC_MIPS_AUX_DYNAMIC = 0x70000031, - GUM_ELF_DYNAMIC_MIPS_PLTGOT = 0x70000032, - GUM_ELF_DYNAMIC_MIPS_RLD_OBJ_UPDATE = 0x70000033, - GUM_ELF_DYNAMIC_MIPS_RWPLT = 0x70000034, - GUM_ELF_DYNAMIC_MIPS_RLD_MAP_REL = 0x70000035, +G_BEGIN_DECLS - GUM_ELF_DYNAMIC_PPC_GOT = 0x70000000, - GUM_ELF_DYNAMIC_PPC_TLSOPT = 0x70000001, +#define G_TYPE_FILTER_OUTPUT_STREAM (g_filter_output_stream_get_type ()) +#define G_FILTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStream)) +#define G_FILTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStreamClass)) +#define G_IS_FILTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILTER_OUTPUT_STREAM)) +#define G_IS_FILTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILTER_OUTPUT_STREAM)) +#define G_FILTER_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILTER_OUTPUT_STREAM, GFilterOutputStreamClass)) - GUM_ELF_DYNAMIC_PPC64_GLINK = 0x70000000, - GUM_ELF_DYNAMIC_PPC64_OPD = 0x70000001, - GUM_ELF_DYNAMIC_PPC64_OPDSZ = 0x70000002, - GUM_ELF_DYNAMIC_PPC64_TLSOPT = 0x70000003, +/** + * GFilterOutputStream: + * + * A base class for all output streams that work on an underlying stream. + **/ +typedef struct _GFilterOutputStreamClass GFilterOutputStreamClass; - GUM_ELF_DYNAMIC_AUXILIARY = 0x7ffffffd, - GUM_ELF_DYNAMIC_USED = 0x7ffffffe, - GUM_ELF_DYNAMIC_FILTER = 0x7fffffff, +struct _GFilterOutputStream +{ + GOutputStream parent_instance; - GUM_ELF_DYNAMIC_HIPROC = 0x7fffffff, -} GumElfDynamicTag; + /*< protected >*/ + GOutputStream *base_stream; +}; -typedef enum { - GUM_ELF_SHDR_INDEX_UNDEF, - GUM_ELF_SHDR_INDEX_BEFORE = 0xff00, - GUM_ELF_SHDR_INDEX_AFTER = 0xff01, - GUM_ELF_SHDR_INDEX_ABS = 0xfff1, - GUM_ELF_SHDR_INDEX_COMMON = 0xfff2, - GUM_ELF_SHDR_INDEX_XINDEX = 0xffff, -} GumElfShdrIndex; +struct _GFilterOutputStreamClass +{ + GOutputStreamClass parent_class; -typedef enum { - GUM_ELF_SYMBOL_NOTYPE, - GUM_ELF_SYMBOL_OBJECT, - GUM_ELF_SYMBOL_FUNC, - GUM_ELF_SYMBOL_SECTION, - GUM_ELF_SYMBOL_FILE, - GUM_ELF_SYMBOL_COMMON, - GUM_ELF_SYMBOL_TLS, - GUM_ELF_SYMBOL_NUM, - GUM_ELF_SYMBOL_LOOS = 10, - GUM_ELF_SYMBOL_GNU_IFUNC = 10, - GUM_ELF_SYMBOL_HIOS = 12, - GUM_ELF_SYMBOL_LOPROC, - GUM_ELF_SYMBOL_SPARC_REGISTER = 13, - GUM_ELF_SYMBOL_HIPROC = 15, -} GumElfSymbolType; + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); +}; -typedef enum { - GUM_ELF_BIND_LOCAL, - GUM_ELF_BIND_GLOBAL, - GUM_ELF_BIND_WEAK, - GUM_ELF_BIND_LOOS = 10, - GUM_ELF_BIND_GNU_UNIQUE = 10, - GUM_ELF_BIND_HIOS = 12, +GIO_AVAILABLE_IN_ALL +GType g_filter_output_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GOutputStream * g_filter_output_stream_get_base_stream (GFilterOutputStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_filter_output_stream_get_close_base_stream (GFilterOutputStream *stream); +GIO_AVAILABLE_IN_ALL +void g_filter_output_stream_set_close_base_stream (GFilterOutputStream *stream, + gboolean close_base); - GUM_ELF_BIND_LOPROC, - GUM_ELF_BIND_HIPROC = 15, -} GumElfSymbolBind; +G_END_DECLS -typedef enum { - GUM_ELF_IA32_NONE, - GUM_ELF_IA32_32, - GUM_ELF_IA32_PC32, - GUM_ELF_IA32_GOT32, - GUM_ELF_IA32_PLT32, - GUM_ELF_IA32_COPY, - GUM_ELF_IA32_GLOB_DAT, - GUM_ELF_IA32_JMP_SLOT, - GUM_ELF_IA32_RELATIVE, - GUM_ELF_IA32_GOTOFF, - GUM_ELF_IA32_GOTPC, - GUM_ELF_IA32_32PLT, - GUM_ELF_IA32_TLS_TPOFF = 14, - GUM_ELF_IA32_TLS_IE, - GUM_ELF_IA32_TLS_GOTIE, - GUM_ELF_IA32_TLS_LE, - GUM_ELF_IA32_TLS_GD, - GUM_ELF_IA32_TLS_LDM, - GUM_ELF_IA32_16, - GUM_ELF_IA32_PC16, - GUM_ELF_IA32_8, - GUM_ELF_IA32_PC8, - GUM_ELF_IA32_TLS_GD_32, - GUM_ELF_IA32_TLS_GD_PUSH, - GUM_ELF_IA32_TLS_GD_CALL, - GUM_ELF_IA32_TLS_GD_POP, - GUM_ELF_IA32_TLS_LDM_32, - GUM_ELF_IA32_TLS_LDM_PUSH, - GUM_ELF_IA32_TLS_LDM_CALL, - GUM_ELF_IA32_TLS_LDM_POP, - GUM_ELF_IA32_TLS_LDO_32, - GUM_ELF_IA32_TLS_IE_32, - GUM_ELF_IA32_TLS_LE_32, - GUM_ELF_IA32_TLS_DTPMOD32, - GUM_ELF_IA32_TLS_DTPOFF32, - GUM_ELF_IA32_TLS_TPOFF32, - GUM_ELF_IA32_SIZE32, - GUM_ELF_IA32_TLS_GOTDESC, - GUM_ELF_IA32_TLS_DESC_CALL, - GUM_ELF_IA32_TLS_DESC, - GUM_ELF_IA32_IRELATIVE, - GUM_ELF_IA32_GOT32X, -} GumElfIA32Relocation; - -typedef enum { - GUM_ELF_X64_NONE, - GUM_ELF_X64_64, - GUM_ELF_X64_PC32, - GUM_ELF_X64_GOT32, - GUM_ELF_X64_PLT32, - GUM_ELF_X64_COPY, - GUM_ELF_X64_GLOB_DAT, - GUM_ELF_X64_JUMP_SLOT, - GUM_ELF_X64_RELATIVE, - GUM_ELF_X64_GOTPCREL, - GUM_ELF_X64_32, - GUM_ELF_X64_32S, - GUM_ELF_X64_16, - GUM_ELF_X64_PC16, - GUM_ELF_X64_8, - GUM_ELF_X64_PC8, - GUM_ELF_X64_DTPMOD64, - GUM_ELF_X64_DTPOFF64, - GUM_ELF_X64_TPOFF64, - GUM_ELF_X64_TLSGD, - GUM_ELF_X64_TLSLD, - GUM_ELF_X64_DTPOFF32, - GUM_ELF_X64_GOTTPOFF, - GUM_ELF_X64_TPOFF32, - GUM_ELF_X64_PC64, - GUM_ELF_X64_GOTOFF64, - GUM_ELF_X64_GOTPC32, - GUM_ELF_X64_GOT64, - GUM_ELF_X64_GOTPCREL64, - GUM_ELF_X64_GOTPC64, - GUM_ELF_X64_GOTPLT64, - GUM_ELF_X64_PLTOFF64, - GUM_ELF_X64_SIZE32, - GUM_ELF_X64_SIZE64, - GUM_ELF_X64_GOTPC32_TLSDESC, - GUM_ELF_X64_TLSDESC_CALL, - GUM_ELF_X64_TLSDESC, - GUM_ELF_X64_IRELATIVE, - GUM_ELF_X64_RELATIVE64, - GUM_ELF_X64_GOTPCRELX = 41, - GUM_ELF_X64_REX_GOTPCRELX, -} GumElfX64Relocation; - -typedef enum { - GUM_ELF_ARM_NONE, - GUM_ELF_ARM_PC24, - GUM_ELF_ARM_ABS32, - GUM_ELF_ARM_REL32, - GUM_ELF_ARM_PC13, - GUM_ELF_ARM_ABS16, - GUM_ELF_ARM_ABS12, - GUM_ELF_ARM_THM_ABS5, - GUM_ELF_ARM_ABS8, - GUM_ELF_ARM_SBREL32, - GUM_ELF_ARM_THM_PC22, - GUM_ELF_ARM_THM_PC8, - GUM_ELF_ARM_AMP_VCALL9, - GUM_ELF_ARM_SWI24, - GUM_ELF_ARM_TLS_DESC = 13, - GUM_ELF_ARM_THM_SWI8, - GUM_ELF_ARM_XPC25, - GUM_ELF_ARM_THM_XPC22, - GUM_ELF_ARM_TLS_DTPMOD32, - GUM_ELF_ARM_TLS_DTPOFF32, - GUM_ELF_ARM_TLS_TPOFF32, - GUM_ELF_ARM_COPY, - GUM_ELF_ARM_GLOB_DAT, - GUM_ELF_ARM_JUMP_SLOT, - GUM_ELF_ARM_RELATIVE, - GUM_ELF_ARM_GOTOFF, - GUM_ELF_ARM_GOTPC, - GUM_ELF_ARM_GOT32, - GUM_ELF_ARM_PLT32, - GUM_ELF_ARM_CALL, - GUM_ELF_ARM_JUMP24, - GUM_ELF_ARM_THM_JUMP24, - GUM_ELF_ARM_BASE_ABS, - GUM_ELF_ARM_ALU_PCREL_7_0, - GUM_ELF_ARM_ALU_PCREL_15_8, - GUM_ELF_ARM_ALU_PCREL_23_15, - GUM_ELF_ARM_LDR_SBREL_11_0, - GUM_ELF_ARM_ALU_SBREL_19_12, - GUM_ELF_ARM_ALU_SBREL_27_20, - GUM_ELF_ARM_TARGET1, - GUM_ELF_ARM_SBREL31, - GUM_ELF_ARM_V4BX, - GUM_ELF_ARM_TARGET2, - GUM_ELF_ARM_PREL31, - GUM_ELF_ARM_MOVW_ABS_NC, - GUM_ELF_ARM_MOVT_ABS, - GUM_ELF_ARM_MOVW_PREL_NC, - GUM_ELF_ARM_MOVT_PREL, - GUM_ELF_ARM_THM_MOVW_ABS_NC, - GUM_ELF_ARM_THM_MOVT_ABS, - GUM_ELF_ARM_THM_MOVW_PREL_NC, - GUM_ELF_ARM_THM_MOVT_PREL, - GUM_ELF_ARM_THM_JUMP19, - GUM_ELF_ARM_THM_JUMP6, - GUM_ELF_ARM_THM_ALU_PREL_11_0, - GUM_ELF_ARM_THM_PC12, - GUM_ELF_ARM_ABS32_NOI, - GUM_ELF_ARM_REL32_NOI, - GUM_ELF_ARM_ALU_PC_G0_NC, - GUM_ELF_ARM_ALU_PC_G0, - GUM_ELF_ARM_ALU_PC_G1_NC, - GUM_ELF_ARM_ALU_PC_G1, - GUM_ELF_ARM_ALU_PC_G2, - GUM_ELF_ARM_LDR_PC_G1, - GUM_ELF_ARM_LDR_PC_G2, - GUM_ELF_ARM_LDRS_PC_G0, - GUM_ELF_ARM_LDRS_PC_G1, - GUM_ELF_ARM_LDRS_PC_G2, - GUM_ELF_ARM_LDC_PC_G0, - GUM_ELF_ARM_LDC_PC_G1, - GUM_ELF_ARM_LDC_PC_G2, - GUM_ELF_ARM_ALU_SB_G0_NC, - GUM_ELF_ARM_ALU_SB_G0, - GUM_ELF_ARM_ALU_SB_G1_NC, - GUM_ELF_ARM_ALU_SB_G1, - GUM_ELF_ARM_ALU_SB_G2, - GUM_ELF_ARM_LDR_SB_G0, - GUM_ELF_ARM_LDR_SB_G1, - GUM_ELF_ARM_LDR_SB_G2, - GUM_ELF_ARM_LDRS_SB_G0, - GUM_ELF_ARM_LDRS_SB_G1, - GUM_ELF_ARM_LDRS_SB_G2, - GUM_ELF_ARM_LDC_SB_G0, - GUM_ELF_ARM_LDC_SB_G1, - GUM_ELF_ARM_LDC_SB_G2, - GUM_ELF_ARM_MOVW_BREL_NC, - GUM_ELF_ARM_MOVT_BREL, - GUM_ELF_ARM_MOVW_BREL, - GUM_ELF_ARM_THM_MOVW_BREL_NC, - GUM_ELF_ARM_THM_MOVT_BREL, - GUM_ELF_ARM_THM_MOVW_BREL, - GUM_ELF_ARM_TLS_GOTDESC, - GUM_ELF_ARM_TLS_CALL, - GUM_ELF_ARM_TLS_DESCSEQ, - GUM_ELF_ARM_THM_TLS_CALL, - GUM_ELF_ARM_PLT32_ABS, - GUM_ELF_ARM_GOT_ABS, - GUM_ELF_ARM_GOT_PREL, - GUM_ELF_ARM_GOT_BREL12, - GUM_ELF_ARM_GOTOFF12, - GUM_ELF_ARM_GOTRELAX, - GUM_ELF_ARM_GNU_VTENTRY, - GUM_ELF_ARM_GNU_VTINHERIT, - GUM_ELF_ARM_THM_PC11, - GUM_ELF_ARM_THM_PC9, - GUM_ELF_ARM_TLS_GD32, - GUM_ELF_ARM_TLS_LDM32, - GUM_ELF_ARM_TLS_LDO32, - GUM_ELF_ARM_TLS_IE32, - GUM_ELF_ARM_TLS_LE32, - GUM_ELF_ARM_TLS_LDO12, - GUM_ELF_ARM_TLS_LE12, - GUM_ELF_ARM_TLS_IE12GP, - GUM_ELF_ARM_ME_TOO = 128, - GUM_ELF_ARM_THM_TLS_DESCSEQ, - GUM_ELF_ARM_THM_TLS_DESCSEQ16 = 129, - GUM_ELF_ARM_THM_TLS_DESCSEQ32, - GUM_ELF_ARM_THM_GOT_BREL12, - GUM_ELF_ARM_IRELATIVE = 160, - GUM_ELF_ARM_RXPC25 = 249, - GUM_ELF_ARM_RSBREL32, - GUM_ELF_ARM_THM_RPC22, - GUM_ELF_ARM_RREL32, - GUM_ELF_ARM_RABS22, - GUM_ELF_ARM_RPC24, - GUM_ELF_ARM_RBASE, -} GumElfArmRelocation; - -typedef enum { - GUM_ELF_ARM64_NONE, - GUM_ELF_ARM64_P32_ABS32, - GUM_ELF_ARM64_P32_COPY = 180, - GUM_ELF_ARM64_P32_GLOB_DAT, - GUM_ELF_ARM64_P32_JUMP_SLOT, - GUM_ELF_ARM64_P32_RELATIVE, - GUM_ELF_ARM64_P32_TLS_DTPMOD, - GUM_ELF_ARM64_P32_TLS_DTPREL, - GUM_ELF_ARM64_P32_TLS_TPREL, - GUM_ELF_ARM64_P32_TLSDESC, - GUM_ELF_ARM64_P32_IRELATIVE, - GUM_ELF_ARM64_ABS64 = 257, - GUM_ELF_ARM64_ABS32, - GUM_ELF_ARM64_ABS16, - GUM_ELF_ARM64_PREL64, - GUM_ELF_ARM64_PREL32, - GUM_ELF_ARM64_PREL16, - GUM_ELF_ARM64_MOVW_UABS_G0, - GUM_ELF_ARM64_MOVW_UABS_G0_NC, - GUM_ELF_ARM64_MOVW_UABS_G1, - GUM_ELF_ARM64_MOVW_UABS_G1_NC, - GUM_ELF_ARM64_MOVW_UABS_G2, - GUM_ELF_ARM64_MOVW_UABS_G2_NC, - GUM_ELF_ARM64_MOVW_UABS_G3, - GUM_ELF_ARM64_MOVW_SABS_G0, - GUM_ELF_ARM64_MOVW_SABS_G1, - GUM_ELF_ARM64_MOVW_SABS_G2, - GUM_ELF_ARM64_LD_PREL_LO19, - GUM_ELF_ARM64_ADR_PREL_LO21, - GUM_ELF_ARM64_ADR_PREL_PG_HI21, - GUM_ELF_ARM64_ADR_PREL_PG_HI21_NC, - GUM_ELF_ARM64_ADD_ABS_LO12_NC, - GUM_ELF_ARM64_LDST8_ABS_LO12_NC, - GUM_ELF_ARM64_TSTBR14, - GUM_ELF_ARM64_CONDBR19, - GUM_ELF_ARM64_JUMP26 = 282, - GUM_ELF_ARM64_CALL26, - GUM_ELF_ARM64_LDST16_ABS_LO12_NC, - GUM_ELF_ARM64_LDST32_ABS_LO12_NC, - GUM_ELF_ARM64_LDST64_ABS_LO12_NC, - GUM_ELF_ARM64_MOVW_PREL_G0, - GUM_ELF_ARM64_MOVW_PREL_G0_NC, - GUM_ELF_ARM64_MOVW_PREL_G1, - GUM_ELF_ARM64_MOVW_PREL_G1_NC, - GUM_ELF_ARM64_MOVW_PREL_G2, - GUM_ELF_ARM64_MOVW_PREL_G2_NC, - GUM_ELF_ARM64_MOVW_PREL_G3, - GUM_ELF_ARM64_LDST128_ABS_LO12_NC = 299, - GUM_ELF_ARM64_MOVW_GOTOFF_G0, - GUM_ELF_ARM64_MOVW_GOTOFF_G0_NC, - GUM_ELF_ARM64_MOVW_GOTOFF_G1, - GUM_ELF_ARM64_MOVW_GOTOFF_G1_NC, - GUM_ELF_ARM64_MOVW_GOTOFF_G2, - GUM_ELF_ARM64_MOVW_GOTOFF_G2_NC, - GUM_ELF_ARM64_MOVW_GOTOFF_G3, - GUM_ELF_ARM64_GOTREL64, - GUM_ELF_ARM64_GOTREL32, - GUM_ELF_ARM64_GOT_LD_PREL19, - GUM_ELF_ARM64_LD64_GOTOFF_LO15, - GUM_ELF_ARM64_ADR_GOT_PAGE, - GUM_ELF_ARM64_LD64_GOT_LO12_NC, - GUM_ELF_ARM64_LD64_GOTPAGE_LO15, - GUM_ELF_ARM64_TLSGD_ADR_PREL21 = 512, - GUM_ELF_ARM64_TLSGD_ADR_PAGE21, - GUM_ELF_ARM64_TLSGD_ADD_LO12_NC, - GUM_ELF_ARM64_TLSGD_MOVW_G1, - GUM_ELF_ARM64_TLSGD_MOVW_G0_NC, - GUM_ELF_ARM64_TLSLD_ADR_PREL21, - GUM_ELF_ARM64_TLSLD_ADR_PAGE21, - GUM_ELF_ARM64_TLSLD_ADD_LO12_NC, - GUM_ELF_ARM64_TLSLD_MOVW_G1, - GUM_ELF_ARM64_TLSLD_MOVW_G0_NC, - GUM_ELF_ARM64_TLSLD_LD_PREL19, - GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G2, - GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G1, - GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G1_NC, - GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G0, - GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G0_NC, - GUM_ELF_ARM64_TLSLD_ADD_DTPREL_HI12, - GUM_ELF_ARM64_TLSLD_ADD_DTPREL_LO12, - GUM_ELF_ARM64_TLSLD_ADD_DTPREL_LO12_NC, - GUM_ELF_ARM64_TLSLD_LDST8_DTPREL_LO12, - GUM_ELF_ARM64_TLSLD_LDST8_DTPREL_LO12_NC, - GUM_ELF_ARM64_TLSLD_LDST16_DTPREL_LO12, - GUM_ELF_ARM64_TLSLD_LDST16_DTPREL_LO12_NC, - GUM_ELF_ARM64_TLSLD_LDST32_DTPREL_LO12, - GUM_ELF_ARM64_TLSLD_LDST32_DTPREL_LO12_NC, - GUM_ELF_ARM64_TLSLD_LDST64_DTPREL_LO12, - GUM_ELF_ARM64_TLSLD_LDST64_DTPREL_LO12_NC, - GUM_ELF_ARM64_TLSIE_MOVW_GOTTPREL_G1, - GUM_ELF_ARM64_TLSIE_MOVW_GOTTPREL_G0_NC, - GUM_ELF_ARM64_TLSIE_ADR_GOTTPREL_PAGE21, - GUM_ELF_ARM64_TLSIE_LD64_GOTTPREL_LO12_NC, - GUM_ELF_ARM64_TLSIE_LD_GOTTPREL_PREL19, - GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G2, - GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G1, - GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G1_NC, - GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G0, - GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G0_NC, - GUM_ELF_ARM64_TLSLE_ADD_TPREL_HI12, - GUM_ELF_ARM64_TLSLE_ADD_TPREL_LO12, - GUM_ELF_ARM64_TLSLE_ADD_TPREL_LO12_NC, - GUM_ELF_ARM64_TLSLE_LDST8_TPREL_LO12, - GUM_ELF_ARM64_TLSLE_LDST8_TPREL_LO12_NC, - GUM_ELF_ARM64_TLSLE_LDST16_TPREL_LO12, - GUM_ELF_ARM64_TLSLE_LDST16_TPREL_LO12_NC, - GUM_ELF_ARM64_TLSLE_LDST32_TPREL_LO12, - GUM_ELF_ARM64_TLSLE_LDST32_TPREL_LO12_NC, - GUM_ELF_ARM64_TLSLE_LDST64_TPREL_LO12, - GUM_ELF_ARM64_TLSLE_LDST64_TPREL_LO12_NC, - GUM_ELF_ARM64_TLSDESC_LD_PREL19, - GUM_ELF_ARM64_TLSDESC_ADR_PREL21, - GUM_ELF_ARM64_TLSDESC_ADR_PAGE21, - GUM_ELF_ARM64_TLSDESC_LD64_LO12, - GUM_ELF_ARM64_TLSDESC_ADD_LO12, - GUM_ELF_ARM64_TLSDESC_OFF_G1, - GUM_ELF_ARM64_TLSDESC_OFF_G0_NC, - GUM_ELF_ARM64_TLSDESC_LDR, - GUM_ELF_ARM64_TLSDESC_ADD, - GUM_ELF_ARM64_TLSDESC_CALL, - GUM_ELF_ARM64_TLSLE_LDST128_TPREL_LO12, - GUM_ELF_ARM64_TLSLE_LDST128_TPREL_LO12_NC, - GUM_ELF_ARM64_TLSLD_LDST128_DTPREL_LO12, - GUM_ELF_ARM64_TLSLD_LDST128_DTPREL_LO12_NC, - GUM_ELF_ARM64_COPY = 1024, - GUM_ELF_ARM64_GLOB_DAT, - GUM_ELF_ARM64_JUMP_SLOT, - GUM_ELF_ARM64_RELATIVE, - GUM_ELF_ARM64_TLS_DTPMOD, - GUM_ELF_ARM64_TLS_DTPREL, - GUM_ELF_ARM64_TLS_TPREL, - GUM_ELF_ARM64_TLSDESC, - GUM_ELF_ARM64_IRELATIVE, -} GumElfArm64Relocation; - -typedef enum { - GUM_ELF_MIPS_NONE, - GUM_ELF_MIPS_16, - GUM_ELF_MIPS_32, - GUM_ELF_MIPS_REL32, - GUM_ELF_MIPS_26, - GUM_ELF_MIPS_HI16, - GUM_ELF_MIPS_LO16, - GUM_ELF_MIPS_GPREL16, - GUM_ELF_MIPS_LITERAL, - GUM_ELF_MIPS_GOT16, - GUM_ELF_MIPS_PC16, - GUM_ELF_MIPS_CALL16, - GUM_ELF_MIPS_GPREL32, - GUM_ELF_MIPS_SHIFT5 = 16, - GUM_ELF_MIPS_SHIFT6, - GUM_ELF_MIPS_64, - GUM_ELF_MIPS_GOT_DISP, - GUM_ELF_MIPS_GOT_PAGE, - GUM_ELF_MIPS_GOT_OFST, - GUM_ELF_MIPS_GOT_HI16, - GUM_ELF_MIPS_GOT_LO16, - GUM_ELF_MIPS_SUB, - GUM_ELF_MIPS_INSERT_A, - GUM_ELF_MIPS_INSERT_B, - GUM_ELF_MIPS_DELETE, - GUM_ELF_MIPS_HIGHER, - GUM_ELF_MIPS_HIGHEST, - GUM_ELF_MIPS_CALL_HI16, - GUM_ELF_MIPS_CALL_LO16, - GUM_ELF_MIPS_SCN_DISP, - GUM_ELF_MIPS_REL16, - GUM_ELF_MIPS_ADD_IMMEDIATE, - GUM_ELF_MIPS_PJUMP, - GUM_ELF_MIPS_RELGOT, - GUM_ELF_MIPS_JALR, - GUM_ELF_MIPS_TLS_DTPMOD32, - GUM_ELF_MIPS_TLS_DTPREL32, - GUM_ELF_MIPS_TLS_DTPMOD64, - GUM_ELF_MIPS_TLS_DTPREL64, - GUM_ELF_MIPS_TLS_GD, - GUM_ELF_MIPS_TLS_LDM, - GUM_ELF_MIPS_TLS_DTPREL_HI16, - GUM_ELF_MIPS_TLS_DTPREL_LO16, - GUM_ELF_MIPS_TLS_GOTTPREL, - GUM_ELF_MIPS_TLS_TPREL32, - GUM_ELF_MIPS_TLS_TPREL64, - GUM_ELF_MIPS_TLS_TPREL_HI16, - GUM_ELF_MIPS_TLS_TPREL_LO16, - GUM_ELF_MIPS_GLOB_DAT, - GUM_ELF_MIPS_COPY = 126, - GUM_ELF_MIPS_JUMP_SLOT, -} GumElfMipsRelocation; +#endif /* __G_FILTER_OUTPUT_STREAM_H__ */ -typedef struct _GumElfSegmentDetails GumElfSegmentDetails; -typedef struct _GumElfSectionDetails GumElfSectionDetails; -typedef struct _GumElfRelocationDetails GumElfRelocationDetails; -typedef struct _GumElfDynamicEntryDetails GumElfDynamicEntryDetails; -typedef struct _GumElfSymbolDetails GumElfSymbolDetails; +G_BEGIN_DECLS -typedef gboolean (* GumFoundElfSegmentFunc) ( - const GumElfSegmentDetails * details, gpointer user_data); -typedef gboolean (* GumFoundElfSectionFunc) ( - const GumElfSectionDetails * details, gpointer user_data); -typedef gboolean (* GumFoundElfRelocationFunc) ( - const GumElfRelocationDetails * details, gpointer user_data); -typedef gboolean (* GumFoundElfDynamicEntryFunc) ( - const GumElfDynamicEntryDetails * details, gpointer user_data); -typedef gboolean (* GumFoundElfSymbolFunc) (const GumElfSymbolDetails * details, - gpointer user_data); +#define G_TYPE_BUFFERED_OUTPUT_STREAM (g_buffered_output_stream_get_type ()) +#define G_BUFFERED_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_BUFFERED_OUTPUT_STREAM, GBufferedOutputStream)) +#define G_BUFFERED_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_BUFFERED_OUTPUT_STREAM, GBufferedOutputStreamClass)) +#define G_IS_BUFFERED_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_BUFFERED_OUTPUT_STREAM)) +#define G_IS_BUFFERED_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_BUFFERED_OUTPUT_STREAM)) +#define G_BUFFERED_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_BUFFERED_OUTPUT_STREAM, GBufferedOutputStreamClass)) -struct _GumElfSegmentDetails -{ - GumAddress vm_address; - guint64 vm_size; - guint64 file_offset; - guint64 file_size; - GumPageProtection protection; -}; +/** + * GBufferedOutputStream: + * + * An implementation of #GFilterOutputStream with a sized buffer. + **/ +typedef struct _GBufferedOutputStreamClass GBufferedOutputStreamClass; +typedef struct _GBufferedOutputStreamPrivate GBufferedOutputStreamPrivate; -struct _GumElfSectionDetails +struct _GBufferedOutputStream { - const gchar * id; - const gchar * name; - GumElfSectionType type; - guint64 flags; - GumAddress address; - guint64 offset; - gsize size; - guint32 link; - guint32 info; - guint64 alignment; - guint64 entry_size; - GumPageProtection protection; -}; + GFilterOutputStream parent_instance; -struct _GumElfRelocationDetails -{ - GumAddress address; - guint32 type; - const GumElfSymbolDetails * symbol; - gint64 addend; - const GumElfSectionDetails * parent; + /*< protected >*/ + GBufferedOutputStreamPrivate *priv; }; -struct _GumElfDynamicEntryDetails +struct _GBufferedOutputStreamClass { - GumElfDynamicTag tag; - guint64 val; -}; + GFilterOutputStreamClass parent_class; -struct _GumElfSymbolDetails -{ - const gchar * name; - GumAddress address; - gsize size; - GumElfSymbolType type; - GumElfSymbolBind bind; - guint16 shdr_index; - const GumElfSectionDetails * section; + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); }; -GUM_API GumElfModule * gum_elf_module_new_from_file (const gchar * path, - GError ** error); -GUM_API GumElfModule * gum_elf_module_new_from_blob (GBytes * blob, - GError ** error); -GUM_API GumElfModule * gum_elf_module_new_from_memory (const gchar * path, - GumAddress base_address, GError ** error); - -GUM_API gboolean gum_elf_module_load (GumElfModule * self, GError ** error); - -GUM_API GumElfType gum_elf_module_get_etype (GumElfModule * self); -GUM_API guint gum_elf_module_get_pointer_size (GumElfModule * self); -GUM_API gint gum_elf_module_get_byte_order (GumElfModule * self); -GUM_API GumElfOSABI gum_elf_module_get_os_abi (GumElfModule * self); -GUM_API guint8 gum_elf_module_get_os_abi_version (GumElfModule * self); -GUM_API GumElfMachine gum_elf_module_get_machine (GumElfModule * self); -GUM_API GumAddress gum_elf_module_get_base_address (GumElfModule * self); -GUM_API GumAddress gum_elf_module_get_preferred_address (GumElfModule * self); -GUM_API guint64 gum_elf_module_get_mapped_size (GumElfModule * self); -GUM_API GumAddress gum_elf_module_get_entrypoint (GumElfModule * self); -GUM_API const gchar * gum_elf_module_get_interpreter (GumElfModule * self); -GUM_API const gchar * gum_elf_module_get_source_path (GumElfModule * self); -GUM_API GBytes * gum_elf_module_get_source_blob (GumElfModule * self); -GUM_API GumElfSourceMode gum_elf_module_get_source_mode (GumElfModule * self); -GUM_API gconstpointer gum_elf_module_get_file_data (GumElfModule * self, - gsize * size); - -GUM_API void gum_elf_module_enumerate_segments (GumElfModule * self, - GumFoundElfSegmentFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_sections (GumElfModule * self, - GumFoundElfSectionFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_relocations (GumElfModule * self, - GumFoundElfRelocationFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_dynamic_entries (GumElfModule * self, - GumFoundElfDynamicEntryFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_imports (GumElfModule * self, - GumFoundImportFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_exports (GumElfModule * self, - GumFoundExportFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_dynamic_symbols (GumElfModule * self, - GumFoundElfSymbolFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_symbols (GumElfModule * self, - GumFoundElfSymbolFunc func, gpointer user_data); -GUM_API void gum_elf_module_enumerate_dependencies (GumElfModule * self, - GumFoundDependencyFunc func, gpointer user_data); -GUM_API GumAddress gum_elf_module_translate_to_offline (GumElfModule * self, - GumAddress online_address); -GUM_API GumAddress gum_elf_module_translate_to_online (GumElfModule * self, - GumAddress offline_address); +GIO_AVAILABLE_IN_ALL +GType g_buffered_output_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GOutputStream* g_buffered_output_stream_new (GOutputStream *base_stream); +GIO_AVAILABLE_IN_ALL +GOutputStream* g_buffered_output_stream_new_sized (GOutputStream *base_stream, + gsize size); +GIO_AVAILABLE_IN_ALL +gsize g_buffered_output_stream_get_buffer_size (GBufferedOutputStream *stream); +GIO_AVAILABLE_IN_ALL +void g_buffered_output_stream_set_buffer_size (GBufferedOutputStream *stream, + gsize size); +GIO_AVAILABLE_IN_ALL +gboolean g_buffered_output_stream_get_auto_grow (GBufferedOutputStream *stream); +GIO_AVAILABLE_IN_ALL +void g_buffered_output_stream_set_auto_grow (GBufferedOutputStream *stream, + gboolean auto_grow); G_END_DECLS -#endif -/* - * Copyright (C) 2009-2022 Ole André Vadla Ravnås +#endif /* __G_BUFFERED_OUTPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Ryan Lortie */ -#ifndef __GUM_EVENT_H__ -#define __GUM_EVENT_H__ +#ifndef __G_BYTES_ICON_H__ +#define __G_BYTES_ICON_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -G_BEGIN_DECLS -typedef guint GumEventType; +G_BEGIN_DECLS -typedef union _GumEvent GumEvent; +#define G_TYPE_BYTES_ICON (g_bytes_icon_get_type ()) +#define G_BYTES_ICON(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_BYTES_ICON, GBytesIcon)) +#define G_IS_BYTES_ICON(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_BYTES_ICON)) -typedef struct _GumAnyEvent GumAnyEvent; -typedef struct _GumCallEvent GumCallEvent; -typedef struct _GumRetEvent GumRetEvent; -typedef struct _GumExecEvent GumExecEvent; -typedef struct _GumBlockEvent GumBlockEvent; -typedef struct _GumCompileEvent GumCompileEvent; +/** + * GBytesIcon: + * + * Gets an icon for a #GBytes. Implements #GLoadableIcon. + **/ +GIO_AVAILABLE_IN_2_38 +GType g_bytes_icon_get_type (void) G_GNUC_CONST; -enum _GumEventType -{ - GUM_NOTHING = 0, - GUM_CALL = 1 << 0, - GUM_RET = 1 << 1, - GUM_EXEC = 1 << 2, - GUM_BLOCK = 1 << 3, - GUM_COMPILE = 1 << 4, -}; +GIO_AVAILABLE_IN_2_38 +GIcon * g_bytes_icon_new (GBytes *bytes); -struct _GumAnyEvent -{ - GumEventType type; -}; +GIO_AVAILABLE_IN_2_38 +GBytes * g_bytes_icon_get_bytes (GBytesIcon *icon); -struct _GumCallEvent -{ - GumEventType type; +G_END_DECLS - gpointer location; - gpointer target; - gint depth; -}; +#endif /* __G_BYTES_ICON_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ -struct _GumRetEvent -{ - GumEventType type; +#ifndef __G_CANCELLABLE_H__ +#define __G_CANCELLABLE_H__ - gpointer location; - gpointer target; - gint depth; -}; +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -struct _GumExecEvent -{ - GumEventType type; - gpointer location; -}; +G_BEGIN_DECLS -struct _GumBlockEvent -{ - GumEventType type; +#define G_TYPE_CANCELLABLE (g_cancellable_get_type ()) +#define G_CANCELLABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CANCELLABLE, GCancellable)) +#define G_CANCELLABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CANCELLABLE, GCancellableClass)) +#define G_IS_CANCELLABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CANCELLABLE)) +#define G_IS_CANCELLABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CANCELLABLE)) +#define G_CANCELLABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CANCELLABLE, GCancellableClass)) - gpointer start; - gpointer end; -}; +/** + * GCancellable: + * + * Allows actions to be cancelled. + */ +typedef struct _GCancellableClass GCancellableClass; +typedef struct _GCancellablePrivate GCancellablePrivate; -struct _GumCompileEvent +struct _GCancellable { - GumEventType type; + GObject parent_instance; - gpointer start; - gpointer end; + /*< private >*/ + GCancellablePrivate *priv; }; -union _GumEvent +struct _GCancellableClass { - GumEventType type; + GObjectClass parent_class; - GumAnyEvent any; - GumCallEvent call; - GumRetEvent ret; - GumExecEvent exec; - GumBlockEvent block; - GumCompileEvent compile; + void (* cancelled) (GCancellable *cancellable); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); }; +GIO_AVAILABLE_IN_ALL +GType g_cancellable_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GCancellable *g_cancellable_new (void); + +/* These are only safe to call inside a cancellable op */ +GIO_AVAILABLE_IN_ALL +gboolean g_cancellable_is_cancelled (GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +gboolean g_cancellable_set_error_if_cancelled (GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +int g_cancellable_get_fd (GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +gboolean g_cancellable_make_pollfd (GCancellable *cancellable, + GPollFD *pollfd); +GIO_AVAILABLE_IN_ALL +void g_cancellable_release_fd (GCancellable *cancellable); + +GIO_AVAILABLE_IN_ALL +GSource * g_cancellable_source_new (GCancellable *cancellable); + +GIO_AVAILABLE_IN_ALL +GCancellable *g_cancellable_get_current (void); +GIO_AVAILABLE_IN_ALL +void g_cancellable_push_current (GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +void g_cancellable_pop_current (GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +void g_cancellable_reset (GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +gulong g_cancellable_connect (GCancellable *cancellable, + GCallback callback, + gpointer data, + GDestroyNotify data_destroy_func); +GIO_AVAILABLE_IN_ALL +void g_cancellable_disconnect (GCancellable *cancellable, + gulong handler_id); + + +/* This is safe to call from another thread */ +GIO_AVAILABLE_IN_ALL +void g_cancellable_cancel (GCancellable *cancellable); + G_END_DECLS -#endif -/* - * Copyright (C) 2009-2022 Ole André Vadla Ravnås +#endif /* __G_CANCELLABLE_H__ */ +/* GIO - GLib Input, Output and Streaming Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson */ -#ifndef __GUM_EVENT_SINK_H__ -#define __GUM_EVENT_SINK_H__ +#ifndef __G_CHARSET_CONVERTER_H__ +#define __G_CHARSET_CONVERTER_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -G_BEGIN_DECLS +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ -#define GUM_TYPE_EVENT_SINK (gum_event_sink_get_type ()) -GUM_DECLARE_INTERFACE (GumEventSink, gum_event_sink, GUM, EVENT_SINK, GObject) +#ifndef __G_CONVERTER_H__ +#define __G_CONVERTER_H__ -#define GUM_TYPE_DEFAULT_EVENT_SINK (gum_default_event_sink_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumDefaultEventSink, gum_default_event_sink, GUM, - DEFAULT_EVENT_SINK, GObject) +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -#define GUM_TYPE_CALLBACK_EVENT_SINK (gum_callback_event_sink_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumCallbackEventSink, gum_callback_event_sink, GUM, - CALLBACK_EVENT_SINK, GObject) -typedef void (* GumEventSinkCallback) (const GumEvent * event, - GumCpuContext * cpu_context, gpointer user_data); +G_BEGIN_DECLS -#ifndef GUM_DIET +#define G_TYPE_CONVERTER (g_converter_get_type ()) +#define G_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_CONVERTER, GConverter)) +#define G_IS_CONVERTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_CONVERTER)) +#define G_CONVERTER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_CONVERTER, GConverterIface)) -struct _GumEventSinkInterface -{ - GTypeInterface parent; +/** + * GConverter: + * + * Seek object for streaming operations. + * + * Since: 2.24 + **/ +typedef struct _GConverterIface GConverterIface; - GumEventType (* query_mask) (GumEventSink * self); - void (* start) (GumEventSink * self); - void (* process) (GumEventSink * self, const GumEvent * event, - GumCpuContext * cpu_context); - void (* flush) (GumEventSink * self); - void (* stop) (GumEventSink * self); +/** + * GConverterIface: + * @g_iface: The parent interface. + * @convert: Converts data. + * @reset: Reverts the internal state of the converter to its initial state. + * + * Provides an interface for converting data from one type + * to another type. The conversion can be stateful + * and may fail at any place. + * + * Since: 2.24 + **/ +struct _GConverterIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + GConverterResult (* convert) (GConverter *converter, + const void *inbuf, + gsize inbuf_size, + void *outbuf, + gsize outbuf_size, + GConverterFlags flags, + gsize *bytes_read, + gsize *bytes_written, + GError **error); + void (* reset) (GConverter *converter); }; -#endif +GIO_AVAILABLE_IN_ALL +GType g_converter_get_type (void) G_GNUC_CONST; -GUM_API GumEventType gum_event_sink_query_mask (GumEventSink * self); -GUM_API void gum_event_sink_start (GumEventSink * self); -GUM_API void gum_event_sink_process (GumEventSink * self, - const GumEvent * event, GumCpuContext * cpu_context); -GUM_API void gum_event_sink_flush (GumEventSink * self); -GUM_API void gum_event_sink_stop (GumEventSink * self); +GIO_AVAILABLE_IN_ALL +GConverterResult g_converter_convert (GConverter *converter, + const void *inbuf, + gsize inbuf_size, + void *outbuf, + gsize outbuf_size, + GConverterFlags flags, + gsize *bytes_read, + gsize *bytes_written, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_converter_reset (GConverter *converter); -GUM_API GumEventSink * gum_event_sink_make_default (void); -GUM_API GumEventSink * gum_event_sink_make_from_callback (GumEventType mask, - GumEventSinkCallback callback, gpointer data, GDestroyNotify data_destroy); G_END_DECLS -#endif -/* - * Copyright (C) 2015-2024 Ole André Vadla Ravnås - * Copyright (C) 2020 Francesco Tamagni - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_EXCEPTOR_H__ -#define __GUM_EXCEPTOR_H__ -#include +#endif /* __G_CONVERTER_H__ */ G_BEGIN_DECLS -#define GUM_TYPE_EXCEPTOR (gum_exceptor_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumExceptor, gum_exceptor, GUM, EXCEPTOR, GObject) - -#if defined (G_OS_WIN32) || defined (__APPLE__) -# define GUM_NATIVE_SETJMP(env) setjmp (env) -# define GUM_NATIVE_LONGJMP longjmp -# ifndef GUM_GIR_COMPILATION - typedef jmp_buf GumExceptorNativeJmpBuf; -# endif -#else -# define GUM_NATIVE_SETJMP(env) sigsetjmp (env, TRUE) -# define GUM_NATIVE_LONGJMP siglongjmp -# ifndef GUM_GIR_COMPILATION - typedef sigjmp_buf GumExceptorNativeJmpBuf; -# endif -#endif -#ifdef GUM_GIR_COMPILATION -typedef int GumExceptorNativeJmpBuf; -#endif - -typedef struct _GumExceptionDetails GumExceptionDetails; -typedef guint GumExceptionType; -typedef struct _GumExceptionMemoryDetails GumExceptionMemoryDetails; -typedef gboolean (* GumExceptionHandler) (GumExceptionDetails * details, - gpointer user_data); +#define G_TYPE_CHARSET_CONVERTER (g_charset_converter_get_type ()) +#define G_CHARSET_CONVERTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CHARSET_CONVERTER, GCharsetConverter)) +#define G_CHARSET_CONVERTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CHARSET_CONVERTER, GCharsetConverterClass)) +#define G_IS_CHARSET_CONVERTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CHARSET_CONVERTER)) +#define G_IS_CHARSET_CONVERTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CHARSET_CONVERTER)) +#define G_CHARSET_CONVERTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CHARSET_CONVERTER, GCharsetConverterClass)) -typedef struct _GumExceptorScope GumExceptorScope; +typedef struct _GCharsetConverterClass GCharsetConverterClass; -enum _GumExceptionType +struct _GCharsetConverterClass { - GUM_EXCEPTION_ABORT = 1, - GUM_EXCEPTION_ACCESS_VIOLATION, - GUM_EXCEPTION_GUARD_PAGE, - GUM_EXCEPTION_ILLEGAL_INSTRUCTION, - GUM_EXCEPTION_STACK_OVERFLOW, - GUM_EXCEPTION_ARITHMETIC, - GUM_EXCEPTION_BREAKPOINT, - GUM_EXCEPTION_SINGLE_STEP, - GUM_EXCEPTION_SYSTEM + GObjectClass parent_class; }; -struct _GumExceptionMemoryDetails -{ - GumMemoryOperation operation; - gpointer address; -}; +GIO_AVAILABLE_IN_ALL +GType g_charset_converter_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GCharsetConverter *g_charset_converter_new (const gchar *to_charset, + const gchar *from_charset, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_charset_converter_set_use_fallback (GCharsetConverter *converter, + gboolean use_fallback); +GIO_AVAILABLE_IN_ALL +gboolean g_charset_converter_get_use_fallback (GCharsetConverter *converter); +GIO_AVAILABLE_IN_ALL +guint g_charset_converter_get_num_fallbacks (GCharsetConverter *converter); -struct _GumExceptionDetails -{ - GumThreadId thread_id; - GumExceptionType type; - gpointer address; - GumExceptionMemoryDetails memory; - GumCpuContext context; - gpointer native_context; -}; +G_END_DECLS -struct _GumExceptorScope -{ - GumExceptionDetails exception; +#endif /* __G_CHARSET_CONVERTER_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ - /*< private */ - gboolean exception_occurred; - gpointer padding[2]; - GumExceptorNativeJmpBuf env; -#ifdef __ANDROID__ - sigset_t mask; +#ifndef __G_CONTENT_TYPE_H__ +#define __G_CONTENT_TYPE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif - GumExceptorScope * next; -}; -GUM_API void gum_exceptor_disable (void); +G_BEGIN_DECLS -GUM_API GumExceptor * gum_exceptor_obtain (void); +GIO_AVAILABLE_IN_ALL +gboolean g_content_type_equals (const gchar *type1, + const gchar *type2); +GIO_AVAILABLE_IN_ALL +gboolean g_content_type_is_a (const gchar *type, + const gchar *supertype); +GIO_AVAILABLE_IN_2_52 +gboolean g_content_type_is_mime_type (const gchar *type, + const gchar *mime_type); +GIO_AVAILABLE_IN_ALL +gboolean g_content_type_is_unknown (const gchar *type); +GIO_AVAILABLE_IN_ALL +gchar * g_content_type_get_description (const gchar *type); +GIO_AVAILABLE_IN_ALL +gchar * g_content_type_get_mime_type (const gchar *type); +GIO_AVAILABLE_IN_ALL +GIcon * g_content_type_get_icon (const gchar *type); +GIO_AVAILABLE_IN_2_34 +GIcon * g_content_type_get_symbolic_icon (const gchar *type); +GIO_AVAILABLE_IN_2_34 +gchar * g_content_type_get_generic_icon_name (const gchar *type); + +GIO_AVAILABLE_IN_ALL +gboolean g_content_type_can_be_executable (const gchar *type); + +GIO_AVAILABLE_IN_ALL +gchar * g_content_type_from_mime_type (const gchar *mime_type); + +GIO_AVAILABLE_IN_ALL +gchar * g_content_type_guess (const gchar *filename, + const guchar *data, + gsize data_size, + gboolean *result_uncertain); + +GIO_AVAILABLE_IN_ALL +gchar ** g_content_type_guess_for_tree (GFile *root); + +GIO_AVAILABLE_IN_ALL +GList * g_content_types_get_registered (void); -GUM_API void gum_exceptor_reset (GumExceptor * self); +/*< private >*/ +#ifndef __GTK_DOC_IGNORE__ +GIO_AVAILABLE_IN_2_60 +const gchar * const *g_content_type_get_mime_dirs (void); +GIO_AVAILABLE_IN_2_60 +void g_content_type_set_mime_dirs (const gchar * const *dirs); +#endif /* __GTK_DOC_IGNORE__ */ -GUM_API void gum_exceptor_add (GumExceptor * self, GumExceptionHandler func, - gpointer user_data); -GUM_API void gum_exceptor_remove (GumExceptor * self, GumExceptionHandler func, - gpointer user_data); +G_END_DECLS -#if defined (_MSC_VER) && defined (HAVE_I386) && GLIB_SIZEOF_VOID_P == 8 -/* - * On MSVC/x86_64 setjmp() is actually an intrinsic that calls _setjmp() with a - * a hidden second argument specifying the frame pointer. This makes sense when - * the longjmp() is guaranteed to happen from code we control, but is not - * reliable otherwise. +#endif /* __G_CONTENT_TYPE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson */ -# define gum_exceptor_try(self, scope) ( \ - _gum_exceptor_prepare_try (self, scope), \ - ((int (*) (jmp_buf env, void * frame_pointer)) _setjmp) ( \ - (scope)->env, NULL) == 0) -#else -# define gum_exceptor_try(self, scope) ( \ - _gum_exceptor_prepare_try (self, scope), \ - GUM_NATIVE_SETJMP ((scope)->env) == 0) + +#ifndef __G_CONVERTER_INPUT_STREAM_H__ +#define __G_CONVERTER_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif -GUM_API gboolean gum_exceptor_catch (GumExceptor * self, - GumExceptorScope * scope); -GUM_API gboolean gum_exceptor_has_scope (GumExceptor * self, - GumThreadId thread_id); -GUM_API gchar * gum_exception_details_to_string ( - const GumExceptionDetails * details); -GUM_API void _gum_exceptor_prepare_try (GumExceptor * self, - GumExceptorScope * scope); +G_BEGIN_DECLS -G_END_DECLS +#define G_TYPE_CONVERTER_INPUT_STREAM (g_converter_input_stream_get_type ()) +#define G_CONVERTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CONVERTER_INPUT_STREAM, GConverterInputStream)) +#define G_CONVERTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CONVERTER_INPUT_STREAM, GConverterInputStreamClass)) +#define G_IS_CONVERTER_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CONVERTER_INPUT_STREAM)) +#define G_IS_CONVERTER_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CONVERTER_INPUT_STREAM)) +#define G_CONVERTER_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CONVERTER_INPUT_STREAM, GConverterInputStreamClass)) -#endif -/* - * Copyright (C) 2009 Ole André Vadla Ravnås +/** + * GConverterInputStream: * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_FUNCTION_H__ -#define __GUM_FUNCTION_H__ + * An implementation of #GFilterInputStream that allows data + * conversion. + **/ +typedef struct _GConverterInputStreamClass GConverterInputStreamClass; +typedef struct _GConverterInputStreamPrivate GConverterInputStreamPrivate; -G_BEGIN_DECLS +struct _GConverterInputStream +{ + GFilterInputStream parent_instance; -typedef struct _GumFunctionDetails GumFunctionDetails; + /*< private >*/ + GConverterInputStreamPrivate *priv; +}; -struct _GumFunctionDetails +struct _GConverterInputStreamClass { - const gchar * name; - gpointer address; - gint num_arguments; + GFilterInputStreamClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); }; +GIO_AVAILABLE_IN_ALL +GType g_converter_input_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GInputStream *g_converter_input_stream_new (GInputStream *base_stream, + GConverter *converter); +GIO_AVAILABLE_IN_ALL +GConverter *g_converter_input_stream_get_converter (GConverterInputStream *converter_stream); + G_END_DECLS -#endif -/* - * Copyright (C) 2008-2024 Ole André Vadla Ravnås - * Copyright (C) 2008 Christian Berentsen - * Copyright (C) 2024 Francesco Tamagni +#endif /* __G_CONVERTER_INPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_INTERCEPTOR_H__ -#define __GUM_INTERCEPTOR_H__ - -/* - * Copyright (C) 2008-2022 Ole André Vadla Ravnås + * Copyright (C) 2009 Red Hat, Inc. * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_INVOCATION_LISTENER_H__ -#define __GUM_INVOCATION_LISTENER_H__ - -/* - * Copyright (C) 2008-2022 Ole André Vadla Ravnås + * SPDX-License-Identifier: LGPL-2.1-or-later * - * Licence: wxWindows Library Licence, Version 3.1 + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson */ -#ifndef __GUM_INVOCATION_CONTEXT_H__ -#define __GUM_INVOCATION_CONTEXT_H__ +#ifndef __G_CONVERTER_OUTPUT_STREAM_H__ +#define __G_CONVERTER_OUTPUT_STREAM_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -#define GUM_IC_GET_THREAD_DATA(context, data_type) \ - ((data_type *) gum_invocation_context_get_listener_thread_data (context, \ - sizeof (data_type))) -#define GUM_IC_GET_FUNC_DATA(context, data_type) \ - ((data_type) gum_invocation_context_get_listener_function_data (context)) -#define GUM_IC_GET_INVOCATION_DATA(context, data_type) \ - ((data_type *) \ - gum_invocation_context_get_listener_invocation_data (context,\ - sizeof (data_type))) +G_BEGIN_DECLS -#define GUM_IC_GET_REPLACEMENT_DATA(ctx, data_type) \ - ((data_type) gum_invocation_context_get_replacement_data (ctx)) +#define G_TYPE_CONVERTER_OUTPUT_STREAM (g_converter_output_stream_get_type ()) +#define G_CONVERTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CONVERTER_OUTPUT_STREAM, GConverterOutputStream)) +#define G_CONVERTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CONVERTER_OUTPUT_STREAM, GConverterOutputStreamClass)) +#define G_IS_CONVERTER_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CONVERTER_OUTPUT_STREAM)) +#define G_IS_CONVERTER_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CONVERTER_OUTPUT_STREAM)) +#define G_CONVERTER_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CONVERTER_OUTPUT_STREAM, GConverterOutputStreamClass)) -typedef struct _GumInvocationBackend GumInvocationBackend; -typedef struct _GumInvocationContext GumInvocationContext; -typedef guint GumPointCut; +/** + * GConverterOutputStream: + * + * An implementation of #GFilterOutputStream that allows data + * conversion. + **/ +typedef struct _GConverterOutputStreamClass GConverterOutputStreamClass; +typedef struct _GConverterOutputStreamPrivate GConverterOutputStreamPrivate; -struct _GumInvocationBackend +struct _GConverterOutputStream { - GumPointCut (* get_point_cut) (GumInvocationContext * context); - - GumThreadId (* get_thread_id) (GumInvocationContext * context); - guint (* get_depth) (GumInvocationContext * context); - - gpointer (* get_listener_thread_data) (GumInvocationContext * context, - gsize required_size); - gpointer (* get_listener_function_data) (GumInvocationContext * context); - gpointer (* get_listener_invocation_data) ( - GumInvocationContext * context, gsize required_size); + GFilterOutputStream parent_instance; - gpointer (* get_replacement_data) (GumInvocationContext * context); - - gpointer state; - gpointer data; + /*< private >*/ + GConverterOutputStreamPrivate *priv; }; -struct _GumInvocationContext +struct _GConverterOutputStreamClass { - gpointer function; - GumCpuContext * cpu_context; - gint system_error; - - /*< private */ - GumInvocationBackend * backend; -}; + GFilterOutputStreamClass parent_class; -enum _GumPointCut -{ - GUM_POINT_ENTER, - GUM_POINT_LEAVE + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); }; -G_BEGIN_DECLS - -GUM_API GumPointCut gum_invocation_context_get_point_cut ( - GumInvocationContext * context); - -GUM_API gpointer gum_invocation_context_get_nth_argument ( - GumInvocationContext * context, guint n); -GUM_API void gum_invocation_context_replace_nth_argument ( - GumInvocationContext * context, guint n, gpointer value); -GUM_API gpointer gum_invocation_context_get_return_value ( - GumInvocationContext * context); -GUM_API void gum_invocation_context_replace_return_value ( - GumInvocationContext * context, gpointer value); +GIO_AVAILABLE_IN_ALL +GType g_converter_output_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GOutputStream *g_converter_output_stream_new (GOutputStream *base_stream, + GConverter *converter); +GIO_AVAILABLE_IN_ALL +GConverter *g_converter_output_stream_get_converter (GConverterOutputStream *converter_stream); -GUM_API gpointer gum_invocation_context_get_return_address ( - GumInvocationContext * context); +G_END_DECLS -GUM_API guint gum_invocation_context_get_thread_id ( - GumInvocationContext * context); -GUM_API guint gum_invocation_context_get_depth ( - GumInvocationContext * context); +#endif /* __G_CONVERTER_OUTPUT_STREAM_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ -GUM_API gpointer gum_invocation_context_get_listener_thread_data ( - GumInvocationContext * context, gsize required_size); -GUM_API gpointer gum_invocation_context_get_listener_function_data ( - GumInvocationContext * context); -GUM_API gpointer gum_invocation_context_get_listener_invocation_data ( - GumInvocationContext * context, gsize required_size); +#ifndef __G_CREDENTIALS_H__ +#define __G_CREDENTIALS_H__ -GUM_API gpointer gum_invocation_context_get_replacement_data ( - GumInvocationContext * context); +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -G_END_DECLS +#ifdef G_OS_UNIX +/* To get the uid_t type */ +#include +#include #endif G_BEGIN_DECLS -#define GUM_TYPE_INVOCATION_LISTENER (gum_invocation_listener_get_type ()) -GUM_DECLARE_INTERFACE (GumInvocationListener, gum_invocation_listener, GUM, - INVOCATION_LISTENER, GObject) - -typedef void (* GumInvocationCallback) (GumInvocationContext * context, - gpointer user_data); +#define G_TYPE_CREDENTIALS (g_credentials_get_type ()) +#define G_CREDENTIALS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_CREDENTIALS, GCredentials)) +#define G_CREDENTIALS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_CREDENTIALS, GCredentialsClass)) +#define G_CREDENTIALS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_CREDENTIALS, GCredentialsClass)) +#define G_IS_CREDENTIALS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_CREDENTIALS)) +#define G_IS_CREDENTIALS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_CREDENTIALS)) -#ifndef GUM_DIET +typedef struct _GCredentialsClass GCredentialsClass; -struct _GumInvocationListenerInterface -{ - GTypeInterface parent; +GIO_AVAILABLE_IN_ALL +GType g_credentials_get_type (void) G_GNUC_CONST; - void (* on_enter) (GumInvocationListener * self, - GumInvocationContext * context); - void (* on_leave) (GumInvocationListener * self, - GumInvocationContext * context); -}; +GIO_AVAILABLE_IN_ALL +GCredentials *g_credentials_new (void); -#else +GIO_AVAILABLE_IN_ALL +gchar *g_credentials_to_string (GCredentials *credentials); -struct _GumInvocationListener -{ - GumObject parent; +GIO_AVAILABLE_IN_ALL +gpointer g_credentials_get_native (GCredentials *credentials, + GCredentialsType native_type); - GumInvocationCallback on_enter; - GumInvocationCallback on_leave; +GIO_AVAILABLE_IN_ALL +void g_credentials_set_native (GCredentials *credentials, + GCredentialsType native_type, + gpointer native); - gpointer data; - GDestroyNotify data_destroy; -}; +GIO_AVAILABLE_IN_ALL +gboolean g_credentials_is_same_user (GCredentials *credentials, + GCredentials *other_credentials, + GError **error); +#ifdef G_OS_UNIX +GIO_AVAILABLE_IN_2_36 +pid_t g_credentials_get_unix_pid (GCredentials *credentials, + GError **error); +GIO_AVAILABLE_IN_ALL +uid_t g_credentials_get_unix_user (GCredentials *credentials, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_credentials_set_unix_user (GCredentials *credentials, + uid_t uid, + GError **error); #endif -GUM_API GumInvocationListener * gum_make_call_listener ( - GumInvocationCallback on_enter, GumInvocationCallback on_leave, - gpointer data, GDestroyNotify data_destroy); -GUM_API GumInvocationListener * gum_make_probe_listener ( - GumInvocationCallback on_hit, gpointer data, GDestroyNotify data_destroy); +G_END_DECLS -GUM_API void gum_invocation_listener_on_enter (GumInvocationListener * self, - GumInvocationContext * context); -GUM_API void gum_invocation_listener_on_leave (GumInvocationListener * self, - GumInvocationContext * context); +#endif /* __G_CREDENTIALS_H__ */ +/* + * Copyright 2015 Collabora Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Philip Withnall + */ -G_END_DECLS +#ifndef __G_DATAGRAM_BASED_H__ +#define __G_DATAGRAM_BASED_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif -G_BEGIN_DECLS - -#define GUM_TYPE_INTERCEPTOR (gum_interceptor_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumInterceptor, gum_interceptor, GUM, INTERCEPTOR, - GObject) - -typedef GArray GumInvocationStack; -typedef guint GumInvocationState; -typedef void (* GumInterceptorLockedFunc) (gpointer user_data); - -typedef enum -{ - GUM_ATTACH_OK = 0, - GUM_ATTACH_WRONG_SIGNATURE = -1, - GUM_ATTACH_ALREADY_ATTACHED = -2, - GUM_ATTACH_POLICY_VIOLATION = -3, - GUM_ATTACH_WRONG_TYPE = -4, -} GumAttachReturn; - -typedef enum -{ - GUM_REPLACE_OK = 0, - GUM_REPLACE_WRONG_SIGNATURE = -1, - GUM_REPLACE_ALREADY_REPLACED = -2, - GUM_REPLACE_POLICY_VIOLATION = -3, - GUM_REPLACE_WRONG_TYPE = -4, -} GumReplaceReturn; - -GUM_API GumInterceptor * gum_interceptor_obtain (void); - -GUM_API GumAttachReturn gum_interceptor_attach (GumInterceptor * self, - gpointer function_address, GumInvocationListener * listener, - gpointer listener_function_data); -GUM_API void gum_interceptor_detach (GumInterceptor * self, - GumInvocationListener * listener); - -GUM_API GumReplaceReturn gum_interceptor_replace (GumInterceptor * self, - gpointer function_address, gpointer replacement_function, - gpointer replacement_data, gpointer * original_function); -GumReplaceReturn gum_interceptor_replace_fast (GumInterceptor * self, - gpointer function_address, gpointer replacement_function, - gpointer * original_function); -GUM_API void gum_interceptor_revert (GumInterceptor * self, - gpointer function_address); - -GUM_API void gum_interceptor_begin_transaction (GumInterceptor * self); -GUM_API void gum_interceptor_end_transaction (GumInterceptor * self); -GUM_API gboolean gum_interceptor_flush (GumInterceptor * self); - -GUM_API GumInvocationContext * gum_interceptor_get_current_invocation (void); -GUM_API GumInvocationContext * gum_interceptor_get_live_replacement_invocation ( - gpointer replacement_function); -GUM_API GumInvocationStack * gum_interceptor_get_current_stack (void); - -GUM_API void gum_interceptor_ignore_current_thread (GumInterceptor * self); -GUM_API void gum_interceptor_unignore_current_thread (GumInterceptor * self); -GUM_API gboolean gum_interceptor_maybe_unignore_current_thread ( - GumInterceptor * self); - -GUM_API void gum_interceptor_ignore_other_threads (GumInterceptor * self); -GUM_API void gum_interceptor_unignore_other_threads (GumInterceptor * self); - -GUM_API gpointer gum_invocation_stack_translate (GumInvocationStack * self, - gpointer return_address); - -GUM_API void gum_interceptor_save (GumInvocationState * state); -GUM_API void gum_interceptor_restore (GumInvocationState * state); -GUM_API void gum_interceptor_with_lock_held (GumInterceptor * self, - GumInterceptorLockedFunc func, gpointer user_data); -GUM_API gboolean gum_interceptor_is_locked (GumInterceptor * self); +G_BEGIN_DECLS -G_END_DECLS +#define G_TYPE_DATAGRAM_BASED (g_datagram_based_get_type ()) +#define G_DATAGRAM_BASED(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_DATAGRAM_BASED, GDatagramBased)) +#define G_IS_DATAGRAM_BASED(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_DATAGRAM_BASED)) +#define G_DATAGRAM_BASED_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \ + G_TYPE_DATAGRAM_BASED, \ + GDatagramBasedInterface)) +#define G_TYPE_IS_DATAGRAM_BASED(type) (g_type_is_a ((type), \ + G_TYPE_DATAGRAM_BASED)) -#endif -/* - * Copyright (C) 2015-2021 Ole André Vadla Ravnås +/** + * GDatagramBased: * - * Licence: wxWindows Library Licence, Version 3.1 + * Interface for socket-like objects with datagram semantics. + * + * Since: 2.48 */ +typedef struct _GDatagramBasedInterface GDatagramBasedInterface; -#ifndef __GUM_KERNEL_H__ -#define __GUM_KERNEL_H__ - - -G_BEGIN_DECLS - -typedef struct _GumKernelModuleRangeDetails GumKernelModuleRangeDetails; - -struct _GumKernelModuleRangeDetails +/** + * GDatagramBasedInterface: + * @g_iface: The parent interface. + * @receive_messages: Virtual method for g_datagram_based_receive_messages(). + * @send_messages: Virtual method for g_datagram_based_send_messages(). + * @create_source: Virtual method for g_datagram_based_create_source(). + * @condition_check: Virtual method for g_datagram_based_condition_check(). + * @condition_wait: Virtual method for + * g_datagram_based_condition_wait(). + * + * Provides an interface for socket-like objects which have datagram semantics, + * following the Berkeley sockets API. The interface methods are thin wrappers + * around the corresponding virtual methods, and no pre-processing of inputs is + * implemented — so implementations of this API must handle all functionality + * documented in the interface methods. + * + * Since: 2.48 + */ +struct _GDatagramBasedInterface { - gchar name[48]; - GumAddress address; - guint64 size; - GumPageProtection protection; + GTypeInterface g_iface; + + /* Virtual table */ + gint (*receive_messages) (GDatagramBased *datagram_based, + GInputMessage *messages, + guint num_messages, + gint flags, + gint64 timeout, + GCancellable *cancellable, + GError **error); + gint (*send_messages) (GDatagramBased *datagram_based, + GOutputMessage *messages, + guint num_messages, + gint flags, + gint64 timeout, + GCancellable *cancellable, + GError **error); + + GSource *(*create_source) (GDatagramBased *datagram_based, + GIOCondition condition, + GCancellable *cancellable); + GIOCondition (*condition_check) (GDatagramBased *datagram_based, + GIOCondition condition); + gboolean (*condition_wait) (GDatagramBased *datagram_based, + GIOCondition condition, + gint64 timeout, + GCancellable *cancellable, + GError **error); }; -typedef gboolean (* GumFoundKernelModuleRangeFunc) ( - const GumKernelModuleRangeDetails * details, gpointer user_data); +GIO_AVAILABLE_IN_2_48 +GType +g_datagram_based_get_type (void); -GUM_API gboolean gum_kernel_api_is_available (void); -GUM_API guint gum_kernel_query_page_size (void); -GUM_API GumAddress gum_kernel_alloc_n_pages (guint n_pages); -GUM_API void gum_kernel_free_pages (GumAddress mem); -GUM_API gboolean gum_kernel_try_mprotect (GumAddress address, gsize size, - GumPageProtection prot); -GUM_API guint8 * gum_kernel_read (GumAddress address, gsize len, - gsize * n_bytes_read); -GUM_API gboolean gum_kernel_write (GumAddress address, const guint8 * bytes, - gsize len); -GUM_API void gum_kernel_scan (const GumMemoryRange * range, - const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, - gpointer user_data); -GUM_API void gum_kernel_enumerate_ranges (GumPageProtection prot, - GumFoundRangeFunc func, gpointer user_data); -GUM_API void gum_kernel_enumerate_module_ranges (const gchar * module_name, - GumPageProtection prot, GumFoundKernelModuleRangeFunc func, - gpointer user_data); -GUM_API void gum_kernel_enumerate_modules (GumFoundModuleFunc func, - gpointer user_data); -GUM_API GumAddress gum_kernel_find_base_address (void); -GUM_API void gum_kernel_set_base_address (GumAddress base); +GIO_AVAILABLE_IN_2_48 +gint +g_datagram_based_receive_messages (GDatagramBased *datagram_based, + GInputMessage *messages, + guint num_messages, + gint flags, + gint64 timeout, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_48 +gint +g_datagram_based_send_messages (GDatagramBased *datagram_based, + GOutputMessage *messages, + guint num_messages, + gint flags, + gint64 timeout, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_48 +GSource * +g_datagram_based_create_source (GDatagramBased *datagram_based, + GIOCondition condition, + GCancellable *cancellable); +GIO_AVAILABLE_IN_2_48 +GIOCondition +g_datagram_based_condition_check (GDatagramBased *datagram_based, + GIOCondition condition); +GIO_AVAILABLE_IN_2_48 +gboolean +g_datagram_based_condition_wait (GDatagramBased *datagram_based, + GIOCondition condition, + gint64 timeout, + GCancellable *cancellable, + GError **error); G_END_DECLS -#endif -/* - * Copyright (C) 2015-2021 Ole André Vadla Ravnås +#endif /* __G_DATAGRAM_BASED_H__ */ +/* GIO - GLib Input, Output and Streaming Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson */ -#ifndef __GUM_LIBC_H__ -#define __GUM_LIBC_H__ - - -G_BEGIN_DECLS - -GUM_API gpointer gum_memset (gpointer dst, gint c, gsize n); -GUM_API gpointer gum_memcpy (gpointer dst, gconstpointer src, gsize n); -GUM_API gpointer gum_memmove (gpointer dst, gconstpointer src, gsize n); - -G_END_DECLS +#ifndef __G_DATA_INPUT_STREAM_H__ +#define __G_DATA_INPUT_STREAM_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." #endif -/* - * Copyright (C) 2010-2022 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_MEMORY_ACCESS_MONITOR_H__ -#define __GUM_MEMORY_ACCESS_MONITOR_H__ G_BEGIN_DECLS -#define GUM_TYPE_MEMORY_ACCESS_MONITOR (gum_memory_access_monitor_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumMemoryAccessMonitor, gum_memory_access_monitor, GUM, - MEMORY_ACCESS_MONITOR, GObject) - -typedef struct _GumMemoryAccessDetails GumMemoryAccessDetails; +#define G_TYPE_DATA_INPUT_STREAM (g_data_input_stream_get_type ()) +#define G_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStream)) +#define G_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass)) +#define G_IS_DATA_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_INPUT_STREAM)) +#define G_IS_DATA_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_INPUT_STREAM)) +#define G_DATA_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_INPUT_STREAM, GDataInputStreamClass)) -typedef void (* GumMemoryAccessNotify) (GumMemoryAccessMonitor * monitor, - const GumMemoryAccessDetails * details, gpointer user_data); +/** + * GDataInputStream: + * + * An implementation of #GBufferedInputStream that allows for high-level + * data manipulation of arbitrary data (including binary operations). + **/ +typedef struct _GDataInputStreamClass GDataInputStreamClass; +typedef struct _GDataInputStreamPrivate GDataInputStreamPrivate; -struct _GumMemoryAccessDetails +struct _GDataInputStream { - GumMemoryOperation operation; - gpointer from; - gpointer address; + GBufferedInputStream parent_instance; - guint range_index; - guint page_index; - guint pages_completed; - guint pages_total; + /*< private >*/ + GDataInputStreamPrivate *priv; }; -GUM_API GumMemoryAccessMonitor * gum_memory_access_monitor_new ( - const GumMemoryRange * ranges, guint num_ranges, - GumPageProtection access_mask, gboolean auto_reset, - GumMemoryAccessNotify func, gpointer data, - GDestroyNotify data_destroy); +struct _GDataInputStreamClass +{ + GBufferedInputStreamClass parent_class; -GUM_API gboolean gum_memory_access_monitor_enable ( - GumMemoryAccessMonitor * self, GError ** error); -GUM_API void gum_memory_access_monitor_disable (GumMemoryAccessMonitor * self); + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_data_input_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDataInputStream * g_data_input_stream_new (GInputStream *base_stream); + +GIO_AVAILABLE_IN_ALL +void g_data_input_stream_set_byte_order (GDataInputStream *stream, + GDataStreamByteOrder order); +GIO_AVAILABLE_IN_ALL +GDataStreamByteOrder g_data_input_stream_get_byte_order (GDataInputStream *stream); +GIO_AVAILABLE_IN_ALL +void g_data_input_stream_set_newline_type (GDataInputStream *stream, + GDataStreamNewlineType type); +GIO_AVAILABLE_IN_ALL +GDataStreamNewlineType g_data_input_stream_get_newline_type (GDataInputStream *stream); +GIO_AVAILABLE_IN_ALL +guchar g_data_input_stream_read_byte (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gint16 g_data_input_stream_read_int16 (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +guint16 g_data_input_stream_read_uint16 (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gint32 g_data_input_stream_read_int32 (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +guint32 g_data_input_stream_read_uint32 (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gint64 g_data_input_stream_read_int64 (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +guint64 g_data_input_stream_read_uint64 (GDataInputStream *stream, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +char * g_data_input_stream_read_line (GDataInputStream *stream, + gsize *length, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_30 +char * g_data_input_stream_read_line_utf8 (GDataInputStream *stream, + gsize *length, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_data_input_stream_read_line_async (GDataInputStream *stream, + gint io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +char * g_data_input_stream_read_line_finish (GDataInputStream *stream, + GAsyncResult *result, + gsize *length, + GError **error); +GIO_AVAILABLE_IN_2_30 +char * g_data_input_stream_read_line_finish_utf8(GDataInputStream *stream, + GAsyncResult *result, + gsize *length, + GError **error); +GIO_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto) +char * g_data_input_stream_read_until (GDataInputStream *stream, + const gchar *stop_chars, + gsize *length, + GCancellable *cancellable, + GError **error); +GIO_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto_async) +void g_data_input_stream_read_until_async (GDataInputStream *stream, + const gchar *stop_chars, + gint io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_DEPRECATED_IN_2_56_FOR (g_data_input_stream_read_upto_finish) +char * g_data_input_stream_read_until_finish (GDataInputStream *stream, + GAsyncResult *result, + gsize *length, + GError **error); + +GIO_AVAILABLE_IN_ALL +char * g_data_input_stream_read_upto (GDataInputStream *stream, + const gchar *stop_chars, + gssize stop_chars_len, + gsize *length, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_data_input_stream_read_upto_async (GDataInputStream *stream, + const gchar *stop_chars, + gssize stop_chars_len, + gint io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +char * g_data_input_stream_read_upto_finish (GDataInputStream *stream, + GAsyncResult *result, + gsize *length, + GError **error); G_END_DECLS -#endif -/* - * Copyright (C) 2013-2022 Ole André Vadla Ravnås +#endif /* __G_DATA_INPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson */ -#ifndef __GUM_MEMORY_MAP_H__ -#define __GUM_MEMORY_MAP_H__ - - -G_BEGIN_DECLS - -#define GUM_TYPE_MEMORY_MAP (gum_memory_map_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumMemoryMap, gum_memory_map, GUM, MEMORY_MAP, GObject) +#ifndef __G_DATA_OUTPUT_STREAM_H__ +#define __G_DATA_OUTPUT_STREAM_H__ -GUM_API GumMemoryMap * gum_memory_map_new (GumPageProtection prot); +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -GUM_API gboolean gum_memory_map_contains (GumMemoryMap * self, - const GumMemoryRange * range); -GUM_API void gum_memory_map_update (GumMemoryMap * self); +G_BEGIN_DECLS -G_END_DECLS +#define G_TYPE_DATA_OUTPUT_STREAM (g_data_output_stream_get_type ()) +#define G_DATA_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DATA_OUTPUT_STREAM, GDataOutputStream)) +#define G_DATA_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DATA_OUTPUT_STREAM, GDataOutputStreamClass)) +#define G_IS_DATA_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DATA_OUTPUT_STREAM)) +#define G_IS_DATA_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DATA_OUTPUT_STREAM)) +#define G_DATA_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DATA_OUTPUT_STREAM, GDataOutputStreamClass)) -#endif -/* - * Copyright (C) 2017-2019 Ole André Vadla Ravnås +/** + * GDataOutputStream: * - * Licence: wxWindows Library Licence, Version 3.1 - */ - -#ifndef __GUM_METAL_ARRAY_H__ -#define __GUM_METAL_ARRAY_H__ - - -typedef struct _GumMetalArray GumMetalArray; + * An implementation of #GBufferedOutputStream that allows for high-level + * data manipulation of arbitrary data (including binary operations). + **/ +typedef struct _GDataOutputStream GDataOutputStream; +typedef struct _GDataOutputStreamClass GDataOutputStreamClass; +typedef struct _GDataOutputStreamPrivate GDataOutputStreamPrivate; -struct _GumMetalArray +struct _GDataOutputStream { - gpointer data; - guint length; - guint capacity; + GFilterOutputStream parent_instance; - guint element_size; + /*< private >*/ + GDataOutputStreamPrivate *priv; }; -G_BEGIN_DECLS +struct _GDataOutputStreamClass +{ + GFilterOutputStreamClass parent_class; -GUM_API void gum_metal_array_init (GumMetalArray * array, guint element_size); -GUM_API void gum_metal_array_free (GumMetalArray * array); + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; -GUM_API gpointer gum_metal_array_element_at (GumMetalArray * self, - guint index_); -GUM_API gpointer gum_metal_array_insert_at (GumMetalArray * self, guint index_); -GUM_API void gum_metal_array_remove_at (GumMetalArray * self, guint index_); -GUM_API void gum_metal_array_remove_all (GumMetalArray * self); -GUM_API gpointer gum_metal_array_append (GumMetalArray * self); -GUM_API void gum_metal_array_get_extents (GumMetalArray * self, - gpointer * start, gpointer * end); -GUM_API void gum_metal_array_ensure_capacity (GumMetalArray * self, - guint capacity); +GIO_AVAILABLE_IN_ALL +GType g_data_output_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDataOutputStream * g_data_output_stream_new (GOutputStream *base_stream); + +GIO_AVAILABLE_IN_ALL +void g_data_output_stream_set_byte_order (GDataOutputStream *stream, + GDataStreamByteOrder order); +GIO_AVAILABLE_IN_ALL +GDataStreamByteOrder g_data_output_stream_get_byte_order (GDataOutputStream *stream); + +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_byte (GDataOutputStream *stream, + guchar data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_int16 (GDataOutputStream *stream, + gint16 data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_uint16 (GDataOutputStream *stream, + guint16 data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_int32 (GDataOutputStream *stream, + gint32 data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_uint32 (GDataOutputStream *stream, + guint32 data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_int64 (GDataOutputStream *stream, + gint64 data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_uint64 (GDataOutputStream *stream, + guint64 data, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_data_output_stream_put_string (GDataOutputStream *stream, + const char *str, + GCancellable *cancellable, + GError **error); G_END_DECLS -#endif -/* GLIB - Library of useful routines for C programming - * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald +#endif /* __G_DATA_OUTPUT_STREAM_H__ */ +/* + * Copyright © 2010 Codethink Limited + * Copyright © 2011 Canonical Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie */ -/* - * Modified by the GLib Team and others 1997-2000. See the AUTHORS - * file for a list of people on the GLib Team. See the ChangeLog - * files for a list of changes. These files are distributed with - * GLib at ftp://ftp.gtk.org/pub/gtk/. - */ +#ifndef __G_DBUS_ACTION_GROUP_H__ +#define __G_DBUS_ACTION_GROUP_H__ -#ifndef __GUM_METAL_HASH_H__ -#define __GUM_METAL_HASH_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif G_BEGIN_DECLS -typedef struct _GumMetalHashTable GumMetalHashTable; -typedef struct _GumMetalHashTableIter GumMetalHashTableIter; - -struct _GumMetalHashTableIter -{ - gpointer dummy1; - gpointer dummy2; - gpointer dummy3; - int dummy4; - gboolean dummy5; - gpointer dummy6; -}; - -GUM_API GumMetalHashTable * gum_metal_hash_table_new (GHashFunc hash_func, - GEqualFunc key_equal_func); -GUM_API GumMetalHashTable * gum_metal_hash_table_new_full (GHashFunc hash_func, - GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, - GDestroyNotify value_destroy_func); -GUM_API void gum_metal_hash_table_destroy (GumMetalHashTable * hash_table); -GUM_API gboolean gum_metal_hash_table_insert (GumMetalHashTable * hash_table, - gpointer key, gpointer value); -GUM_API gboolean gum_metal_hash_table_replace (GumMetalHashTable * hash_table, - gpointer key, gpointer value); -GUM_API gboolean gum_metal_hash_table_add (GumMetalHashTable * hash_table, - gpointer key); -GUM_API gboolean gum_metal_hash_table_remove (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API void gum_metal_hash_table_remove_all (GumMetalHashTable * hash_table); -GUM_API gboolean gum_metal_hash_table_steal (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API void gum_metal_hash_table_steal_all (GumMetalHashTable * hash_table); -GUM_API gpointer gum_metal_hash_table_lookup (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API gboolean gum_metal_hash_table_contains (GumMetalHashTable * hash_table, - gconstpointer key); -GUM_API gboolean gum_metal_hash_table_lookup_extended ( - GumMetalHashTable * hash_table, gconstpointer lookup_key, - gpointer * orig_key, gpointer * value); -GUM_API void gum_metal_hash_table_foreach (GumMetalHashTable * hash_table, - GHFunc func, gpointer user_data); -GUM_API gpointer gum_metal_hash_table_find (GumMetalHashTable * hash_table, - GHRFunc predicate, gpointer user_data); -GUM_API guint gum_metal_hash_table_foreach_remove ( - GumMetalHashTable * hash_table, GHRFunc func, gpointer user_data); -GUM_API guint gum_metal_hash_table_foreach_steal (GumMetalHashTable * hash_table, - GHRFunc func, gpointer user_data); -GUM_API guint gum_metal_hash_table_size (GumMetalHashTable * hash_table); - -GUM_API void gum_metal_hash_table_iter_init (GumMetalHashTableIter * iter, - GumMetalHashTable * hash_table); -GUM_API gboolean gum_metal_hash_table_iter_next (GumMetalHashTableIter * iter, - gpointer * key, gpointer * value); -GUM_API GumMetalHashTable* gum_metal_hash_table_iter_get_hash_table ( - GumMetalHashTableIter * iter); -GUM_API void gum_metal_hash_table_iter_remove (GumMetalHashTableIter * iter); -GUM_API void gum_metal_hash_table_iter_replace (GumMetalHashTableIter * iter, - gpointer value); -GUM_API void gum_metal_hash_table_iter_steal (GumMetalHashTableIter * iter); - -GUM_API GumMetalHashTable * gum_metal_hash_table_ref ( - GumMetalHashTable * hash_table); -GUM_API void gum_metal_hash_table_unref (GumMetalHashTable * hash_table); +#define G_TYPE_DBUS_ACTION_GROUP (g_dbus_action_group_get_type ()) +#define G_DBUS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_DBUS_ACTION_GROUP, GDBusActionGroup)) +#define G_DBUS_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_DBUS_ACTION_GROUP, GDBusActionGroupClass)) +#define G_IS_DBUS_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_DBUS_ACTION_GROUP)) +#define G_IS_DBUS_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_DBUS_ACTION_GROUP)) +#define G_DBUS_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_DBUS_ACTION_GROUP, GDBusActionGroupClass)) + +GIO_AVAILABLE_IN_ALL +GType g_dbus_action_group_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +GDBusActionGroup * g_dbus_action_group_get (GDBusConnection *connection, + const gchar *bus_name, + const gchar *object_path); G_END_DECLS -#endif -/* - * Copyright (C) 2016-2022 Ole André Vadla Ravnås +#endif /* __G_DBUS_ACTION_GROUP_H__ */ +/* GDBus - GLib D-Bus Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen */ -#ifndef __GUM_MODULE_API_RESOLVER_H__ -#define __GUM_MODULE_API_RESOLVER_H__ +#ifndef __G_DBUS_ADDRESS_H__ +#define __G_DBUS_ADDRESS_H__ +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -G_BEGIN_DECLS -#define GUM_TYPE_MODULE_API_RESOLVER (gum_module_api_resolver_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumModuleApiResolver, gum_module_api_resolver, GUM, - MODULE_API_RESOLVER, GObject) +G_BEGIN_DECLS -GUM_API GumApiResolver * gum_module_api_resolver_new (void); +GIO_AVAILABLE_IN_2_36 +gchar *g_dbus_address_escape_value (const gchar *string); + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_address (const gchar *string); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_supported_address (const gchar *string, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_dbus_address_get_stream (const gchar *address, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GIOStream *g_dbus_address_get_stream_finish (GAsyncResult *res, + gchar **out_guid, + GError **error); + +GIO_AVAILABLE_IN_ALL +GIOStream *g_dbus_address_get_stream_sync (const gchar *address, + gchar **out_guid, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_address_get_for_bus_sync (GBusType bus_type, + GCancellable *cancellable, + GError **error); G_END_DECLS -#endif -/* - * Copyright (C) 2015-2022 Ole André Vadla Ravnås +#endif /* __G_DBUS_ADDRESS_H__ */ +/* GDBus - GLib D-Bus Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen */ -#ifndef __GUM_MODULE_MAP_H__ -#define __GUM_MODULE_MAP_H__ - - -G_BEGIN_DECLS +#ifndef __G_DBUS_AUTH_OBSERVER_H__ +#define __G_DBUS_AUTH_OBSERVER_H__ -#define GUM_TYPE_MODULE_MAP (gum_module_map_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumModuleMap, gum_module_map, GUM, MODULE_MAP, GObject) +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -typedef gboolean (* GumModuleMapFilterFunc) (const GumModuleDetails * details, - gpointer user_data); -GUM_API GumModuleMap * gum_module_map_new (void); -GUM_API GumModuleMap * gum_module_map_new_filtered (GumModuleMapFilterFunc func, - gpointer data, GDestroyNotify data_destroy); +G_BEGIN_DECLS -GUM_API const GumModuleDetails * gum_module_map_find (GumModuleMap * self, - GumAddress address); +#define G_TYPE_DBUS_AUTH_OBSERVER (g_dbus_auth_observer_get_type ()) +#define G_DBUS_AUTH_OBSERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_AUTH_OBSERVER, GDBusAuthObserver)) +#define G_IS_DBUS_AUTH_OBSERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_AUTH_OBSERVER)) -GUM_API void gum_module_map_update (GumModuleMap * self); +GIO_AVAILABLE_IN_ALL +GType g_dbus_auth_observer_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusAuthObserver *g_dbus_auth_observer_new (void); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_auth_observer_authorize_authenticated_peer (GDBusAuthObserver *observer, + GIOStream *stream, + GCredentials *credentials); -GUM_API GArray * gum_module_map_get_values (GumModuleMap * self); +GIO_AVAILABLE_IN_2_34 +gboolean g_dbus_auth_observer_allow_mechanism (GDBusAuthObserver *observer, + const gchar *mechanism); G_END_DECLS -#endif -/* - * Copyright (C) 2014 Ole André Vadla Ravnås +#endif /* _G_DBUS_AUTH_OBSERVER_H__ */ +/* GDBus - GLib D-Bus Library * - * Licence: wxWindows Library Licence, Version 3.1 + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen */ -#ifndef __GUM_PRINTF_H__ -#define __GUM_PRINTF_H__ +#ifndef __G_DBUS_CONNECTION_H__ +#define __G_DBUS_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif G_BEGIN_DECLS -gint gum_vsnprintf (gchar * str, gsize size, const gchar * format, - va_list args); -gint gum_snprintf (gchar * str, gsize size, const gchar * format, ...); -gint gum_vasprintf (gchar ** ret, const gchar * format, va_list ap); -gint gum_asprintf (gchar ** ret, const gchar * format, ...); +#define G_TYPE_DBUS_CONNECTION (g_dbus_connection_get_type ()) +#define G_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_CONNECTION, GDBusConnection)) +#define G_IS_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_CONNECTION)) + +GIO_AVAILABLE_IN_ALL +GType g_dbus_connection_get_type (void) G_GNUC_CONST; + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +void g_bus_get (GBusType bus_type, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_bus_get_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_bus_get_sync (GBusType bus_type, + GCancellable *cancellable, + GError **error); + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_new (GIOStream *stream, + const gchar *guid, + GDBusConnectionFlags flags, + GDBusAuthObserver *observer, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_connection_new_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_connection_new_sync (GIOStream *stream, + const gchar *guid, + GDBusConnectionFlags flags, + GDBusAuthObserver *observer, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_new_for_address (const gchar *address, + GDBusConnectionFlags flags, + GDBusAuthObserver *observer, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_connection_new_for_address_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_connection_new_for_address_sync (const gchar *address, + GDBusConnectionFlags flags, + GDBusAuthObserver *observer, + GCancellable *cancellable, + GError **error); + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_start_message_processing (GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_is_closed (GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +GIOStream *g_dbus_connection_get_stream (GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_connection_get_guid (GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_connection_get_unique_name (GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +GCredentials *g_dbus_connection_get_peer_credentials (GDBusConnection *connection); + +GIO_AVAILABLE_IN_2_34 +guint32 g_dbus_connection_get_last_serial (GDBusConnection *connection); + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_get_exit_on_close (GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_set_exit_on_close (GDBusConnection *connection, + gboolean exit_on_close); +GIO_AVAILABLE_IN_ALL +GDBusCapabilityFlags g_dbus_connection_get_capabilities (GDBusConnection *connection); +GIO_AVAILABLE_IN_2_60 +GDBusConnectionFlags g_dbus_connection_get_flags (GDBusConnection *connection); + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_close (GDBusConnection *connection, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_close_finish (GDBusConnection *connection, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_close_sync (GDBusConnection *connection, + GCancellable *cancellable, + GError **error); + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_flush (GDBusConnection *connection, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_flush_finish (GDBusConnection *connection, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_flush_sync (GDBusConnection *connection, + GCancellable *cancellable, + GError **error); + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_send_message (GDBusConnection *connection, + GDBusMessage *message, + GDBusSendMessageFlags flags, + volatile guint32 *out_serial, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_send_message_with_reply (GDBusConnection *connection, + GDBusMessage *message, + GDBusSendMessageFlags flags, + gint timeout_msec, + volatile guint32 *out_serial, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_connection_send_message_with_reply_finish (GDBusConnection *connection, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection, + GDBusMessage *message, + GDBusSendMessageFlags flags, + gint timeout_msec, + volatile guint32 *out_serial, + GCancellable *cancellable, + GError **error); + +/* ---------------------------------------------------------------------------------------------------- */ + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_emit_signal (GDBusConnection *connection, + const gchar *destination_bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_call (GDBusConnection *connection, + const gchar *bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + const GVariantType *reply_type, + GDBusCallFlags flags, + gint timeout_msec, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_connection_call_finish (GDBusConnection *connection, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_connection_call_sync (GDBusConnection *connection, + const gchar *bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + const GVariantType *reply_type, + GDBusCallFlags flags, + gint timeout_msec, + GCancellable *cancellable, + GError **error); -G_END_DECLS +#ifdef G_OS_UNIX -#endif -/* - * Copyright (C) 2010-2024 Ole André Vadla Ravnås - * Copyright (C) 2024 Francesco Tamagni +GIO_AVAILABLE_IN_2_30 +void g_dbus_connection_call_with_unix_fd_list (GDBusConnection *connection, + const gchar *bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + const GVariantType *reply_type, + GDBusCallFlags flags, + gint timeout_msec, + GUnixFDList *fd_list, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_30 +GVariant *g_dbus_connection_call_with_unix_fd_list_finish (GDBusConnection *connection, + GUnixFDList **out_fd_list, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_2_30 +GVariant *g_dbus_connection_call_with_unix_fd_list_sync (GDBusConnection *connection, + const gchar *bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + const GVariantType *reply_type, + GDBusCallFlags flags, + gint timeout_msec, + GUnixFDList *fd_list, + GUnixFDList **out_fd_list, + GCancellable *cancellable, + GError **error); + +#endif /* G_OS_UNIX */ + +/* ---------------------------------------------------------------------------------------------------- */ + + +/** + * GDBusInterfaceMethodCallFunc: + * @connection: A #GDBusConnection. + * @sender: The unique bus name of the remote caller. + * @object_path: The object path that the method was invoked on. + * @interface_name: The D-Bus interface name the method was invoked on. + * @method_name: The name of the method that was invoked. + * @parameters: A #GVariant tuple with parameters. + * @invocation: (transfer full): A #GDBusMethodInvocation object that must be used to return a value or error. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). + * + * The type of the @method_call function in #GDBusInterfaceVTable. * - * Licence: wxWindows Library Licence, Version 3.1 + * Since: 2.26 */ +typedef void (*GDBusInterfaceMethodCallFunc) (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + GDBusMethodInvocation *invocation, + gpointer user_data); -#ifndef __GUM_SPINLOCK_H__ -#define __GUM_SPINLOCK_H__ - - -#define GUM_SPINLOCK_INIT { NULL } - -G_BEGIN_DECLS +/** + * GDBusInterfaceGetPropertyFunc: + * @connection: A #GDBusConnection. + * @sender: The unique bus name of the remote caller. + * @object_path: The object path that the method was invoked on. + * @interface_name: The D-Bus interface name for the property. + * @property_name: The name of the property to get the value of. + * @error: Return location for error. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). + * + * The type of the @get_property function in #GDBusInterfaceVTable. + * + * Returns: A #GVariant with the value for @property_name or %NULL if + * @error is set. If the returned #GVariant is floating, it is + * consumed - otherwise its reference count is decreased by one. + * + * Since: 2.26 + */ +typedef GVariant *(*GDBusInterfaceGetPropertyFunc) (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GError **error, + gpointer user_data); -typedef struct _GumSpinlock GumSpinlock; +/** + * GDBusInterfaceSetPropertyFunc: + * @connection: A #GDBusConnection. + * @sender: The unique bus name of the remote caller. + * @object_path: The object path that the method was invoked on. + * @interface_name: The D-Bus interface name for the property. + * @property_name: The name of the property to get the value of. + * @value: The value to set the property to. + * @error: Return location for error. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_object(). + * + * The type of the @set_property function in #GDBusInterfaceVTable. + * + * Returns: %TRUE if the property was set to @value, %FALSE if @error is set. + * + * Since: 2.26 + */ +typedef gboolean (*GDBusInterfaceSetPropertyFunc) (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *property_name, + GVariant *value, + GError **error, + gpointer user_data); -struct _GumSpinlock +/** + * GDBusInterfaceVTable: + * @method_call: Function for handling incoming method calls. + * @get_property: Function for getting a property. + * @set_property: Function for setting a property. + * + * Virtual table for handling properties and method calls for a D-Bus + * interface. + * + * Since 2.38, if you want to handle getting/setting D-Bus properties + * asynchronously, give %NULL as your get_property() or set_property() + * function. The D-Bus call will be directed to your @method_call function, + * with the provided @interface_name set to "org.freedesktop.DBus.Properties". + * + * Ownership of the #GDBusMethodInvocation object passed to the + * method_call() function is transferred to your handler; you must + * call one of the methods of #GDBusMethodInvocation to return a reply + * (possibly empty), or an error. These functions also take ownership + * of the passed-in invocation object, so unless the invocation + * object has otherwise been referenced, it will be then be freed. + * Calling one of these functions may be done within your + * method_call() implementation but it also can be done at a later + * point to handle the method asynchronously. + * + * The usual checks on the validity of the calls is performed. For + * `Get` calls, an error is automatically returned if the property does + * not exist or the permissions do not allow access. The same checks are + * performed for `Set` calls, and the provided value is also checked for + * being the correct type. + * + * For both `Get` and `Set` calls, the #GDBusMethodInvocation + * passed to the @method_call handler can be queried with + * g_dbus_method_invocation_get_property_info() to get a pointer + * to the #GDBusPropertyInfo of the property. + * + * If you have readable properties specified in your interface info, + * you must ensure that you either provide a non-%NULL @get_property() + * function or provide implementations of both the `Get` and `GetAll` + * methods on org.freedesktop.DBus.Properties interface in your @method_call + * function. Note that the required return type of the `Get` call is + * `(v)`, not the type of the property. `GetAll` expects a return value + * of type `a{sv}`. + * + * If you have writable properties specified in your interface info, + * you must ensure that you either provide a non-%NULL @set_property() + * function or provide an implementation of the `Set` call. If implementing + * the call, you must return the value of type %G_VARIANT_TYPE_UNIT. + * + * Since: 2.26 + */ +struct _GDBusInterfaceVTable { - gpointer data; + GDBusInterfaceMethodCallFunc method_call; + GDBusInterfaceGetPropertyFunc get_property; + GDBusInterfaceSetPropertyFunc set_property; + + /*< private >*/ + /* Padding for future expansion - also remember to update + * gdbusconnection.c:_g_dbus_interface_vtable_copy() when + * changing this. + */ + gpointer padding[8]; }; -GUM_API void gum_spinlock_init (GumSpinlock * spinlock); +GIO_AVAILABLE_IN_ALL +guint g_dbus_connection_register_object (GDBusConnection *connection, + const gchar *object_path, + GDBusInterfaceInfo *interface_info, + const GDBusInterfaceVTable *vtable, + gpointer user_data, + GDestroyNotify user_data_free_func, + GError **error); +GIO_AVAILABLE_IN_2_46 +guint g_dbus_connection_register_object_with_closures (GDBusConnection *connection, + const gchar *object_path, + GDBusInterfaceInfo *interface_info, + GClosure *method_call_closure, + GClosure *get_property_closure, + GClosure *set_property_closure, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_unregister_object (GDBusConnection *connection, + guint registration_id); + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * GDBusSubtreeEnumerateFunc: + * @connection: A #GDBusConnection. + * @sender: The unique bus name of the remote caller. + * @object_path: The object path that was registered with g_dbus_connection_register_subtree(). + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). + * + * The type of the @enumerate function in #GDBusSubtreeVTable. + * + * This function is called when generating introspection data and also + * when preparing to dispatch incoming messages in the event that the + * %G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not + * specified (ie: to verify that the object path is valid). + * + * Hierarchies are not supported; the items that you return should not + * contain the `/` character. + * + * The return value will be freed with g_strfreev(). + * + * Returns: (array zero-terminated=1) (transfer full): A newly allocated array of strings for node names that are children of @object_path. + * + * Since: 2.26 + */ +typedef gchar** (*GDBusSubtreeEnumerateFunc) (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + gpointer user_data); -GUM_API void gum_spinlock_acquire (GumSpinlock * spinlock); -GUM_API gboolean gum_spinlock_try_acquire (GumSpinlock * spinlock); -GUM_API void gum_spinlock_release (GumSpinlock * spinlock); +/** + * GDBusSubtreeIntrospectFunc: + * @connection: A #GDBusConnection. + * @sender: The unique bus name of the remote caller. + * @object_path: The object path that was registered with g_dbus_connection_register_subtree(). + * @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). + * + * The type of the @introspect function in #GDBusSubtreeVTable. + * + * Subtrees are flat. @node, if non-%NULL, is always exactly one + * segment of the object path (ie: it never contains a slash). + * + * This function should return %NULL to indicate that there is no object + * at this node. + * + * If this function returns non-%NULL, the return value is expected to + * be a %NULL-terminated array of pointers to #GDBusInterfaceInfo + * structures describing the interfaces implemented by @node. This + * array will have g_dbus_interface_info_unref() called on each item + * before being freed with g_free(). + * + * The difference between returning %NULL and an array containing zero + * items is that the standard DBus interfaces will returned to the + * remote introspector in the empty array case, but not in the %NULL + * case. + * + * Returns: (array zero-terminated=1) (nullable) (transfer full): A %NULL-terminated array of pointers to #GDBusInterfaceInfo, or %NULL. + * + * Since: 2.26 + */ +typedef GDBusInterfaceInfo ** (*GDBusSubtreeIntrospectFunc) (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *node, + gpointer user_data); -G_END_DECLS +/** + * GDBusSubtreeDispatchFunc: + * @connection: A #GDBusConnection. + * @sender: The unique bus name of the remote caller. + * @object_path: The object path that was registered with g_dbus_connection_register_subtree(). + * @interface_name: The D-Bus interface name that the method call or property access is for. + * @node: A node that is a child of @object_path (relative to @object_path) or %NULL for the root of the subtree. + * @out_user_data: (nullable) (not optional): Return location for user data to pass to functions in the returned #GDBusInterfaceVTable. + * @user_data: The @user_data #gpointer passed to g_dbus_connection_register_subtree(). + * + * The type of the @dispatch function in #GDBusSubtreeVTable. + * + * Subtrees are flat. @node, if non-%NULL, is always exactly one + * segment of the object path (ie: it never contains a slash). + * + * Returns: (nullable): A #GDBusInterfaceVTable or %NULL if you don't want to handle the methods. + * + * Since: 2.26 + */ +typedef const GDBusInterfaceVTable * (*GDBusSubtreeDispatchFunc) (GDBusConnection *connection, + const gchar *sender, + const gchar *object_path, + const gchar *interface_name, + const gchar *node, + gpointer *out_user_data, + gpointer user_data); -#endif -/* - * Copyright (C) 2009-2024 Ole André Vadla Ravnås - * Copyright (C) 2010 Karl Trygve Kalleberg - * Copyright (C) 2023 Håvard Sørbø +/** + * GDBusSubtreeVTable: + * @enumerate: Function for enumerating child nodes. + * @introspect: Function for introspecting a child node. + * @dispatch: Function for dispatching a remote call on a child node. * - * Licence: wxWindows Library Licence, Version 3.1 + * Virtual table for handling subtrees registered with g_dbus_connection_register_subtree(). + * + * Since: 2.26 */ +struct _GDBusSubtreeVTable +{ + GDBusSubtreeEnumerateFunc enumerate; + GDBusSubtreeIntrospectFunc introspect; + GDBusSubtreeDispatchFunc dispatch; -#ifndef __GUM_STALKER_H__ -#define __GUM_STALKER_H__ + /*< private >*/ + /* Padding for future expansion - also remember to update + * gdbusconnection.c:_g_dbus_subtree_vtable_copy() when + * changing this. + */ + gpointer padding[8]; +}; -#ifndef CAPSTONE_ENGINE_H -#define CAPSTONE_ENGINE_H +GIO_AVAILABLE_IN_ALL +guint g_dbus_connection_register_subtree (GDBusConnection *connection, + const gchar *object_path, + const GDBusSubtreeVTable *vtable, + GDBusSubtreeFlags flags, + gpointer user_data, + GDestroyNotify user_data_free_func, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_connection_unregister_subtree (GDBusConnection *connection, + guint registration_id); + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * GDBusSignalCallback: + * @connection: A #GDBusConnection. + * @sender_name: (nullable): The unique bus name of the sender of the signal, + or %NULL on a peer-to-peer D-Bus connection. + * @object_path: The object path that the signal was emitted on. + * @interface_name: The name of the interface. + * @signal_name: The name of the signal. + * @parameters: A #GVariant tuple with parameters for the signal. + * @user_data: User data passed when subscribing to the signal. + * + * Signature for callback function used in g_dbus_connection_signal_subscribe(). + * + * Since: 2.26 + */ +typedef void (*GDBusSignalCallback) (GDBusConnection *connection, + const gchar *sender_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *signal_name, + GVariant *parameters, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +guint g_dbus_connection_signal_subscribe (GDBusConnection *connection, + const gchar *sender, + const gchar *interface_name, + const gchar *member, + const gchar *object_path, + const gchar *arg0, + GDBusSignalFlags flags, + GDBusSignalCallback callback, + gpointer user_data, + GDestroyNotify user_data_free_func); +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_signal_unsubscribe (GDBusConnection *connection, + guint subscription_id); + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * GDBusMessageFilterFunction: + * @connection: (transfer none): A #GDBusConnection. + * @message: (transfer full): A locked #GDBusMessage that the filter function takes ownership of. + * @incoming: %TRUE if it is a message received from the other peer, %FALSE if it is + * a message to be sent to the other peer. + * @user_data: User data passed when adding the filter. + * + * Signature for function used in g_dbus_connection_add_filter(). + * + * A filter function is passed a #GDBusMessage and expected to return + * a #GDBusMessage too. Passive filter functions that don't modify the + * message can simply return the @message object: + * |[ + * static GDBusMessage * + * passive_filter (GDBusConnection *connection + * GDBusMessage *message, + * gboolean incoming, + * gpointer user_data) + * { + * // inspect @message + * return message; + * } + * ]| + * Filter functions that wants to drop a message can simply return %NULL: + * |[ + * static GDBusMessage * + * drop_filter (GDBusConnection *connection + * GDBusMessage *message, + * gboolean incoming, + * gpointer user_data) + * { + * if (should_drop_message) + * { + * g_object_unref (message); + * message = NULL; + * } + * return message; + * } + * ]| + * Finally, a filter function may modify a message by copying it: + * |[ + * static GDBusMessage * + * modifying_filter (GDBusConnection *connection + * GDBusMessage *message, + * gboolean incoming, + * gpointer user_data) + * { + * GDBusMessage *copy; + * GError *error; + * + * error = NULL; + * copy = g_dbus_message_copy (message, &error); + * // handle @error being set + * g_object_unref (message); + * + * // modify @copy + * + * return copy; + * } + * ]| + * If the returned #GDBusMessage is different from @message and cannot + * be sent on @connection (it could use features, such as file + * descriptors, not compatible with @connection), then a warning is + * logged to standard error. Applications can + * check this ahead of time using g_dbus_message_to_blob() passing a + * #GDBusCapabilityFlags value obtained from @connection. + * + * Returns: (transfer full) (nullable): A #GDBusMessage that will be freed with + * g_object_unref() or %NULL to drop the message. Passive filter + * functions can simply return the passed @message object. + * + * Since: 2.26 + */ +typedef GDBusMessage *(*GDBusMessageFilterFunction) (GDBusConnection *connection, + GDBusMessage *message, + gboolean incoming, + gpointer user_data); -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2016 */ +GIO_AVAILABLE_IN_ALL +guint g_dbus_connection_add_filter (GDBusConnection *connection, + GDBusMessageFilterFunction filter_function, + gpointer user_data, + GDestroyNotify user_data_free_func); -#ifdef __cplusplus -extern "C" { -#endif +GIO_AVAILABLE_IN_ALL +void g_dbus_connection_remove_filter (GDBusConnection *connection, + guint filter_id); -#include +/* ---------------------------------------------------------------------------------------------------- */ -#if defined(CAPSTONE_HAS_OSXKERNEL) -#include -#else -#include -#include -#endif -/* Capstone Disassembly Engine */ -/* By Axel Souchet & Nguyen Anh Quynh, 2014 */ +G_END_DECLS -#ifndef CAPSTONE_PLATFORM_H -#define CAPSTONE_PLATFORM_H +#endif /* __G_DBUS_CONNECTION_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ +#ifndef __G_DBUS_ERROR_H__ +#define __G_DBUS_ERROR_H__ -// handle C99 issue (for pre-2013 VisualStudio) -#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) -// MSVC +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -// stdbool.h -#if (_MSC_VER < 1800) || defined(_KERNEL_MODE) -// this system does not have stdbool.h -#ifndef __cplusplus -typedef unsigned char bool; -#define false 0 -#define true 1 -#endif // __cplusplus -#else -// VisualStudio 2013+ -> C99 is supported -#include -#endif // (_MSC_VER < 1800) || defined(_KERNEL_MODE) +G_BEGIN_DECLS -#else -// not MSVC -> C99 is supported -#include -#endif // !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) +/** + * G_DBUS_ERROR: + * + * Error domain for errors generated by a remote message bus. Errors + * in this domain will be from the #GDBusError enumeration. See + * #GError for more information on error domains. + * + * Note that this error domain is intended only for + * returning errors from a remote message bus process. Errors + * generated locally in-process by e.g. #GDBusConnection should use the + * %G_IO_ERROR domain. + * + * Since: 2.26 + */ +#define G_DBUS_ERROR g_dbus_error_quark() +GIO_AVAILABLE_IN_ALL +GQuark g_dbus_error_quark (void); -// handle inttypes.h / stdint.h compatibility -#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) -#include "windowsce/stdint.h" -#endif // defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) +/* Used by applications to check, get and strip the D-Bus error name */ +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_error_is_remote_error (const GError *error); +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_error_get_remote_error (const GError *error); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_error_strip_remote_error (GError *error); -#if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) -// this system does not have inttypes.h +/** + * GDBusErrorEntry: + * @error_code: An error code. + * @dbus_error_name: The D-Bus error name to associate with @error_code. + * + * Struct used in g_dbus_error_register_error_domain(). + * + * Since: 2.26 + */ +struct _GDBusErrorEntry +{ + gint error_code; + const gchar *dbus_error_name; +}; -#if defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) -// this system does not have stdint.h -typedef signed char int8_t; -typedef signed short int16_t; -typedef signed int int32_t; -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; -#endif // defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_error_register_error (GQuark error_domain, + gint error_code, + const gchar *dbus_error_name); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_error_unregister_error (GQuark error_domain, + gint error_code, + const gchar *dbus_error_name); +GIO_AVAILABLE_IN_ALL +void g_dbus_error_register_error_domain (const gchar *error_domain_quark_name, + volatile gsize *quark_volatile, + const GDBusErrorEntry *entries, + guint num_entries); + +/* Only used by object mappings to map back and forth to GError */ +GIO_AVAILABLE_IN_ALL +GError *g_dbus_error_new_for_dbus_error (const gchar *dbus_error_name, + const gchar *dbus_error_message); +GIO_AVAILABLE_IN_ALL +void g_dbus_error_set_dbus_error (GError **error, + const gchar *dbus_error_name, + const gchar *dbus_error_message, + const gchar *format, + ...) G_GNUC_PRINTF(4, 5); +GIO_AVAILABLE_IN_ALL +void g_dbus_error_set_dbus_error_valist (GError **error, + const gchar *dbus_error_name, + const gchar *dbus_error_message, + const gchar *format, + va_list var_args) G_GNUC_PRINTF(4, 0); +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_error_encode_gerror (const GError *error); -#if defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) -#define INT8_MIN (-127i8 - 1) -#define INT16_MIN (-32767i16 - 1) -#define INT32_MIN (-2147483647i32 - 1) -#define INT64_MIN (-9223372036854775807i64 - 1) -#define INT8_MAX 127i8 -#define INT16_MAX 32767i16 -#define INT32_MAX 2147483647i32 -#define INT64_MAX 9223372036854775807i64 -#define UINT8_MAX 0xffui8 -#define UINT16_MAX 0xffffui16 -#define UINT32_MAX 0xffffffffui32 -#define UINT64_MAX 0xffffffffffffffffui64 -#endif // defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) +G_END_DECLS -#ifdef CAPSTONE_HAS_OSXKERNEL -// this system has stdint.h -#include -#endif +#endif /* __G_DBUS_ERROR_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ -#define __PRI_8_LENGTH_MODIFIER__ "hh" -#define __PRI_64_LENGTH_MODIFIER__ "ll" +#ifndef __G_DBUS_INTERFACE_H__ +#define __G_DBUS_INTERFACE_H__ -#define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" -#define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" -#define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" -#define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" -#define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" -#define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" +G_BEGIN_DECLS -#if defined(_MSC_VER) && _MSC_VER <= 1700 -#define PRId32 "ld" -#define PRIi32 "li" -#define PRIo32 "lo" -#define PRIu32 "lu" -#define PRIx32 "lx" -#define PRIX32 "lX" -#else // OSX -#define PRId32 "d" -#define PRIi32 "i" -#define PRIo32 "o" -#define PRIu32 "u" -#define PRIx32 "x" -#define PRIX32 "X" -#endif // defined(_MSC_VER) && _MSC_VER <= 1700 +#define G_TYPE_DBUS_INTERFACE (g_dbus_interface_get_type()) +#define G_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE, GDBusInterface)) +#define G_IS_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE)) +#define G_DBUS_INTERFACE_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_INTERFACE, GDBusInterfaceIface)) -#if defined(_MSC_VER) && _MSC_VER <= 1700 -// redefine functions from inttypes.h used in cstool -#define strtoull _strtoui64 -#endif +/** + * GDBusInterface: + * + * Base type for D-Bus interfaces. + * + * Since: 2.30 + */ -#define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" -#define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" -#define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" -#define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" -#define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" -#define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" +typedef struct _GDBusInterfaceIface GDBusInterfaceIface; -#else -// this system has inttypes.h by default -#include -#endif // defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) +/** + * GDBusInterfaceIface: + * @parent_iface: The parent interface. + * @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info(). + * @get_object: Gets the enclosing #GDBusObject. See g_dbus_interface_get_object(). + * @set_object: Sets the enclosing #GDBusObject. See g_dbus_interface_set_object(). + * @dup_object: Gets a reference to the enclosing #GDBusObject. See g_dbus_interface_dup_object(). Added in 2.32. + * + * Base type for D-Bus interfaces. + * + * Since: 2.30 + */ +struct _GDBusInterfaceIface +{ + GTypeInterface parent_iface; + + /* Virtual Functions */ + GDBusInterfaceInfo *(*get_info) (GDBusInterface *interface_); + GDBusObject *(*get_object) (GDBusInterface *interface_); + void (*set_object) (GDBusInterface *interface_, + GDBusObject *object); + GDBusObject *(*dup_object) (GDBusInterface *interface_); +}; -#endif +GIO_AVAILABLE_IN_ALL +GType g_dbus_interface_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusInterfaceInfo *g_dbus_interface_get_info (GDBusInterface *interface_); +GIO_AVAILABLE_IN_ALL +GDBusObject *g_dbus_interface_get_object (GDBusInterface *interface_); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_set_object (GDBusInterface *interface_, + GDBusObject *object); +GIO_AVAILABLE_IN_2_32 +GDBusObject *g_dbus_interface_dup_object (GDBusInterface *interface_); -#ifdef _MSC_VER -#pragma warning(disable:4201) -#pragma warning(disable:4100) -#define CAPSTONE_API __cdecl -#ifdef CAPSTONE_SHARED -#define CAPSTONE_EXPORT __declspec(dllexport) -#else // defined(CAPSTONE_STATIC) -#define CAPSTONE_EXPORT -#endif -#else -#define CAPSTONE_API -#if (defined(__GNUC__) || defined(__IBMC__)) && !defined(CAPSTONE_STATIC) -#define CAPSTONE_EXPORT __attribute__((visibility("default"))) -#else // defined(CAPSTONE_STATIC) -#define CAPSTONE_EXPORT -#endif -#endif +G_END_DECLS -#if (defined(__GNUC__) || defined(__IBMC__)) -#define CAPSTONE_DEPRECATED __attribute__((deprecated)) -#elif defined(_MSC_VER) -#define CAPSTONE_DEPRECATED __declspec(deprecated) -#else -#pragma message("WARNING: You need to implement CAPSTONE_DEPRECATED for this compiler") -#define CAPSTONE_DEPRECATED -#endif +#endif /* __G_DBUS_INTERFACE_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ -// Capstone API version -#define CS_API_MAJOR 5 -#define CS_API_MINOR 0 +#ifndef __G_DBUS_INTERFACE_SKELETON_H__ +#define __G_DBUS_INTERFACE_SKELETON_H__ -// Version for bleeding edge code of the Github's "next" branch. -// Use this if you want the absolutely latest development code. -// This version number will be bumped up whenever we have a new major change. -#define CS_NEXT_VERSION 5 -// Capstone package version -#define CS_VERSION_MAJOR CS_API_MAJOR -#define CS_VERSION_MINOR CS_API_MINOR -#define CS_VERSION_EXTRA 1 +G_BEGIN_DECLS -/// Macro for meta programming. -/// Meant for projects using Capstone and need to support multiple -/// versions of it. -/// These macros replace several instances of the old "ARM64" with -/// the new "AArch64" name depending on the CS version. -#if CS_NEXT_VERSION < 6 -#define CS_AARCH64(x) ARM64##x -#else -#define CS_AARCH64(x) AArch64##x -#endif +#define G_TYPE_DBUS_INTERFACE_SKELETON (g_dbus_interface_skeleton_get_type ()) +#define G_DBUS_INTERFACE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeleton)) +#define G_DBUS_INTERFACE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonClass)) +#define G_DBUS_INTERFACE_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonClass)) +#define G_IS_DBUS_INTERFACE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE_SKELETON)) +#define G_IS_DBUS_INTERFACE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_INTERFACE_SKELETON)) -#if CS_NEXT_VERSION < 6 -#define CS_AARCH64pre(x) x##ARM64 -#else -#define CS_AARCH64pre(x) x##AARCH64 -#endif +typedef struct _GDBusInterfaceSkeletonClass GDBusInterfaceSkeletonClass; +typedef struct _GDBusInterfaceSkeletonPrivate GDBusInterfaceSkeletonPrivate; -#if CS_NEXT_VERSION < 6 -#define CS_AARCH64CC(x) ARM64_CC##x -#else -#define CS_AARCH64CC(x) AArch64CC##x -#endif +/** + * GDBusInterfaceSkeleton: + * + * The #GDBusInterfaceSkeleton structure contains private data and should + * only be accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusInterfaceSkeleton +{ + /*< private >*/ + GObject parent_instance; + GDBusInterfaceSkeletonPrivate *priv; +}; -#if CS_NEXT_VERSION < 6 -#define CS_AARCH64_VL_(x) ARM64_VAS_##x -#else -#define CS_AARCH64_VL_(x) AArch64Layout_VL_##x -#endif +/** + * GDBusInterfaceSkeletonClass: + * @parent_class: The parent class. + * @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details. + * @get_vtable: Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details. + * @get_properties: Returns a #GVariant with all properties. See g_dbus_interface_skeleton_get_properties(). + * @flush: Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush(). + * @g_authorize_method: Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal. + * + * Class structure for #GDBusInterfaceSkeleton. + * + * Since: 2.30 + */ +struct _GDBusInterfaceSkeletonClass +{ + GObjectClass parent_class; -#if CS_NEXT_VERSION < 6 -#define CS_aarch64_ arm64 -#else -#define CS_aarch64_ aarch64 -#endif + /* Virtual Functions */ + GDBusInterfaceInfo *(*get_info) (GDBusInterfaceSkeleton *interface_); + GDBusInterfaceVTable *(*get_vtable) (GDBusInterfaceSkeleton *interface_); + GVariant *(*get_properties) (GDBusInterfaceSkeleton *interface_); + void (*flush) (GDBusInterfaceSkeleton *interface_); -#if CS_NEXT_VERSION < 6 -#define CS_aarch64(x) arm64##x -#else -#define CS_aarch64(x) aarch64##x -#endif + /*< private >*/ + gpointer vfunc_padding[8]; + /*< public >*/ -#if CS_NEXT_VERSION < 6 -#define CS_aarch64_op() cs_arm64_op -#define CS_aarch64_reg() arm64_reg -#define CS_aarch64_cc() arm64_cc -#define CS_cs_aarch64() cs_arm64 -#define CS_aarch64_extender() arm64_extender -#define CS_aarch64_shifter() arm64_shifter -#define CS_aarch64_vas() arm64_vas -#else -#define CS_aarch64_op() cs_aarch64_op -#define CS_aarch64_reg() aarch64_reg -#define CS_aarch64_cc() AArch64CC_CondCode -#define CS_cs_aarch64() cs_aarch64 -#define CS_aarch64_extender() aarch64_extender -#define CS_aarch64_shifter() aarch64_shifter -#define CS_aarch64_vas() AArch64Layout_VectorLayout -#endif + /* Signals */ + gboolean (*g_authorize_method) (GDBusInterfaceSkeleton *interface_, + GDBusMethodInvocation *invocation); -/// Macro to create combined version which can be compared to -/// result of cs_version() API. -#define CS_MAKE_VERSION(major, minor) ((major << 8) + minor) + /*< private >*/ + gpointer signal_padding[8]; +}; -/// Maximum size of an instruction mnemonic string. -#define CS_MNEMONIC_SIZE 32 +GIO_AVAILABLE_IN_ALL +GType g_dbus_interface_skeleton_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusInterfaceSkeletonFlags g_dbus_interface_skeleton_get_flags (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_, + GDBusInterfaceSkeletonFlags flags); +GIO_AVAILABLE_IN_ALL +GDBusInterfaceInfo *g_dbus_interface_skeleton_get_info (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +GDBusInterfaceVTable *g_dbus_interface_skeleton_get_vtable (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_interface_skeleton_get_properties (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_skeleton_flush (GDBusInterfaceSkeleton *interface_); + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_interface_skeleton_export (GDBusInterfaceSkeleton *interface_, + GDBusConnection *connection, + const gchar *object_path, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_skeleton_unexport (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_skeleton_unexport_from_connection (GDBusInterfaceSkeleton *interface_, + GDBusConnection *connection); + +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_interface_skeleton_get_connection (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +GList *g_dbus_interface_skeleton_get_connections (GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_interface_skeleton_has_connection (GDBusInterfaceSkeleton *interface_, + GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_interface_skeleton_get_object_path (GDBusInterfaceSkeleton *interface_); -// Handle using with all API -typedef size_t csh; +G_END_DECLS -/// Architecture type -typedef enum cs_arch { - CS_ARCH_ARM = 0, ///< ARM architecture (including Thumb, Thumb-2) - CS_ARCH_ARM64, ///< ARM-64, also called AArch64 - CS_ARCH_MIPS, ///< Mips architecture - CS_ARCH_X86, ///< X86 architecture (including x86 & x86-64) - CS_ARCH_PPC, ///< PowerPC architecture - CS_ARCH_SPARC, ///< Sparc architecture - CS_ARCH_SYSZ, ///< SystemZ architecture - CS_ARCH_XCORE, ///< XCore architecture - CS_ARCH_M68K, ///< 68K architecture - CS_ARCH_TMS320C64X, ///< TMS320C64x architecture - CS_ARCH_M680X, ///< 680X architecture - CS_ARCH_EVM, ///< Ethereum architecture - CS_ARCH_MOS65XX, ///< MOS65XX architecture (including MOS6502) - CS_ARCH_WASM, ///< WebAssembly architecture - CS_ARCH_BPF, ///< Berkeley Packet Filter architecture (including eBPF) - CS_ARCH_RISCV, ///< RISCV architecture - CS_ARCH_SH, ///< SH architecture - CS_ARCH_TRICORE, ///< TriCore architecture - CS_ARCH_MAX, - CS_ARCH_ALL = 0xFFFF, // All architectures - for cs_support() -} cs_arch; +#endif /* __G_DBUS_INTERFACE_SKELETON_H */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ -// Support value to verify diet mode of the engine. -// If cs_support(CS_SUPPORT_DIET) return True, the engine was compiled -// in diet mode. -#define CS_SUPPORT_DIET (CS_ARCH_ALL + 1) +#ifndef __G_DBUS_INTROSPECTION_H__ +#define __G_DBUS_INTROSPECTION_H__ -// Support value to verify X86 reduce mode of the engine. -// If cs_support(CS_SUPPORT_X86_REDUCE) return True, the engine was compiled -// in X86 reduce mode. -#define CS_SUPPORT_X86_REDUCE (CS_ARCH_ALL + 2) +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -/// Mode type -typedef enum cs_mode { - CS_MODE_LITTLE_ENDIAN = 0, ///< little-endian mode (default mode) - CS_MODE_ARM = 0, ///< 32-bit ARM - CS_MODE_16 = 1 << 1, ///< 16-bit mode (X86) - CS_MODE_32 = 1 << 2, ///< 32-bit mode (X86) - CS_MODE_64 = 1 << 3, ///< 64-bit mode (X86, PPC) - CS_MODE_THUMB = 1 << 4, ///< ARM's Thumb mode, including Thumb-2 - CS_MODE_MCLASS = 1 << 5, ///< ARM's Cortex-M series - CS_MODE_V8 = 1 << 6, ///< ARMv8 A32 encodings for ARM - CS_MODE_MICRO = 1 << 4, ///< MicroMips mode (MIPS) - CS_MODE_MIPS3 = 1 << 5, ///< Mips III ISA - CS_MODE_MIPS32R6 = 1 << 6, ///< Mips32r6 ISA - CS_MODE_MIPS2 = 1 << 7, ///< Mips II ISA - CS_MODE_V9 = 1 << 4, ///< SparcV9 mode (Sparc) - CS_MODE_QPX = 1 << 4, ///< Quad Processing eXtensions mode (PPC) - CS_MODE_SPE = 1 << 5, ///< Signal Processing Engine mode (PPC) - CS_MODE_BOOKE = 1 << 6, ///< Book-E mode (PPC) - CS_MODE_PS = 1 << 7, ///< Paired-singles mode (PPC) - CS_MODE_M68K_000 = 1 << 1, ///< M68K 68000 mode - CS_MODE_M68K_010 = 1 << 2, ///< M68K 68010 mode - CS_MODE_M68K_020 = 1 << 3, ///< M68K 68020 mode - CS_MODE_M68K_030 = 1 << 4, ///< M68K 68030 mode - CS_MODE_M68K_040 = 1 << 5, ///< M68K 68040 mode - CS_MODE_M68K_060 = 1 << 6, ///< M68K 68060 mode - CS_MODE_BIG_ENDIAN = 1U << 31, ///< big-endian mode - CS_MODE_MIPS32 = CS_MODE_32, ///< Mips32 ISA (Mips) - CS_MODE_MIPS64 = CS_MODE_64, ///< Mips64 ISA (Mips) - CS_MODE_M680X_6301 = 1 << 1, ///< M680X Hitachi 6301,6303 mode - CS_MODE_M680X_6309 = 1 << 2, ///< M680X Hitachi 6309 mode - CS_MODE_M680X_6800 = 1 << 3, ///< M680X Motorola 6800,6802 mode - CS_MODE_M680X_6801 = 1 << 4, ///< M680X Motorola 6801,6803 mode - CS_MODE_M680X_6805 = 1 << 5, ///< M680X Motorola/Freescale 6805 mode - CS_MODE_M680X_6808 = 1 << 6, ///< M680X Motorola/Freescale/NXP 68HC08 mode - CS_MODE_M680X_6809 = 1 << 7, ///< M680X Motorola 6809 mode - CS_MODE_M680X_6811 = 1 << 8, ///< M680X Motorola/Freescale/NXP 68HC11 mode - CS_MODE_M680X_CPU12 = 1 << 9, ///< M680X Motorola/Freescale/NXP CPU12 - ///< used on M68HC12/HCS12 - CS_MODE_M680X_HCS08 = 1 << 10, ///< M680X Freescale/NXP HCS08 mode - CS_MODE_BPF_CLASSIC = 0, ///< Classic BPF mode (default) - CS_MODE_BPF_EXTENDED = 1 << 0, ///< Extended BPF mode - CS_MODE_RISCV32 = 1 << 0, ///< RISCV RV32G - CS_MODE_RISCV64 = 1 << 1, ///< RISCV RV64G - CS_MODE_RISCVC = 1 << 2, ///< RISCV compressed instructure mode - CS_MODE_MOS65XX_6502 = 1 << 1, ///< MOS65XXX MOS 6502 - CS_MODE_MOS65XX_65C02 = 1 << 2, ///< MOS65XXX WDC 65c02 - CS_MODE_MOS65XX_W65C02 = 1 << 3, ///< MOS65XXX WDC W65c02 - CS_MODE_MOS65XX_65816 = 1 << 4, ///< MOS65XXX WDC 65816, 8-bit m/x - CS_MODE_MOS65XX_65816_LONG_M = (1 << 5), ///< MOS65XXX WDC 65816, 16-bit m, 8-bit x - CS_MODE_MOS65XX_65816_LONG_X = (1 << 6), ///< MOS65XXX WDC 65816, 8-bit m, 16-bit x - CS_MODE_MOS65XX_65816_LONG_MX = CS_MODE_MOS65XX_65816_LONG_M | CS_MODE_MOS65XX_65816_LONG_X, - CS_MODE_SH2 = 1 << 1, ///< SH2 - CS_MODE_SH2A = 1 << 2, ///< SH2A - CS_MODE_SH3 = 1 << 3, ///< SH3 - CS_MODE_SH4 = 1 << 4, ///< SH4 - CS_MODE_SH4A = 1 << 5, ///< SH4A - CS_MODE_SHFPU = 1 << 6, ///< w/ FPU - CS_MODE_SHDSP = 1 << 7, ///< w/ DSP - CS_MODE_TRICORE_110 = 1 << 1, ///< Tricore 1.1 - CS_MODE_TRICORE_120 = 1 << 2, ///< Tricore 1.2 - CS_MODE_TRICORE_130 = 1 << 3, ///< Tricore 1.3 - CS_MODE_TRICORE_131 = 1 << 4, ///< Tricore 1.3.1 - CS_MODE_TRICORE_160 = 1 << 5, ///< Tricore 1.6 - CS_MODE_TRICORE_161 = 1 << 6, ///< Tricore 1.6.1 - CS_MODE_TRICORE_162 = 1 << 7, ///< Tricore 1.6.2 -} cs_mode; -typedef void* (CAPSTONE_API *cs_malloc_t)(size_t size); -typedef void* (CAPSTONE_API *cs_calloc_t)(size_t nmemb, size_t size); -typedef void* (CAPSTONE_API *cs_realloc_t)(void *ptr, size_t size); -typedef void (CAPSTONE_API *cs_free_t)(void *ptr); -typedef int (CAPSTONE_API *cs_vsnprintf_t)(char *str, size_t size, const char *format, va_list ap); +G_BEGIN_DECLS +/** + * GDBusAnnotationInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @key: The name of the annotation, e.g. "org.freedesktop.DBus.Deprecated". + * @value: The value of the annotation. + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about an annotation. + * + * Since: 2.26 + */ +struct _GDBusAnnotationInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *key; + gchar *value; + GDBusAnnotationInfo **annotations; +}; -/// User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf() -/// By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf(). -typedef struct cs_opt_mem { - cs_malloc_t malloc; - cs_calloc_t calloc; - cs_realloc_t realloc; - cs_free_t free; - cs_vsnprintf_t vsnprintf; -} cs_opt_mem; +/** + * GDBusArgInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @name: Name of the argument, e.g. @unix_user_id. + * @signature: D-Bus signature of the argument (a single complete type). + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about an argument for a method or a signal. + * + * Since: 2.26 + */ +struct _GDBusArgInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *name; + gchar *signature; + GDBusAnnotationInfo **annotations; +}; -/// Customize mnemonic for instructions with alternative name. -/// To reset existing customized instruction to its default mnemonic, -/// call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value -/// for @mnemonic. -typedef struct cs_opt_mnem { - /// ID of instruction to be customized. - unsigned int id; - /// Customized instruction mnemonic. - const char *mnemonic; -} cs_opt_mnem; +/** + * GDBusMethodInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @name: The name of the D-Bus method, e.g. @RequestName. + * @in_args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no in arguments. + * @out_args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no out arguments. + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about a method on an D-Bus interface. + * + * Since: 2.26 + */ +struct _GDBusMethodInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *name; + GDBusArgInfo **in_args; + GDBusArgInfo **out_args; + GDBusAnnotationInfo **annotations; +}; -/// Runtime option for the disassembled engine -typedef enum cs_opt_type { - CS_OPT_INVALID = 0, ///< No option specified - CS_OPT_SYNTAX, ///< Assembly output syntax - CS_OPT_DETAIL, ///< Break down instruction structure into details - CS_OPT_MODE, ///< Change engine's mode at run-time - CS_OPT_MEM, ///< User-defined dynamic memory related functions - CS_OPT_SKIPDATA, ///< Skip data when disassembling. Then engine is in SKIPDATA mode. - CS_OPT_SKIPDATA_SETUP, ///< Setup user-defined function for SKIPDATA option - CS_OPT_MNEMONIC, ///< Customize instruction mnemonic - CS_OPT_UNSIGNED, ///< print immediate operands in unsigned form - CS_OPT_NO_BRANCH_OFFSET, ///< ARM, prints branch immediates without offset. -} cs_opt_type; +/** + * GDBusSignalInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @name: The name of the D-Bus signal, e.g. "NameOwnerChanged". + * @args: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusArgInfo structures or %NULL if there are no arguments. + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about a signal on a D-Bus interface. + * + * Since: 2.26 + */ +struct _GDBusSignalInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *name; + GDBusArgInfo **args; + GDBusAnnotationInfo **annotations; +}; -/// Runtime option value (associated with option type above) -typedef enum cs_opt_value { - CS_OPT_OFF = 0, ///< Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED. - CS_OPT_ON = 3, ///< Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA). - CS_OPT_SYNTAX_DEFAULT = 0, ///< Default asm syntax (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_INTEL, ///< X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_ATT, ///< X86 ATT asm syntax (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_NOREGNAME, ///< Prints register name with only number (CS_OPT_SYNTAX) - CS_OPT_SYNTAX_MASM, ///< X86 Intel Masm syntax (CS_OPT_SYNTAX). - CS_OPT_SYNTAX_MOTOROLA, ///< MOS65XX use $ as hex prefix -} cs_opt_value; +/** + * GDBusPropertyInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @name: The name of the D-Bus property, e.g. "SupportedFilesystems". + * @signature: The D-Bus signature of the property (a single complete type). + * @flags: Access control flags for the property. + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about a D-Bus property on a D-Bus interface. + * + * Since: 2.26 + */ +struct _GDBusPropertyInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *name; + gchar *signature; + GDBusPropertyInfoFlags flags; + GDBusAnnotationInfo **annotations; +}; -/// Common instruction operand types - to be consistent across all architectures. -typedef enum cs_op_type { - CS_OP_INVALID = 0, ///< uninitialized/invalid operand. - CS_OP_REG, ///< Register operand. - CS_OP_IMM, ///< Immediate operand. - CS_OP_FP, ///< Floating-Point operand. - CS_OP_MEM = - 0x80, ///< Memory operand. Can be ORed with another operand type. -} cs_op_type; +/** + * GDBusInterfaceInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @name: The name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties". + * @methods: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusMethodInfo structures or %NULL if there are no methods. + * @signals: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusSignalInfo structures or %NULL if there are no signals. + * @properties: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusPropertyInfo structures or %NULL if there are no properties. + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about a D-Bus interface. + * + * Since: 2.26 + */ +struct _GDBusInterfaceInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *name; + GDBusMethodInfo **methods; + GDBusSignalInfo **signals; + GDBusPropertyInfo **properties; + GDBusAnnotationInfo **annotations; +}; -/// Common instruction operand access types - to be consistent across all architectures. -/// It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE -typedef enum cs_ac_type { - CS_AC_INVALID = 0, ///< Uninitialized/invalid access type. - CS_AC_READ = 1 << 0, ///< Operand read from memory or register. - CS_AC_WRITE = 1 << 1, ///< Operand write to memory or register. -} cs_ac_type; +/** + * GDBusNodeInfo: + * @ref_count: The reference count or -1 if statically allocated. + * @path: The path of the node or %NULL if omitted. Note that this may be a relative path. See the D-Bus specification for more details. + * @interfaces: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusInterfaceInfo structures or %NULL if there are no interfaces. + * @nodes: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusNodeInfo structures or %NULL if there are no nodes. + * @annotations: (array zero-terminated=1): A pointer to a %NULL-terminated array of pointers to #GDBusAnnotationInfo structures or %NULL if there are no annotations. + * + * Information about nodes in a remote object hierarchy. + * + * Since: 2.26 + */ +struct _GDBusNodeInfo +{ + /*< public >*/ + gint ref_count; /* (atomic) */ + gchar *path; + GDBusInterfaceInfo **interfaces; + GDBusNodeInfo **nodes; + GDBusAnnotationInfo **annotations; +}; -/// Common instruction groups - to be consistent across all architectures. -typedef enum cs_group_type { - CS_GRP_INVALID = 0, ///< uninitialized/invalid group. - CS_GRP_JUMP, ///< all jump instructions (conditional+direct+indirect jumps) - CS_GRP_CALL, ///< all call instructions - CS_GRP_RET, ///< all return instructions - CS_GRP_INT, ///< all interrupt instructions (int+syscall) - CS_GRP_IRET, ///< all interrupt return instructions - CS_GRP_PRIVILEGE, ///< all privileged instructions - CS_GRP_BRANCH_RELATIVE, ///< all relative branching instructions -} cs_group_type; +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_annotation_info_lookup (GDBusAnnotationInfo **annotations, + const gchar *name); +GIO_AVAILABLE_IN_ALL +GDBusMethodInfo *g_dbus_interface_info_lookup_method (GDBusInterfaceInfo *info, + const gchar *name); +GIO_AVAILABLE_IN_ALL +GDBusSignalInfo *g_dbus_interface_info_lookup_signal (GDBusInterfaceInfo *info, + const gchar *name); +GIO_AVAILABLE_IN_ALL +GDBusPropertyInfo *g_dbus_interface_info_lookup_property (GDBusInterfaceInfo *info, + const gchar *name); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_info_cache_build (GDBusInterfaceInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_info_cache_release (GDBusInterfaceInfo *info); + +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_info_generate_xml (GDBusInterfaceInfo *info, + guint indent, + GString *string_builder); + +GIO_AVAILABLE_IN_ALL +GDBusNodeInfo *g_dbus_node_info_new_for_xml (const gchar *xml_data, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusInterfaceInfo *g_dbus_node_info_lookup_interface (GDBusNodeInfo *info, + const gchar *name); +GIO_AVAILABLE_IN_ALL +void g_dbus_node_info_generate_xml (GDBusNodeInfo *info, + guint indent, + GString *string_builder); + +GIO_AVAILABLE_IN_ALL +GDBusNodeInfo *g_dbus_node_info_ref (GDBusNodeInfo *info); +GIO_AVAILABLE_IN_ALL +GDBusInterfaceInfo *g_dbus_interface_info_ref (GDBusInterfaceInfo *info); +GIO_AVAILABLE_IN_ALL +GDBusMethodInfo *g_dbus_method_info_ref (GDBusMethodInfo *info); +GIO_AVAILABLE_IN_ALL +GDBusSignalInfo *g_dbus_signal_info_ref (GDBusSignalInfo *info); +GIO_AVAILABLE_IN_ALL +GDBusPropertyInfo *g_dbus_property_info_ref (GDBusPropertyInfo *info); +GIO_AVAILABLE_IN_ALL +GDBusArgInfo *g_dbus_arg_info_ref (GDBusArgInfo *info); +GIO_AVAILABLE_IN_ALL +GDBusAnnotationInfo *g_dbus_annotation_info_ref (GDBusAnnotationInfo *info); + +GIO_AVAILABLE_IN_ALL +void g_dbus_node_info_unref (GDBusNodeInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_interface_info_unref (GDBusInterfaceInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_method_info_unref (GDBusMethodInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_signal_info_unref (GDBusSignalInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_property_info_unref (GDBusPropertyInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_arg_info_unref (GDBusArgInfo *info); +GIO_AVAILABLE_IN_ALL +void g_dbus_annotation_info_unref (GDBusAnnotationInfo *info); + +/** + * G_TYPE_DBUS_NODE_INFO: + * + * The #GType for a boxed type holding a #GDBusNodeInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_NODE_INFO (g_dbus_node_info_get_type ()) /** - User-defined callback function for SKIPDATA option. - See tests/test_skipdata.c for sample code demonstrating this API. + * G_TYPE_DBUS_INTERFACE_INFO: + * + * The #GType for a boxed type holding a #GDBusInterfaceInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_INTERFACE_INFO (g_dbus_interface_info_get_type ()) - @code: the input buffer containing code to be disassembled. - This is the same buffer passed to cs_disasm(). - @code_size: size (in bytes) of the above @code buffer. - @offset: the position of the currently-examining byte in the input - buffer @code mentioned above. - @user_data: user-data passed to cs_option() via @user_data field in - cs_opt_skipdata struct below. +/** + * G_TYPE_DBUS_METHOD_INFO: + * + * The #GType for a boxed type holding a #GDBusMethodInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_METHOD_INFO (g_dbus_method_info_get_type ()) - @return: return number of bytes to skip, or 0 to immediately stop disassembling. -*/ -typedef size_t (CAPSTONE_API *cs_skipdata_cb_t)(const uint8_t *code, size_t code_size, size_t offset, void *user_data); +/** + * G_TYPE_DBUS_SIGNAL_INFO: + * + * The #GType for a boxed type holding a #GDBusSignalInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_SIGNAL_INFO (g_dbus_signal_info_get_type ()) -/// User-customized setup for SKIPDATA option -typedef struct cs_opt_skipdata { - /// Capstone considers data to skip as special "instructions". - /// User can specify the string for this instruction's "mnemonic" here. - /// By default (if @mnemonic is NULL), Capstone use ".byte". - const char *mnemonic; +/** + * G_TYPE_DBUS_PROPERTY_INFO: + * + * The #GType for a boxed type holding a #GDBusPropertyInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_PROPERTY_INFO (g_dbus_property_info_get_type ()) - /// User-defined callback function to be called when Capstone hits data. - /// If the returned value from this callback is positive (>0), Capstone - /// will skip exactly that number of bytes & continue. Otherwise, if - /// the callback returns 0, Capstone stops disassembling and returns - /// immediately from cs_disasm() - /// NOTE: if this callback pointer is NULL, Capstone would skip a number - /// of bytes depending on architectures, as following: - /// Arm: 2 bytes (Thumb mode) or 4 bytes. - /// Arm64: 4 bytes. - /// Mips: 4 bytes. - /// M680x: 1 byte. - /// PowerPC: 4 bytes. - /// Sparc: 4 bytes. - /// SystemZ: 2 bytes. - /// X86: 1 bytes. - /// XCore: 2 bytes. - /// EVM: 1 bytes. - /// RISCV: 4 bytes. - /// WASM: 1 bytes. - /// MOS65XX: 1 bytes. - /// BPF: 8 bytes. - /// TriCore: 2 bytes. - cs_skipdata_cb_t callback; // default value is NULL +/** + * G_TYPE_DBUS_ARG_INFO: + * + * The #GType for a boxed type holding a #GDBusArgInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_ARG_INFO (g_dbus_arg_info_get_type ()) - /// User-defined data to be passed to @callback function pointer. - void *user_data; -} cs_opt_skipdata; +/** + * G_TYPE_DBUS_ANNOTATION_INFO: + * + * The #GType for a boxed type holding a #GDBusAnnotationInfo. + * + * Since: 2.26 + */ +#define G_TYPE_DBUS_ANNOTATION_INFO (g_dbus_annotation_info_get_type ()) + +GIO_AVAILABLE_IN_ALL +GType g_dbus_node_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GType g_dbus_interface_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GType g_dbus_method_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GType g_dbus_signal_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GType g_dbus_property_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GType g_dbus_arg_info_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GType g_dbus_annotation_info_get_type (void) G_GNUC_CONST; +G_END_DECLS -#ifndef CAPSTONE_ARM_H -#define CAPSTONE_ARM_H +#endif /* __G_DBUS_INTROSPECTION_H__ */ +/* + * Copyright © 2011 Canonical Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ +#ifndef __G_DBUS_MENU_MODEL_H__ +#define __G_DBUS_MENU_MODEL_H__ -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif +#define G_TYPE_DBUS_MENU_MODEL (g_dbus_menu_model_get_type ()) +#define G_DBUS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_DBUS_MENU_MODEL, GDBusMenuModel)) +#define G_IS_DBUS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_DBUS_MENU_MODEL)) -/// ARM shift type -typedef enum arm_shifter { - ARM_SFT_INVALID = 0, - ARM_SFT_ASR, ///< shift with immediate const - ARM_SFT_LSL, ///< shift with immediate const - ARM_SFT_LSR, ///< shift with immediate const - ARM_SFT_ROR, ///< shift with immediate const - ARM_SFT_RRX, ///< shift with immediate const - ARM_SFT_ASR_REG, ///< shift with register - ARM_SFT_LSL_REG, ///< shift with register - ARM_SFT_LSR_REG, ///< shift with register - ARM_SFT_ROR_REG, ///< shift with register - ARM_SFT_RRX_REG, ///< shift with register -} arm_shifter; +typedef struct _GDBusMenuModel GDBusMenuModel; -/// ARM condition code -typedef enum arm_cc { - ARM_CC_INVALID = 0, - ARM_CC_EQ, ///< Equal Equal - ARM_CC_NE, ///< Not equal Not equal, or unordered - ARM_CC_HS, ///< Carry set >, ==, or unordered - ARM_CC_LO, ///< Carry clear Less than - ARM_CC_MI, ///< Minus, negative Less than - ARM_CC_PL, ///< Plus, positive or zero >, ==, or unordered - ARM_CC_VS, ///< Overflow Unordered - ARM_CC_VC, ///< No overflow Not unordered - ARM_CC_HI, ///< Unsigned higher Greater than, or unordered - ARM_CC_LS, ///< Unsigned lower or same Less than or equal - ARM_CC_GE, ///< Greater than or equal Greater than or equal - ARM_CC_LT, ///< Less than Less than, or unordered - ARM_CC_GT, ///< Greater than Greater than - ARM_CC_LE, ///< Less than or equal <, ==, or unordered - ARM_CC_AL ///< Always (unconditional) Always (unconditional) -} arm_cc; +GIO_AVAILABLE_IN_ALL +GType g_dbus_menu_model_get_type (void) G_GNUC_CONST; -typedef enum arm_sysreg { - /// Special registers for MSR - ARM_SYSREG_INVALID = 0, +GIO_AVAILABLE_IN_ALL +GDBusMenuModel * g_dbus_menu_model_get (GDBusConnection *connection, + const gchar *bus_name, + const gchar *object_path); - // SPSR* registers can be OR combined - ARM_SYSREG_SPSR_C = 1, - ARM_SYSREG_SPSR_X = 2, - ARM_SYSREG_SPSR_S = 4, - ARM_SYSREG_SPSR_F = 8, +G_END_DECLS - // CPSR* registers can be OR combined - ARM_SYSREG_CPSR_C = 16, - ARM_SYSREG_CPSR_X = 32, - ARM_SYSREG_CPSR_S = 64, - ARM_SYSREG_CPSR_F = 128, +#endif /* __G_DBUS_MENU_MODEL_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ - // independent registers - ARM_SYSREG_APSR = 256, - ARM_SYSREG_APSR_G, - ARM_SYSREG_APSR_NZCVQ, - ARM_SYSREG_APSR_NZCVQG, +#ifndef __G_DBUS_MESSAGE_H__ +#define __G_DBUS_MESSAGE_H__ - ARM_SYSREG_IAPSR, - ARM_SYSREG_IAPSR_G, - ARM_SYSREG_IAPSR_NZCVQG, - ARM_SYSREG_IAPSR_NZCVQ, +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif - ARM_SYSREG_EAPSR, - ARM_SYSREG_EAPSR_G, - ARM_SYSREG_EAPSR_NZCVQG, - ARM_SYSREG_EAPSR_NZCVQ, - ARM_SYSREG_XPSR, - ARM_SYSREG_XPSR_G, - ARM_SYSREG_XPSR_NZCVQG, - ARM_SYSREG_XPSR_NZCVQ, +G_BEGIN_DECLS - ARM_SYSREG_IPSR, - ARM_SYSREG_EPSR, - ARM_SYSREG_IEPSR, +#define G_TYPE_DBUS_MESSAGE (g_dbus_message_get_type ()) +#define G_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_MESSAGE, GDBusMessage)) +#define G_IS_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_MESSAGE)) + +GIO_AVAILABLE_IN_ALL +GType g_dbus_message_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new (void); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_signal (const gchar *path, + const gchar *interface_, + const gchar *signal); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_method_call (const gchar *name, + const gchar *path, + const gchar *interface_, + const gchar *method); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_method_reply (GDBusMessage *method_call_message); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_method_error (GDBusMessage *method_call_message, + const gchar *error_name, + const gchar *error_message_format, + ...) G_GNUC_PRINTF(3, 4); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_method_error_valist (GDBusMessage *method_call_message, + const gchar *error_name, + const gchar *error_message_format, + va_list var_args); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_method_error_literal (GDBusMessage *method_call_message, + const gchar *error_name, + const gchar *error_message); +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_message_print (GDBusMessage *message, + guint indent); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_message_get_locked (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_lock (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_copy (GDBusMessage *message, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusMessageByteOrder g_dbus_message_get_byte_order (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_byte_order (GDBusMessage *message, + GDBusMessageByteOrder byte_order); + +GIO_AVAILABLE_IN_ALL +GDBusMessageType g_dbus_message_get_message_type (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_message_type (GDBusMessage *message, + GDBusMessageType type); +GIO_AVAILABLE_IN_ALL +GDBusMessageFlags g_dbus_message_get_flags (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_flags (GDBusMessage *message, + GDBusMessageFlags flags); +GIO_AVAILABLE_IN_ALL +guint32 g_dbus_message_get_serial (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_serial (GDBusMessage *message, + guint32 serial); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_message_get_header (GDBusMessage *message, + GDBusMessageHeaderField header_field); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_header (GDBusMessage *message, + GDBusMessageHeaderField header_field, + GVariant *value); +GIO_AVAILABLE_IN_ALL +guchar *g_dbus_message_get_header_fields (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_message_get_body (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_body (GDBusMessage *message, + GVariant *body); - ARM_SYSREG_MSP, - ARM_SYSREG_PSP, - ARM_SYSREG_PRIMASK, - ARM_SYSREG_BASEPRI, - ARM_SYSREG_BASEPRI_MAX, - ARM_SYSREG_FAULTMASK, - ARM_SYSREG_CONTROL, - ARM_SYSREG_MSPLIM, - ARM_SYSREG_PSPLIM, - ARM_SYSREG_MSP_NS, - ARM_SYSREG_PSP_NS, - ARM_SYSREG_MSPLIM_NS, - ARM_SYSREG_PSPLIM_NS, - ARM_SYSREG_PRIMASK_NS, - ARM_SYSREG_BASEPRI_NS, - ARM_SYSREG_FAULTMASK_NS, - ARM_SYSREG_CONTROL_NS, - ARM_SYSREG_SP_NS, +#ifdef G_OS_UNIX - // Banked Registers - ARM_SYSREG_R8_USR, - ARM_SYSREG_R9_USR, - ARM_SYSREG_R10_USR, - ARM_SYSREG_R11_USR, - ARM_SYSREG_R12_USR, - ARM_SYSREG_SP_USR, - ARM_SYSREG_LR_USR, - ARM_SYSREG_R8_FIQ, - ARM_SYSREG_R9_FIQ, - ARM_SYSREG_R10_FIQ, - ARM_SYSREG_R11_FIQ, - ARM_SYSREG_R12_FIQ, - ARM_SYSREG_SP_FIQ, - ARM_SYSREG_LR_FIQ, - ARM_SYSREG_LR_IRQ, - ARM_SYSREG_SP_IRQ, - ARM_SYSREG_LR_SVC, - ARM_SYSREG_SP_SVC, - ARM_SYSREG_LR_ABT, - ARM_SYSREG_SP_ABT, - ARM_SYSREG_LR_UND, - ARM_SYSREG_SP_UND, - ARM_SYSREG_LR_MON, - ARM_SYSREG_SP_MON, - ARM_SYSREG_ELR_HYP, - ARM_SYSREG_SP_HYP, +GIO_AVAILABLE_IN_ALL +GUnixFDList *g_dbus_message_get_unix_fd_list (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_unix_fd_list (GDBusMessage *message, + GUnixFDList *fd_list); + +#endif /* G_OS_UNIX */ + +GIO_AVAILABLE_IN_ALL +guint32 g_dbus_message_get_reply_serial (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_reply_serial (GDBusMessage *message, + guint32 value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_interface (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_interface (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_member (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_member (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_path (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_path (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_sender (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_sender (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_destination (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_destination (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_error_name (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_error_name (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_signature (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_signature (GDBusMessage *message, + const gchar *value); + +GIO_AVAILABLE_IN_ALL +guint32 g_dbus_message_get_num_unix_fds (GDBusMessage *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_message_set_num_unix_fds (GDBusMessage *message, + guint32 value); + +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_message_get_arg0 (GDBusMessage *message); + + +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_message_new_from_blob (guchar *blob, + gsize blob_len, + GDBusCapabilityFlags capabilities, + GError **error); + +GIO_AVAILABLE_IN_ALL +gssize g_dbus_message_bytes_needed (guchar *blob, + gsize blob_len, + GError **error); + +GIO_AVAILABLE_IN_ALL +guchar *g_dbus_message_to_blob (GDBusMessage *message, + gsize *out_size, + GDBusCapabilityFlags capabilities, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_message_to_gerror (GDBusMessage *message, + GError **error); - ARM_SYSREG_SPSR_FIQ, - ARM_SYSREG_SPSR_IRQ, - ARM_SYSREG_SPSR_SVC, - ARM_SYSREG_SPSR_ABT, - ARM_SYSREG_SPSR_UND, - ARM_SYSREG_SPSR_MON, - ARM_SYSREG_SPSR_HYP, -} arm_sysreg; +G_END_DECLS -/// The memory barrier constants map directly to the 4-bit encoding of -/// the option field for Memory Barrier operations. -typedef enum arm_mem_barrier { - ARM_MB_INVALID = 0, - ARM_MB_RESERVED_0, - ARM_MB_OSHLD, - ARM_MB_OSHST, - ARM_MB_OSH, - ARM_MB_RESERVED_4, - ARM_MB_NSHLD, - ARM_MB_NSHST, - ARM_MB_NSH, - ARM_MB_RESERVED_8, - ARM_MB_ISHLD, - ARM_MB_ISHST, - ARM_MB_ISH, - ARM_MB_RESERVED_12, - ARM_MB_LD, - ARM_MB_ST, - ARM_MB_SY, -} arm_mem_barrier; +#endif /* __G_DBUS_MESSAGE_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ -/// Operand type for instruction's operands -typedef enum arm_op_type { - ARM_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - ARM_OP_REG, ///< = CS_OP_REG (Register operand). - ARM_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - ARM_OP_MEM, ///< = CS_OP_MEM (Memory operand). - ARM_OP_FP, ///< = CS_OP_FP (Floating-Point operand). - ARM_OP_CIMM = 64, ///< C-Immediate (coprocessor registers) - ARM_OP_PIMM, ///< P-Immediate (coprocessor registers) - ARM_OP_SETEND, ///< operand for SETEND instruction - ARM_OP_SYSREG, ///< MSR/MRS special register operand -} arm_op_type; +#ifndef __G_DBUS_METHOD_INVOCATION_H__ +#define __G_DBUS_METHOD_INVOCATION_H__ -/// Operand type for SETEND instruction -typedef enum arm_setend_type { - ARM_SETEND_INVALID = 0, ///< Uninitialized. - ARM_SETEND_BE, ///< BE operand. - ARM_SETEND_LE, ///< LE operand -} arm_setend_type; +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif -typedef enum arm_cpsmode_type { - ARM_CPSMODE_INVALID = 0, - ARM_CPSMODE_IE = 2, - ARM_CPSMODE_ID = 3 -} arm_cpsmode_type; -/// Operand type for SETEND instruction -typedef enum arm_cpsflag_type { - ARM_CPSFLAG_INVALID = 0, - ARM_CPSFLAG_F = 1, - ARM_CPSFLAG_I = 2, - ARM_CPSFLAG_A = 4, - ARM_CPSFLAG_NONE = 16, ///< no flag -} arm_cpsflag_type; +G_BEGIN_DECLS -/// Data type for elements of vector instructions. -typedef enum arm_vectordata_type { - ARM_VECTORDATA_INVALID = 0, +#define G_TYPE_DBUS_METHOD_INVOCATION (g_dbus_method_invocation_get_type ()) +#define G_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_METHOD_INVOCATION, GDBusMethodInvocation)) +#define G_IS_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_METHOD_INVOCATION)) - // Integer type - ARM_VECTORDATA_I8, - ARM_VECTORDATA_I16, - ARM_VECTORDATA_I32, - ARM_VECTORDATA_I64, +/** + * G_DBUS_METHOD_INVOCATION_HANDLED: + * + * The value returned by handlers of the signals generated by + * the `gdbus-codegen` tool to indicate that a method call has been + * handled by an implementation. It is equal to %TRUE, but using + * this macro is sometimes more readable. + * + * In code that needs to be backwards-compatible with older GLib, + * use %TRUE instead, often written like this: + * + * |[ + * g_dbus_method_invocation_return_error (invocation, ...); + * return TRUE; // handled + * ]| + * + * Since: 2.68 + */ +#define G_DBUS_METHOD_INVOCATION_HANDLED TRUE GIO_AVAILABLE_MACRO_IN_2_68 - // Signed integer type - ARM_VECTORDATA_S8, - ARM_VECTORDATA_S16, - ARM_VECTORDATA_S32, - ARM_VECTORDATA_S64, +/** + * G_DBUS_METHOD_INVOCATION_UNHANDLED: + * + * The value returned by handlers of the signals generated by + * the `gdbus-codegen` tool to indicate that a method call has not been + * handled by an implementation. It is equal to %FALSE, but using + * this macro is sometimes more readable. + * + * In code that needs to be backwards-compatible with older GLib, + * use %FALSE instead. + * + * Since: 2.68 + */ +#define G_DBUS_METHOD_INVOCATION_UNHANDLED FALSE GIO_AVAILABLE_MACRO_IN_2_68 + +GIO_AVAILABLE_IN_ALL +GType g_dbus_method_invocation_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_method_invocation_get_sender (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_method_invocation_get_object_path (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_method_invocation_get_interface_name (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_method_invocation_get_method_name (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +const GDBusMethodInfo *g_dbus_method_invocation_get_method_info (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_2_38 +const GDBusPropertyInfo *g_dbus_method_invocation_get_property_info (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_method_invocation_get_connection (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +GDBusMessage *g_dbus_method_invocation_get_message (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_method_invocation_get_parameters (GDBusMethodInvocation *invocation); +GIO_AVAILABLE_IN_ALL +gpointer g_dbus_method_invocation_get_user_data (GDBusMethodInvocation *invocation); + +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation, + GVariant *parameters); +#ifdef G_OS_UNIX +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_value_with_unix_fd_list (GDBusMethodInvocation *invocation, + GVariant *parameters, + GUnixFDList *fd_list); +#endif /* G_OS_UNIX */ +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_error (GDBusMethodInvocation *invocation, + GQuark domain, + gint code, + const gchar *format, + ...) G_GNUC_PRINTF(4, 5); +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_error_valist (GDBusMethodInvocation *invocation, + GQuark domain, + gint code, + const gchar *format, + va_list var_args) + G_GNUC_PRINTF(4, 0); +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_error_literal (GDBusMethodInvocation *invocation, + GQuark domain, + gint code, + const gchar *message); +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_gerror (GDBusMethodInvocation *invocation, + const GError *error); +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_take_error (GDBusMethodInvocation *invocation, + GError *error); +GIO_AVAILABLE_IN_ALL +void g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation, + const gchar *error_name, + const gchar *error_message); - // Unsigned integer type - ARM_VECTORDATA_U8, - ARM_VECTORDATA_U16, - ARM_VECTORDATA_U32, - ARM_VECTORDATA_U64, +G_END_DECLS - // Data type for VMUL/VMULL - ARM_VECTORDATA_P8, +#endif /* __G_DBUS_METHOD_INVOCATION_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ - // Floating type - ARM_VECTORDATA_F16, - ARM_VECTORDATA_F32, - ARM_VECTORDATA_F64, +#ifndef __G_DBUS_NAME_OWNING_H__ +#define __G_DBUS_NAME_OWNING_H__ - // Convert float <-> float - ARM_VECTORDATA_F16F64, // f16.f64 - ARM_VECTORDATA_F64F16, // f64.f16 - ARM_VECTORDATA_F32F16, // f32.f16 - ARM_VECTORDATA_F16F32, // f32.f16 - ARM_VECTORDATA_F64F32, // f64.f32 - ARM_VECTORDATA_F32F64, // f32.f64 +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif - // Convert integer <-> float - ARM_VECTORDATA_S32F32, // s32.f32 - ARM_VECTORDATA_U32F32, // u32.f32 - ARM_VECTORDATA_F32S32, // f32.s32 - ARM_VECTORDATA_F32U32, // f32.u32 - ARM_VECTORDATA_F64S16, // f64.s16 - ARM_VECTORDATA_F32S16, // f32.s16 - ARM_VECTORDATA_F64S32, // f64.s32 - ARM_VECTORDATA_S16F64, // s16.f64 - ARM_VECTORDATA_S16F32, // s16.f64 - ARM_VECTORDATA_S32F64, // s32.f64 - ARM_VECTORDATA_U16F64, // u16.f64 - ARM_VECTORDATA_U16F32, // u16.f32 - ARM_VECTORDATA_U32F64, // u32.f64 - ARM_VECTORDATA_F64U16, // f64.u16 - ARM_VECTORDATA_F32U16, // f32.u16 - ARM_VECTORDATA_F64U32, // f64.u32 - ARM_VECTORDATA_F16U16, // f16.u16 - ARM_VECTORDATA_U16F16, // u16.f16 - ARM_VECTORDATA_F16U32, // f16.u32 - ARM_VECTORDATA_U32F16, // u32.f16 -} arm_vectordata_type; -/// ARM registers -typedef enum arm_reg { - ARM_REG_INVALID = 0, - ARM_REG_APSR, - ARM_REG_APSR_NZCV, - ARM_REG_CPSR, - ARM_REG_FPEXC, - ARM_REG_FPINST, - ARM_REG_FPSCR, - ARM_REG_FPSCR_NZCV, - ARM_REG_FPSID, - ARM_REG_ITSTATE, - ARM_REG_LR, - ARM_REG_PC, - ARM_REG_SP, - ARM_REG_SPSR, - ARM_REG_D0, - ARM_REG_D1, - ARM_REG_D2, - ARM_REG_D3, - ARM_REG_D4, - ARM_REG_D5, - ARM_REG_D6, - ARM_REG_D7, - ARM_REG_D8, - ARM_REG_D9, - ARM_REG_D10, - ARM_REG_D11, - ARM_REG_D12, - ARM_REG_D13, - ARM_REG_D14, - ARM_REG_D15, - ARM_REG_D16, - ARM_REG_D17, - ARM_REG_D18, - ARM_REG_D19, - ARM_REG_D20, - ARM_REG_D21, - ARM_REG_D22, - ARM_REG_D23, - ARM_REG_D24, - ARM_REG_D25, - ARM_REG_D26, - ARM_REG_D27, - ARM_REG_D28, - ARM_REG_D29, - ARM_REG_D30, - ARM_REG_D31, - ARM_REG_FPINST2, - ARM_REG_MVFR0, - ARM_REG_MVFR1, - ARM_REG_MVFR2, - ARM_REG_Q0, - ARM_REG_Q1, - ARM_REG_Q2, - ARM_REG_Q3, - ARM_REG_Q4, - ARM_REG_Q5, - ARM_REG_Q6, - ARM_REG_Q7, - ARM_REG_Q8, - ARM_REG_Q9, - ARM_REG_Q10, - ARM_REG_Q11, - ARM_REG_Q12, - ARM_REG_Q13, - ARM_REG_Q14, - ARM_REG_Q15, - ARM_REG_R0, - ARM_REG_R1, - ARM_REG_R2, - ARM_REG_R3, - ARM_REG_R4, - ARM_REG_R5, - ARM_REG_R6, - ARM_REG_R7, - ARM_REG_R8, - ARM_REG_R9, - ARM_REG_R10, - ARM_REG_R11, - ARM_REG_R12, - ARM_REG_S0, - ARM_REG_S1, - ARM_REG_S2, - ARM_REG_S3, - ARM_REG_S4, - ARM_REG_S5, - ARM_REG_S6, - ARM_REG_S7, - ARM_REG_S8, - ARM_REG_S9, - ARM_REG_S10, - ARM_REG_S11, - ARM_REG_S12, - ARM_REG_S13, - ARM_REG_S14, - ARM_REG_S15, - ARM_REG_S16, - ARM_REG_S17, - ARM_REG_S18, - ARM_REG_S19, - ARM_REG_S20, - ARM_REG_S21, - ARM_REG_S22, - ARM_REG_S23, - ARM_REG_S24, - ARM_REG_S25, - ARM_REG_S26, - ARM_REG_S27, - ARM_REG_S28, - ARM_REG_S29, - ARM_REG_S30, - ARM_REG_S31, +G_BEGIN_DECLS - ARM_REG_ENDING, // <-- mark the end of the list or registers +/** + * GBusAcquiredCallback: + * @connection: The #GDBusConnection to a message bus. + * @name: The name that is requested to be owned. + * @user_data: User data passed to g_bus_own_name(). + * + * Invoked when a connection to a message bus has been obtained. + * + * Since: 2.26 + */ +typedef void (*GBusAcquiredCallback) (GDBusConnection *connection, + const gchar *name, + gpointer user_data); - // alias registers - ARM_REG_R13 = ARM_REG_SP, - ARM_REG_R14 = ARM_REG_LR, - ARM_REG_R15 = ARM_REG_PC, +/** + * GBusNameAcquiredCallback: + * @connection: The #GDBusConnection on which to acquired the name. + * @name: The name being owned. + * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection(). + * + * Invoked when the name is acquired. + * + * Since: 2.26 + */ +typedef void (*GBusNameAcquiredCallback) (GDBusConnection *connection, + const gchar *name, + gpointer user_data); - ARM_REG_SB = ARM_REG_R9, - ARM_REG_SL = ARM_REG_R10, - ARM_REG_FP = ARM_REG_R11, - ARM_REG_IP = ARM_REG_R12, -} arm_reg; +/** + * GBusNameLostCallback: + * @connection: The #GDBusConnection on which to acquire the name or %NULL if + * the connection was disconnected. + * @name: The name being owned. + * @user_data: User data passed to g_bus_own_name() or g_bus_own_name_on_connection(). + * + * Invoked when the name is lost or @connection has been closed. + * + * Since: 2.26 + */ +typedef void (*GBusNameLostCallback) (GDBusConnection *connection, + const gchar *name, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +guint g_bus_own_name (GBusType bus_type, + const gchar *name, + GBusNameOwnerFlags flags, + GBusAcquiredCallback bus_acquired_handler, + GBusNameAcquiredCallback name_acquired_handler, + GBusNameLostCallback name_lost_handler, + gpointer user_data, + GDestroyNotify user_data_free_func); + +GIO_AVAILABLE_IN_ALL +guint g_bus_own_name_on_connection (GDBusConnection *connection, + const gchar *name, + GBusNameOwnerFlags flags, + GBusNameAcquiredCallback name_acquired_handler, + GBusNameLostCallback name_lost_handler, + gpointer user_data, + GDestroyNotify user_data_free_func); + +GIO_AVAILABLE_IN_ALL +guint g_bus_own_name_with_closures (GBusType bus_type, + const gchar *name, + GBusNameOwnerFlags flags, + GClosure *bus_acquired_closure, + GClosure *name_acquired_closure, + GClosure *name_lost_closure); + +GIO_AVAILABLE_IN_ALL +guint g_bus_own_name_on_connection_with_closures ( + GDBusConnection *connection, + const gchar *name, + GBusNameOwnerFlags flags, + GClosure *name_acquired_closure, + GClosure *name_lost_closure); + +GIO_AVAILABLE_IN_ALL +void g_bus_unown_name (guint owner_id); -/// Instruction's operand referring to memory -/// This is associated with ARM_OP_MEM operand type above -typedef struct arm_op_mem { - arm_reg base; ///< base register - arm_reg index; ///< index register - int scale; ///< scale for index register (can be 1, or -1) - int disp; ///< displacement/offset value - /// left-shift on index register, or 0 if irrelevant - /// NOTE: this value can also be fetched via operand.shift.value - int lshift; -} arm_op_mem; +G_END_DECLS -/// Instruction operand -typedef struct cs_arm_op { - int vector_index; ///< Vector Index for some vector operands (or -1 if irrelevant) +#endif /* __G_DBUS_NAME_OWNING_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ - struct { - arm_shifter type; - unsigned int value; - } shift; +#ifndef __G_DBUS_NAME_WATCHING_H__ +#define __G_DBUS_NAME_WATCHING_H__ - arm_op_type type; ///< operand type +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif - union { - int reg; ///< register value for REG/SYSREG operand - int32_t imm; ///< immediate value for C-IMM, P-IMM or IMM operand - double fp; ///< floating point value for FP operand - arm_op_mem mem; ///< base/index/scale/disp value for MEM operand - arm_setend_type setend; ///< SETEND instruction's operand type - }; - /// in some instructions, an operand can be subtracted or added to - /// the base register, - /// if TRUE, this operand is subtracted. otherwise, it is added. - bool subtracted; +G_BEGIN_DECLS - /// How is this operand accessed? (READ, WRITE or READ|WRITE) - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; +/** + * GBusNameAppearedCallback: + * @connection: The #GDBusConnection the name is being watched on. + * @name: The name being watched. + * @name_owner: Unique name of the owner of the name being watched. + * @user_data: User data passed to g_bus_watch_name(). + * + * Invoked when the name being watched is known to have to have an owner. + * + * Since: 2.26 + */ +typedef void (*GBusNameAppearedCallback) (GDBusConnection *connection, + const gchar *name, + const gchar *name_owner, + gpointer user_data); - /// Neon lane index for NEON instructions (or -1 if irrelevant) - int8_t neon_lane; -} cs_arm_op; +/** + * GBusNameVanishedCallback: + * @connection: The #GDBusConnection the name is being watched on, or + * %NULL. + * @name: The name being watched. + * @user_data: User data passed to g_bus_watch_name(). + * + * Invoked when the name being watched is known not to have to have an owner. + * + * This is also invoked when the #GDBusConnection on which the watch was + * established has been closed. In that case, @connection will be + * %NULL. + * + * Since: 2.26 + */ +typedef void (*GBusNameVanishedCallback) (GDBusConnection *connection, + const gchar *name, + gpointer user_data); + + +GIO_AVAILABLE_IN_ALL +guint g_bus_watch_name (GBusType bus_type, + const gchar *name, + GBusNameWatcherFlags flags, + GBusNameAppearedCallback name_appeared_handler, + GBusNameVanishedCallback name_vanished_handler, + gpointer user_data, + GDestroyNotify user_data_free_func); +GIO_AVAILABLE_IN_ALL +guint g_bus_watch_name_on_connection (GDBusConnection *connection, + const gchar *name, + GBusNameWatcherFlags flags, + GBusNameAppearedCallback name_appeared_handler, + GBusNameVanishedCallback name_vanished_handler, + gpointer user_data, + GDestroyNotify user_data_free_func); +GIO_AVAILABLE_IN_ALL +guint g_bus_watch_name_with_closures (GBusType bus_type, + const gchar *name, + GBusNameWatcherFlags flags, + GClosure *name_appeared_closure, + GClosure *name_vanished_closure); +GIO_AVAILABLE_IN_ALL +guint g_bus_watch_name_on_connection_with_closures ( + GDBusConnection *connection, + const gchar *name, + GBusNameWatcherFlags flags, + GClosure *name_appeared_closure, + GClosure *name_vanished_closure); +GIO_AVAILABLE_IN_ALL +void g_bus_unwatch_name (guint watcher_id); -/// Instruction structure -typedef struct cs_arm { - bool usermode; ///< User-mode registers to be loaded (for LDM/STM instructions) - int vector_size; ///< Scalar size for vector instructions - arm_vectordata_type vector_data; ///< Data type for elements of vector instructions - arm_cpsmode_type cps_mode; ///< CPS mode for CPS instruction - arm_cpsflag_type cps_flag; ///< CPS mode for CPS instruction - arm_cc cc; ///< conditional code for this insn - bool update_flags; ///< does this insn update flags? - bool writeback; ///< does this insn write-back? - bool post_index; ///< only set if writeback is 'True', if 'False' pre-index, otherwise post. - arm_mem_barrier mem_barrier; ///< Option for some memory barrier instructions +G_END_DECLS - /// Number of operands of this instruction, - /// or 0 when instruction has no operand. - uint8_t op_count; +#endif /* __G_DBUS_NAME_WATCHING_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ - cs_arm_op operands[36]; ///< operands for this instruction. -} cs_arm; +#ifndef __G_DBUS_OBJECT_H__ +#define __G_DBUS_OBJECT_H__ -/// ARM instruction -typedef enum arm_insn { - ARM_INS_INVALID = 0, - ARM_INS_ADC, - ARM_INS_ADD, - ARM_INS_ADDW, - ARM_INS_ADR, - ARM_INS_AESD, - ARM_INS_AESE, - ARM_INS_AESIMC, - ARM_INS_AESMC, - ARM_INS_AND, - ARM_INS_ASR, - ARM_INS_B, - ARM_INS_BFC, - ARM_INS_BFI, - ARM_INS_BIC, - ARM_INS_BKPT, - ARM_INS_BL, - ARM_INS_BLX, - ARM_INS_BLXNS, - ARM_INS_BX, - ARM_INS_BXJ, - ARM_INS_BXNS, - ARM_INS_CBNZ, - ARM_INS_CBZ, - ARM_INS_CDP, - ARM_INS_CDP2, - ARM_INS_CLREX, - ARM_INS_CLZ, - ARM_INS_CMN, - ARM_INS_CMP, - ARM_INS_CPS, - ARM_INS_CRC32B, - ARM_INS_CRC32CB, - ARM_INS_CRC32CH, - ARM_INS_CRC32CW, - ARM_INS_CRC32H, - ARM_INS_CRC32W, - ARM_INS_CSDB, - ARM_INS_DBG, - ARM_INS_DCPS1, - ARM_INS_DCPS2, - ARM_INS_DCPS3, - ARM_INS_DFB, - ARM_INS_DMB, - ARM_INS_DSB, - ARM_INS_EOR, - ARM_INS_ERET, - ARM_INS_ESB, - ARM_INS_FADDD, - ARM_INS_FADDS, - ARM_INS_FCMPZD, - ARM_INS_FCMPZS, - ARM_INS_FCONSTD, - ARM_INS_FCONSTS, - ARM_INS_FLDMDBX, - ARM_INS_FLDMIAX, - ARM_INS_FMDHR, - ARM_INS_FMDLR, - ARM_INS_FMSTAT, - ARM_INS_FSTMDBX, - ARM_INS_FSTMIAX, - ARM_INS_FSUBD, - ARM_INS_FSUBS, - ARM_INS_HINT, - ARM_INS_HLT, - ARM_INS_HVC, - ARM_INS_ISB, - ARM_INS_IT, - ARM_INS_LDA, - ARM_INS_LDAB, - ARM_INS_LDAEX, - ARM_INS_LDAEXB, - ARM_INS_LDAEXD, - ARM_INS_LDAEXH, - ARM_INS_LDAH, - ARM_INS_LDC, - ARM_INS_LDC2, - ARM_INS_LDC2L, - ARM_INS_LDCL, - ARM_INS_LDM, - ARM_INS_LDMDA, - ARM_INS_LDMDB, - ARM_INS_LDMIB, - ARM_INS_LDR, - ARM_INS_LDRB, - ARM_INS_LDRBT, - ARM_INS_LDRD, - ARM_INS_LDREX, - ARM_INS_LDREXB, - ARM_INS_LDREXD, - ARM_INS_LDREXH, - ARM_INS_LDRH, - ARM_INS_LDRHT, - ARM_INS_LDRSB, - ARM_INS_LDRSBT, - ARM_INS_LDRSH, - ARM_INS_LDRSHT, - ARM_INS_LDRT, - ARM_INS_LSL, - ARM_INS_LSR, - ARM_INS_MCR, - ARM_INS_MCR2, - ARM_INS_MCRR, - ARM_INS_MCRR2, - ARM_INS_MLA, - ARM_INS_MLS, - ARM_INS_MOV, - ARM_INS_MOVS, - ARM_INS_MOVT, - ARM_INS_MOVW, - ARM_INS_MRC, - ARM_INS_MRC2, - ARM_INS_MRRC, - ARM_INS_MRRC2, - ARM_INS_MRS, - ARM_INS_MSR, - ARM_INS_MUL, - ARM_INS_MVN, - ARM_INS_NEG, - ARM_INS_NOP, - ARM_INS_ORN, - ARM_INS_ORR, - ARM_INS_PKHBT, - ARM_INS_PKHTB, - ARM_INS_PLD, - ARM_INS_PLDW, - ARM_INS_PLI, - ARM_INS_POP, - ARM_INS_PUSH, - ARM_INS_QADD, - ARM_INS_QADD16, - ARM_INS_QADD8, - ARM_INS_QASX, - ARM_INS_QDADD, - ARM_INS_QDSUB, - ARM_INS_QSAX, - ARM_INS_QSUB, - ARM_INS_QSUB16, - ARM_INS_QSUB8, - ARM_INS_RBIT, - ARM_INS_REV, - ARM_INS_REV16, - ARM_INS_REVSH, - ARM_INS_RFEDA, - ARM_INS_RFEDB, - ARM_INS_RFEIA, - ARM_INS_RFEIB, - ARM_INS_ROR, - ARM_INS_RRX, - ARM_INS_RSB, - ARM_INS_RSC, - ARM_INS_SADD16, - ARM_INS_SADD8, - ARM_INS_SASX, - ARM_INS_SBC, - ARM_INS_SBFX, - ARM_INS_SDIV, - ARM_INS_SEL, - ARM_INS_SETEND, - ARM_INS_SETPAN, - ARM_INS_SEV, - ARM_INS_SEVL, - ARM_INS_SG, - ARM_INS_SHA1C, - ARM_INS_SHA1H, - ARM_INS_SHA1M, - ARM_INS_SHA1P, - ARM_INS_SHA1SU0, - ARM_INS_SHA1SU1, - ARM_INS_SHA256H, - ARM_INS_SHA256H2, - ARM_INS_SHA256SU0, - ARM_INS_SHA256SU1, - ARM_INS_SHADD16, - ARM_INS_SHADD8, - ARM_INS_SHASX, - ARM_INS_SHSAX, - ARM_INS_SHSUB16, - ARM_INS_SHSUB8, - ARM_INS_SMC, - ARM_INS_SMLABB, - ARM_INS_SMLABT, - ARM_INS_SMLAD, - ARM_INS_SMLADX, - ARM_INS_SMLAL, - ARM_INS_SMLALBB, - ARM_INS_SMLALBT, - ARM_INS_SMLALD, - ARM_INS_SMLALDX, - ARM_INS_SMLALTB, - ARM_INS_SMLALTT, - ARM_INS_SMLATB, - ARM_INS_SMLATT, - ARM_INS_SMLAWB, - ARM_INS_SMLAWT, - ARM_INS_SMLSD, - ARM_INS_SMLSDX, - ARM_INS_SMLSLD, - ARM_INS_SMLSLDX, - ARM_INS_SMMLA, - ARM_INS_SMMLAR, - ARM_INS_SMMLS, - ARM_INS_SMMLSR, - ARM_INS_SMMUL, - ARM_INS_SMMULR, - ARM_INS_SMUAD, - ARM_INS_SMUADX, - ARM_INS_SMULBB, - ARM_INS_SMULBT, - ARM_INS_SMULL, - ARM_INS_SMULTB, - ARM_INS_SMULTT, - ARM_INS_SMULWB, - ARM_INS_SMULWT, - ARM_INS_SMUSD, - ARM_INS_SMUSDX, - ARM_INS_SRSDA, - ARM_INS_SRSDB, - ARM_INS_SRSIA, - ARM_INS_SRSIB, - ARM_INS_SSAT, - ARM_INS_SSAT16, - ARM_INS_SSAX, - ARM_INS_SSUB16, - ARM_INS_SSUB8, - ARM_INS_STC, - ARM_INS_STC2, - ARM_INS_STC2L, - ARM_INS_STCL, - ARM_INS_STL, - ARM_INS_STLB, - ARM_INS_STLEX, - ARM_INS_STLEXB, - ARM_INS_STLEXD, - ARM_INS_STLEXH, - ARM_INS_STLH, - ARM_INS_STM, - ARM_INS_STMDA, - ARM_INS_STMDB, - ARM_INS_STMIB, - ARM_INS_STR, - ARM_INS_STRB, - ARM_INS_STRBT, - ARM_INS_STRD, - ARM_INS_STREX, - ARM_INS_STREXB, - ARM_INS_STREXD, - ARM_INS_STREXH, - ARM_INS_STRH, - ARM_INS_STRHT, - ARM_INS_STRT, - ARM_INS_SUB, - ARM_INS_SUBS, - ARM_INS_SUBW, - ARM_INS_SVC, - ARM_INS_SWP, - ARM_INS_SWPB, - ARM_INS_SXTAB, - ARM_INS_SXTAB16, - ARM_INS_SXTAH, - ARM_INS_SXTB, - ARM_INS_SXTB16, - ARM_INS_SXTH, - ARM_INS_TBB, - ARM_INS_TBH, - ARM_INS_TEQ, - ARM_INS_TRAP, - ARM_INS_TSB, - ARM_INS_TST, - ARM_INS_TT, - ARM_INS_TTA, - ARM_INS_TTAT, - ARM_INS_TTT, - ARM_INS_UADD16, - ARM_INS_UADD8, - ARM_INS_UASX, - ARM_INS_UBFX, - ARM_INS_UDF, - ARM_INS_UDIV, - ARM_INS_UHADD16, - ARM_INS_UHADD8, - ARM_INS_UHASX, - ARM_INS_UHSAX, - ARM_INS_UHSUB16, - ARM_INS_UHSUB8, - ARM_INS_UMAAL, - ARM_INS_UMLAL, - ARM_INS_UMULL, - ARM_INS_UQADD16, - ARM_INS_UQADD8, - ARM_INS_UQASX, - ARM_INS_UQSAX, - ARM_INS_UQSUB16, - ARM_INS_UQSUB8, - ARM_INS_USAD8, - ARM_INS_USADA8, - ARM_INS_USAT, - ARM_INS_USAT16, - ARM_INS_USAX, - ARM_INS_USUB16, - ARM_INS_USUB8, - ARM_INS_UXTAB, - ARM_INS_UXTAB16, - ARM_INS_UXTAH, - ARM_INS_UXTB, - ARM_INS_UXTB16, - ARM_INS_UXTH, - ARM_INS_VABA, - ARM_INS_VABAL, - ARM_INS_VABD, - ARM_INS_VABDL, - ARM_INS_VABS, - ARM_INS_VACGE, - ARM_INS_VACGT, - ARM_INS_VACLE, - ARM_INS_VACLT, - ARM_INS_VADD, - ARM_INS_VADDHN, - ARM_INS_VADDL, - ARM_INS_VADDW, - ARM_INS_VAND, - ARM_INS_VBIC, - ARM_INS_VBIF, - ARM_INS_VBIT, - ARM_INS_VBSL, - ARM_INS_VCADD, - ARM_INS_VCEQ, - ARM_INS_VCGE, - ARM_INS_VCGT, - ARM_INS_VCLE, - ARM_INS_VCLS, - ARM_INS_VCLT, - ARM_INS_VCLZ, - ARM_INS_VCMLA, - ARM_INS_VCMP, - ARM_INS_VCMPE, - ARM_INS_VCNT, - ARM_INS_VCVT, - ARM_INS_VCVTA, - ARM_INS_VCVTB, - ARM_INS_VCVTM, - ARM_INS_VCVTN, - ARM_INS_VCVTP, - ARM_INS_VCVTR, - ARM_INS_VCVTT, - ARM_INS_VDIV, - ARM_INS_VDUP, - ARM_INS_VEOR, - ARM_INS_VEXT, - ARM_INS_VFMA, - ARM_INS_VFMS, - ARM_INS_VFNMA, - ARM_INS_VFNMS, - ARM_INS_VHADD, - ARM_INS_VHSUB, - ARM_INS_VINS, - ARM_INS_VJCVT, - ARM_INS_VLD1, - ARM_INS_VLD2, - ARM_INS_VLD3, - ARM_INS_VLD4, - ARM_INS_VLDMDB, - ARM_INS_VLDMIA, - ARM_INS_VLDR, - ARM_INS_VLLDM, - ARM_INS_VLSTM, - ARM_INS_VMAX, - ARM_INS_VMAXNM, - ARM_INS_VMIN, - ARM_INS_VMINNM, - ARM_INS_VMLA, - ARM_INS_VMLAL, - ARM_INS_VMLS, - ARM_INS_VMLSL, - ARM_INS_VMOV, - ARM_INS_VMOVL, - ARM_INS_VMOVN, - ARM_INS_VMOVX, - ARM_INS_VMRS, - ARM_INS_VMSR, - ARM_INS_VMUL, - ARM_INS_VMULL, - ARM_INS_VMVN, - ARM_INS_VNEG, - ARM_INS_VNMLA, - ARM_INS_VNMLS, - ARM_INS_VNMUL, - ARM_INS_VORN, - ARM_INS_VORR, - ARM_INS_VPADAL, - ARM_INS_VPADD, - ARM_INS_VPADDL, - ARM_INS_VPMAX, - ARM_INS_VPMIN, - ARM_INS_VPOP, - ARM_INS_VPUSH, - ARM_INS_VQABS, - ARM_INS_VQADD, - ARM_INS_VQDMLAL, - ARM_INS_VQDMLSL, - ARM_INS_VQDMULH, - ARM_INS_VQDMULL, - ARM_INS_VQMOVN, - ARM_INS_VQMOVUN, - ARM_INS_VQNEG, - ARM_INS_VQRDMLAH, - ARM_INS_VQRDMLSH, - ARM_INS_VQRDMULH, - ARM_INS_VQRSHL, - ARM_INS_VQRSHRN, - ARM_INS_VQRSHRUN, - ARM_INS_VQSHL, - ARM_INS_VQSHLU, - ARM_INS_VQSHRN, - ARM_INS_VQSHRUN, - ARM_INS_VQSUB, - ARM_INS_VRADDHN, - ARM_INS_VRECPE, - ARM_INS_VRECPS, - ARM_INS_VREV16, - ARM_INS_VREV32, - ARM_INS_VREV64, - ARM_INS_VRHADD, - ARM_INS_VRINTA, - ARM_INS_VRINTM, - ARM_INS_VRINTN, - ARM_INS_VRINTP, - ARM_INS_VRINTR, - ARM_INS_VRINTX, - ARM_INS_VRINTZ, - ARM_INS_VRSHL, - ARM_INS_VRSHR, - ARM_INS_VRSHRN, - ARM_INS_VRSQRTE, - ARM_INS_VRSQRTS, - ARM_INS_VRSRA, - ARM_INS_VRSUBHN, - ARM_INS_VSDOT, - ARM_INS_VSELEQ, - ARM_INS_VSELGE, - ARM_INS_VSELGT, - ARM_INS_VSELVS, - ARM_INS_VSHL, - ARM_INS_VSHLL, - ARM_INS_VSHR, - ARM_INS_VSHRN, - ARM_INS_VSLI, - ARM_INS_VSQRT, - ARM_INS_VSRA, - ARM_INS_VSRI, - ARM_INS_VST1, - ARM_INS_VST2, - ARM_INS_VST3, - ARM_INS_VST4, - ARM_INS_VSTMDB, - ARM_INS_VSTMIA, - ARM_INS_VSTR, - ARM_INS_VSUB, - ARM_INS_VSUBHN, - ARM_INS_VSUBL, - ARM_INS_VSUBW, - ARM_INS_VSWP, - ARM_INS_VTBL, - ARM_INS_VTBX, - ARM_INS_VTRN, - ARM_INS_VTST, - ARM_INS_VUDOT, - ARM_INS_VUZP, - ARM_INS_VZIP, - ARM_INS_WFE, - ARM_INS_WFI, - ARM_INS_YIELD, +G_BEGIN_DECLS - ARM_INS_ENDING, // <-- mark the end of the list of instructions -} arm_insn; +#define G_TYPE_DBUS_OBJECT (g_dbus_object_get_type()) +#define G_DBUS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT, GDBusObject)) +#define G_IS_DBUS_OBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT)) +#define G_DBUS_OBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_OBJECT, GDBusObjectIface)) -/// Group of ARM instructions -typedef enum arm_insn_group { - ARM_GRP_INVALID = 0, ///< = CS_GRP_INVALID +typedef struct _GDBusObjectIface GDBusObjectIface; - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - ARM_GRP_JUMP, ///< = CS_GRP_JUMP - ARM_GRP_CALL, ///< = CS_GRP_CALL - ARM_GRP_INT = 4, ///< = CS_GRP_INT - ARM_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE - ARM_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE +/** + * GDBusObjectIface: + * @parent_iface: The parent interface. + * @get_object_path: Returns the object path. See g_dbus_object_get_object_path(). + * @get_interfaces: Returns all interfaces. See g_dbus_object_get_interfaces(). + * @get_interface: Returns an interface by name. See g_dbus_object_get_interface(). + * @interface_added: Signal handler for the #GDBusObject::interface-added signal. + * @interface_removed: Signal handler for the #GDBusObject::interface-removed signal. + * + * Base object type for D-Bus objects. + * + * Since: 2.30 + */ +struct _GDBusObjectIface +{ + GTypeInterface parent_iface; - // Architecture-specific groups - ARM_GRP_CRYPTO = 128, - ARM_GRP_DATABARRIER, - ARM_GRP_DIVIDE, - ARM_GRP_FPARMV8, - ARM_GRP_MULTPRO, - ARM_GRP_NEON, - ARM_GRP_T2EXTRACTPACK, - ARM_GRP_THUMB2DSP, - ARM_GRP_TRUSTZONE, - ARM_GRP_V4T, - ARM_GRP_V5T, - ARM_GRP_V5TE, - ARM_GRP_V6, - ARM_GRP_V6T2, - ARM_GRP_V7, - ARM_GRP_V8, - ARM_GRP_VFP2, - ARM_GRP_VFP3, - ARM_GRP_VFP4, - ARM_GRP_ARM, - ARM_GRP_MCLASS, - ARM_GRP_NOTMCLASS, - ARM_GRP_THUMB, - ARM_GRP_THUMB1ONLY, - ARM_GRP_THUMB2, - ARM_GRP_PREV8, - ARM_GRP_FPVMLX, - ARM_GRP_MULOPS, - ARM_GRP_CRC, - ARM_GRP_DPVFP, - ARM_GRP_V6M, - ARM_GRP_VIRTUALIZATION, + /* Virtual Functions */ + const gchar *(*get_object_path) (GDBusObject *object); + GList *(*get_interfaces) (GDBusObject *object); + GDBusInterface *(*get_interface) (GDBusObject *object, + const gchar *interface_name); - ARM_GRP_ENDING, -} arm_insn_group; + /* Signals */ + void (*interface_added) (GDBusObject *object, + GDBusInterface *interface_); + void (*interface_removed) (GDBusObject *object, + GDBusInterface *interface_); -#ifdef __cplusplus -} -#endif +}; -#endif -#ifndef CAPSTONE_ARM64_H -#define CAPSTONE_ARM64_H +GIO_AVAILABLE_IN_ALL +GType g_dbus_object_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_object_get_object_path (GDBusObject *object); +GIO_AVAILABLE_IN_ALL +GList *g_dbus_object_get_interfaces (GDBusObject *object); +GIO_AVAILABLE_IN_ALL +GDBusInterface *g_dbus_object_get_interface (GDBusObject *object, + const gchar *interface_name); -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2013-2015 */ +G_END_DECLS -#ifdef __cplusplus -extern "C" { -#endif +#endif /* __G_DBUS_OBJECT_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ +#ifndef __G_DBUS_OBJECT_MANAGER_H__ +#define __G_DBUS_OBJECT_MANAGER_H__ -#ifdef _MSC_VER -#pragma warning(disable : 4201) -#endif -/// ARM64 shift type -typedef enum arm64_shifter { - ARM64_SFT_INVALID = 0, - ARM64_SFT_LSL = 1, - ARM64_SFT_MSL = 2, - ARM64_SFT_LSR = 3, - ARM64_SFT_ASR = 4, - ARM64_SFT_ROR = 5, -} arm64_shifter; +G_BEGIN_DECLS -/// ARM64 extender type -typedef enum arm64_extender { - ARM64_EXT_INVALID = 0, - ARM64_EXT_UXTB = 1, - ARM64_EXT_UXTH = 2, - ARM64_EXT_UXTW = 3, - ARM64_EXT_UXTX = 4, - ARM64_EXT_SXTB = 5, - ARM64_EXT_SXTH = 6, - ARM64_EXT_SXTW = 7, - ARM64_EXT_SXTX = 8, -} arm64_extender; +#define G_TYPE_DBUS_OBJECT_MANAGER (g_dbus_object_manager_get_type()) +#define G_DBUS_OBJECT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_MANAGER, GDBusObjectManager)) +#define G_IS_DBUS_OBJECT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_MANAGER)) +#define G_DBUS_OBJECT_MANAGER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_OBJECT_MANAGER, GDBusObjectManagerIface)) -/// ARM64 condition code -typedef enum arm64_cc { - ARM64_CC_INVALID = 0, - ARM64_CC_EQ = 1, ///< Equal - ARM64_CC_NE = 2, ///< Not equal: Not equal, or unordered - ARM64_CC_HS = 3, ///< Unsigned higher or same: >, ==, or unordered - ARM64_CC_LO = 4, ///< Unsigned lower or same: Less than - ARM64_CC_MI = 5, ///< Minus, negative: Less than - ARM64_CC_PL = 6, ///< Plus, positive or zero: >, ==, or unordered - ARM64_CC_VS = 7, ///< Overflow: Unordered - ARM64_CC_VC = 8, ///< No overflow: Ordered - ARM64_CC_HI = 9, ///< Unsigned higher: Greater than, or unordered - ARM64_CC_LS = 10, ///< Unsigned lower or same: Less than or equal - ARM64_CC_GE = 11, ///< Greater than or equal: Greater than or equal - ARM64_CC_LT = 12, ///< Less than: Less than, or unordered - ARM64_CC_GT = 13, ///< Signed greater than: Greater than - ARM64_CC_LE = 14, ///< Signed less than or equal: <, ==, or unordered - ARM64_CC_AL = 15, ///< Always (unconditional): Always (unconditional) - ARM64_CC_NV = 16, ///< Always (unconditional): Always (unconditional) - //< Note the NV exists purely to disassemble 0b1111. Execution is "always". -} arm64_cc; +typedef struct _GDBusObjectManagerIface GDBusObjectManagerIface; -/// System registers -typedef enum arm64_sysreg { - // System registers for MRS - ARM64_SYSREG_INVALID = 0, +/** + * GDBusObjectManagerIface: + * @parent_iface: The parent interface. + * @get_object_path: Virtual function for g_dbus_object_manager_get_object_path(). + * @get_objects: Virtual function for g_dbus_object_manager_get_objects(). + * @get_object: Virtual function for g_dbus_object_manager_get_object(). + * @get_interface: Virtual function for g_dbus_object_manager_get_interface(). + * @object_added: Signal handler for the #GDBusObjectManager::object-added signal. + * @object_removed: Signal handler for the #GDBusObjectManager::object-removed signal. + * @interface_added: Signal handler for the #GDBusObjectManager::interface-added signal. + * @interface_removed: Signal handler for the #GDBusObjectManager::interface-removed signal. + * + * Base type for D-Bus object managers. + * + * Since: 2.30 + */ +struct _GDBusObjectManagerIface +{ + GTypeInterface parent_iface; + + /* Virtual Functions */ + const gchar *(*get_object_path) (GDBusObjectManager *manager); + GList *(*get_objects) (GDBusObjectManager *manager); + GDBusObject *(*get_object) (GDBusObjectManager *manager, + const gchar *object_path); + GDBusInterface *(*get_interface) (GDBusObjectManager *manager, + const gchar *object_path, + const gchar *interface_name); + + /* Signals */ + void (*object_added) (GDBusObjectManager *manager, + GDBusObject *object); + void (*object_removed) (GDBusObjectManager *manager, + GDBusObject *object); + + void (*interface_added) (GDBusObjectManager *manager, + GDBusObject *object, + GDBusInterface *interface_); + void (*interface_removed) (GDBusObjectManager *manager, + GDBusObject *object, + GDBusInterface *interface_); +}; - ARM64_SYSREG_ACCDATA_EL1 = 0xC685, - ARM64_SYSREG_ACTLR_EL1 = 0xC081, - ARM64_SYSREG_ACTLR_EL2 = 0xE081, - ARM64_SYSREG_ACTLR_EL3 = 0xF081, - ARM64_SYSREG_AFSR0_EL1 = 0xC288, - ARM64_SYSREG_AFSR0_EL12 = 0xEA88, - ARM64_SYSREG_AFSR0_EL2 = 0xE288, - ARM64_SYSREG_AFSR0_EL3 = 0xF288, - ARM64_SYSREG_AFSR1_EL1 = 0xC289, - ARM64_SYSREG_AFSR1_EL12 = 0xEA89, - ARM64_SYSREG_AFSR1_EL2 = 0xE289, - ARM64_SYSREG_AFSR1_EL3 = 0xF289, - ARM64_SYSREG_AIDR_EL1 = 0xC807, - ARM64_SYSREG_AMAIR_EL1 = 0xC518, - ARM64_SYSREG_AMAIR_EL12 = 0xED18, - ARM64_SYSREG_AMAIR_EL2 = 0xE518, - ARM64_SYSREG_AMAIR_EL3 = 0xF518, - ARM64_SYSREG_AMCFGR_EL0 = 0xDE91, - ARM64_SYSREG_AMCGCR_EL0 = 0xDE92, - ARM64_SYSREG_AMCNTENCLR0_EL0 = 0xDE94, - ARM64_SYSREG_AMCNTENCLR1_EL0 = 0xDE98, - ARM64_SYSREG_AMCNTENSET0_EL0 = 0xDE95, - ARM64_SYSREG_AMCNTENSET1_EL0 = 0xDE99, - ARM64_SYSREG_AMCR_EL0 = 0xDE90, - ARM64_SYSREG_AMEVCNTR00_EL0 = 0xDEA0, - ARM64_SYSREG_AMEVCNTR01_EL0 = 0xDEA1, - ARM64_SYSREG_AMEVCNTR02_EL0 = 0xDEA2, - ARM64_SYSREG_AMEVCNTR03_EL0 = 0xDEA3, - ARM64_SYSREG_AMEVCNTR10_EL0 = 0xDEE0, - ARM64_SYSREG_AMEVCNTR110_EL0 = 0xDEEA, - ARM64_SYSREG_AMEVCNTR111_EL0 = 0xDEEB, - ARM64_SYSREG_AMEVCNTR112_EL0 = 0xDEEC, - ARM64_SYSREG_AMEVCNTR113_EL0 = 0xDEED, - ARM64_SYSREG_AMEVCNTR114_EL0 = 0xDEEE, - ARM64_SYSREG_AMEVCNTR115_EL0 = 0xDEEF, - ARM64_SYSREG_AMEVCNTR11_EL0 = 0xDEE1, - ARM64_SYSREG_AMEVCNTR12_EL0 = 0xDEE2, - ARM64_SYSREG_AMEVCNTR13_EL0 = 0xDEE3, - ARM64_SYSREG_AMEVCNTR14_EL0 = 0xDEE4, - ARM64_SYSREG_AMEVCNTR15_EL0 = 0xDEE5, - ARM64_SYSREG_AMEVCNTR16_EL0 = 0xDEE6, - ARM64_SYSREG_AMEVCNTR17_EL0 = 0xDEE7, - ARM64_SYSREG_AMEVCNTR18_EL0 = 0xDEE8, - ARM64_SYSREG_AMEVCNTR19_EL0 = 0xDEE9, - ARM64_SYSREG_AMEVCNTVOFF00_EL2 = 0xE6C0, - ARM64_SYSREG_AMEVCNTVOFF010_EL2 = 0xE6CA, - ARM64_SYSREG_AMEVCNTVOFF011_EL2 = 0xE6CB, - ARM64_SYSREG_AMEVCNTVOFF012_EL2 = 0xE6CC, - ARM64_SYSREG_AMEVCNTVOFF013_EL2 = 0xE6CD, - ARM64_SYSREG_AMEVCNTVOFF014_EL2 = 0xE6CE, - ARM64_SYSREG_AMEVCNTVOFF015_EL2 = 0xE6CF, - ARM64_SYSREG_AMEVCNTVOFF01_EL2 = 0xE6C1, - ARM64_SYSREG_AMEVCNTVOFF02_EL2 = 0xE6C2, - ARM64_SYSREG_AMEVCNTVOFF03_EL2 = 0xE6C3, - ARM64_SYSREG_AMEVCNTVOFF04_EL2 = 0xE6C4, - ARM64_SYSREG_AMEVCNTVOFF05_EL2 = 0xE6C5, - ARM64_SYSREG_AMEVCNTVOFF06_EL2 = 0xE6C6, - ARM64_SYSREG_AMEVCNTVOFF07_EL2 = 0xE6C7, - ARM64_SYSREG_AMEVCNTVOFF08_EL2 = 0xE6C8, - ARM64_SYSREG_AMEVCNTVOFF09_EL2 = 0xE6C9, - ARM64_SYSREG_AMEVCNTVOFF10_EL2 = 0xE6D0, - ARM64_SYSREG_AMEVCNTVOFF110_EL2 = 0xE6DA, - ARM64_SYSREG_AMEVCNTVOFF111_EL2 = 0xE6DB, - ARM64_SYSREG_AMEVCNTVOFF112_EL2 = 0xE6DC, - ARM64_SYSREG_AMEVCNTVOFF113_EL2 = 0xE6DD, - ARM64_SYSREG_AMEVCNTVOFF114_EL2 = 0xE6DE, - ARM64_SYSREG_AMEVCNTVOFF115_EL2 = 0xE6DF, - ARM64_SYSREG_AMEVCNTVOFF11_EL2 = 0xE6D1, - ARM64_SYSREG_AMEVCNTVOFF12_EL2 = 0xE6D2, - ARM64_SYSREG_AMEVCNTVOFF13_EL2 = 0xE6D3, - ARM64_SYSREG_AMEVCNTVOFF14_EL2 = 0xE6D4, - ARM64_SYSREG_AMEVCNTVOFF15_EL2 = 0xE6D5, - ARM64_SYSREG_AMEVCNTVOFF16_EL2 = 0xE6D6, - ARM64_SYSREG_AMEVCNTVOFF17_EL2 = 0xE6D7, - ARM64_SYSREG_AMEVCNTVOFF18_EL2 = 0xE6D8, - ARM64_SYSREG_AMEVCNTVOFF19_EL2 = 0xE6D9, - ARM64_SYSREG_AMEVTYPER00_EL0 = 0xDEB0, - ARM64_SYSREG_AMEVTYPER01_EL0 = 0xDEB1, - ARM64_SYSREG_AMEVTYPER02_EL0 = 0xDEB2, - ARM64_SYSREG_AMEVTYPER03_EL0 = 0xDEB3, - ARM64_SYSREG_AMEVTYPER10_EL0 = 0xDEF0, - ARM64_SYSREG_AMEVTYPER110_EL0 = 0xDEFA, - ARM64_SYSREG_AMEVTYPER111_EL0 = 0xDEFB, - ARM64_SYSREG_AMEVTYPER112_EL0 = 0xDEFC, - ARM64_SYSREG_AMEVTYPER113_EL0 = 0xDEFD, - ARM64_SYSREG_AMEVTYPER114_EL0 = 0xDEFE, - ARM64_SYSREG_AMEVTYPER115_EL0 = 0xDEFF, - ARM64_SYSREG_AMEVTYPER11_EL0 = 0xDEF1, - ARM64_SYSREG_AMEVTYPER12_EL0 = 0xDEF2, - ARM64_SYSREG_AMEVTYPER13_EL0 = 0xDEF3, - ARM64_SYSREG_AMEVTYPER14_EL0 = 0xDEF4, - ARM64_SYSREG_AMEVTYPER15_EL0 = 0xDEF5, - ARM64_SYSREG_AMEVTYPER16_EL0 = 0xDEF6, - ARM64_SYSREG_AMEVTYPER17_EL0 = 0xDEF7, - ARM64_SYSREG_AMEVTYPER18_EL0 = 0xDEF8, - ARM64_SYSREG_AMEVTYPER19_EL0 = 0xDEF9, - ARM64_SYSREG_AMUSERENR_EL0 = 0xDE93, - ARM64_SYSREG_APDAKEYHI_EL1 = 0xC111, - ARM64_SYSREG_APDAKEYLO_EL1 = 0xC110, - ARM64_SYSREG_APDBKEYHI_EL1 = 0xC113, - ARM64_SYSREG_APDBKEYLO_EL1 = 0xC112, - ARM64_SYSREG_APGAKEYHI_EL1 = 0xC119, - ARM64_SYSREG_APGAKEYLO_EL1 = 0xC118, - ARM64_SYSREG_APIAKEYHI_EL1 = 0xC109, - ARM64_SYSREG_APIAKEYLO_EL1 = 0xC108, - ARM64_SYSREG_APIBKEYHI_EL1 = 0xC10B, - ARM64_SYSREG_APIBKEYLO_EL1 = 0xC10A, - ARM64_SYSREG_BRBCR_EL1 = 0x8C80, - ARM64_SYSREG_BRBCR_EL12 = 0xAC80, - ARM64_SYSREG_BRBCR_EL2 = 0xA480, - ARM64_SYSREG_BRBFCR_EL1 = 0x8C81, - ARM64_SYSREG_BRBIDR0_EL1 = 0x8C90, - ARM64_SYSREG_BRBINF0_EL1 = 0x8C00, - ARM64_SYSREG_BRBINF10_EL1 = 0x8C50, - ARM64_SYSREG_BRBINF11_EL1 = 0x8C58, - ARM64_SYSREG_BRBINF12_EL1 = 0x8C60, - ARM64_SYSREG_BRBINF13_EL1 = 0x8C68, - ARM64_SYSREG_BRBINF14_EL1 = 0x8C70, - ARM64_SYSREG_BRBINF15_EL1 = 0x8C78, - ARM64_SYSREG_BRBINF16_EL1 = 0x8C04, - ARM64_SYSREG_BRBINF17_EL1 = 0x8C0C, - ARM64_SYSREG_BRBINF18_EL1 = 0x8C14, - ARM64_SYSREG_BRBINF19_EL1 = 0x8C1C, - ARM64_SYSREG_BRBINF1_EL1 = 0x8C08, - ARM64_SYSREG_BRBINF20_EL1 = 0x8C24, - ARM64_SYSREG_BRBINF21_EL1 = 0x8C2C, - ARM64_SYSREG_BRBINF22_EL1 = 0x8C34, - ARM64_SYSREG_BRBINF23_EL1 = 0x8C3C, - ARM64_SYSREG_BRBINF24_EL1 = 0x8C44, - ARM64_SYSREG_BRBINF25_EL1 = 0x8C4C, - ARM64_SYSREG_BRBINF26_EL1 = 0x8C54, - ARM64_SYSREG_BRBINF27_EL1 = 0x8C5C, - ARM64_SYSREG_BRBINF28_EL1 = 0x8C64, - ARM64_SYSREG_BRBINF29_EL1 = 0x8C6C, - ARM64_SYSREG_BRBINF2_EL1 = 0x8C10, - ARM64_SYSREG_BRBINF30_EL1 = 0x8C74, - ARM64_SYSREG_BRBINF31_EL1 = 0x8C7C, - ARM64_SYSREG_BRBINF3_EL1 = 0x8C18, - ARM64_SYSREG_BRBINF4_EL1 = 0x8C20, - ARM64_SYSREG_BRBINF5_EL1 = 0x8C28, - ARM64_SYSREG_BRBINF6_EL1 = 0x8C30, - ARM64_SYSREG_BRBINF7_EL1 = 0x8C38, - ARM64_SYSREG_BRBINF8_EL1 = 0x8C40, - ARM64_SYSREG_BRBINF9_EL1 = 0x8C48, - ARM64_SYSREG_BRBINFINJ_EL1 = 0x8C88, - ARM64_SYSREG_BRBSRC0_EL1 = 0x8C01, - ARM64_SYSREG_BRBSRC10_EL1 = 0x8C51, - ARM64_SYSREG_BRBSRC11_EL1 = 0x8C59, - ARM64_SYSREG_BRBSRC12_EL1 = 0x8C61, - ARM64_SYSREG_BRBSRC13_EL1 = 0x8C69, - ARM64_SYSREG_BRBSRC14_EL1 = 0x8C71, - ARM64_SYSREG_BRBSRC15_EL1 = 0x8C79, - ARM64_SYSREG_BRBSRC16_EL1 = 0x8C05, +GIO_AVAILABLE_IN_ALL +GType g_dbus_object_manager_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_object_manager_get_object_path (GDBusObjectManager *manager); +GIO_AVAILABLE_IN_ALL +GList *g_dbus_object_manager_get_objects (GDBusObjectManager *manager); +GIO_AVAILABLE_IN_ALL +GDBusObject *g_dbus_object_manager_get_object (GDBusObjectManager *manager, + const gchar *object_path); +GIO_AVAILABLE_IN_ALL +GDBusInterface *g_dbus_object_manager_get_interface (GDBusObjectManager *manager, + const gchar *object_path, + const gchar *interface_name); + +G_END_DECLS + +#endif /* __G_DBUS_OBJECT_MANAGER_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_OBJECT_MANAGER_CLIENT_H__ +#define __G_DBUS_OBJECT_MANAGER_CLIENT_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_OBJECT_MANAGER_CLIENT (g_dbus_object_manager_client_get_type ()) +#define G_DBUS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT, GDBusObjectManagerClient)) +#define G_DBUS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT, GDBusObjectManagerClientClass)) +#define G_DBUS_OBJECT_MANAGER_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT, GDBusObjectManagerClientClass)) +#define G_IS_DBUS_OBJECT_MANAGER_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT)) +#define G_IS_DBUS_OBJECT_MANAGER_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_MANAGER_CLIENT)) + +typedef struct _GDBusObjectManagerClientClass GDBusObjectManagerClientClass; +typedef struct _GDBusObjectManagerClientPrivate GDBusObjectManagerClientPrivate; + +/** + * GDBusObjectManagerClient: + * + * The #GDBusObjectManagerClient structure contains private data and should + * only be accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusObjectManagerClient +{ + /*< private >*/ + GObject parent_instance; + GDBusObjectManagerClientPrivate *priv; +}; + +/** + * GDBusObjectManagerClientClass: + * @parent_class: The parent class. + * @interface_proxy_signal: Signal class handler for the #GDBusObjectManagerClient::interface-proxy-signal signal. + * @interface_proxy_properties_changed: Signal class handler for the #GDBusObjectManagerClient::interface-proxy-properties-changed signal. + * + * Class structure for #GDBusObjectManagerClient. + * + * Since: 2.30 + */ +struct _GDBusObjectManagerClientClass +{ + GObjectClass parent_class; + + /* signals */ + void (*interface_proxy_signal) (GDBusObjectManagerClient *manager, + GDBusObjectProxy *object_proxy, + GDBusProxy *interface_proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters); + + void (*interface_proxy_properties_changed) (GDBusObjectManagerClient *manager, + GDBusObjectProxy *object_proxy, + GDBusProxy *interface_proxy, + GVariant *changed_properties, + const gchar* const *invalidated_properties); + + /*< private >*/ + gpointer padding[8]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_dbus_object_manager_client_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +void g_dbus_object_manager_client_new (GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GDBusProxyTypeFunc get_proxy_type_func, + gpointer get_proxy_type_user_data, + GDestroyNotify get_proxy_type_destroy_notify, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusObjectManager *g_dbus_object_manager_client_new_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusObjectManager *g_dbus_object_manager_client_new_sync (GDBusConnection *connection, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GDBusProxyTypeFunc get_proxy_type_func, + gpointer get_proxy_type_user_data, + GDestroyNotify get_proxy_type_destroy_notify, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_manager_client_new_for_bus (GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GDBusProxyTypeFunc get_proxy_type_func, + gpointer get_proxy_type_user_data, + GDestroyNotify get_proxy_type_destroy_notify, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusObjectManager *g_dbus_object_manager_client_new_for_bus_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusObjectManager *g_dbus_object_manager_client_new_for_bus_sync (GBusType bus_type, + GDBusObjectManagerClientFlags flags, + const gchar *name, + const gchar *object_path, + GDBusProxyTypeFunc get_proxy_type_func, + gpointer get_proxy_type_user_data, + GDestroyNotify get_proxy_type_destroy_notify, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_object_manager_client_get_connection (GDBusObjectManagerClient *manager); +GIO_AVAILABLE_IN_ALL +GDBusObjectManagerClientFlags g_dbus_object_manager_client_get_flags (GDBusObjectManagerClient *manager); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_object_manager_client_get_name (GDBusObjectManagerClient *manager); +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_object_manager_client_get_name_owner (GDBusObjectManagerClient *manager); + +G_END_DECLS + +#endif /* __G_DBUS_OBJECT_MANAGER_CLIENT_H */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_OBJECT_MANAGER_SERVER_H__ +#define __G_DBUS_OBJECT_MANAGER_SERVER_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_OBJECT_MANAGER_SERVER (g_dbus_object_manager_server_get_type ()) +#define G_DBUS_OBJECT_MANAGER_SERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_MANAGER_SERVER, GDBusObjectManagerServer)) +#define G_DBUS_OBJECT_MANAGER_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_MANAGER_SERVER, GDBusObjectManagerServerClass)) +#define G_DBUS_OBJECT_MANAGER_SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_MANAGER_SERVER, GDBusObjectManagerServerClass)) +#define G_IS_DBUS_OBJECT_MANAGER_SERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_MANAGER_SERVER)) +#define G_IS_DBUS_OBJECT_MANAGER_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_MANAGER_SERVER)) + +typedef struct _GDBusObjectManagerServerClass GDBusObjectManagerServerClass; +typedef struct _GDBusObjectManagerServerPrivate GDBusObjectManagerServerPrivate; + +/** + * GDBusObjectManagerServer: + * + * The #GDBusObjectManagerServer structure contains private data and should + * only be accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusObjectManagerServer +{ + /*< private >*/ + GObject parent_instance; + GDBusObjectManagerServerPrivate *priv; +}; + +/** + * GDBusObjectManagerServerClass: + * @parent_class: The parent class. + * + * Class structure for #GDBusObjectManagerServer. + * + * Since: 2.30 + */ +struct _GDBusObjectManagerServerClass +{ + GObjectClass parent_class; + + /*< private >*/ + gpointer padding[8]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_dbus_object_manager_server_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusObjectManagerServer *g_dbus_object_manager_server_new (const gchar *object_path); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_object_manager_server_get_connection (GDBusObjectManagerServer *manager); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_manager_server_set_connection (GDBusObjectManagerServer *manager, + GDBusConnection *connection); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager, + GDBusObjectSkeleton *object); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager, + GDBusObjectSkeleton *object); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_object_manager_server_is_exported (GDBusObjectManagerServer *manager, + GDBusObjectSkeleton *object); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager, + const gchar *object_path); + +G_END_DECLS + +#endif /* __G_DBUS_OBJECT_MANAGER_SERVER_H */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_OBJECT_PROXY_H__ +#define __G_DBUS_OBJECT_PROXY_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_OBJECT_PROXY (g_dbus_object_proxy_get_type ()) +#define G_DBUS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxy)) +#define G_DBUS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxyClass)) +#define G_DBUS_OBJECT_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_PROXY, GDBusObjectProxyClass)) +#define G_IS_DBUS_OBJECT_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_PROXY)) +#define G_IS_DBUS_OBJECT_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_PROXY)) + +typedef struct _GDBusObjectProxyClass GDBusObjectProxyClass; +typedef struct _GDBusObjectProxyPrivate GDBusObjectProxyPrivate; + +/** + * GDBusObjectProxy: + * + * The #GDBusObjectProxy structure contains private data and should + * only be accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusObjectProxy +{ + /*< private >*/ + GObject parent_instance; + GDBusObjectProxyPrivate *priv; +}; + +/** + * GDBusObjectProxyClass: + * @parent_class: The parent class. + * + * Class structure for #GDBusObjectProxy. + * + * Since: 2.30 + */ +struct _GDBusObjectProxyClass +{ + GObjectClass parent_class; + + /*< private >*/ + gpointer padding[8]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_dbus_object_proxy_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusObjectProxy *g_dbus_object_proxy_new (GDBusConnection *connection, + const gchar *object_path); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_object_proxy_get_connection (GDBusObjectProxy *proxy); + +G_END_DECLS + +#endif /* __G_DBUS_OBJECT_PROXY_H */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_OBJECT_SKELETON_H__ +#define __G_DBUS_OBJECT_SKELETON_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_OBJECT_SKELETON (g_dbus_object_skeleton_get_type ()) +#define G_DBUS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeleton)) +#define G_DBUS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonClass)) +#define G_DBUS_OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonClass)) +#define G_IS_DBUS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_SKELETON)) +#define G_IS_DBUS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_SKELETON)) + +typedef struct _GDBusObjectSkeletonClass GDBusObjectSkeletonClass; +typedef struct _GDBusObjectSkeletonPrivate GDBusObjectSkeletonPrivate; + +/** + * GDBusObjectSkeleton: + * + * The #GDBusObjectSkeleton structure contains private data and should only be + * accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusObjectSkeleton +{ + /*< private >*/ + GObject parent_instance; + GDBusObjectSkeletonPrivate *priv; +}; + +/** + * GDBusObjectSkeletonClass: + * @parent_class: The parent class. + * @authorize_method: Signal class handler for the #GDBusObjectSkeleton::authorize-method signal. + * + * Class structure for #GDBusObjectSkeleton. + * + * Since: 2.30 + */ +struct _GDBusObjectSkeletonClass +{ + GObjectClass parent_class; + + /* Signals */ + gboolean (*authorize_method) (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_, + GDBusMethodInvocation *invocation); + + /*< private >*/ + gpointer padding[8]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_dbus_object_skeleton_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusObjectSkeleton *g_dbus_object_skeleton_new (const gchar *object_path); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_skeleton_add_interface (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_skeleton_remove_interface (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_skeleton_remove_interface_by_name (GDBusObjectSkeleton *object, + const gchar *interface_name); +GIO_AVAILABLE_IN_ALL +void g_dbus_object_skeleton_set_object_path (GDBusObjectSkeleton *object, + const gchar *object_path); + +G_END_DECLS + +#endif /* __G_DBUS_OBJECT_SKELETON_H */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_PROXY_H__ +#define __G_DBUS_PROXY_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_PROXY (g_dbus_proxy_get_type ()) +#define G_DBUS_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_PROXY, GDBusProxy)) +#define G_DBUS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_PROXY, GDBusProxyClass)) +#define G_DBUS_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_PROXY, GDBusProxyClass)) +#define G_IS_DBUS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_PROXY)) +#define G_IS_DBUS_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_PROXY)) + +typedef struct _GDBusProxyClass GDBusProxyClass; +typedef struct _GDBusProxyPrivate GDBusProxyPrivate; + +/** + * GDBusProxy: + * + * The #GDBusProxy structure contains only private data and + * should only be accessed using the provided API. + * + * Since: 2.26 + */ +struct _GDBusProxy +{ + /*< private >*/ + GObject parent_instance; + GDBusProxyPrivate *priv; +}; + +/** + * GDBusProxyClass: + * @g_properties_changed: Signal class handler for the #GDBusProxy::g-properties-changed signal. + * @g_signal: Signal class handler for the #GDBusProxy::g-signal signal. + * + * Class structure for #GDBusProxy. + * + * Since: 2.26 + */ +struct _GDBusProxyClass +{ + /*< private >*/ + GObjectClass parent_class; + + /*< public >*/ + /* Signals */ + void (*g_properties_changed) (GDBusProxy *proxy, + GVariant *changed_properties, + const gchar* const *invalidated_properties); + void (*g_signal) (GDBusProxy *proxy, + const gchar *sender_name, + const gchar *signal_name, + GVariant *parameters); + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[32]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_dbus_proxy_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_new (GDBusConnection *connection, + GDBusProxyFlags flags, + GDBusInterfaceInfo *info, + const gchar *name, + const gchar *object_path, + const gchar *interface_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusProxy *g_dbus_proxy_new_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusProxy *g_dbus_proxy_new_sync (GDBusConnection *connection, + GDBusProxyFlags flags, + GDBusInterfaceInfo *info, + const gchar *name, + const gchar *object_path, + const gchar *interface_name, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_new_for_bus (GBusType bus_type, + GDBusProxyFlags flags, + GDBusInterfaceInfo *info, + const gchar *name, + const gchar *object_path, + const gchar *interface_name, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GDBusProxy *g_dbus_proxy_new_for_bus_finish (GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusProxy *g_dbus_proxy_new_for_bus_sync (GBusType bus_type, + GDBusProxyFlags flags, + GDBusInterfaceInfo *info, + const gchar *name, + const gchar *object_path, + const gchar *interface_name, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GDBusConnection *g_dbus_proxy_get_connection (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +GDBusProxyFlags g_dbus_proxy_get_flags (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_proxy_get_name (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_proxy_get_name_owner (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_proxy_get_object_path (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_proxy_get_interface_name (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +gint g_dbus_proxy_get_default_timeout (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_set_default_timeout (GDBusProxy *proxy, + gint timeout_msec); +GIO_AVAILABLE_IN_ALL +GDBusInterfaceInfo *g_dbus_proxy_get_interface_info (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_set_interface_info (GDBusProxy *proxy, + GDBusInterfaceInfo *info); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_proxy_get_cached_property (GDBusProxy *proxy, + const gchar *property_name); +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_set_cached_property (GDBusProxy *proxy, + const gchar *property_name, + GVariant *value); +GIO_AVAILABLE_IN_ALL +gchar **g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy); +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_call (GDBusProxy *proxy, + const gchar *method_name, + GVariant *parameters, + GDBusCallFlags flags, + gint timeout_msec, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_proxy_call_finish (GDBusProxy *proxy, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_proxy_call_sync (GDBusProxy *proxy, + const gchar *method_name, + GVariant *parameters, + GDBusCallFlags flags, + gint timeout_msec, + GCancellable *cancellable, + GError **error); + +#ifdef G_OS_UNIX + +GIO_AVAILABLE_IN_ALL +void g_dbus_proxy_call_with_unix_fd_list (GDBusProxy *proxy, + const gchar *method_name, + GVariant *parameters, + GDBusCallFlags flags, + gint timeout_msec, + GUnixFDList *fd_list, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_proxy_call_with_unix_fd_list_finish (GDBusProxy *proxy, + GUnixFDList **out_fd_list, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_proxy_call_with_unix_fd_list_sync (GDBusProxy *proxy, + const gchar *method_name, + GVariant *parameters, + GDBusCallFlags flags, + gint timeout_msec, + GUnixFDList *fd_list, + GUnixFDList **out_fd_list, + GCancellable *cancellable, + GError **error); + +#endif /* G_OS_UNIX */ + +G_END_DECLS + +#endif /* __G_DBUS_PROXY_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_SERVER_H__ +#define __G_DBUS_SERVER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_SERVER (g_dbus_server_get_type ()) +#define G_DBUS_SERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_SERVER, GDBusServer)) +#define G_IS_DBUS_SERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_SERVER)) + +GIO_AVAILABLE_IN_ALL +GType g_dbus_server_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GDBusServer *g_dbus_server_new_sync (const gchar *address, + GDBusServerFlags flags, + const gchar *guid, + GDBusAuthObserver *observer, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_server_get_client_address (GDBusServer *server); +GIO_AVAILABLE_IN_ALL +const gchar *g_dbus_server_get_guid (GDBusServer *server); +GIO_AVAILABLE_IN_ALL +GDBusServerFlags g_dbus_server_get_flags (GDBusServer *server); +GIO_AVAILABLE_IN_ALL +void g_dbus_server_start (GDBusServer *server); +GIO_AVAILABLE_IN_ALL +void g_dbus_server_stop (GDBusServer *server); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_server_is_active (GDBusServer *server); + +G_END_DECLS + +#endif /* __G_DBUS_SERVER_H__ */ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_UTILS_H__ +#define __G_DBUS_UTILS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_guid (const gchar *string); +GIO_AVAILABLE_IN_ALL +gchar *g_dbus_generate_guid (void); + +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_name (const gchar *string); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_unique_name (const gchar *string); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_member_name (const gchar *string); +GIO_AVAILABLE_IN_ALL +gboolean g_dbus_is_interface_name (const gchar *string); +GIO_AVAILABLE_IN_2_70 +gboolean g_dbus_is_error_name (const gchar *string); + +GIO_AVAILABLE_IN_ALL +void g_dbus_gvariant_to_gvalue (GVariant *value, + GValue *out_gvalue); +GIO_AVAILABLE_IN_ALL +GVariant *g_dbus_gvalue_to_gvariant (const GValue *gvalue, + const GVariantType *type); +GIO_AVAILABLE_IN_2_68 +gchar *g_dbus_escape_object_path_bytestring (const guint8 *bytes); +GIO_AVAILABLE_IN_2_68 +gchar *g_dbus_escape_object_path (const gchar *s); +GIO_AVAILABLE_IN_2_68 +guint8 *g_dbus_unescape_object_path (const gchar *s); + +G_END_DECLS + +#endif /* __G_DBUS_UTILS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2021 Endless OS Foundation, LLC + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef __G_DEBUG_CONTROLLER_H__ +#define __G_DEBUG_CONTROLLER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_DEBUG_CONTROLLER_EXTENSION_POINT_NAME: + * + * Extension point for debug control functionality. + * See [Extending GIO][extending-gio]. + * + * Since: 2.72 + */ +#define G_DEBUG_CONTROLLER_EXTENSION_POINT_NAME "gio-debug-controller" + +/** + * GDebugController: + * + * #GDebugController is an interface to expose control of debugging features and + * debug output. + * + * Since: 2.72 + */ +#define G_TYPE_DEBUG_CONTROLLER (g_debug_controller_get_type ()) +GIO_AVAILABLE_IN_2_72 +G_DECLARE_INTERFACE(GDebugController, g_debug_controller, g, debug_controller, GObject) + +#define G_DEBUG_CONTROLLER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DEBUG_CONTROLLER, GDebugController)) +#define G_IS_DEBUG_CONTROLLER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DEBUG_CONTROLLER)) +#define G_DEBUG_CONTROLLER_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_DEBUG_CONTROLLER, GDebugControllerInterface)) + +/** + * GDebugControllerInterface: + * @g_iface: The parent interface. + * + * The virtual function table for #GDebugController. + * + * Since: 2.72 + */ +struct _GDebugControllerInterface { + /*< private >*/ + GTypeInterface g_iface; +}; + +GIO_AVAILABLE_IN_2_72 +gboolean g_debug_controller_get_debug_enabled (GDebugController *self); +GIO_AVAILABLE_IN_2_72 +void g_debug_controller_set_debug_enabled (GDebugController *self, + gboolean debug_enabled); + +G_END_DECLS + +#endif /* __G_DEBUG_CONTROLLER_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2021 Endless OS Foundation, LLC + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef __G_DEBUG_CONTROLLER_DBUS_H__ +#define __G_DEBUG_CONTROLLER_DBUS_H__ + + +G_BEGIN_DECLS + +/** + * GDebugControllerDBus: + * + * #GDebugControllerDBus is an implementation of #GDebugController over D-Bus. + * + * Since: 2.72 + */ +#define G_TYPE_DEBUG_CONTROLLER_DBUS (g_debug_controller_dbus_get_type ()) +GIO_AVAILABLE_IN_2_72 +G_DECLARE_DERIVABLE_TYPE (GDebugControllerDBus, g_debug_controller_dbus, G, DEBUG_CONTROLLER_DBUS, GObject) + +/** + * GDebugControllerDBusClass: + * @parent_class: The parent class. + * @authorize: Default handler for the #GDebugControllerDBus::authorize signal. + * + * The virtual function table for #GDebugControllerDBus. + * + * Since: 2.72 + */ +struct _GDebugControllerDBusClass +{ + GObjectClass parent_class; + + gboolean (*authorize) (GDebugControllerDBus *controller, + GDBusMethodInvocation *invocation); + + gpointer padding[12]; +}; + +GIO_AVAILABLE_IN_2_72 +GDebugControllerDBus *g_debug_controller_dbus_new (GDBusConnection *connection, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_72 +void g_debug_controller_dbus_stop (GDebugControllerDBus *self); + +G_END_DECLS + +#endif /* __G_DEBUG_CONTROLLER_DBUS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + * David Zeuthen + */ + +#ifndef __G_DRIVE_H__ +#define __G_DRIVE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE: + * + * The string used to obtain a Unix device path with g_drive_get_identifier(). + * + * Since: 2.58 + */ +#define G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE "unix-device" + +#define G_TYPE_DRIVE (g_drive_get_type ()) +#define G_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DRIVE, GDrive)) +#define G_IS_DRIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DRIVE)) +#define G_DRIVE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DRIVE, GDriveIface)) + +/** + * GDriveIface: + * @g_iface: The parent interface. + * @changed: Signal emitted when the drive is changed. + * @disconnected: The removed signal that is emitted when the #GDrive have been disconnected. If the recipient is holding references to the object they should release them so the object can be finalized. + * @eject_button: Signal emitted when the physical eject button (if any) of a drive have been pressed. + * @get_name: Returns the name for the given #GDrive. + * @get_icon: Returns a #GIcon for the given #GDrive. + * @has_volumes: Returns %TRUE if the #GDrive has mountable volumes. + * @get_volumes: Returns a list #GList of #GVolume for the #GDrive. + * @is_removable: Returns %TRUE if the #GDrive and/or its media is considered removable by the user. Since 2.50. + * @is_media_removable: Returns %TRUE if the #GDrive supports removal and insertion of media. + * @has_media: Returns %TRUE if the #GDrive has media inserted. + * @is_media_check_automatic: Returns %TRUE if the #GDrive is capable of automatically detecting media changes. + * @can_poll_for_media: Returns %TRUE if the #GDrive is capable of manually polling for media change. + * @can_eject: Returns %TRUE if the #GDrive can eject media. + * @eject: Ejects a #GDrive. + * @eject_finish: Finishes an eject operation. + * @poll_for_media: Poll for media insertion/removal on a #GDrive. + * @poll_for_media_finish: Finishes a media poll operation. + * @get_identifier: Returns the identifier of the given kind, or %NULL if + * the #GDrive doesn't have one. + * @enumerate_identifiers: Returns an array strings listing the kinds + * of identifiers which the #GDrive has. + * @get_start_stop_type: Gets a #GDriveStartStopType with details about starting/stopping the drive. Since 2.22. + * @can_stop: Returns %TRUE if a #GDrive can be stopped. Since 2.22. + * @stop: Stops a #GDrive. Since 2.22. + * @stop_finish: Finishes a stop operation. Since 2.22. + * @can_start: Returns %TRUE if a #GDrive can be started. Since 2.22. + * @can_start_degraded: Returns %TRUE if a #GDrive can be started degraded. Since 2.22. + * @start: Starts a #GDrive. Since 2.22. + * @start_finish: Finishes a start operation. Since 2.22. + * @stop_button: Signal emitted when the physical stop button (if any) of a drive have been pressed. Since 2.22. + * @eject_with_operation: Starts ejecting a #GDrive using a #GMountOperation. Since 2.22. + * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. + * @get_sort_key: Gets a key used for sorting #GDrive instances or %NULL if no such key exists. Since 2.32. + * @get_symbolic_icon: Returns a symbolic #GIcon for the given #GDrive. Since 2.34. + * + * Interface for creating #GDrive implementations. + */ +typedef struct _GDriveIface GDriveIface; + +struct _GDriveIface +{ + GTypeInterface g_iface; + + /* signals */ + void (* changed) (GDrive *drive); + void (* disconnected) (GDrive *drive); + void (* eject_button) (GDrive *drive); + + /* Virtual Table */ + char * (* get_name) (GDrive *drive); + GIcon * (* get_icon) (GDrive *drive); + gboolean (* has_volumes) (GDrive *drive); + GList * (* get_volumes) (GDrive *drive); + gboolean (* is_media_removable) (GDrive *drive); + gboolean (* has_media) (GDrive *drive); + gboolean (* is_media_check_automatic) (GDrive *drive); + gboolean (* can_eject) (GDrive *drive); + gboolean (* can_poll_for_media) (GDrive *drive); + void (* eject) (GDrive *drive, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_finish) (GDrive *drive, + GAsyncResult *result, + GError **error); + void (* poll_for_media) (GDrive *drive, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* poll_for_media_finish) (GDrive *drive, + GAsyncResult *result, + GError **error); + + char * (* get_identifier) (GDrive *drive, + const char *kind); + char ** (* enumerate_identifiers) (GDrive *drive); + + GDriveStartStopType (* get_start_stop_type) (GDrive *drive); + + gboolean (* can_start) (GDrive *drive); + gboolean (* can_start_degraded) (GDrive *drive); + void (* start) (GDrive *drive, + GDriveStartFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* start_finish) (GDrive *drive, + GAsyncResult *result, + GError **error); + + gboolean (* can_stop) (GDrive *drive); + void (* stop) (GDrive *drive, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* stop_finish) (GDrive *drive, + GAsyncResult *result, + GError **error); + /* signal, not VFunc */ + void (* stop_button) (GDrive *drive); + + void (* eject_with_operation) (GDrive *drive, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_with_operation_finish) (GDrive *drive, + GAsyncResult *result, + GError **error); + + const gchar * (* get_sort_key) (GDrive *drive); + GIcon * (* get_symbolic_icon) (GDrive *drive); + gboolean (* is_removable) (GDrive *drive); + +}; + +GIO_AVAILABLE_IN_ALL +GType g_drive_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +char * g_drive_get_name (GDrive *drive); +GIO_AVAILABLE_IN_ALL +GIcon * g_drive_get_icon (GDrive *drive); +GIO_AVAILABLE_IN_ALL +GIcon * g_drive_get_symbolic_icon (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_has_volumes (GDrive *drive); +GIO_AVAILABLE_IN_ALL +GList * g_drive_get_volumes (GDrive *drive); +GIO_AVAILABLE_IN_2_50 +gboolean g_drive_is_removable (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_is_media_removable (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_has_media (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_is_media_check_automatic (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_can_poll_for_media (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_can_eject (GDrive *drive); +GIO_DEPRECATED_FOR(g_drive_eject_with_operation) +void g_drive_eject (GDrive *drive, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_DEPRECATED_FOR(g_drive_eject_with_operation_finish) +gboolean g_drive_eject_finish (GDrive *drive, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_drive_poll_for_media (GDrive *drive, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_poll_for_media_finish (GDrive *drive, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +char * g_drive_get_identifier (GDrive *drive, + const char *kind); +GIO_AVAILABLE_IN_ALL +char ** g_drive_enumerate_identifiers (GDrive *drive); + +GIO_AVAILABLE_IN_ALL +GDriveStartStopType g_drive_get_start_stop_type (GDrive *drive); + +GIO_AVAILABLE_IN_ALL +gboolean g_drive_can_start (GDrive *drive); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_can_start_degraded (GDrive *drive); +GIO_AVAILABLE_IN_ALL +void g_drive_start (GDrive *drive, + GDriveStartFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_start_finish (GDrive *drive, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_drive_can_stop (GDrive *drive); +GIO_AVAILABLE_IN_ALL +void g_drive_stop (GDrive *drive, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_stop_finish (GDrive *drive, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_drive_eject_with_operation (GDrive *drive, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_drive_eject_with_operation_finish (GDrive *drive, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_32 +const gchar *g_drive_get_sort_key (GDrive *drive); + +G_END_DECLS + +#endif /* __G_DRIVE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2010 Red Hat, Inc. + * Copyright © 2015 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_DTLS_CLIENT_CONNECTION_H__ +#define __G_DTLS_CLIENT_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2010 Red Hat, Inc. + * Copyright © 2015 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_DTLS_CONNECTION_H__ +#define __G_DTLS_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_DTLS_CONNECTION (g_dtls_connection_get_type ()) +#define G_DTLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnection)) +#define G_IS_DTLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CONNECTION)) +#define G_DTLS_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CONNECTION, GDtlsConnectionInterface)) + +typedef struct _GDtlsConnectionInterface GDtlsConnectionInterface; + +/** + * GDtlsConnectionInterface: + * @g_iface: The parent interface. + * @accept_certificate: Check whether to accept a certificate. + * @handshake: Perform a handshake operation. + * @handshake_async: Start an asynchronous handshake operation. + * @handshake_finish: Finish an asynchronous handshake operation. + * @shutdown: Shut down one or both directions of the connection. + * @shutdown_async: Start an asynchronous shutdown operation. + * @shutdown_finish: Finish an asynchronous shutdown operation. + * @set_advertised_protocols: Set APLN protocol list (Since: 2.60) + * @get_negotiated_protocol: Get ALPN-negotiated protocol (Since: 2.60) + * @get_binding_data: Retrieve TLS channel binding data (Since: 2.66) + * + * Virtual method table for a #GDtlsConnection implementation. + * + * Since: 2.48 + */ +struct _GDtlsConnectionInterface +{ + GTypeInterface g_iface; + + /* signals */ + gboolean (*accept_certificate) (GDtlsConnection *connection, + GTlsCertificate *peer_cert, + GTlsCertificateFlags errors); + + /* methods */ + gboolean (*handshake) (GDtlsConnection *conn, + GCancellable *cancellable, + GError **error); + + void (*handshake_async) (GDtlsConnection *conn, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*handshake_finish) (GDtlsConnection *conn, + GAsyncResult *result, + GError **error); + + gboolean (*shutdown) (GDtlsConnection *conn, + gboolean shutdown_read, + gboolean shutdown_write, + GCancellable *cancellable, + GError **error); + + void (*shutdown_async) (GDtlsConnection *conn, + gboolean shutdown_read, + gboolean shutdown_write, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*shutdown_finish) (GDtlsConnection *conn, + GAsyncResult *result, + GError **error); + + void (*set_advertised_protocols) (GDtlsConnection *conn, + const gchar * const *protocols); + const gchar *(*get_negotiated_protocol) (GDtlsConnection *conn); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + gboolean (*get_binding_data) (GDtlsConnection *conn, + GTlsChannelBindingType type, + GByteArray *data, + GError **error); +G_GNUC_END_IGNORE_DEPRECATIONS +}; + +GIO_AVAILABLE_IN_2_48 +GType g_dtls_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_set_database (GDtlsConnection *conn, + GTlsDatabase *database); +GIO_AVAILABLE_IN_2_48 +GTlsDatabase *g_dtls_connection_get_database (GDtlsConnection *conn); + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_set_certificate (GDtlsConnection *conn, + GTlsCertificate *certificate); +GIO_AVAILABLE_IN_2_48 +GTlsCertificate *g_dtls_connection_get_certificate (GDtlsConnection *conn); + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_set_interaction (GDtlsConnection *conn, + GTlsInteraction *interaction); +GIO_AVAILABLE_IN_2_48 +GTlsInteraction *g_dtls_connection_get_interaction (GDtlsConnection *conn); + +GIO_AVAILABLE_IN_2_48 +GTlsCertificate *g_dtls_connection_get_peer_certificate (GDtlsConnection *conn); +GIO_AVAILABLE_IN_2_48 +GTlsCertificateFlags g_dtls_connection_get_peer_certificate_errors (GDtlsConnection *conn); + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_set_require_close_notify (GDtlsConnection *conn, + gboolean require_close_notify); +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_get_require_close_notify (GDtlsConnection *conn); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GIO_DEPRECATED_IN_2_60 +void g_dtls_connection_set_rehandshake_mode (GDtlsConnection *conn, + GTlsRehandshakeMode mode); +GIO_DEPRECATED_IN_2_60 +GTlsRehandshakeMode g_dtls_connection_get_rehandshake_mode (GDtlsConnection *conn); +G_GNUC_END_IGNORE_DEPRECATIONS + +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_handshake (GDtlsConnection *conn, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_handshake_async (GDtlsConnection *conn, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_handshake_finish (GDtlsConnection *conn, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_shutdown (GDtlsConnection *conn, + gboolean shutdown_read, + gboolean shutdown_write, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_shutdown_async (GDtlsConnection *conn, + gboolean shutdown_read, + gboolean shutdown_write, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_shutdown_finish (GDtlsConnection *conn, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_close (GDtlsConnection *conn, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_48 +void g_dtls_connection_close_async (GDtlsConnection *conn, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_close_finish (GDtlsConnection *conn, + GAsyncResult *result, + GError **error); + +/*< protected >*/ +GIO_AVAILABLE_IN_2_48 +gboolean g_dtls_connection_emit_accept_certificate (GDtlsConnection *conn, + GTlsCertificate *peer_cert, + GTlsCertificateFlags errors); +GIO_AVAILABLE_IN_2_60 +void g_dtls_connection_set_advertised_protocols (GDtlsConnection *conn, + const gchar * const *protocols); + +GIO_AVAILABLE_IN_2_60 +const gchar * g_dtls_connection_get_negotiated_protocol (GDtlsConnection *conn); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GIO_AVAILABLE_IN_2_66 +gboolean g_dtls_connection_get_channel_binding_data (GDtlsConnection *conn, + GTlsChannelBindingType type, + GByteArray *data, + GError **error); +G_GNUC_END_IGNORE_DEPRECATIONS + +GIO_AVAILABLE_IN_2_70 +GTlsProtocolVersion g_dtls_connection_get_protocol_version (GDtlsConnection *conn); + +GIO_AVAILABLE_IN_2_70 +gchar * g_dtls_connection_get_ciphersuite_name (GDtlsConnection *conn); + +G_END_DECLS + +#endif /* __G_DTLS_CONNECTION_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_DTLS_CLIENT_CONNECTION (g_dtls_client_connection_get_type ()) +#define G_DTLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_CLIENT_CONNECTION, GDtlsClientConnection)) +#define G_IS_DTLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_CLIENT_CONNECTION)) +#define G_DTLS_CLIENT_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_CLIENT_CONNECTION, GDtlsClientConnectionInterface)) + +typedef struct _GDtlsClientConnectionInterface GDtlsClientConnectionInterface; + +/** + * GDtlsClientConnectionInterface: + * @g_iface: The parent interface. + * + * vtable for a #GDtlsClientConnection implementation. + * + * Since: 2.48 + */ +struct _GDtlsClientConnectionInterface +{ + GTypeInterface g_iface; +}; + +GIO_AVAILABLE_IN_2_48 +GType g_dtls_client_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_48 +GDatagramBased *g_dtls_client_connection_new (GDatagramBased *base_socket, + GSocketConnectable *server_identity, + GError **error); + +GIO_AVAILABLE_IN_2_48 +GTlsCertificateFlags g_dtls_client_connection_get_validation_flags (GDtlsClientConnection *conn); +GIO_AVAILABLE_IN_2_48 +void g_dtls_client_connection_set_validation_flags (GDtlsClientConnection *conn, + GTlsCertificateFlags flags); +GIO_AVAILABLE_IN_2_48 +GSocketConnectable *g_dtls_client_connection_get_server_identity (GDtlsClientConnection *conn); +GIO_AVAILABLE_IN_2_48 +void g_dtls_client_connection_set_server_identity (GDtlsClientConnection *conn, + GSocketConnectable *identity); +GIO_AVAILABLE_IN_2_48 +GList * g_dtls_client_connection_get_accepted_cas (GDtlsClientConnection *conn); + + +G_END_DECLS + +#endif /* __G_DTLS_CLIENT_CONNECTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2010 Red Hat, Inc. + * Copyright © 2015 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_DTLS_SERVER_CONNECTION_H__ +#define __G_DTLS_SERVER_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_DTLS_SERVER_CONNECTION (g_dtls_server_connection_get_type ()) +#define G_DTLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_DTLS_SERVER_CONNECTION, GDtlsServerConnection)) +#define G_IS_DTLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_DTLS_SERVER_CONNECTION)) +#define G_DTLS_SERVER_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_DTLS_SERVER_CONNECTION, GDtlsServerConnectionInterface)) + +/** + * GDtlsServerConnection: + * + * DTLS server-side connection. This is the server-side implementation + * of a #GDtlsConnection. + * + * Since: 2.48 + */ +typedef struct _GDtlsServerConnectionInterface GDtlsServerConnectionInterface; + +/** + * GDtlsServerConnectionInterface: + * @g_iface: The parent interface. + * + * vtable for a #GDtlsServerConnection implementation. + * + * Since: 2.48 + */ +struct _GDtlsServerConnectionInterface +{ + GTypeInterface g_iface; +}; + +GIO_AVAILABLE_IN_2_48 +GType g_dtls_server_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_48 +GDatagramBased *g_dtls_server_connection_new (GDatagramBased *base_socket, + GTlsCertificate *certificate, + GError **error); + +G_END_DECLS + +#endif /* __G_DTLS_SERVER_CONNECTION_H__ */ +/* Gio - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Matthias Clasen + * Clemens N. Buss + */ + +#ifndef __G_EMBLEMED_ICON_H__ +#define __G_EMBLEMED_ICON_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_ICON_H__ +#define __G_ICON_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_ICON (g_icon_get_type ()) +#define G_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_ICON, GIcon)) +#define G_IS_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_ICON)) +#define G_ICON_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_ICON, GIconIface)) + +/** + * GIcon: + * + * An abstract type that specifies an icon. + **/ +typedef struct _GIconIface GIconIface; + +/** + * GIconIface: + * @g_iface: The parent interface. + * @hash: A hash for a given #GIcon. + * @equal: Checks if two #GIcons are equal. + * @to_tokens: Serializes a #GIcon into tokens. The tokens must not + * contain any whitespace. Don't implement if the #GIcon can't be + * serialized (Since 2.20). + * @from_tokens: Constructs a #GIcon from tokens. Set the #GError if + * the tokens are malformed. Don't implement if the #GIcon can't be + * serialized (Since 2.20). + * @serialize: Serializes a #GIcon into a #GVariant. Since: 2.38 + * + * GIconIface is used to implement GIcon types for various + * different systems. See #GThemedIcon and #GLoadableIcon for + * examples of how to implement this interface. + */ +struct _GIconIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + guint (* hash) (GIcon *icon); + gboolean (* equal) (GIcon *icon1, + GIcon *icon2); + + /** + * GIconIface::to_tokens: + * @icon: The #GIcon + * @tokens: (element-type utf8) (out caller-allocates): + * The array to fill with tokens + * @out_version: (out): version of serialized tokens + * + * Serializes the @icon into string tokens. + * This is can be invoked when g_icon_new_for_string() is called. + * + * Returns: %TRUE if serialization took place, %FALSE otherwise + * + * Since: 2.20 + */ + gboolean (* to_tokens) (GIcon *icon, + GPtrArray *tokens, + gint *out_version); + + /** + * GIconIface::from_tokens: + * @tokens: (array length=num_tokens): An array of tokens + * @num_tokens: The number of tokens in @tokens + * @version: Version of the serialized tokens + * @error: Return location for errors, or %NULL to ignore + * + * Constructs a #GIcon from a list of @tokens. + * + * Returns: (nullable) (transfer full): the #GIcon or %NULL on error + * + * Since: 2.20 + */ + GIcon * (* from_tokens) (gchar **tokens, + gint num_tokens, + gint version, + GError **error); + + GVariant * (* serialize) (GIcon *icon); +}; + +GIO_AVAILABLE_IN_ALL +GType g_icon_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +guint g_icon_hash (gconstpointer icon); +GIO_AVAILABLE_IN_ALL +gboolean g_icon_equal (GIcon *icon1, + GIcon *icon2); +GIO_AVAILABLE_IN_ALL +gchar *g_icon_to_string (GIcon *icon); +GIO_AVAILABLE_IN_ALL +GIcon *g_icon_new_for_string (const gchar *str, + GError **error); + +GIO_AVAILABLE_IN_2_38 +GVariant * g_icon_serialize (GIcon *icon); +GIO_AVAILABLE_IN_2_38 +GIcon * g_icon_deserialize (GVariant *value); + +G_END_DECLS + +#endif /* __G_ICON_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Clemens N. Buss + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + */ + +#ifndef __G_EMBLEM_H__ +#define __G_EMBLEM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_EMBLEM (g_emblem_get_type ()) +#define G_EMBLEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_EMBLEM, GEmblem)) +#define G_EMBLEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_EMBLEM, GEmblemClass)) +#define G_IS_EMBLEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_EMBLEM)) +#define G_IS_EMBLEM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_EMBLEM)) +#define G_EMBLEM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_EMBLEM, GEmblemClass)) + +/** + * GEmblem: + * + * An object for Emblems + */ +typedef struct _GEmblem GEmblem; +typedef struct _GEmblemClass GEmblemClass; + +GIO_AVAILABLE_IN_ALL +GType g_emblem_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GEmblem *g_emblem_new (GIcon *icon); +GIO_AVAILABLE_IN_ALL +GEmblem *g_emblem_new_with_origin (GIcon *icon, + GEmblemOrigin origin); +GIO_AVAILABLE_IN_ALL +GIcon *g_emblem_get_icon (GEmblem *emblem); +GIO_AVAILABLE_IN_ALL +GEmblemOrigin g_emblem_get_origin (GEmblem *emblem); + +G_END_DECLS + +#endif /* __G_EMBLEM_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_EMBLEMED_ICON (g_emblemed_icon_get_type ()) +#define G_EMBLEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_EMBLEMED_ICON, GEmblemedIcon)) +#define G_EMBLEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_EMBLEMED_ICON, GEmblemedIconClass)) +#define G_IS_EMBLEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_EMBLEMED_ICON)) +#define G_IS_EMBLEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_EMBLEMED_ICON)) +#define G_EMBLEMED_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_EMBLEMED_ICON, GEmblemedIconClass)) + +/** + * GEmblemedIcon: + * + * An implementation of #GIcon for icons with emblems. + **/ +typedef struct _GEmblemedIcon GEmblemedIcon; +typedef struct _GEmblemedIconClass GEmblemedIconClass; +typedef struct _GEmblemedIconPrivate GEmblemedIconPrivate; + +struct _GEmblemedIcon +{ + GObject parent_instance; + + /*< private >*/ + GEmblemedIconPrivate *priv; +}; + +struct _GEmblemedIconClass +{ + GObjectClass parent_class; +}; + +GIO_AVAILABLE_IN_ALL +GType g_emblemed_icon_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GIcon *g_emblemed_icon_new (GIcon *icon, + GEmblem *emblem); +GIO_AVAILABLE_IN_ALL +GIcon *g_emblemed_icon_get_icon (GEmblemedIcon *emblemed); +GIO_AVAILABLE_IN_ALL +GList *g_emblemed_icon_get_emblems (GEmblemedIcon *emblemed); +GIO_AVAILABLE_IN_ALL +void g_emblemed_icon_add_emblem (GEmblemedIcon *emblemed, + GEmblem *emblem); +GIO_AVAILABLE_IN_ALL +void g_emblemed_icon_clear_emblems (GEmblemedIcon *emblemed); + +G_END_DECLS + +#endif /* __G_EMBLEMED_ICON_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_H__ +#define __G_FILE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE (g_file_get_type ()) +#define G_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_FILE, GFile)) +#define G_IS_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_FILE)) +#define G_FILE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_FILE, GFileIface)) + +#if 0 +/** + * GFile: + * + * A handle to an object implementing the #GFileIface interface. + * Generally stores a location within the file system. Handles do not + * necessarily represent files or directories that currently exist. + **/ +typedef struct _GFile GFile; /* Dummy typedef */ +#endif +typedef struct _GFileIface GFileIface; + + +/** + * GFileIface: + * @g_iface: The parent interface. + * @dup: Duplicates a #GFile. + * @hash: Creates a hash of a #GFile. + * @equal: Checks equality of two given #GFiles. + * @is_native: Checks to see if a file is native to the system. + * @has_uri_scheme: Checks to see if a #GFile has a given URI scheme. + * @get_uri_scheme: Gets the URI scheme for a #GFile. + * @get_basename: Gets the basename for a given #GFile. + * @get_path: Gets the current path within a #GFile. + * @get_uri: Gets a URI for the path within a #GFile. + * @get_parse_name: Gets the parsed name for the #GFile. + * @get_parent: Gets the parent directory for the #GFile. + * @prefix_matches: Checks whether a #GFile contains a specified file. + * @get_relative_path: Gets the path for a #GFile relative to a given path. + * @resolve_relative_path: Resolves a relative path for a #GFile to an absolute path. + * @get_child_for_display_name: Gets the child #GFile for a given display name. + * @enumerate_children: Gets a #GFileEnumerator with the children of a #GFile. + * @enumerate_children_async: Asynchronously gets a #GFileEnumerator with the children of a #GFile. + * @enumerate_children_finish: Finishes asynchronously enumerating the children. + * @query_info: Gets the #GFileInfo for a #GFile. + * @query_info_async: Asynchronously gets the #GFileInfo for a #GFile. + * @query_info_finish: Finishes an asynchronous query info operation. + * @query_filesystem_info: Gets a #GFileInfo for the file system #GFile is on. + * @query_filesystem_info_async: Asynchronously gets a #GFileInfo for the file system #GFile is on. + * @query_filesystem_info_finish: Finishes asynchronously getting the file system info. + * @find_enclosing_mount: Gets a #GMount for the #GFile. + * @find_enclosing_mount_async: Asynchronously gets the #GMount for a #GFile. + * @find_enclosing_mount_finish: Finishes asynchronously getting the volume. + * @set_display_name: Sets the display name for a #GFile. + * @set_display_name_async: Asynchronously sets a #GFile's display name. + * @set_display_name_finish: Finishes asynchronously setting a #GFile's display name. + * @query_settable_attributes: Returns a list of #GFileAttributeInfos that can be set. + * @_query_settable_attributes_async: Asynchronously gets a list of #GFileAttributeInfos that can be set. + * @_query_settable_attributes_finish: Finishes asynchronously querying settable attributes. + * @query_writable_namespaces: Returns a list of #GFileAttributeInfo namespaces that are writable. + * @_query_writable_namespaces_async: Asynchronously gets a list of #GFileAttributeInfo namespaces that are writable. + * @_query_writable_namespaces_finish: Finishes asynchronously querying the writable namespaces. + * @set_attribute: Sets a #GFileAttributeInfo. + * @set_attributes_from_info: Sets a #GFileAttributeInfo with information from a #GFileInfo. + * @set_attributes_async: Asynchronously sets a file's attributes. + * @set_attributes_finish: Finishes setting a file's attributes asynchronously. + * @read_fn: Reads a file asynchronously. + * @read_async: Asynchronously reads a file. + * @read_finish: Finishes asynchronously reading a file. + * @append_to: Writes to the end of a file. + * @append_to_async: Asynchronously writes to the end of a file. + * @append_to_finish: Finishes an asynchronous file append operation. + * @create: Creates a new file. + * @create_async: Asynchronously creates a file. + * @create_finish: Finishes asynchronously creating a file. + * @replace: Replaces the contents of a file. + * @replace_async: Asynchronously replaces the contents of a file. + * @replace_finish: Finishes asynchronously replacing a file. + * @delete_file: Deletes a file. + * @delete_file_async: Asynchronously deletes a file. + * @delete_file_finish: Finishes an asynchronous delete. + * @trash: Sends a #GFile to the Trash location. + * @trash_async: Asynchronously sends a #GFile to the Trash location. + * @trash_finish: Finishes an asynchronous file trashing operation. + * @make_directory: Makes a directory. + * @make_directory_async: Asynchronously makes a directory. + * @make_directory_finish: Finishes making a directory asynchronously. + * @make_symbolic_link: (nullable): Makes a symbolic link. %NULL if symbolic + * links are unsupported. + * @make_symbolic_link_async: Asynchronously makes a symbolic link + * @make_symbolic_link_finish: Finishes making a symbolic link asynchronously. + * @copy: (nullable): Copies a file. %NULL if copying is unsupported, which will + * cause `GFile` to use a fallback copy method where it reads from the + * source and writes to the destination. + * @copy_async: Asynchronously copies a file. + * @copy_finish: Finishes an asynchronous copy operation. + * @move: Moves a file. + * @move_async: Asynchronously moves a file. Since: 2.72 + * @move_finish: Finishes an asynchronous move operation. Since: 2.72 + * @mount_mountable: Mounts a mountable object. + * @mount_mountable_finish: Finishes a mounting operation. + * @unmount_mountable: Unmounts a mountable object. + * @unmount_mountable_finish: Finishes an unmount operation. + * @eject_mountable: Ejects a mountable. + * @eject_mountable_finish: Finishes an eject operation. + * @mount_enclosing_volume: Mounts a specified location. + * @mount_enclosing_volume_finish: Finishes mounting a specified location. + * @monitor_dir: Creates a #GFileMonitor for the location. + * @monitor_file: Creates a #GFileMonitor for the location. + * @open_readwrite: Open file read/write. Since 2.22. + * @open_readwrite_async: Asynchronously opens file read/write. Since 2.22. + * @open_readwrite_finish: Finishes an asynchronous open read/write. Since 2.22. + * @create_readwrite: Creates file read/write. Since 2.22. + * @create_readwrite_async: Asynchronously creates file read/write. Since 2.22. + * @create_readwrite_finish: Finishes an asynchronous creates read/write. Since 2.22. + * @replace_readwrite: Replaces file read/write. Since 2.22. + * @replace_readwrite_async: Asynchronously replaces file read/write. Since 2.22. + * @replace_readwrite_finish: Finishes an asynchronous replace read/write. Since 2.22. + * @start_mountable: Starts a mountable object. Since 2.22. + * @start_mountable_finish: Finishes a start operation. Since 2.22. + * @stop_mountable: Stops a mountable. Since 2.22. + * @stop_mountable_finish: Finishes a stop operation. Since 2.22. + * @supports_thread_contexts: a boolean that indicates whether the #GFile implementation supports thread-default contexts. Since 2.22. + * @unmount_mountable_with_operation: Unmounts a mountable object using a #GMountOperation. Since 2.22. + * @unmount_mountable_with_operation_finish: Finishes an unmount operation using a #GMountOperation. Since 2.22. + * @eject_mountable_with_operation: Ejects a mountable object using a #GMountOperation. Since 2.22. + * @eject_mountable_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. + * @poll_mountable: Polls a mountable object for media changes. Since 2.22. + * @poll_mountable_finish: Finishes a poll operation for media changes. Since 2.22. + * @measure_disk_usage: Recursively measures the disk usage of @file. Since 2.38 + * @measure_disk_usage_async: Asynchronously recursively measures the disk usage of @file. Since 2.38 + * @measure_disk_usage_finish: Finishes an asynchronous recursive measurement of the disk usage of @file. Since 2.38 + * + * An interface for writing VFS file handles. + **/ +struct _GFileIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + GFile * (* dup) (GFile *file); + guint (* hash) (GFile *file); + gboolean (* equal) (GFile *file1, + GFile *file2); + gboolean (* is_native) (GFile *file); + gboolean (* has_uri_scheme) (GFile *file, + const char *uri_scheme); + char * (* get_uri_scheme) (GFile *file); + char * (* get_basename) (GFile *file); + char * (* get_path) (GFile *file); + char * (* get_uri) (GFile *file); + char * (* get_parse_name) (GFile *file); + GFile * (* get_parent) (GFile *file); + gboolean (* prefix_matches) (GFile *prefix, + GFile *file); + char * (* get_relative_path) (GFile *parent, + GFile *descendant); + GFile * (* resolve_relative_path) (GFile *file, + const char *relative_path); + GFile * (* get_child_for_display_name) (GFile *file, + const char *display_name, + GError **error); + + GFileEnumerator * (* enumerate_children) (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); + void (* enumerate_children_async) (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileEnumerator * (* enumerate_children_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFileInfo * (* query_info) (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); + void (* query_info_async) (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileInfo * (* query_info_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFileInfo * (* query_filesystem_info) (GFile *file, + const char *attributes, + GCancellable *cancellable, + GError **error); + void (* query_filesystem_info_async) (GFile *file, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileInfo * (* query_filesystem_info_finish)(GFile *file, + GAsyncResult *res, + GError **error); + + GMount * (* find_enclosing_mount) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* find_enclosing_mount_async) (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GMount * (* find_enclosing_mount_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFile * (* set_display_name) (GFile *file, + const char *display_name, + GCancellable *cancellable, + GError **error); + void (* set_display_name_async) (GFile *file, + const char *display_name, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFile * (* set_display_name_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFileAttributeInfoList * (* query_settable_attributes) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* _query_settable_attributes_async) (void); + void (* _query_settable_attributes_finish) (void); + + GFileAttributeInfoList * (* query_writable_namespaces) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* _query_writable_namespaces_async) (void); + void (* _query_writable_namespaces_finish) (void); + + gboolean (* set_attribute) (GFile *file, + const char *attribute, + GFileAttributeType type, + gpointer value_p, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); + gboolean (* set_attributes_from_info) (GFile *file, + GFileInfo *info, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); + void (* set_attributes_async) (GFile *file, + GFileInfo *info, + GFileQueryInfoFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* set_attributes_finish) (GFile *file, + GAsyncResult *result, + GFileInfo **info, + GError **error); + + GFileInputStream * (* read_fn) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* read_async) (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileInputStream * (* read_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFileOutputStream * (* append_to) (GFile *file, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); + void (* append_to_async) (GFile *file, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileOutputStream * (* append_to_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFileOutputStream * (* create) (GFile *file, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); + void (* create_async) (GFile *file, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileOutputStream * (* create_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + GFileOutputStream * (* replace) (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); + void (* replace_async) (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileOutputStream * (* replace_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + gboolean (* delete_file) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* delete_file_async) (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* delete_file_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + gboolean (* trash) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* trash_async) (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* trash_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + gboolean (* make_directory) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* make_directory_async) (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* make_directory_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + gboolean (* make_symbolic_link) (GFile *file, + const char *symlink_value, + GCancellable *cancellable, + GError **error); + void (* make_symbolic_link_async) (GFile *file, + const char *symlink_value, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* make_symbolic_link_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + gboolean (* copy) (GFile *source, + GFile *destination, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GError **error); + void (* copy_async) (GFile *source, + GFile *destination, + GFileCopyFlags flags, + int io_priority, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* copy_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + gboolean (* move) (GFile *source, + GFile *destination, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GError **error); + void (* move_async) (GFile *source, + GFile *destination, + GFileCopyFlags flags, + int io_priority, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* move_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* mount_mountable) (GFile *file, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFile * (* mount_mountable_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* unmount_mountable) (GFile *file, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* unmount_mountable_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* eject_mountable) (GFile *file, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_mountable_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* mount_enclosing_volume) (GFile *location, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* mount_enclosing_volume_finish) (GFile *location, + GAsyncResult *result, + GError **error); + + GFileMonitor * (* monitor_dir) (GFile *file, + GFileMonitorFlags flags, + GCancellable *cancellable, + GError **error); + GFileMonitor * (* monitor_file) (GFile *file, + GFileMonitorFlags flags, + GCancellable *cancellable, + GError **error); + + GFileIOStream * (* open_readwrite) (GFile *file, + GCancellable *cancellable, + GError **error); + void (* open_readwrite_async) (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileIOStream * (* open_readwrite_finish) (GFile *file, + GAsyncResult *res, + GError **error); + GFileIOStream * (* create_readwrite) (GFile *file, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); + void (* create_readwrite_async) (GFile *file, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileIOStream * (* create_readwrite_finish) (GFile *file, + GAsyncResult *res, + GError **error); + GFileIOStream * (* replace_readwrite) (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); + void (* replace_readwrite_async) (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileIOStream * (* replace_readwrite_finish) (GFile *file, + GAsyncResult *res, + GError **error); + + void (* start_mountable) (GFile *file, + GDriveStartFlags flags, + GMountOperation *start_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* start_mountable_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* stop_mountable) (GFile *file, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* stop_mountable_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + gboolean supports_thread_contexts; + + void (* unmount_mountable_with_operation) (GFile *file, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* unmount_mountable_with_operation_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* eject_mountable_with_operation) (GFile *file, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_mountable_with_operation_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + void (* poll_mountable) (GFile *file, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* poll_mountable_finish) (GFile *file, + GAsyncResult *result, + GError **error); + + gboolean (* measure_disk_usage) (GFile *file, + GFileMeasureFlags flags, + GCancellable *cancellable, + GFileMeasureProgressCallback progress_callback, + gpointer progress_data, + guint64 *disk_usage, + guint64 *num_dirs, + guint64 *num_files, + GError **error); + void (* measure_disk_usage_async) (GFile *file, + GFileMeasureFlags flags, + gint io_priority, + GCancellable *cancellable, + GFileMeasureProgressCallback progress_callback, + gpointer progress_data, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* measure_disk_usage_finish) (GFile *file, + GAsyncResult *result, + guint64 *disk_usage, + guint64 *num_dirs, + guint64 *num_files, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_file_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFile * g_file_new_for_path (const char *path); +GIO_AVAILABLE_IN_ALL +GFile * g_file_new_for_uri (const char *uri); +GIO_AVAILABLE_IN_ALL +GFile * g_file_new_for_commandline_arg (const char *arg); +GIO_AVAILABLE_IN_2_36 +GFile * g_file_new_for_commandline_arg_and_cwd (const gchar *arg, + const gchar *cwd); +GIO_AVAILABLE_IN_2_32 +GFile * g_file_new_tmp (const char *tmpl, + GFileIOStream **iostream, + GError **error); +GIO_AVAILABLE_IN_2_74 +void g_file_new_tmp_async (const char *tmpl, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_74 +GFile * g_file_new_tmp_finish (GAsyncResult *result, + GFileIOStream **iostream, + GError **error); +GIO_AVAILABLE_IN_2_74 +void g_file_new_tmp_dir_async (const char *tmpl, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_74 +GFile * g_file_new_tmp_dir_finish (GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +GFile * g_file_parse_name (const char *parse_name); +GIO_AVAILABLE_IN_2_56 +GFile * g_file_new_build_filename (const gchar *first_element, + ...) G_GNUC_NULL_TERMINATED; +GIO_AVAILABLE_IN_ALL +GFile * g_file_dup (GFile *file); +GIO_AVAILABLE_IN_ALL +guint g_file_hash (gconstpointer file); +GIO_AVAILABLE_IN_ALL +gboolean g_file_equal (GFile *file1, + GFile *file2); +GIO_AVAILABLE_IN_ALL +char * g_file_get_basename (GFile *file); +GIO_AVAILABLE_IN_ALL +char * g_file_get_path (GFile *file); +GIO_AVAILABLE_IN_2_56 +const char * g_file_peek_path (GFile *file); +GIO_AVAILABLE_IN_ALL +char * g_file_get_uri (GFile *file); +GIO_AVAILABLE_IN_ALL +char * g_file_get_parse_name (GFile *file); +GIO_AVAILABLE_IN_ALL +GFile * g_file_get_parent (GFile *file); +GIO_AVAILABLE_IN_ALL +gboolean g_file_has_parent (GFile *file, + GFile *parent); +GIO_AVAILABLE_IN_ALL +GFile * g_file_get_child (GFile *file, + const char *name); +GIO_AVAILABLE_IN_ALL +GFile * g_file_get_child_for_display_name (GFile *file, + const char *display_name, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_has_prefix (GFile *file, + GFile *prefix); +GIO_AVAILABLE_IN_ALL +char * g_file_get_relative_path (GFile *parent, + GFile *descendant); +GIO_AVAILABLE_IN_ALL +GFile * g_file_resolve_relative_path (GFile *file, + const char *relative_path); +GIO_AVAILABLE_IN_ALL +gboolean g_file_is_native (GFile *file); +GIO_AVAILABLE_IN_ALL +gboolean g_file_has_uri_scheme (GFile *file, + const char *uri_scheme); +GIO_AVAILABLE_IN_ALL +char * g_file_get_uri_scheme (GFile *file); +GIO_AVAILABLE_IN_ALL +GFileInputStream * g_file_read (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_read_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileInputStream * g_file_read_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileOutputStream * g_file_append_to (GFile *file, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileOutputStream * g_file_create (GFile *file, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileOutputStream * g_file_replace (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_append_to_async (GFile *file, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileOutputStream * g_file_append_to_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_create_async (GFile *file, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileOutputStream * g_file_create_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_replace_async (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileOutputStream * g_file_replace_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileIOStream * g_file_open_readwrite (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_open_readwrite_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileIOStream * g_file_open_readwrite_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileIOStream * g_file_create_readwrite (GFile *file, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_create_readwrite_async (GFile *file, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileIOStream * g_file_create_readwrite_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileIOStream * g_file_replace_readwrite (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_replace_readwrite_async (GFile *file, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileIOStream * g_file_replace_readwrite_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_query_exists (GFile *file, + GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +GFileType g_file_query_file_type (GFile *file, + GFileQueryInfoFlags flags, + GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +GFileInfo * g_file_query_info (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_query_info_async (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileInfo * g_file_query_info_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileInfo * g_file_query_filesystem_info (GFile *file, + const char *attributes, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_query_filesystem_info_async (GFile *file, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileInfo * g_file_query_filesystem_info_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GMount * g_file_find_enclosing_mount (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_find_enclosing_mount_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GMount * g_file_find_enclosing_mount_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileEnumerator * g_file_enumerate_children (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_enumerate_children_async (GFile *file, + const char *attributes, + GFileQueryInfoFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileEnumerator * g_file_enumerate_children_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +GFile * g_file_set_display_name (GFile *file, + const char *display_name, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_set_display_name_async (GFile *file, + const char *display_name, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFile * g_file_set_display_name_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_delete (GFile *file, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_34 +void g_file_delete_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_34 +gboolean g_file_delete_finish (GFile *file, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_file_trash (GFile *file, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_38 +void g_file_trash_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_38 +gboolean g_file_trash_finish (GFile *file, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_file_copy (GFile *source, + GFile *destination, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_copy_async (GFile *source, + GFile *destination, + GFileCopyFlags flags, + int io_priority, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_copy_finish (GFile *file, + GAsyncResult *res, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_move (GFile *source, + GFile *destination, + GFileCopyFlags flags, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GError **error); +GIO_AVAILABLE_IN_2_72 +void g_file_move_async (GFile *source, + GFile *destination, + GFileCopyFlags flags, + int io_priority, + GCancellable *cancellable, + GFileProgressCallback progress_callback, + gpointer progress_callback_data, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_72 +gboolean g_file_move_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_make_directory (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_38 +void g_file_make_directory_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_38 +gboolean g_file_make_directory_finish (GFile *file, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_file_make_directory_with_parents (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_make_symbolic_link (GFile *file, + const char *symlink_value, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_74 +void g_file_make_symbolic_link_async (GFile *file, + const char *symlink_value, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_74 +gboolean g_file_make_symbolic_link_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileAttributeInfoList *g_file_query_settable_attributes (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileAttributeInfoList *g_file_query_writable_namespaces (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute (GFile *file, + const char *attribute, + GFileAttributeType type, + gpointer value_p, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attributes_from_info (GFile *file, + GFileInfo *info, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_set_attributes_async (GFile *file, + GFileInfo *info, + GFileQueryInfoFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attributes_finish (GFile *file, + GAsyncResult *result, + GFileInfo **info, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute_string (GFile *file, + const char *attribute, + const char *value, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute_byte_string (GFile *file, + const char *attribute, + const char *value, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute_uint32 (GFile *file, + const char *attribute, + guint32 value, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute_int32 (GFile *file, + const char *attribute, + gint32 value, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute_uint64 (GFile *file, + const char *attribute, + guint64 value, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_set_attribute_int64 (GFile *file, + const char *attribute, + gint64 value, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_mount_enclosing_volume (GFile *location, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_mount_enclosing_volume_finish (GFile *location, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_mount_mountable (GFile *file, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFile * g_file_mount_mountable_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_DEPRECATED_FOR(g_file_unmount_mountable_with_operation) +void g_file_unmount_mountable (GFile *file, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_DEPRECATED_FOR(g_file_unmount_mountable_with_operation_finish) +gboolean g_file_unmount_mountable_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_unmount_mountable_with_operation (GFile *file, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_unmount_mountable_with_operation_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_DEPRECATED_FOR(g_file_eject_mountable_with_operation) +void g_file_eject_mountable (GFile *file, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_DEPRECATED_FOR(g_file_eject_mountable_with_operation_finish) +gboolean g_file_eject_mountable_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_eject_mountable_with_operation (GFile *file, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_eject_mountable_with_operation_finish (GFile *file, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_68 +char * g_file_build_attribute_list_for_copy (GFile *file, + GFileCopyFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_file_copy_attributes (GFile *source, + GFile *destination, + GFileCopyFlags flags, + GCancellable *cancellable, + GError **error); + + +GIO_AVAILABLE_IN_ALL +GFileMonitor* g_file_monitor_directory (GFile *file, + GFileMonitorFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileMonitor* g_file_monitor_file (GFile *file, + GFileMonitorFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GFileMonitor* g_file_monitor (GFile *file, + GFileMonitorFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_38 +gboolean g_file_measure_disk_usage (GFile *file, + GFileMeasureFlags flags, + GCancellable *cancellable, + GFileMeasureProgressCallback progress_callback, + gpointer progress_data, + guint64 *disk_usage, + guint64 *num_dirs, + guint64 *num_files, + GError **error); + +GIO_AVAILABLE_IN_2_38 +void g_file_measure_disk_usage_async (GFile *file, + GFileMeasureFlags flags, + gint io_priority, + GCancellable *cancellable, + GFileMeasureProgressCallback progress_callback, + gpointer progress_data, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_38 +gboolean g_file_measure_disk_usage_finish (GFile *file, + GAsyncResult *result, + guint64 *disk_usage, + guint64 *num_dirs, + guint64 *num_files, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_file_start_mountable (GFile *file, + GDriveStartFlags flags, + GMountOperation *start_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_start_mountable_finish (GFile *file, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_stop_mountable (GFile *file, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_stop_mountable_finish (GFile *file, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_file_poll_mountable (GFile *file, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_poll_mountable_finish (GFile *file, + GAsyncResult *result, + GError **error); + +/* Utilities */ + +GIO_AVAILABLE_IN_ALL +GAppInfo *g_file_query_default_handler (GFile *file, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_60 +void g_file_query_default_handler_async (GFile *file, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_60 +GAppInfo *g_file_query_default_handler_finish (GFile *file, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_file_load_contents (GFile *file, + GCancellable *cancellable, + char **contents, + gsize *length, + char **etag_out, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_load_contents_async (GFile *file, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_load_contents_finish (GFile *file, + GAsyncResult *res, + char **contents, + gsize *length, + char **etag_out, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_load_partial_contents_async (GFile *file, + GCancellable *cancellable, + GFileReadMoreCallback read_more_callback, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_load_partial_contents_finish (GFile *file, + GAsyncResult *res, + char **contents, + gsize *length, + char **etag_out, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_replace_contents (GFile *file, + const char *contents, + gsize length, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + char **new_etag, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_replace_contents_async (GFile *file, + const char *contents, + gsize length, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_40 +void g_file_replace_contents_bytes_async (GFile *file, + GBytes *contents, + const char *etag, + gboolean make_backup, + GFileCreateFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_replace_contents_finish (GFile *file, + GAsyncResult *res, + char **new_etag, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_file_supports_thread_contexts (GFile *file); + +GIO_AVAILABLE_IN_2_56 +GBytes *g_file_load_bytes (GFile *file, + GCancellable *cancellable, + gchar **etag_out, + GError **error); +GIO_AVAILABLE_IN_2_56 +void g_file_load_bytes_async (GFile *file, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_56 +GBytes *g_file_load_bytes_finish (GFile *file, + GAsyncResult *result, + gchar **etag_out, + GError **error); + +G_END_DECLS + +#endif /* __G_FILE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_ATTRIBUTE_H__ +#define __G_FILE_ATTRIBUTE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * GFileAttributeInfo: + * @name: the name of the attribute. + * @type: the #GFileAttributeType type of the attribute. + * @flags: a set of #GFileAttributeInfoFlags. + * + * Information about a specific attribute. + **/ +struct _GFileAttributeInfo +{ + char *name; + GFileAttributeType type; + GFileAttributeInfoFlags flags; +}; + +/** + * GFileAttributeInfoList: + * @infos: an array of #GFileAttributeInfos. + * @n_infos: the number of values in the array. + * + * Acts as a lightweight registry for possible valid file attributes. + * The registry stores Key-Value pair formats as #GFileAttributeInfos. + **/ +struct _GFileAttributeInfoList +{ + GFileAttributeInfo *infos; + int n_infos; +}; + +#define G_TYPE_FILE_ATTRIBUTE_INFO_LIST (g_file_attribute_info_list_get_type ()) +GIO_AVAILABLE_IN_ALL +GType g_file_attribute_info_list_get_type (void); + +GIO_AVAILABLE_IN_ALL +GFileAttributeInfoList * g_file_attribute_info_list_new (void); +GIO_AVAILABLE_IN_ALL +GFileAttributeInfoList * g_file_attribute_info_list_ref (GFileAttributeInfoList *list); +GIO_AVAILABLE_IN_ALL +void g_file_attribute_info_list_unref (GFileAttributeInfoList *list); +GIO_AVAILABLE_IN_ALL +GFileAttributeInfoList * g_file_attribute_info_list_dup (GFileAttributeInfoList *list); +GIO_AVAILABLE_IN_ALL +const GFileAttributeInfo *g_file_attribute_info_list_lookup (GFileAttributeInfoList *list, + const char *name); +GIO_AVAILABLE_IN_ALL +void g_file_attribute_info_list_add (GFileAttributeInfoList *list, + const char *name, + GFileAttributeType type, + GFileAttributeInfoFlags flags); + +G_END_DECLS + +#endif /* __G_FILE_INFO_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_ENUMERATOR_H__ +#define __G_FILE_ENUMERATOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE_ENUMERATOR (g_file_enumerator_get_type ()) +#define G_FILE_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumerator)) +#define G_FILE_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass)) +#define G_IS_FILE_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_ENUMERATOR)) +#define G_IS_FILE_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_ENUMERATOR)) +#define G_FILE_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_ENUMERATOR, GFileEnumeratorClass)) + +/** + * GFileEnumerator: + * + * A per matched file iterator. + **/ +typedef struct _GFileEnumeratorClass GFileEnumeratorClass; +typedef struct _GFileEnumeratorPrivate GFileEnumeratorPrivate; + +struct _GFileEnumerator +{ + GObject parent_instance; + + /*< private >*/ + GFileEnumeratorPrivate *priv; +}; + +struct _GFileEnumeratorClass +{ + GObjectClass parent_class; + + /* Virtual Table */ + + GFileInfo * (* next_file) (GFileEnumerator *enumerator, + GCancellable *cancellable, + GError **error); + gboolean (* close_fn) (GFileEnumerator *enumerator, + GCancellable *cancellable, + GError **error); + + void (* next_files_async) (GFileEnumerator *enumerator, + int num_files, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GList * (* next_files_finish) (GFileEnumerator *enumerator, + GAsyncResult *result, + GError **error); + void (* close_async) (GFileEnumerator *enumerator, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* close_finish) (GFileEnumerator *enumerator, + GAsyncResult *result, + GError **error); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); + void (*_g_reserved7) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_file_enumerator_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_enumerator_next_file (GFileEnumerator *enumerator, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_enumerator_close (GFileEnumerator *enumerator, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_enumerator_next_files_async (GFileEnumerator *enumerator, + int num_files, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GList * g_file_enumerator_next_files_finish (GFileEnumerator *enumerator, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_enumerator_close_async (GFileEnumerator *enumerator, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_file_enumerator_close_finish (GFileEnumerator *enumerator, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_file_enumerator_is_closed (GFileEnumerator *enumerator); +GIO_AVAILABLE_IN_ALL +gboolean g_file_enumerator_has_pending (GFileEnumerator *enumerator); +GIO_AVAILABLE_IN_ALL +void g_file_enumerator_set_pending (GFileEnumerator *enumerator, + gboolean pending); +GIO_AVAILABLE_IN_ALL +GFile * g_file_enumerator_get_container (GFileEnumerator *enumerator); +GIO_AVAILABLE_IN_2_36 +GFile * g_file_enumerator_get_child (GFileEnumerator *enumerator, + GFileInfo *info); + +GIO_AVAILABLE_IN_2_44 +gboolean g_file_enumerator_iterate (GFileEnumerator *direnum, + GFileInfo **out_info, + GFile **out_child, + GCancellable *cancellable, + GError **error); + + +G_END_DECLS + +#endif /* __G_FILE_ENUMERATOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_ICON_H__ +#define __G_FILE_ICON_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE_ICON (g_file_icon_get_type ()) +#define G_FILE_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_ICON, GFileIcon)) +#define G_FILE_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_ICON, GFileIconClass)) +#define G_IS_FILE_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_ICON)) +#define G_IS_FILE_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_ICON)) +#define G_FILE_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_ICON, GFileIconClass)) + +/** + * GFileIcon: + * + * Gets an icon for a #GFile. Implements #GLoadableIcon. + **/ +typedef struct _GFileIconClass GFileIconClass; + +GIO_AVAILABLE_IN_ALL +GType g_file_icon_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GIcon * g_file_icon_new (GFile *file); + +GIO_AVAILABLE_IN_ALL +GFile * g_file_icon_get_file (GFileIcon *icon); + +G_END_DECLS + +#endif /* __G_FILE_ICON_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_INFO_H__ +#define __G_FILE_INFO_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE_INFO (g_file_info_get_type ()) +#define G_FILE_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_INFO, GFileInfo)) +#define G_FILE_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_INFO, GFileInfoClass)) +#define G_IS_FILE_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_INFO)) +#define G_IS_FILE_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_INFO)) +#define G_FILE_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_INFO, GFileInfoClass)) + +/** + * GFileInfo: + * + * Stores information about a file system object referenced by a #GFile. + **/ +typedef struct _GFileInfoClass GFileInfoClass; + + +/* Common Attributes: */ +/** + * G_FILE_ATTRIBUTE_STANDARD_TYPE: + * + * A key in the "standard" namespace for storing file types. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * The value for this key should contain a #GFileType. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_TYPE "standard::type" /* uint32 (GFileType) */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN: + * + * A key in the "standard" namespace for checking if a file is hidden. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN "standard::is-hidden" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP: + * + * A key in the "standard" namespace for checking if a file is a backup file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP "standard::is-backup" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK: + * + * A key in the "standard" namespace for checking if the file is a symlink. + * Typically the actual type is something else, if we followed the symlink + * to get the type. + * + * On Windows NTFS mountpoints are considered to be symlinks as well. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "standard::is-symlink" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL: + * + * A key in the "standard" namespace for checking if a file is virtual. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL "standard::is-virtual" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE: + * + * A key in the "standard" namespace for checking if a file is + * volatile. This is meant for opaque, non-POSIX-like backends to + * indicate that the URI is not persistent. Applications should look + * at %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.46 + **/ +#define G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE "standard::is-volatile" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_NAME: + * + * A key in the "standard" namespace for getting the name of the file. + * + * The name is the on-disk filename which may not be in any known encoding, + * and can thus not be generally displayed as is. It is guaranteed to be set on + * every file. + * + * Use %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the + * name in a user interface. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_NAME "standard::name" /* byte string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME: + * + * A key in the "standard" namespace for getting the display name of the file. + * + * A display name is guaranteed to be in UTF-8 and can thus be displayed in + * the UI. It is guaranteed to be set on every file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "standard::display-name" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME: + * + * A key in the "standard" namespace for edit name of the file. + * + * An edit name is similar to the display name, but it is meant to be + * used when you want to rename the file in the UI. The display name + * might contain information you don't want in the new filename (such as + * "(invalid unicode)" if the filename was in an invalid encoding). + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME "standard::edit-name" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_COPY_NAME: + * + * A key in the "standard" namespace for getting the copy name of the file. + * + * The copy name is an optional version of the name. If available it's always + * in UTF8, and corresponds directly to the original filename (only transcoded to + * UTF8). This is useful if you want to copy the file to another filesystem that + * might have a different encoding. If the filename is not a valid string in the + * encoding selected for the filesystem it is in then the copy name will not be set. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_COPY_NAME "standard::copy-name" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION: + * + * A key in the "standard" namespace for getting the description of the file. + * + * The description is a utf8 string that describes the file, generally containing + * the filename, but can also contain further information. Example descriptions + * could be "filename (on hostname)" for a remote file or "filename (in trash)" + * for a file in the trash. This is useful for instance as the window title + * when displaying a directory or for a bookmarks menu. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_DESCRIPTION "standard::description" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_ICON: + * + * A key in the "standard" namespace for getting the icon for the file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT. + * + * The value for this key should contain a #GIcon. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_ICON "standard::icon" /* object (GIcon) */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON: + * + * A key in the "standard" namespace for getting the symbolic icon for the file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT. + * + * The value for this key should contain a #GIcon. + * + * Since: 2.34 + **/ +#define G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON "standard::symbolic-icon" /* object (GIcon) */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE: + * + * A key in the "standard" namespace for getting the content type of the file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + * The value for this key should contain a valid content type. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE "standard::content-type" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE: + * + * A key in the "standard" namespace for getting the fast content type. + * + * The fast content type isn't as reliable as the regular one, as it + * only uses the filename to guess it, but it is faster to calculate than the + * regular content type. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + **/ +#define G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE "standard::fast-content-type" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_SIZE: + * + * A key in the "standard" namespace for getting the file's size (in bytes). + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_SIZE "standard::size" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE: + * + * A key in the "standard" namespace for getting the amount of disk space + * that is consumed by the file (in bytes). + * + * This will generally be larger than the file size (due to block size + * overhead) but can occasionally be smaller (for example, for sparse files). + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + * + * Since: 2.20 + **/ +#define G_FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE "standard::allocated-size" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET: + * + * A key in the "standard" namespace for getting the symlink target, if the file + * is a symlink. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "standard::symlink-target" /* byte string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_TARGET_URI: + * + * A key in the "standard" namespace for getting the target URI for the file, in + * the case of %G_FILE_TYPE_SHORTCUT or %G_FILE_TYPE_MOUNTABLE files. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_TARGET_URI "standard::target-uri" /* string */ + +/** + * G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER: + * + * A key in the "standard" namespace for setting the sort order of a file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_INT32. + * + * An example use would be in file managers, which would use this key + * to set the order files are displayed. Files with smaller sort order + * should be sorted first, and files without sort order as if sort order + * was zero. + **/ +#define G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER "standard::sort-order" /* int32 */ + +/* Entity tags, used to avoid missing updates on save */ + +/** + * G_FILE_ATTRIBUTE_ETAG_VALUE: + * + * A key in the "etag" namespace for getting the value of the file's + * entity tag. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_ETAG_VALUE "etag::value" /* string */ + +/* File identifier, for e.g. avoiding loops when doing recursive + * directory scanning + */ + +/** + * G_FILE_ATTRIBUTE_ID_FILE: + * + * A key in the "id" namespace for getting a file identifier. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + * An example use would be during listing files, to avoid recursive + * directory scanning. + **/ +#define G_FILE_ATTRIBUTE_ID_FILE "id::file" /* string */ + +/** + * G_FILE_ATTRIBUTE_ID_FILESYSTEM: + * + * A key in the "id" namespace for getting the file system identifier. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + * An example use would be during drag and drop to see if the source + * and target are on the same filesystem (default to move) or not (default + * to copy). + **/ +#define G_FILE_ATTRIBUTE_ID_FILESYSTEM "id::filesystem" /* string */ + +/* Calculated Access Rights for current user */ + +/** + * G_FILE_ATTRIBUTE_ACCESS_CAN_READ: + * + * A key in the "access" namespace for getting read privileges. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * This attribute will be %TRUE if the user is able to read the file. + **/ +#define G_FILE_ATTRIBUTE_ACCESS_CAN_READ "access::can-read" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE: + * + * A key in the "access" namespace for getting write privileges. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * This attribute will be %TRUE if the user is able to write to the file. + **/ +#define G_FILE_ATTRIBUTE_ACCESS_CAN_WRITE "access::can-write" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE: + * + * A key in the "access" namespace for getting execution privileges. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * This attribute will be %TRUE if the user is able to execute the file. + **/ +#define G_FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE "access::can-execute" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE: + * + * A key in the "access" namespace for checking deletion privileges. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * This attribute will be %TRUE if the user is able to delete the file. + **/ +#define G_FILE_ATTRIBUTE_ACCESS_CAN_DELETE "access::can-delete" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH: + * + * A key in the "access" namespace for checking trashing privileges. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * This attribute will be %TRUE if the user is able to move the file to + * the trash. + **/ +#define G_FILE_ATTRIBUTE_ACCESS_CAN_TRASH "access::can-trash" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME: + * + * A key in the "access" namespace for checking renaming privileges. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * This attribute will be %TRUE if the user is able to rename the file. + **/ +#define G_FILE_ATTRIBUTE_ACCESS_CAN_RENAME "access::can-rename" /* boolean */ + +/* TODO: Should we have special version for directories? can_enumerate, etc */ + +/* Mountable attributes */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) is mountable. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT "mountable::can-mount" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) is unmountable. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT "mountable::can-unmount" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) can be ejected. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT "mountable::can-eject" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE: + * + * A key in the "mountable" namespace for getting the unix device. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE "mountable::unix-device" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE: + * + * A key in the "mountable" namespace for getting the unix device file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + * Since: 2.22 + **/ +#define G_FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE "mountable::unix-device-file" /* string */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI: + * + * A key in the "mountable" namespace for getting the HAL UDI for the mountable + * file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI "mountable::hal-udi" /* string */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) can be started. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.22 + */ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START "mountable::can-start" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) can be started degraded. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.22 + */ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED "mountable::can-start-degraded" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) can be stopped. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.22 + */ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP "mountable::can-stop" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE: + * + * A key in the "mountable" namespace for getting the #GDriveStartStopType. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * Since: 2.22 + */ +#define G_FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE "mountable::start-stop-type" /* uint32 (GDriveStartStopType) */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) can be polled. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.22 + */ +#define G_FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL "mountable::can-poll" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC: + * + * A key in the "mountable" namespace for checking if a file (of + * type G_FILE_TYPE_MOUNTABLE) is automatically polled for media. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.22 + */ +#define G_FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC "mountable::is-media-check-automatic" /* boolean */ + +/* Time attributes */ + +/** + * G_FILE_ATTRIBUTE_TIME_MODIFIED: + * + * A key in the "time" namespace for getting the time the file was last + * modified. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64, and + * contains the time since the file was modified, in seconds since the UNIX + * epoch. + **/ +#define G_FILE_ATTRIBUTE_TIME_MODIFIED "time::modified" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC: + * + * A key in the "time" namespace for getting the microseconds of the time + * the file was last modified. + * + * This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_MODIFIED. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC "time::modified-usec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC: + * + * A key in the "time" namespace for getting the nanoseconds of the time + * the file was last modified. This should be used in conjunction with + * #G_FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding #GFileAttributeType is + * %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * Since: 2.74 + **/ +#define G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC "time::modified-nsec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_ACCESS: + * + * A key in the "time" namespace for getting the time the file was last + * accessed. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64, and + * contains the time since the file was last accessed, in seconds since the + * UNIX epoch. + **/ +#define G_FILE_ATTRIBUTE_TIME_ACCESS "time::access" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_TIME_ACCESS_USEC: + * + * A key in the "time" namespace for getting the microseconds of the time + * the file was last accessed. + * + * This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_ACCESS. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_TIME_ACCESS_USEC "time::access-usec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC: + * + * A key in the "time" namespace for getting the nanoseconds of the time + * the file was last accessed. This should be used in conjunction with + * #G_FILE_ATTRIBUTE_TIME_ACCESS. Corresponding #GFileAttributeType is + * %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * Since: 2.74 + **/ +#define G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC "time::access-nsec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_CHANGED: + * + * A key in the "time" namespace for getting the time the file was last + * changed. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64, + * and contains the time since the file was last changed, in seconds since + * the UNIX epoch. + * + * This corresponds to the traditional UNIX ctime. + **/ +#define G_FILE_ATTRIBUTE_TIME_CHANGED "time::changed" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_TIME_CHANGED_USEC: + * + * A key in the "time" namespace for getting the microseconds of the time + * the file was last changed. + * + * This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_CHANGED. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_TIME_CHANGED_USEC "time::changed-usec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_CHANGED_NSEC: + * + * A key in the "time" namespace for getting the nanoseconds of the time + * the file was last changed. This should be used in conjunction with + * #G_FILE_ATTRIBUTE_TIME_CHANGED. Corresponding #GFileAttributeType is + * %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * Since: 2.74 + **/ +#define G_FILE_ATTRIBUTE_TIME_CHANGED_NSEC "time::changed-nsec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_CREATED: + * + * A key in the "time" namespace for getting the time the file was created. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64, + * and contains the time since the file was created, in seconds since the UNIX + * epoch. + * + * This may correspond to Linux `stx_btime`, FreeBSD `st_birthtim`, NetBSD + * `st_birthtime` or NTFS `ctime`. + **/ +#define G_FILE_ATTRIBUTE_TIME_CREATED "time::created" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_TIME_CREATED_USEC: + * + * A key in the "time" namespace for getting the microseconds of the time + * the file was created. + * + * This should be used in conjunction with %G_FILE_ATTRIBUTE_TIME_CREATED. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_TIME_CREATED_USEC "time::created-usec" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TIME_CREATED_NSEC: + * + * A key in the "time" namespace for getting the nanoseconds of the time + * the file was created. This should be used in conjunction with + * #G_FILE_ATTRIBUTE_TIME_CREATED. Corresponding #GFileAttributeType is + * %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * Since: 2.74 + **/ +#define G_FILE_ATTRIBUTE_TIME_CREATED_NSEC "time::created-nsec" /* uint32 */ + +/* Unix specific attributes */ + +/** + * G_FILE_ATTRIBUTE_UNIX_DEVICE: + * + * A key in the "unix" namespace for getting the device id of the device the + * file is located on (see stat() documentation). + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_DEVICE "unix::device" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_INODE: + * + * A key in the "unix" namespace for getting the inode of the file. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + **/ +#define G_FILE_ATTRIBUTE_UNIX_INODE "unix::inode" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_MODE: + * + * A key in the "unix" namespace for getting the mode of the file + * (e.g. whether the file is a regular file, symlink, etc). + * + * See the documentation for `lstat()`: this attribute is equivalent to + * the `st_mode` member of `struct stat`, and includes both the file type + * and permissions. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_MODE "unix::mode" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_NLINK: + * + * A key in the "unix" namespace for getting the number of hard links + * for a file. + * + * See the documentation for `lstat()`. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_NLINK "unix::nlink" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_UID: + * + * A key in the "unix" namespace for getting the user ID for the file. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_UID "unix::uid" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_GID: + * + * A key in the "unix" namespace for getting the group ID for the file. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_GID "unix::gid" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_RDEV: + * + * A key in the "unix" namespace for getting the device ID for the file + * (if it is a special file). + * + * See the documentation for `lstat()`. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_RDEV "unix::rdev" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE: + * + * A key in the "unix" namespace for getting the block size for the file + * system. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_UNIX_BLOCK_SIZE "unix::block-size" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_BLOCKS: + * + * A key in the "unix" namespace for getting the number of blocks allocated + * for the file. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + **/ +#define G_FILE_ATTRIBUTE_UNIX_BLOCKS "unix::blocks" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT: + * + * A key in the "unix" namespace for checking if the file represents a + * UNIX mount point. + * + * This attribute is %TRUE if the file is a UNIX mount point. + * + * Since 2.58, `/` is considered to be a mount point. + * + * This attribute is only available for UNIX file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT "unix::is-mountpoint" /* boolean */ + +/* DOS specific attributes */ + +/** + * G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE: + * + * A key in the "dos" namespace for checking if the file's archive flag + * is set. + * + * This attribute is %TRUE if the archive flag is set. + * + * This attribute is only available for DOS file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_DOS_IS_ARCHIVE "dos::is-archive" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_DOS_IS_SYSTEM: + * + * A key in the "dos" namespace for checking if the file's backup flag + * is set. + * + * This attribute is %TRUE if the backup flag is set. + * + * This attribute is only available for DOS file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_DOS_IS_SYSTEM "dos::is-system" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT: + * + * A key in the "dos" namespace for checking if the file is a NTFS mount point + * (a volume mount or a junction point). + * + * This attribute is %TRUE if file is a reparse point of type + * [IO_REPARSE_TAG_MOUNT_POINT](https://msdn.microsoft.com/en-us/library/dd541667.aspx). + * + * This attribute is only available for DOS file systems. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.60 + **/ +#define G_FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT "dos::is-mountpoint" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG: + * + * A key in the "dos" namespace for getting the file NTFS reparse tag. + * + * This value is 0 for files that are not reparse points. + * + * See the [Reparse Tags](https://msdn.microsoft.com/en-us/library/dd541667.aspx) + * page for possible reparse tag values. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + * + * Since: 2.60 + **/ +#define G_FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG "dos::reparse-point-tag" /* uint32 */ + +/* Owner attributes */ + +/** + * G_FILE_ATTRIBUTE_OWNER_USER: + * + * A key in the "owner" namespace for getting the user name of the + * file's owner. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_OWNER_USER "owner::user" /* string */ + +/** + * G_FILE_ATTRIBUTE_OWNER_USER_REAL: + * + * A key in the "owner" namespace for getting the real name of the + * user that owns the file. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_OWNER_USER_REAL "owner::user-real" /* string */ + +/** + * G_FILE_ATTRIBUTE_OWNER_GROUP: + * + * A key in the "owner" namespace for getting the file owner's group. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_OWNER_GROUP "owner::group" /* string */ + +/* Thumbnails */ + +/** + * G_FILE_ATTRIBUTE_THUMBNAIL_PATH: + * + * A key in the "thumbnail" namespace for getting the path to the thumbnail + * image. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. + **/ +#define G_FILE_ATTRIBUTE_THUMBNAIL_PATH "thumbnail::path" /* bytestring */ +/** + * G_FILE_ATTRIBUTE_THUMBNAILING_FAILED: + * + * A key in the "thumbnail" namespace for checking if thumbnailing failed. + * + * This attribute is %TRUE if thumbnailing failed. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_THUMBNAILING_FAILED "thumbnail::failed" /* boolean */ +/** + * G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID: + * + * A key in the "thumbnail" namespace for checking whether the thumbnail is outdated. + * + * This attribute is %TRUE if the thumbnail is up-to-date with the file it represents, + * and %FALSE if the file has been modified since the thumbnail was generated. + * + * If %G_FILE_ATTRIBUTE_THUMBNAILING_FAILED is %TRUE and this attribute is %FALSE, + * it indicates that thumbnailing may be attempted again and may succeed. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + * + * Since: 2.40 + */ +#define G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID "thumbnail::is-valid" /* boolean */ + +/* Preview */ + +/** + * G_FILE_ATTRIBUTE_PREVIEW_ICON: + * + * A key in the "preview" namespace for getting a #GIcon that can be + * used to get preview of the file. + * + * For example, it may be a low resolution thumbnail without metadata. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_OBJECT. + * + * The value for this key should contain a #GIcon. + * + * Since: 2.20 + **/ +#define G_FILE_ATTRIBUTE_PREVIEW_ICON "preview::icon" /* object (GIcon) */ + +/* File system info (for g_file_get_filesystem_info) */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_SIZE: + * + * A key in the "filesystem" namespace for getting the total size (in + * bytes) of the file system, used in g_file_query_filesystem_info(). + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + **/ +#define G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "filesystem::size" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_FREE: + * + * A key in the "filesystem" namespace for getting the number of bytes + * of free space left on the file system. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + **/ +#define G_FILE_ATTRIBUTE_FILESYSTEM_FREE "filesystem::free" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_USED: + * + * A key in the "filesystem" namespace for getting the number of bytes + * used by data on the file system. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT64. + * + * Since: 2.32 + */ +#define G_FILE_ATTRIBUTE_FILESYSTEM_USED "filesystem::used" /* uint64 */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_TYPE: + * + * A key in the "filesystem" namespace for getting the file system's type. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_FILESYSTEM_TYPE "filesystem::type" /* string */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_READONLY: + * + * A key in the "filesystem" namespace for checking if the file system + * is read only. + * + * Is set to %TRUE if the file system is read only. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_FILESYSTEM_READONLY "filesystem::readonly" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW: + * + * A key in the "filesystem" namespace for hinting a file manager + * application whether it should preview (e.g. thumbnail) files on the + * file system. + * + * The value for this key contain a #GFilesystemPreviewType. + **/ +#define G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW "filesystem::use-preview" /* uint32 (GFilesystemPreviewType) */ + +/** + * G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE: + * + * A key in the "filesystem" namespace for checking if the file system + * is remote. + * + * Is set to %TRUE if the file system is remote. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BOOLEAN. + **/ +#define G_FILE_ATTRIBUTE_FILESYSTEM_REMOTE "filesystem::remote" /* boolean */ + +/** + * G_FILE_ATTRIBUTE_GVFS_BACKEND: + * + * A key in the "gvfs" namespace that gets the name of the current + * GVFS backend in use. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + **/ +#define G_FILE_ATTRIBUTE_GVFS_BACKEND "gvfs::backend" /* string */ + +/** + * G_FILE_ATTRIBUTE_SELINUX_CONTEXT: + * + * A key in the "selinux" namespace for getting the file's SELinux + * context. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + * Note that this attribute is only available if GLib has been built + * with SELinux support. + **/ +#define G_FILE_ATTRIBUTE_SELINUX_CONTEXT "selinux::context" /* string */ + +/** + * G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT: + * + * A key in the "trash" namespace for getting the number of (toplevel) items + * that are present in the `trash:///` folder. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_UINT32. + **/ +#define G_FILE_ATTRIBUTE_TRASH_ITEM_COUNT "trash::item-count" /* uint32 */ + +/** + * G_FILE_ATTRIBUTE_TRASH_ORIG_PATH: + * + * A key in the "trash" namespace for getting the original path of a file + * inside the `trash:///` folder before it was trashed. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. + * + * Since: 2.24 + **/ +#define G_FILE_ATTRIBUTE_TRASH_ORIG_PATH "trash::orig-path" /* byte string */ + +/** + * G_FILE_ATTRIBUTE_TRASH_DELETION_DATE: + * + * A key in the "trash" namespace for getting the deletion date and time + * of a file inside the `trash:///` folder. + * + * The format of the returned string is `YYYY-MM-DDThh:mm:ss`. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_STRING. + * + * Since: 2.24 + **/ +#define G_FILE_ATTRIBUTE_TRASH_DELETION_DATE "trash::deletion-date" /* string */ + +/** + * G_FILE_ATTRIBUTE_RECENT_MODIFIED: + * + * A key in the "recent" namespace for getting time, when the metadata for the + * file in `recent:///` was last changed. + * + * Corresponding #GFileAttributeType is %G_FILE_ATTRIBUTE_TYPE_INT64. + * + * Since: 2.52 + **/ +#define G_FILE_ATTRIBUTE_RECENT_MODIFIED "recent::modified" /* int64 (time_t) */ + +GIO_AVAILABLE_IN_ALL +GType g_file_info_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFileInfo * g_file_info_new (void); +GIO_AVAILABLE_IN_ALL +GFileInfo * g_file_info_dup (GFileInfo *other); +GIO_AVAILABLE_IN_ALL +void g_file_info_copy_into (GFileInfo *src_info, + GFileInfo *dest_info); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_has_attribute (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_has_namespace (GFileInfo *info, + const char *name_space); +GIO_AVAILABLE_IN_ALL +char ** g_file_info_list_attributes (GFileInfo *info, + const char *name_space); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_get_attribute_data (GFileInfo *info, + const char *attribute, + GFileAttributeType *type, + gpointer *value_pp, + GFileAttributeStatus *status); +GIO_AVAILABLE_IN_ALL +GFileAttributeType g_file_info_get_attribute_type (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +void g_file_info_remove_attribute (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_set_attribute_status (GFileInfo *info, + const char *attribute, + GFileAttributeStatus status); +GIO_AVAILABLE_IN_ALL +char * g_file_info_get_attribute_as_string (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_attribute_string (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_attribute_byte_string (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_get_attribute_boolean (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +guint32 g_file_info_get_attribute_uint32 (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gint32 g_file_info_get_attribute_int32 (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +guint64 g_file_info_get_attribute_uint64 (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gint64 g_file_info_get_attribute_int64 (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +GObject * g_file_info_get_attribute_object (GFileInfo *info, + const char *attribute); +GIO_AVAILABLE_IN_ALL +char ** g_file_info_get_attribute_stringv (GFileInfo *info, + const char *attribute); + +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute (GFileInfo *info, + const char *attribute, + GFileAttributeType type, + gpointer value_p); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_string (GFileInfo *info, + const char *attribute, + const char *attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_byte_string (GFileInfo *info, + const char *attribute, + const char *attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_boolean (GFileInfo *info, + const char *attribute, + gboolean attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_uint32 (GFileInfo *info, + const char *attribute, + guint32 attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_int32 (GFileInfo *info, + const char *attribute, + gint32 attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_uint64 (GFileInfo *info, + const char *attribute, + guint64 attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_int64 (GFileInfo *info, + const char *attribute, + gint64 attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_object (GFileInfo *info, + const char *attribute, + GObject *attr_value); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_stringv (GFileInfo *info, + const char *attribute, + char **attr_value); + +GIO_AVAILABLE_IN_ALL +void g_file_info_clear_status (GFileInfo *info); + +/* Helper getters: */ +GIO_AVAILABLE_IN_2_36 +GDateTime * g_file_info_get_deletion_date (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +GFileType g_file_info_get_file_type (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_get_is_hidden (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_get_is_backup (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +gboolean g_file_info_get_is_symlink (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_name (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_display_name (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_edit_name (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +GIcon * g_file_info_get_icon (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +GIcon * g_file_info_get_symbolic_icon (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_content_type (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +goffset g_file_info_get_size (GFileInfo *info); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GIO_DEPRECATED_IN_2_62_FOR(g_file_info_get_modification_date_time) +void g_file_info_get_modification_time (GFileInfo *info, + GTimeVal *result); +G_GNUC_END_IGNORE_DEPRECATIONS +GIO_AVAILABLE_IN_2_62 +GDateTime * g_file_info_get_modification_date_time (GFileInfo *info); +GIO_AVAILABLE_IN_2_70 +GDateTime * g_file_info_get_access_date_time (GFileInfo *info); +GIO_AVAILABLE_IN_2_70 +GDateTime * g_file_info_get_creation_date_time (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_symlink_target (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +const char * g_file_info_get_etag (GFileInfo *info); +GIO_AVAILABLE_IN_ALL +gint32 g_file_info_get_sort_order (GFileInfo *info); + +GIO_AVAILABLE_IN_ALL +void g_file_info_set_attribute_mask (GFileInfo *info, + GFileAttributeMatcher *mask); +GIO_AVAILABLE_IN_ALL +void g_file_info_unset_attribute_mask (GFileInfo *info); + +/* Helper setters: */ +GIO_AVAILABLE_IN_ALL +void g_file_info_set_file_type (GFileInfo *info, + GFileType type); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_is_hidden (GFileInfo *info, + gboolean is_hidden); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_is_symlink (GFileInfo *info, + gboolean is_symlink); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_name (GFileInfo *info, + const char *name); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_display_name (GFileInfo *info, + const char *display_name); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_edit_name (GFileInfo *info, + const char *edit_name); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_icon (GFileInfo *info, + GIcon *icon); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_symbolic_icon (GFileInfo *info, + GIcon *icon); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_content_type (GFileInfo *info, + const char *content_type); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_size (GFileInfo *info, + goffset size); +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GIO_DEPRECATED_IN_2_62_FOR(g_file_info_set_modification_date_time) +void g_file_info_set_modification_time (GFileInfo *info, + GTimeVal *mtime); +G_GNUC_END_IGNORE_DEPRECATIONS +GIO_AVAILABLE_IN_2_62 +void g_file_info_set_modification_date_time (GFileInfo *info, + GDateTime *mtime); +GIO_AVAILABLE_IN_2_70 +void g_file_info_set_access_date_time (GFileInfo *info, + GDateTime *atime); +GIO_AVAILABLE_IN_2_70 +void g_file_info_set_creation_date_time (GFileInfo *info, + GDateTime *creation_time); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_symlink_target (GFileInfo *info, + const char *symlink_target); +GIO_AVAILABLE_IN_ALL +void g_file_info_set_sort_order (GFileInfo *info, + gint32 sort_order); + +#define G_TYPE_FILE_ATTRIBUTE_MATCHER (g_file_attribute_matcher_get_type ()) +GIO_AVAILABLE_IN_ALL +GType g_file_attribute_matcher_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFileAttributeMatcher *g_file_attribute_matcher_new (const char *attributes); +GIO_AVAILABLE_IN_ALL +GFileAttributeMatcher *g_file_attribute_matcher_ref (GFileAttributeMatcher *matcher); +GIO_AVAILABLE_IN_ALL +void g_file_attribute_matcher_unref (GFileAttributeMatcher *matcher); +GIO_AVAILABLE_IN_ALL +GFileAttributeMatcher *g_file_attribute_matcher_subtract (GFileAttributeMatcher *matcher, + GFileAttributeMatcher *subtract); +GIO_AVAILABLE_IN_ALL +gboolean g_file_attribute_matcher_matches (GFileAttributeMatcher *matcher, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gboolean g_file_attribute_matcher_matches_only (GFileAttributeMatcher *matcher, + const char *attribute); +GIO_AVAILABLE_IN_ALL +gboolean g_file_attribute_matcher_enumerate_namespace (GFileAttributeMatcher *matcher, + const char *ns); +GIO_AVAILABLE_IN_ALL +const char * g_file_attribute_matcher_enumerate_next (GFileAttributeMatcher *matcher); +GIO_AVAILABLE_IN_2_32 +char * g_file_attribute_matcher_to_string (GFileAttributeMatcher *matcher); + +G_END_DECLS + +#endif /* __G_FILE_INFO_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_INPUT_STREAM_H__ +#define __G_FILE_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE_INPUT_STREAM (g_file_input_stream_get_type ()) +#define G_FILE_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_INPUT_STREAM, GFileInputStream)) +#define G_FILE_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_INPUT_STREAM, GFileInputStreamClass)) +#define G_IS_FILE_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_INPUT_STREAM)) +#define G_IS_FILE_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_INPUT_STREAM)) +#define G_FILE_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_INPUT_STREAM, GFileInputStreamClass)) + +/** + * GFileInputStream: + * + * A subclass of GInputStream for opened files. This adds + * a few file-specific operations and seeking. + * + * #GFileInputStream implements #GSeekable. + **/ +typedef struct _GFileInputStreamClass GFileInputStreamClass; +typedef struct _GFileInputStreamPrivate GFileInputStreamPrivate; + +struct _GFileInputStream +{ + GInputStream parent_instance; + + /*< private >*/ + GFileInputStreamPrivate *priv; +}; + +struct _GFileInputStreamClass +{ + GInputStreamClass parent_class; + + goffset (* tell) (GFileInputStream *stream); + gboolean (* can_seek) (GFileInputStream *stream); + gboolean (* seek) (GFileInputStream *stream, + goffset offset, + GSeekType type, + GCancellable *cancellable, + GError **error); + GFileInfo * (* query_info) (GFileInputStream *stream, + const char *attributes, + GCancellable *cancellable, + GError **error); + void (* query_info_async) (GFileInputStream *stream, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileInfo * (* query_info_finish) (GFileInputStream *stream, + GAsyncResult *result, + GError **error); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_file_input_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_input_stream_query_info (GFileInputStream *stream, + const char *attributes, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_input_stream_query_info_async (GFileInputStream *stream, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_input_stream_query_info_finish (GFileInputStream *stream, + GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif /* __G_FILE_FILE_INPUT_STREAM_H__ */ +/* GIO - GLib Input, Io and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_IO_STREAM_H__ +#define __G_FILE_IO_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2008, 2009 Codethink Limited + * Copyright © 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * See the included COPYING file for more information. + * + * Authors: Ryan Lortie + * Alexander Larsson + */ + +#ifndef __G_IO_STREAM_H__ +#define __G_IO_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_IO_ERROR_H__ +#define __G_IO_ERROR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_IO_ERROR: + * + * Error domain for GIO. Errors in this domain will be from the #GIOErrorEnum enumeration. + * See #GError for more information on error domains. + **/ +#define G_IO_ERROR g_io_error_quark() + +GIO_AVAILABLE_IN_ALL +GQuark g_io_error_quark (void); +GIO_AVAILABLE_IN_ALL +GIOErrorEnum g_io_error_from_errno (gint err_no); +GIO_AVAILABLE_IN_2_74 +GIOErrorEnum g_io_error_from_file_error (GFileError file_error); + +#ifdef G_OS_WIN32 +GIO_AVAILABLE_IN_ALL +GIOErrorEnum g_io_error_from_win32_error (gint error_code); +#endif + +G_END_DECLS + +#endif /* __G_IO_ERROR_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_IO_STREAM (g_io_stream_get_type ()) +#define G_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_IO_STREAM, GIOStream)) +#define G_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_IO_STREAM, GIOStreamClass)) +#define G_IS_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_IO_STREAM)) +#define G_IS_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_IO_STREAM)) +#define G_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_IO_STREAM, GIOStreamClass)) + +typedef struct _GIOStreamPrivate GIOStreamPrivate; +typedef struct _GIOStreamClass GIOStreamClass; + +/** + * GIOStream: + * + * Base class for read-write streams. + **/ +struct _GIOStream +{ + GObject parent_instance; + + /*< private >*/ + GIOStreamPrivate *priv; +}; + +struct _GIOStreamClass +{ + GObjectClass parent_class; + + GInputStream * (*get_input_stream) (GIOStream *stream); + GOutputStream * (*get_output_stream) (GIOStream *stream); + + gboolean (* close_fn) (GIOStream *stream, + GCancellable *cancellable, + GError **error); + void (* close_async) (GIOStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* close_finish) (GIOStream *stream, + GAsyncResult *result, + GError **error); + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); + void (*_g_reserved7) (void); + void (*_g_reserved8) (void); + void (*_g_reserved9) (void); + void (*_g_reserved10) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_io_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GInputStream * g_io_stream_get_input_stream (GIOStream *stream); +GIO_AVAILABLE_IN_ALL +GOutputStream *g_io_stream_get_output_stream (GIOStream *stream); + +GIO_AVAILABLE_IN_ALL +void g_io_stream_splice_async (GIOStream *stream1, + GIOStream *stream2, + GIOStreamSpliceFlags flags, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +gboolean g_io_stream_splice_finish (GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_io_stream_close (GIOStream *stream, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_io_stream_close_async (GIOStream *stream, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_io_stream_close_finish (GIOStream *stream, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_io_stream_is_closed (GIOStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_io_stream_has_pending (GIOStream *stream); +GIO_AVAILABLE_IN_ALL +gboolean g_io_stream_set_pending (GIOStream *stream, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_io_stream_clear_pending (GIOStream *stream); + +G_END_DECLS + +#endif /* __G_IO_STREAM_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_FILE_IO_STREAM (g_file_io_stream_get_type ()) +#define G_FILE_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_IO_STREAM, GFileIOStream)) +#define G_FILE_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_IO_STREAM, GFileIOStreamClass)) +#define G_IS_FILE_IO_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_IO_STREAM)) +#define G_IS_FILE_IO_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_IO_STREAM)) +#define G_FILE_IO_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_IO_STREAM, GFileIOStreamClass)) + +/** + * GFileIOStream: + * + * A subclass of GIOStream for opened files. This adds + * a few file-specific operations and seeking and truncating. + * + * #GFileIOStream implements GSeekable. + **/ +typedef struct _GFileIOStreamClass GFileIOStreamClass; +typedef struct _GFileIOStreamPrivate GFileIOStreamPrivate; + +struct _GFileIOStream +{ + GIOStream parent_instance; + + /*< private >*/ + GFileIOStreamPrivate *priv; +}; + +struct _GFileIOStreamClass +{ + GIOStreamClass parent_class; + + goffset (* tell) (GFileIOStream *stream); + gboolean (* can_seek) (GFileIOStream *stream); + gboolean (* seek) (GFileIOStream *stream, + goffset offset, + GSeekType type, + GCancellable *cancellable, + GError **error); + gboolean (* can_truncate) (GFileIOStream *stream); + gboolean (* truncate_fn) (GFileIOStream *stream, + goffset size, + GCancellable *cancellable, + GError **error); + GFileInfo * (* query_info) (GFileIOStream *stream, + const char *attributes, + GCancellable *cancellable, + GError **error); + void (* query_info_async) (GFileIOStream *stream, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileInfo * (* query_info_finish) (GFileIOStream *stream, + GAsyncResult *result, + GError **error); + char * (* get_etag) (GFileIOStream *stream); + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_file_io_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_io_stream_query_info (GFileIOStream *stream, + const char *attributes, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_io_stream_query_info_async (GFileIOStream *stream, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_io_stream_query_info_finish (GFileIOStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +char * g_file_io_stream_get_etag (GFileIOStream *stream); + +G_END_DECLS + +#endif /* __G_FILE_FILE_IO_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_MONITOR_H__ +#define __G_FILE_MONITOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE_MONITOR (g_file_monitor_get_type ()) +#define G_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_MONITOR, GFileMonitor)) +#define G_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_MONITOR, GFileMonitorClass)) +#define G_IS_FILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_MONITOR)) +#define G_IS_FILE_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_MONITOR)) +#define G_FILE_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_MONITOR, GFileMonitorClass)) + +typedef struct _GFileMonitorClass GFileMonitorClass; +typedef struct _GFileMonitorPrivate GFileMonitorPrivate; + +/** + * GFileMonitor: + * + * Watches for changes to a file. + **/ +struct _GFileMonitor +{ + GObject parent_instance; + + /*< private >*/ + GFileMonitorPrivate *priv; +}; + +struct _GFileMonitorClass +{ + GObjectClass parent_class; + + /* Signals */ + void (* changed) (GFileMonitor *monitor, + GFile *file, + GFile *other_file, + GFileMonitorEvent event_type); + + /* Virtual Table */ + gboolean (* cancel) (GFileMonitor *monitor); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_file_monitor_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_file_monitor_cancel (GFileMonitor *monitor); +GIO_AVAILABLE_IN_ALL +gboolean g_file_monitor_is_cancelled (GFileMonitor *monitor); +GIO_AVAILABLE_IN_ALL +void g_file_monitor_set_rate_limit (GFileMonitor *monitor, + gint limit_msecs); + + +/* For implementations */ +GIO_AVAILABLE_IN_ALL +void g_file_monitor_emit_event (GFileMonitor *monitor, + GFile *child, + GFile *other_file, + GFileMonitorEvent event_type); + +G_END_DECLS + +#endif /* __G_FILE_MONITOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILENAME_COMPLETER_H__ +#define __G_FILENAME_COMPLETER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILENAME_COMPLETER (g_filename_completer_get_type ()) +#define G_FILENAME_COMPLETER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILENAME_COMPLETER, GFilenameCompleter)) +#define G_FILENAME_COMPLETER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILENAME_COMPLETER, GFilenameCompleterClass)) +#define G_FILENAME_COMPLETER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILENAME_COMPLETER, GFilenameCompleterClass)) +#define G_IS_FILENAME_COMPLETER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILENAME_COMPLETER)) +#define G_IS_FILENAME_COMPLETER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILENAME_COMPLETER)) + +/** + * GFilenameCompleter: + * + * Completes filenames based on files that exist within the file system. + **/ +typedef struct _GFilenameCompleterClass GFilenameCompleterClass; + +struct _GFilenameCompleterClass +{ + GObjectClass parent_class; + + /*< public >*/ + /* signals */ + void (* got_completion_data) (GFilenameCompleter *filename_completer); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_filename_completer_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFilenameCompleter *g_filename_completer_new (void); + +GIO_AVAILABLE_IN_ALL +char * g_filename_completer_get_completion_suffix (GFilenameCompleter *completer, + const char *initial_text); +GIO_AVAILABLE_IN_ALL +char ** g_filename_completer_get_completions (GFilenameCompleter *completer, + const char *initial_text); +GIO_AVAILABLE_IN_ALL +void g_filename_completer_set_dirs_only (GFilenameCompleter *completer, + gboolean dirs_only); + +G_END_DECLS + +#endif /* __G_FILENAME_COMPLETER_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_FILE_OUTPUT_STREAM_H__ +#define __G_FILE_OUTPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_FILE_OUTPUT_STREAM (g_file_output_stream_get_type ()) +#define G_FILE_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStream)) +#define G_FILE_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStreamClass)) +#define G_IS_FILE_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_FILE_OUTPUT_STREAM)) +#define G_IS_FILE_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_FILE_OUTPUT_STREAM)) +#define G_FILE_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_FILE_OUTPUT_STREAM, GFileOutputStreamClass)) + +/** + * GFileOutputStream: + * + * A subclass of GOutputStream for opened files. This adds + * a few file-specific operations and seeking and truncating. + * + * #GFileOutputStream implements GSeekable. + **/ +typedef struct _GFileOutputStreamClass GFileOutputStreamClass; +typedef struct _GFileOutputStreamPrivate GFileOutputStreamPrivate; + +struct _GFileOutputStream +{ + GOutputStream parent_instance; + + /*< private >*/ + GFileOutputStreamPrivate *priv; +}; + +struct _GFileOutputStreamClass +{ + GOutputStreamClass parent_class; + + goffset (* tell) (GFileOutputStream *stream); + gboolean (* can_seek) (GFileOutputStream *stream); + gboolean (* seek) (GFileOutputStream *stream, + goffset offset, + GSeekType type, + GCancellable *cancellable, + GError **error); + gboolean (* can_truncate) (GFileOutputStream *stream); + gboolean (* truncate_fn) (GFileOutputStream *stream, + goffset size, + GCancellable *cancellable, + GError **error); + GFileInfo * (* query_info) (GFileOutputStream *stream, + const char *attributes, + GCancellable *cancellable, + GError **error); + void (* query_info_async) (GFileOutputStream *stream, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GFileInfo * (* query_info_finish) (GFileOutputStream *stream, + GAsyncResult *result, + GError **error); + char * (* get_etag) (GFileOutputStream *stream); + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_file_output_stream_get_type (void) G_GNUC_CONST; + + +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_output_stream_query_info (GFileOutputStream *stream, + const char *attributes, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_file_output_stream_query_info_async (GFileOutputStream *stream, + const char *attributes, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GFileInfo *g_file_output_stream_query_info_finish (GFileOutputStream *stream, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +char * g_file_output_stream_get_etag (GFileOutputStream *stream); + +G_END_DECLS + +#endif /* __G_FILE_FILE_OUTPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + */ + +#ifndef __G_INET_ADDRESS_H__ +#define __G_INET_ADDRESS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_INET_ADDRESS (g_inet_address_get_type ()) +#define G_INET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INET_ADDRESS, GInetAddress)) +#define G_INET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INET_ADDRESS, GInetAddressClass)) +#define G_IS_INET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INET_ADDRESS)) +#define G_IS_INET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INET_ADDRESS)) +#define G_INET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INET_ADDRESS, GInetAddressClass)) + +typedef struct _GInetAddressClass GInetAddressClass; +typedef struct _GInetAddressPrivate GInetAddressPrivate; + +struct _GInetAddress +{ + GObject parent_instance; + + /*< private >*/ + GInetAddressPrivate *priv; +}; + +struct _GInetAddressClass +{ + GObjectClass parent_class; + + gchar * (*to_string) (GInetAddress *address); + const guint8 * (*to_bytes) (GInetAddress *address); +}; + +GIO_AVAILABLE_IN_ALL +GType g_inet_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GInetAddress * g_inet_address_new_from_string (const gchar *string); + +GIO_AVAILABLE_IN_ALL +GInetAddress * g_inet_address_new_from_bytes (const guint8 *bytes, + GSocketFamily family); + +GIO_AVAILABLE_IN_ALL +GInetAddress * g_inet_address_new_loopback (GSocketFamily family); + +GIO_AVAILABLE_IN_ALL +GInetAddress * g_inet_address_new_any (GSocketFamily family); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_equal (GInetAddress *address, + GInetAddress *other_address); + +GIO_AVAILABLE_IN_ALL +gchar * g_inet_address_to_string (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +const guint8 * g_inet_address_to_bytes (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gsize g_inet_address_get_native_size (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +GSocketFamily g_inet_address_get_family (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_any (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_loopback (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_link_local (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_site_local (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_multicast (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_mc_global (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_mc_link_local (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_mc_node_local (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_mc_org_local (GInetAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_inet_address_get_is_mc_site_local (GInetAddress *address); + +G_END_DECLS + +#endif /* __G_INET_ADDRESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2011 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_INET_ADDRESS_MASK_H__ +#define __G_INET_ADDRESS_MASK_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_INET_ADDRESS_MASK (g_inet_address_mask_get_type ()) +#define G_INET_ADDRESS_MASK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INET_ADDRESS_MASK, GInetAddressMask)) +#define G_INET_ADDRESS_MASK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INET_ADDRESS_MASK, GInetAddressMaskClass)) +#define G_IS_INET_ADDRESS_MASK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INET_ADDRESS_MASK)) +#define G_IS_INET_ADDRESS_MASK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INET_ADDRESS_MASK)) +#define G_INET_ADDRESS_MASK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INET_ADDRESS_MASK, GInetAddressMaskClass)) + +typedef struct _GInetAddressMaskClass GInetAddressMaskClass; +typedef struct _GInetAddressMaskPrivate GInetAddressMaskPrivate; + +struct _GInetAddressMask +{ + GObject parent_instance; + + /*< private >*/ + GInetAddressMaskPrivate *priv; +}; + +struct _GInetAddressMaskClass +{ + GObjectClass parent_class; + +}; + +GIO_AVAILABLE_IN_2_32 +GType g_inet_address_mask_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +GInetAddressMask *g_inet_address_mask_new (GInetAddress *addr, + guint length, + GError **error); + +GIO_AVAILABLE_IN_2_32 +GInetAddressMask *g_inet_address_mask_new_from_string (const gchar *mask_string, + GError **error); +GIO_AVAILABLE_IN_2_32 +gchar *g_inet_address_mask_to_string (GInetAddressMask *mask); + +GIO_AVAILABLE_IN_2_32 +GSocketFamily g_inet_address_mask_get_family (GInetAddressMask *mask); +GIO_AVAILABLE_IN_2_32 +GInetAddress *g_inet_address_mask_get_address (GInetAddressMask *mask); +GIO_AVAILABLE_IN_2_32 +guint g_inet_address_mask_get_length (GInetAddressMask *mask); + +GIO_AVAILABLE_IN_2_32 +gboolean g_inet_address_mask_matches (GInetAddressMask *mask, + GInetAddress *address); +GIO_AVAILABLE_IN_2_32 +gboolean g_inet_address_mask_equal (GInetAddressMask *mask, + GInetAddressMask *mask2); + +G_END_DECLS + +#endif /* __G_INET_ADDRESS_MASK_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + */ + +#ifndef __G_INET_SOCKET_ADDRESS_H__ +#define __G_INET_SOCKET_ADDRESS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + */ + +#ifndef __G_SOCKET_ADDRESS_H__ +#define __G_SOCKET_ADDRESS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_ADDRESS (g_socket_address_get_type ()) +#define G_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SOCKET_ADDRESS, GSocketAddress)) +#define G_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SOCKET_ADDRESS, GSocketAddressClass)) +#define G_IS_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SOCKET_ADDRESS)) +#define G_IS_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SOCKET_ADDRESS)) +#define G_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SOCKET_ADDRESS, GSocketAddressClass)) + +typedef struct _GSocketAddressClass GSocketAddressClass; + +struct _GSocketAddress +{ + GObject parent_instance; +}; + +struct _GSocketAddressClass +{ + GObjectClass parent_class; + + GSocketFamily (*get_family) (GSocketAddress *address); + + gssize (*get_native_size) (GSocketAddress *address); + + gboolean (*to_native) (GSocketAddress *address, + gpointer dest, + gsize destlen, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketFamily g_socket_address_get_family (GSocketAddress *address); + +GIO_AVAILABLE_IN_ALL +GSocketAddress * g_socket_address_new_from_native (gpointer native, + gsize len); + +GIO_AVAILABLE_IN_ALL +gboolean g_socket_address_to_native (GSocketAddress *address, + gpointer dest, + gsize destlen, + GError **error); + +GIO_AVAILABLE_IN_ALL +gssize g_socket_address_get_native_size (GSocketAddress *address); + +G_END_DECLS + +#endif /* __G_SOCKET_ADDRESS_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_INET_SOCKET_ADDRESS (g_inet_socket_address_get_type ()) +#define G_INET_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_INET_SOCKET_ADDRESS, GInetSocketAddress)) +#define G_INET_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_INET_SOCKET_ADDRESS, GInetSocketAddressClass)) +#define G_IS_INET_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_INET_SOCKET_ADDRESS)) +#define G_IS_INET_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_INET_SOCKET_ADDRESS)) +#define G_INET_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_INET_SOCKET_ADDRESS, GInetSocketAddressClass)) + +typedef struct _GInetSocketAddressClass GInetSocketAddressClass; +typedef struct _GInetSocketAddressPrivate GInetSocketAddressPrivate; + +struct _GInetSocketAddress +{ + GSocketAddress parent_instance; + + /*< private >*/ + GInetSocketAddressPrivate *priv; +}; + +struct _GInetSocketAddressClass +{ + GSocketAddressClass parent_class; +}; + +GIO_AVAILABLE_IN_ALL +GType g_inet_socket_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_inet_socket_address_new (GInetAddress *address, + guint16 port); +GIO_AVAILABLE_IN_2_40 +GSocketAddress *g_inet_socket_address_new_from_string (const char *address, + guint port); + +GIO_AVAILABLE_IN_ALL +GInetAddress * g_inet_socket_address_get_address (GInetSocketAddress *address); +GIO_AVAILABLE_IN_ALL +guint16 g_inet_socket_address_get_port (GInetSocketAddress *address); + +GIO_AVAILABLE_IN_2_32 +guint32 g_inet_socket_address_get_flowinfo (GInetSocketAddress *address); +GIO_AVAILABLE_IN_2_32 +guint32 g_inet_socket_address_get_scope_id (GInetSocketAddress *address); + +G_END_DECLS + +#endif /* __G_INET_SOCKET_ADDRESS_H__ */ + +/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ + +/* + * Copyright © 2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Matthias Clasen + */ + +#ifndef __GIO_ENUM_TYPES_H__ +#define __GIO_ENUM_TYPES_H__ + + +G_BEGIN_DECLS + +/* enumerations from "../../../glib/gio/gioenums.h" */ +GIO_AVAILABLE_IN_ALL GType g_app_info_create_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_APP_INFO_CREATE_FLAGS (g_app_info_create_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_converter_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_CONVERTER_FLAGS (g_converter_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_converter_result_get_type (void) G_GNUC_CONST; +#define G_TYPE_CONVERTER_RESULT (g_converter_result_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_data_stream_byte_order_get_type (void) G_GNUC_CONST; +#define G_TYPE_DATA_STREAM_BYTE_ORDER (g_data_stream_byte_order_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_data_stream_newline_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_DATA_STREAM_NEWLINE_TYPE (g_data_stream_newline_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_attribute_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_ATTRIBUTE_TYPE (g_file_attribute_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_attribute_info_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS (g_file_attribute_info_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_attribute_status_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_ATTRIBUTE_STATUS (g_file_attribute_status_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_query_info_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_QUERY_INFO_FLAGS (g_file_query_info_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_create_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_CREATE_FLAGS (g_file_create_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_measure_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_MEASURE_FLAGS (g_file_measure_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_mount_mount_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_MOUNT_MOUNT_FLAGS (g_mount_mount_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_mount_unmount_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_MOUNT_UNMOUNT_FLAGS (g_mount_unmount_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_drive_start_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DRIVE_START_FLAGS (g_drive_start_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_drive_start_stop_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_DRIVE_START_STOP_TYPE (g_drive_start_stop_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_copy_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_COPY_FLAGS (g_file_copy_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_monitor_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_MONITOR_FLAGS (g_file_monitor_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_TYPE (g_file_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_filesystem_preview_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILESYSTEM_PREVIEW_TYPE (g_filesystem_preview_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_file_monitor_event_get_type (void) G_GNUC_CONST; +#define G_TYPE_FILE_MONITOR_EVENT (g_file_monitor_event_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_io_error_enum_get_type (void) G_GNUC_CONST; +#define G_TYPE_IO_ERROR_ENUM (g_io_error_enum_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_ask_password_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_ASK_PASSWORD_FLAGS (g_ask_password_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_password_save_get_type (void) G_GNUC_CONST; +#define G_TYPE_PASSWORD_SAVE (g_password_save_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_mount_operation_result_get_type (void) G_GNUC_CONST; +#define G_TYPE_MOUNT_OPERATION_RESULT (g_mount_operation_result_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_output_stream_splice_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_OUTPUT_STREAM_SPLICE_FLAGS (g_output_stream_splice_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_io_stream_splice_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_IO_STREAM_SPLICE_FLAGS (g_io_stream_splice_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_emblem_origin_get_type (void) G_GNUC_CONST; +#define G_TYPE_EMBLEM_ORIGIN (g_emblem_origin_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_resolver_error_get_type (void) G_GNUC_CONST; +#define G_TYPE_RESOLVER_ERROR (g_resolver_error_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_resolver_record_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_RESOLVER_RECORD_TYPE (g_resolver_record_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_resource_error_get_type (void) G_GNUC_CONST; +#define G_TYPE_RESOURCE_ERROR (g_resource_error_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_resource_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_RESOURCE_FLAGS (g_resource_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_resource_lookup_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_RESOURCE_LOOKUP_FLAGS (g_resource_lookup_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_socket_family_get_type (void) G_GNUC_CONST; +#define G_TYPE_SOCKET_FAMILY (g_socket_family_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_socket_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_SOCKET_TYPE (g_socket_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_socket_msg_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_SOCKET_MSG_FLAGS (g_socket_msg_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_socket_protocol_get_type (void) G_GNUC_CONST; +#define G_TYPE_SOCKET_PROTOCOL (g_socket_protocol_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_zlib_compressor_format_get_type (void) G_GNUC_CONST; +#define G_TYPE_ZLIB_COMPRESSOR_FORMAT (g_zlib_compressor_format_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_unix_socket_address_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_UNIX_SOCKET_ADDRESS_TYPE (g_unix_socket_address_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_bus_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_BUS_TYPE (g_bus_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_bus_name_owner_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_BUS_NAME_OWNER_FLAGS (g_bus_name_owner_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_bus_name_watcher_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_BUS_NAME_WATCHER_FLAGS (g_bus_name_watcher_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_proxy_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_PROXY_FLAGS (g_dbus_proxy_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_error_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_ERROR (g_dbus_error_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_connection_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_CONNECTION_FLAGS (g_dbus_connection_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_capability_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_CAPABILITY_FLAGS (g_dbus_capability_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_call_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_CALL_FLAGS (g_dbus_call_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_message_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_MESSAGE_TYPE (g_dbus_message_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_message_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_MESSAGE_FLAGS (g_dbus_message_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_message_header_field_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_MESSAGE_HEADER_FIELD (g_dbus_message_header_field_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_property_info_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_PROPERTY_INFO_FLAGS (g_dbus_property_info_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_subtree_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_SUBTREE_FLAGS (g_dbus_subtree_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_server_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_SERVER_FLAGS (g_dbus_server_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_signal_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_SIGNAL_FLAGS (g_dbus_signal_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_send_message_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_SEND_MESSAGE_FLAGS (g_dbus_send_message_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_credentials_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_CREDENTIALS_TYPE (g_credentials_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_message_byte_order_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_MESSAGE_BYTE_ORDER (g_dbus_message_byte_order_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_application_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_APPLICATION_FLAGS (g_application_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_error_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_ERROR (g_tls_error_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_certificate_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_CERTIFICATE_FLAGS (g_tls_certificate_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_authentication_mode_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_AUTHENTICATION_MODE (g_tls_authentication_mode_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_channel_binding_type_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_CHANNEL_BINDING_TYPE (g_tls_channel_binding_type_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_channel_binding_error_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_CHANNEL_BINDING_ERROR (g_tls_channel_binding_error_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_rehandshake_mode_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_REHANDSHAKE_MODE (g_tls_rehandshake_mode_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_password_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_PASSWORD_FLAGS (g_tls_password_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_interaction_result_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_INTERACTION_RESULT (g_tls_interaction_result_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_interface_skeleton_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS (g_dbus_interface_skeleton_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_dbus_object_manager_client_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_DBUS_OBJECT_MANAGER_CLIENT_FLAGS (g_dbus_object_manager_client_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_database_verify_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_DATABASE_VERIFY_FLAGS (g_tls_database_verify_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_database_lookup_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_DATABASE_LOOKUP_FLAGS (g_tls_database_lookup_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_certificate_request_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_CERTIFICATE_REQUEST_FLAGS (g_tls_certificate_request_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_tls_protocol_version_get_type (void) G_GNUC_CONST; +#define G_TYPE_TLS_PROTOCOL_VERSION (g_tls_protocol_version_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_io_module_scope_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_IO_MODULE_SCOPE_FLAGS (g_io_module_scope_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_socket_client_event_get_type (void) G_GNUC_CONST; +#define G_TYPE_SOCKET_CLIENT_EVENT (g_socket_client_event_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_socket_listener_event_get_type (void) G_GNUC_CONST; +#define G_TYPE_SOCKET_LISTENER_EVENT (g_socket_listener_event_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_test_dbus_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_TEST_DBUS_FLAGS (g_test_dbus_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_subprocess_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_SUBPROCESS_FLAGS (g_subprocess_flags_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_notification_priority_get_type (void) G_GNUC_CONST; +#define G_TYPE_NOTIFICATION_PRIORITY (g_notification_priority_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_network_connectivity_get_type (void) G_GNUC_CONST; +#define G_TYPE_NETWORK_CONNECTIVITY (g_network_connectivity_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_pollable_return_get_type (void) G_GNUC_CONST; +#define G_TYPE_POLLABLE_RETURN (g_pollable_return_get_type ()) +GIO_AVAILABLE_IN_ALL GType g_memory_monitor_warning_level_get_type (void) G_GNUC_CONST; +#define G_TYPE_MEMORY_MONITOR_WARNING_LEVEL (g_memory_monitor_warning_level_get_type ()) + +/* enumerations from "../../../glib/gio/gresolver.h" */ +GIO_AVAILABLE_IN_ALL GType g_resolver_name_lookup_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_RESOLVER_NAME_LOOKUP_FLAGS (g_resolver_name_lookup_flags_get_type ()) + +/* enumerations from "../../../glib/gio/gsettings.h" */ +GIO_AVAILABLE_IN_ALL GType g_settings_bind_flags_get_type (void) G_GNUC_CONST; +#define G_TYPE_SETTINGS_BIND_FLAGS (g_settings_bind_flags_get_type ()) +G_END_DECLS + +#endif /* __GIO_ENUM_TYPES_H__ */ + +/* Generated data ends here */ + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_IO_MODULE_H__ +#define __G_IO_MODULE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998 Tim Janik + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GMODULE_H__ +#define __GMODULE_H__ + +#pragma once + +#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(GMODULE_STATIC_COMPILATION) +# define _GMODULE_EXPORT __declspec(dllexport) +# define _GMODULE_IMPORT __declspec(dllimport) +#elif __GNUC__ >= 4 +# define _GMODULE_EXPORT __attribute__((visibility("default"))) +# define _GMODULE_IMPORT +#else +# define _GMODULE_EXPORT +# define _GMODULE_IMPORT +#endif +#ifdef GMODULE_COMPILATION +# define _GMODULE_API _GMODULE_EXPORT +#else +# define _GMODULE_API _GMODULE_IMPORT +#endif + +#define _GMODULE_EXTERN _GMODULE_API extern + +#define GMODULE_VAR _GMODULE_EXTERN +#define GMODULE_AVAILABLE_IN_ALL _GMODULE_EXTERN + +#ifdef GLIB_DISABLE_DEPRECATION_WARNINGS +#define GMODULE_DEPRECATED _GMODULE_EXTERN +#define GMODULE_DEPRECATED_FOR(f) _GMODULE_EXTERN +#define GMODULE_UNAVAILABLE(maj,min) _GMODULE_EXTERN +#define GMODULE_UNAVAILABLE_STATIC_INLINE(maj,min) +#else +#define GMODULE_DEPRECATED G_DEPRECATED _GMODULE_EXTERN +#define GMODULE_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GMODULE_EXTERN +#define GMODULE_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GMODULE_EXTERN +#define GMODULE_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_26 +#define GMODULE_DEPRECATED_IN_2_26 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_26_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_26 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_26_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_26 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_26 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_26_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_26 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_26_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_26 +#define GMODULE_DEPRECATED_MACRO_IN_2_26_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_26 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_26_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_26 +#define GMODULE_DEPRECATED_TYPE_IN_2_26_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_26 +#define GMODULE_AVAILABLE_IN_2_26 GMODULE_UNAVAILABLE (2, 26) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_26 GLIB_UNAVAILABLE_STATIC_INLINE (2, 26) +#define GMODULE_AVAILABLE_MACRO_IN_2_26 GLIB_UNAVAILABLE_MACRO (2, 26) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_26 GLIB_UNAVAILABLE_ENUMERATOR (2, 26) +#define GMODULE_AVAILABLE_TYPE_IN_2_26 GLIB_UNAVAILABLE_TYPE (2, 26) +#else +#define GMODULE_AVAILABLE_IN_2_26 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_26 +#define GMODULE_AVAILABLE_MACRO_IN_2_26 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_26 +#define GMODULE_AVAILABLE_TYPE_IN_2_26 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_28 +#define GMODULE_DEPRECATED_IN_2_28 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_28_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_28 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_28_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_28 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_28 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_28_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_28 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_28_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_28 +#define GMODULE_DEPRECATED_MACRO_IN_2_28_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_28 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_28_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_28 +#define GMODULE_DEPRECATED_TYPE_IN_2_28_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_28 +#define GMODULE_AVAILABLE_IN_2_28 GMODULE_UNAVAILABLE (2, 28) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_28 GLIB_UNAVAILABLE_STATIC_INLINE (2, 28) +#define GMODULE_AVAILABLE_MACRO_IN_2_28 GLIB_UNAVAILABLE_MACRO (2, 28) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_28 GLIB_UNAVAILABLE_ENUMERATOR (2, 28) +#define GMODULE_AVAILABLE_TYPE_IN_2_28 GLIB_UNAVAILABLE_TYPE (2, 28) +#else +#define GMODULE_AVAILABLE_IN_2_28 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_28 +#define GMODULE_AVAILABLE_MACRO_IN_2_28 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_28 +#define GMODULE_AVAILABLE_TYPE_IN_2_28 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_30 +#define GMODULE_DEPRECATED_IN_2_30 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_30_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_30 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_30_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_30 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_30 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_30_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_30 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_30_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_30 +#define GMODULE_DEPRECATED_MACRO_IN_2_30_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_30 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_30_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_30 +#define GMODULE_DEPRECATED_TYPE_IN_2_30_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_30 +#define GMODULE_AVAILABLE_IN_2_30 GMODULE_UNAVAILABLE (2, 30) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_30 GLIB_UNAVAILABLE_STATIC_INLINE (2, 30) +#define GMODULE_AVAILABLE_MACRO_IN_2_30 GLIB_UNAVAILABLE_MACRO (2, 30) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_30 GLIB_UNAVAILABLE_ENUMERATOR (2, 30) +#define GMODULE_AVAILABLE_TYPE_IN_2_30 GLIB_UNAVAILABLE_TYPE (2, 30) +#else +#define GMODULE_AVAILABLE_IN_2_30 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_30 +#define GMODULE_AVAILABLE_MACRO_IN_2_30 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_30 +#define GMODULE_AVAILABLE_TYPE_IN_2_30 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_32 +#define GMODULE_DEPRECATED_IN_2_32 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_32_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_32 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_32_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_32 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_32 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_32_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_32 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_32_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_32 +#define GMODULE_DEPRECATED_MACRO_IN_2_32_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_32 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_32_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_32 +#define GMODULE_DEPRECATED_TYPE_IN_2_32_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_32 +#define GMODULE_AVAILABLE_IN_2_32 GMODULE_UNAVAILABLE (2, 32) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_32 GLIB_UNAVAILABLE_STATIC_INLINE (2, 32) +#define GMODULE_AVAILABLE_MACRO_IN_2_32 GLIB_UNAVAILABLE_MACRO (2, 32) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_32 GLIB_UNAVAILABLE_ENUMERATOR (2, 32) +#define GMODULE_AVAILABLE_TYPE_IN_2_32 GLIB_UNAVAILABLE_TYPE (2, 32) +#else +#define GMODULE_AVAILABLE_IN_2_32 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_32 +#define GMODULE_AVAILABLE_MACRO_IN_2_32 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_32 +#define GMODULE_AVAILABLE_TYPE_IN_2_32 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_34 +#define GMODULE_DEPRECATED_IN_2_34 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_34_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_34 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_34_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_34 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_34 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_34_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_34 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_34_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_34 +#define GMODULE_DEPRECATED_MACRO_IN_2_34_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_34 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_34_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_34 +#define GMODULE_DEPRECATED_TYPE_IN_2_34_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_34 +#define GMODULE_AVAILABLE_IN_2_34 GMODULE_UNAVAILABLE (2, 34) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_34 GLIB_UNAVAILABLE_STATIC_INLINE (2, 34) +#define GMODULE_AVAILABLE_MACRO_IN_2_34 GLIB_UNAVAILABLE_MACRO (2, 34) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_34 GLIB_UNAVAILABLE_ENUMERATOR (2, 34) +#define GMODULE_AVAILABLE_TYPE_IN_2_34 GLIB_UNAVAILABLE_TYPE (2, 34) +#else +#define GMODULE_AVAILABLE_IN_2_34 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_34 +#define GMODULE_AVAILABLE_MACRO_IN_2_34 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_34 +#define GMODULE_AVAILABLE_TYPE_IN_2_34 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_36 +#define GMODULE_DEPRECATED_IN_2_36 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_36_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_36 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_36_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_36 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_36 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_36_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_36 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_36_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_36 +#define GMODULE_DEPRECATED_MACRO_IN_2_36_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_36 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_36_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_36 +#define GMODULE_DEPRECATED_TYPE_IN_2_36_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_36 +#define GMODULE_AVAILABLE_IN_2_36 GMODULE_UNAVAILABLE (2, 36) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_36 GLIB_UNAVAILABLE_STATIC_INLINE (2, 36) +#define GMODULE_AVAILABLE_MACRO_IN_2_36 GLIB_UNAVAILABLE_MACRO (2, 36) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_36 GLIB_UNAVAILABLE_ENUMERATOR (2, 36) +#define GMODULE_AVAILABLE_TYPE_IN_2_36 GLIB_UNAVAILABLE_TYPE (2, 36) +#else +#define GMODULE_AVAILABLE_IN_2_36 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_36 +#define GMODULE_AVAILABLE_MACRO_IN_2_36 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_36 +#define GMODULE_AVAILABLE_TYPE_IN_2_36 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_38 +#define GMODULE_DEPRECATED_IN_2_38 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_38_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_38 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_38_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_38 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_38 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_38_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_38 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_38_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_38 +#define GMODULE_DEPRECATED_MACRO_IN_2_38_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_38 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_38_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_38 +#define GMODULE_DEPRECATED_TYPE_IN_2_38_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38 +#define GMODULE_AVAILABLE_IN_2_38 GMODULE_UNAVAILABLE (2, 38) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_38 GLIB_UNAVAILABLE_STATIC_INLINE (2, 38) +#define GMODULE_AVAILABLE_MACRO_IN_2_38 GLIB_UNAVAILABLE_MACRO (2, 38) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_38 GLIB_UNAVAILABLE_ENUMERATOR (2, 38) +#define GMODULE_AVAILABLE_TYPE_IN_2_38 GLIB_UNAVAILABLE_TYPE (2, 38) +#else +#define GMODULE_AVAILABLE_IN_2_38 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_38 +#define GMODULE_AVAILABLE_MACRO_IN_2_38 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_38 +#define GMODULE_AVAILABLE_TYPE_IN_2_38 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_40 +#define GMODULE_DEPRECATED_IN_2_40 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_40_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_40 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_40_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_40 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_40 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_40_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_40 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_40_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_40 +#define GMODULE_DEPRECATED_MACRO_IN_2_40_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_40 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_40_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_40 +#define GMODULE_DEPRECATED_TYPE_IN_2_40_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_40 +#define GMODULE_AVAILABLE_IN_2_40 GMODULE_UNAVAILABLE (2, 40) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_40 GLIB_UNAVAILABLE_STATIC_INLINE (2, 40) +#define GMODULE_AVAILABLE_MACRO_IN_2_40 GLIB_UNAVAILABLE_MACRO (2, 40) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_40 GLIB_UNAVAILABLE_ENUMERATOR (2, 40) +#define GMODULE_AVAILABLE_TYPE_IN_2_40 GLIB_UNAVAILABLE_TYPE (2, 40) +#else +#define GMODULE_AVAILABLE_IN_2_40 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_40 +#define GMODULE_AVAILABLE_MACRO_IN_2_40 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_40 +#define GMODULE_AVAILABLE_TYPE_IN_2_40 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_42 +#define GMODULE_DEPRECATED_IN_2_42 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_42_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_42 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_42_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_42 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_42 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_42_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_42 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_42_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_42 +#define GMODULE_DEPRECATED_MACRO_IN_2_42_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_42 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_42_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_42 +#define GMODULE_DEPRECATED_TYPE_IN_2_42_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_42 +#define GMODULE_AVAILABLE_IN_2_42 GMODULE_UNAVAILABLE (2, 42) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_42 GLIB_UNAVAILABLE_STATIC_INLINE (2, 42) +#define GMODULE_AVAILABLE_MACRO_IN_2_42 GLIB_UNAVAILABLE_MACRO (2, 42) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_42 GLIB_UNAVAILABLE_ENUMERATOR (2, 42) +#define GMODULE_AVAILABLE_TYPE_IN_2_42 GLIB_UNAVAILABLE_TYPE (2, 42) +#else +#define GMODULE_AVAILABLE_IN_2_42 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_42 +#define GMODULE_AVAILABLE_MACRO_IN_2_42 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_42 +#define GMODULE_AVAILABLE_TYPE_IN_2_42 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44 +#define GMODULE_DEPRECATED_IN_2_44 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_44_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_44 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_44_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_44 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_44 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_44_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_44 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_44_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_44 +#define GMODULE_DEPRECATED_MACRO_IN_2_44_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_44 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_44_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_44 +#define GMODULE_DEPRECATED_TYPE_IN_2_44_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44 +#define GMODULE_AVAILABLE_IN_2_44 GMODULE_UNAVAILABLE (2, 44) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_44 GLIB_UNAVAILABLE_STATIC_INLINE (2, 44) +#define GMODULE_AVAILABLE_MACRO_IN_2_44 GLIB_UNAVAILABLE_MACRO (2, 44) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_44 GLIB_UNAVAILABLE_ENUMERATOR (2, 44) +#define GMODULE_AVAILABLE_TYPE_IN_2_44 GLIB_UNAVAILABLE_TYPE (2, 44) +#else +#define GMODULE_AVAILABLE_IN_2_44 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_44 +#define GMODULE_AVAILABLE_MACRO_IN_2_44 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_44 +#define GMODULE_AVAILABLE_TYPE_IN_2_44 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_46 +#define GMODULE_DEPRECATED_IN_2_46 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_46_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_46 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_46_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_46 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_46 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_46_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_46 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_46_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_46 +#define GMODULE_DEPRECATED_MACRO_IN_2_46_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_46 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_46_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_46 +#define GMODULE_DEPRECATED_TYPE_IN_2_46_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_46 +#define GMODULE_AVAILABLE_IN_2_46 GMODULE_UNAVAILABLE (2, 46) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_46 GLIB_UNAVAILABLE_STATIC_INLINE (2, 46) +#define GMODULE_AVAILABLE_MACRO_IN_2_46 GLIB_UNAVAILABLE_MACRO (2, 46) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_46 GLIB_UNAVAILABLE_ENUMERATOR (2, 46) +#define GMODULE_AVAILABLE_TYPE_IN_2_46 GLIB_UNAVAILABLE_TYPE (2, 46) +#else +#define GMODULE_AVAILABLE_IN_2_46 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_46 +#define GMODULE_AVAILABLE_MACRO_IN_2_46 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_46 +#define GMODULE_AVAILABLE_TYPE_IN_2_46 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_48 +#define GMODULE_DEPRECATED_IN_2_48 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_48_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_48 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_48_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_48 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_48 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_48_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_48 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_48_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_48 +#define GMODULE_DEPRECATED_MACRO_IN_2_48_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_48 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_48_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_48 +#define GMODULE_DEPRECATED_TYPE_IN_2_48_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_48 +#define GMODULE_AVAILABLE_IN_2_48 GMODULE_UNAVAILABLE (2, 48) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_48 GLIB_UNAVAILABLE_STATIC_INLINE (2, 48) +#define GMODULE_AVAILABLE_MACRO_IN_2_48 GLIB_UNAVAILABLE_MACRO (2, 48) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_48 GLIB_UNAVAILABLE_ENUMERATOR (2, 48) +#define GMODULE_AVAILABLE_TYPE_IN_2_48 GLIB_UNAVAILABLE_TYPE (2, 48) +#else +#define GMODULE_AVAILABLE_IN_2_48 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_48 +#define GMODULE_AVAILABLE_MACRO_IN_2_48 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_48 +#define GMODULE_AVAILABLE_TYPE_IN_2_48 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_50 +#define GMODULE_DEPRECATED_IN_2_50 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_50_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_50 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_50_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_50 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_50 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_50_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_50 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_50_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_50 +#define GMODULE_DEPRECATED_MACRO_IN_2_50_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_50 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_50_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_50 +#define GMODULE_DEPRECATED_TYPE_IN_2_50_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_50 +#define GMODULE_AVAILABLE_IN_2_50 GMODULE_UNAVAILABLE (2, 50) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_50 GLIB_UNAVAILABLE_STATIC_INLINE (2, 50) +#define GMODULE_AVAILABLE_MACRO_IN_2_50 GLIB_UNAVAILABLE_MACRO (2, 50) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_50 GLIB_UNAVAILABLE_ENUMERATOR (2, 50) +#define GMODULE_AVAILABLE_TYPE_IN_2_50 GLIB_UNAVAILABLE_TYPE (2, 50) +#else +#define GMODULE_AVAILABLE_IN_2_50 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_50 +#define GMODULE_AVAILABLE_MACRO_IN_2_50 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_50 +#define GMODULE_AVAILABLE_TYPE_IN_2_50 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_52 +#define GMODULE_DEPRECATED_IN_2_52 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_52_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_52 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_52_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_52 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_52 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_52_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_52 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_52_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_52 +#define GMODULE_DEPRECATED_MACRO_IN_2_52_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_52 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_52_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_52 +#define GMODULE_DEPRECATED_TYPE_IN_2_52_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_52 +#define GMODULE_AVAILABLE_IN_2_52 GMODULE_UNAVAILABLE (2, 52) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_52 GLIB_UNAVAILABLE_STATIC_INLINE (2, 52) +#define GMODULE_AVAILABLE_MACRO_IN_2_52 GLIB_UNAVAILABLE_MACRO (2, 52) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_52 GLIB_UNAVAILABLE_ENUMERATOR (2, 52) +#define GMODULE_AVAILABLE_TYPE_IN_2_52 GLIB_UNAVAILABLE_TYPE (2, 52) +#else +#define GMODULE_AVAILABLE_IN_2_52 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_52 +#define GMODULE_AVAILABLE_MACRO_IN_2_52 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_52 +#define GMODULE_AVAILABLE_TYPE_IN_2_52 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_54 +#define GMODULE_DEPRECATED_IN_2_54 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_54_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_54 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_54_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_54 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_54 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_54_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_54 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_54_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_54 +#define GMODULE_DEPRECATED_MACRO_IN_2_54_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_54 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_54_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_54 +#define GMODULE_DEPRECATED_TYPE_IN_2_54_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_54 +#define GMODULE_AVAILABLE_IN_2_54 GMODULE_UNAVAILABLE (2, 54) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_54 GLIB_UNAVAILABLE_STATIC_INLINE (2, 54) +#define GMODULE_AVAILABLE_MACRO_IN_2_54 GLIB_UNAVAILABLE_MACRO (2, 54) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_54 GLIB_UNAVAILABLE_ENUMERATOR (2, 54) +#define GMODULE_AVAILABLE_TYPE_IN_2_54 GLIB_UNAVAILABLE_TYPE (2, 54) +#else +#define GMODULE_AVAILABLE_IN_2_54 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_54 +#define GMODULE_AVAILABLE_MACRO_IN_2_54 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_54 +#define GMODULE_AVAILABLE_TYPE_IN_2_54 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_56 +#define GMODULE_DEPRECATED_IN_2_56 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_56_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_56 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_56_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_56 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_56 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_56_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_56 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_56_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_56 +#define GMODULE_DEPRECATED_MACRO_IN_2_56_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_56 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_56_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_56 +#define GMODULE_DEPRECATED_TYPE_IN_2_56_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_56 +#define GMODULE_AVAILABLE_IN_2_56 GMODULE_UNAVAILABLE (2, 56) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_56 GLIB_UNAVAILABLE_STATIC_INLINE (2, 56) +#define GMODULE_AVAILABLE_MACRO_IN_2_56 GLIB_UNAVAILABLE_MACRO (2, 56) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_56 GLIB_UNAVAILABLE_ENUMERATOR (2, 56) +#define GMODULE_AVAILABLE_TYPE_IN_2_56 GLIB_UNAVAILABLE_TYPE (2, 56) +#else +#define GMODULE_AVAILABLE_IN_2_56 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_56 +#define GMODULE_AVAILABLE_MACRO_IN_2_56 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_56 +#define GMODULE_AVAILABLE_TYPE_IN_2_56 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_58 +#define GMODULE_DEPRECATED_IN_2_58 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_58_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_58 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_58_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_58 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_58 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_58_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_58 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_58_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_58 +#define GMODULE_DEPRECATED_MACRO_IN_2_58_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_58 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_58_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_58 +#define GMODULE_DEPRECATED_TYPE_IN_2_58_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_58 +#define GMODULE_AVAILABLE_IN_2_58 GMODULE_UNAVAILABLE (2, 58) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_58 GLIB_UNAVAILABLE_STATIC_INLINE (2, 58) +#define GMODULE_AVAILABLE_MACRO_IN_2_58 GLIB_UNAVAILABLE_MACRO (2, 58) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_58 GLIB_UNAVAILABLE_ENUMERATOR (2, 58) +#define GMODULE_AVAILABLE_TYPE_IN_2_58 GLIB_UNAVAILABLE_TYPE (2, 58) +#else +#define GMODULE_AVAILABLE_IN_2_58 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_58 +#define GMODULE_AVAILABLE_MACRO_IN_2_58 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_58 +#define GMODULE_AVAILABLE_TYPE_IN_2_58 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_60 +#define GMODULE_DEPRECATED_IN_2_60 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_60_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_60 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_60_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_60 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_60 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_60_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_60 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_60_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_60 +#define GMODULE_DEPRECATED_MACRO_IN_2_60_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_60 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_60_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_60 +#define GMODULE_DEPRECATED_TYPE_IN_2_60_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_60 +#define GMODULE_AVAILABLE_IN_2_60 GMODULE_UNAVAILABLE (2, 60) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_60 GLIB_UNAVAILABLE_STATIC_INLINE (2, 60) +#define GMODULE_AVAILABLE_MACRO_IN_2_60 GLIB_UNAVAILABLE_MACRO (2, 60) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_60 GLIB_UNAVAILABLE_ENUMERATOR (2, 60) +#define GMODULE_AVAILABLE_TYPE_IN_2_60 GLIB_UNAVAILABLE_TYPE (2, 60) +#else +#define GMODULE_AVAILABLE_IN_2_60 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_60 +#define GMODULE_AVAILABLE_MACRO_IN_2_60 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_60 +#define GMODULE_AVAILABLE_TYPE_IN_2_60 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_62 +#define GMODULE_DEPRECATED_IN_2_62 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_62_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_62 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_62_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_62 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_62 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_62_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_62 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_62_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_62 +#define GMODULE_DEPRECATED_MACRO_IN_2_62_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_62 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_62_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_62 +#define GMODULE_DEPRECATED_TYPE_IN_2_62_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_62 +#define GMODULE_AVAILABLE_IN_2_62 GMODULE_UNAVAILABLE (2, 62) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_62 GLIB_UNAVAILABLE_STATIC_INLINE (2, 62) +#define GMODULE_AVAILABLE_MACRO_IN_2_62 GLIB_UNAVAILABLE_MACRO (2, 62) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_62 GLIB_UNAVAILABLE_ENUMERATOR (2, 62) +#define GMODULE_AVAILABLE_TYPE_IN_2_62 GLIB_UNAVAILABLE_TYPE (2, 62) +#else +#define GMODULE_AVAILABLE_IN_2_62 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_62 +#define GMODULE_AVAILABLE_MACRO_IN_2_62 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_62 +#define GMODULE_AVAILABLE_TYPE_IN_2_62 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_64 +#define GMODULE_DEPRECATED_IN_2_64 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_64_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_64 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_64_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_64 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_64 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_64_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_64 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_64_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_64 +#define GMODULE_DEPRECATED_MACRO_IN_2_64_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_64 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_64_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_64 +#define GMODULE_DEPRECATED_TYPE_IN_2_64_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_64 +#define GMODULE_AVAILABLE_IN_2_64 GMODULE_UNAVAILABLE (2, 64) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_64 GLIB_UNAVAILABLE_STATIC_INLINE (2, 64) +#define GMODULE_AVAILABLE_MACRO_IN_2_64 GLIB_UNAVAILABLE_MACRO (2, 64) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_64 GLIB_UNAVAILABLE_ENUMERATOR (2, 64) +#define GMODULE_AVAILABLE_TYPE_IN_2_64 GLIB_UNAVAILABLE_TYPE (2, 64) +#else +#define GMODULE_AVAILABLE_IN_2_64 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_64 +#define GMODULE_AVAILABLE_MACRO_IN_2_64 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_64 +#define GMODULE_AVAILABLE_TYPE_IN_2_64 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_66 +#define GMODULE_DEPRECATED_IN_2_66 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_66_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_66 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_66_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_66 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_66 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_66_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_66 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_66_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_66 +#define GMODULE_DEPRECATED_MACRO_IN_2_66_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_66 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_66_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_66 +#define GMODULE_DEPRECATED_TYPE_IN_2_66_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_66 +#define GMODULE_AVAILABLE_IN_2_66 GMODULE_UNAVAILABLE (2, 66) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_66 GLIB_UNAVAILABLE_STATIC_INLINE (2, 66) +#define GMODULE_AVAILABLE_MACRO_IN_2_66 GLIB_UNAVAILABLE_MACRO (2, 66) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_66 GLIB_UNAVAILABLE_ENUMERATOR (2, 66) +#define GMODULE_AVAILABLE_TYPE_IN_2_66 GLIB_UNAVAILABLE_TYPE (2, 66) +#else +#define GMODULE_AVAILABLE_IN_2_66 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_66 +#define GMODULE_AVAILABLE_MACRO_IN_2_66 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_66 +#define GMODULE_AVAILABLE_TYPE_IN_2_66 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68 +#define GMODULE_DEPRECATED_IN_2_68 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_68_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_68 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_68_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_68 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_68 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_68_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_68 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_68_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_68 +#define GMODULE_DEPRECATED_MACRO_IN_2_68_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_68 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_68_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_68 +#define GMODULE_DEPRECATED_TYPE_IN_2_68_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_68 +#define GMODULE_AVAILABLE_IN_2_68 GMODULE_UNAVAILABLE (2, 68) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_68 GLIB_UNAVAILABLE_STATIC_INLINE (2, 68) +#define GMODULE_AVAILABLE_MACRO_IN_2_68 GLIB_UNAVAILABLE_MACRO (2, 68) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_68 GLIB_UNAVAILABLE_ENUMERATOR (2, 68) +#define GMODULE_AVAILABLE_TYPE_IN_2_68 GLIB_UNAVAILABLE_TYPE (2, 68) +#else +#define GMODULE_AVAILABLE_IN_2_68 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_68 +#define GMODULE_AVAILABLE_MACRO_IN_2_68 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_68 +#define GMODULE_AVAILABLE_TYPE_IN_2_68 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_70 +#define GMODULE_DEPRECATED_IN_2_70 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_70_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_70 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_70_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_70 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_70_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_70 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_70_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_70 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_70_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_70 +#define GMODULE_DEPRECATED_MACRO_IN_2_70_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_70 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_70_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_70 +#define GMODULE_DEPRECATED_TYPE_IN_2_70_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_70 +#define GMODULE_AVAILABLE_IN_2_70 GMODULE_UNAVAILABLE (2, 70) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_70 GLIB_UNAVAILABLE_STATIC_INLINE (2, 70) +#define GMODULE_AVAILABLE_MACRO_IN_2_70 GLIB_UNAVAILABLE_MACRO (2, 70) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_70 GLIB_UNAVAILABLE_ENUMERATOR (2, 70) +#define GMODULE_AVAILABLE_TYPE_IN_2_70 GLIB_UNAVAILABLE_TYPE (2, 70) +#else +#define GMODULE_AVAILABLE_IN_2_70 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_70 +#define GMODULE_AVAILABLE_MACRO_IN_2_70 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_70 +#define GMODULE_AVAILABLE_TYPE_IN_2_70 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_72 +#define GMODULE_DEPRECATED_IN_2_72 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_72_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_72 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_72_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_72 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_72_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_72 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_72_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_72 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_72_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_72 +#define GMODULE_DEPRECATED_MACRO_IN_2_72_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_72 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_72_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_72 +#define GMODULE_DEPRECATED_TYPE_IN_2_72_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_72 +#define GMODULE_AVAILABLE_IN_2_72 GMODULE_UNAVAILABLE (2, 72) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_72 GLIB_UNAVAILABLE_STATIC_INLINE (2, 72) +#define GMODULE_AVAILABLE_MACRO_IN_2_72 GLIB_UNAVAILABLE_MACRO (2, 72) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_72 GLIB_UNAVAILABLE_ENUMERATOR (2, 72) +#define GMODULE_AVAILABLE_TYPE_IN_2_72 GLIB_UNAVAILABLE_TYPE (2, 72) +#else +#define GMODULE_AVAILABLE_IN_2_72 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_72 +#define GMODULE_AVAILABLE_MACRO_IN_2_72 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_72 +#define GMODULE_AVAILABLE_TYPE_IN_2_72 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_74 +#define GMODULE_DEPRECATED_IN_2_74 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_74_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_74 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_74_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_74 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_74 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_74_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_74 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_74_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_74 +#define GMODULE_DEPRECATED_MACRO_IN_2_74_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_74 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_74_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_74 +#define GMODULE_DEPRECATED_TYPE_IN_2_74_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_74 +#define GMODULE_AVAILABLE_IN_2_74 GMODULE_UNAVAILABLE (2, 74) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_74 GLIB_UNAVAILABLE_STATIC_INLINE (2, 74) +#define GMODULE_AVAILABLE_MACRO_IN_2_74 GLIB_UNAVAILABLE_MACRO (2, 74) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_74 GLIB_UNAVAILABLE_ENUMERATOR (2, 74) +#define GMODULE_AVAILABLE_TYPE_IN_2_74 GLIB_UNAVAILABLE_TYPE (2, 74) +#else +#define GMODULE_AVAILABLE_IN_2_74 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_74 +#define GMODULE_AVAILABLE_MACRO_IN_2_74 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_74 +#define GMODULE_AVAILABLE_TYPE_IN_2_74 +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_76 +#define GMODULE_DEPRECATED_IN_2_76 GMODULE_DEPRECATED +#define GMODULE_DEPRECATED_IN_2_76_FOR(f) GMODULE_DEPRECATED_FOR (f) +#define GMODULE_DEPRECATED_MACRO_IN_2_76 GLIB_DEPRECATED_MACRO +#define GMODULE_DEPRECATED_MACRO_IN_2_76_FOR(f) GLIB_DEPRECATED_MACRO_FOR (f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_76 GLIB_DEPRECATED_ENUMERATOR +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_76_FOR(f) GLIB_DEPRECATED_ENUMERATOR_FOR (f) +#define GMODULE_DEPRECATED_TYPE_IN_2_76 GLIB_DEPRECATED_TYPE +#define GMODULE_DEPRECATED_TYPE_IN_2_76_FOR(f) GLIB_DEPRECATED_TYPE_FOR (f) +#else +#define GMODULE_DEPRECATED_IN_2_76 _GMODULE_EXTERN +#define GMODULE_DEPRECATED_IN_2_76_FOR(f) _GMODULE_EXTERN +#define GMODULE_DEPRECATED_MACRO_IN_2_76 +#define GMODULE_DEPRECATED_MACRO_IN_2_76_FOR(f) +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_76 +#define GMODULE_DEPRECATED_ENUMERATOR_IN_2_76_FOR(f) +#define GMODULE_DEPRECATED_TYPE_IN_2_76 +#define GMODULE_DEPRECATED_TYPE_IN_2_76_FOR(f) +#endif + +#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_76 +#define GMODULE_AVAILABLE_IN_2_76 GMODULE_UNAVAILABLE (2, 76) +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_76 GLIB_UNAVAILABLE_STATIC_INLINE (2, 76) +#define GMODULE_AVAILABLE_MACRO_IN_2_76 GLIB_UNAVAILABLE_MACRO (2, 76) +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_76 GLIB_UNAVAILABLE_ENUMERATOR (2, 76) +#define GMODULE_AVAILABLE_TYPE_IN_2_76 GLIB_UNAVAILABLE_TYPE (2, 76) +#else +#define GMODULE_AVAILABLE_IN_2_76 _GMODULE_EXTERN +#define GMODULE_AVAILABLE_STATIC_INLINE_IN_2_76 +#define GMODULE_AVAILABLE_MACRO_IN_2_76 +#define GMODULE_AVAILABLE_ENUMERATOR_IN_2_76 +#define GMODULE_AVAILABLE_TYPE_IN_2_76 +#endif + +G_BEGIN_DECLS + +/* exporting and importing functions, this is special cased + * to feature Windows dll stubs. + */ +#if defined(_WIN32) || defined(__CYGWIN__) +# define G_MODULE_EXPORT __declspec(dllexport) +# define G_MODULE_IMPORT __declspec(dllimport) extern +#elif __GNUC__ >= 4 +# define G_MODULE_EXPORT __attribute__((visibility("default"))) +# define G_MODULE_IMPORT extern +#else /* !defined(_WIN32) && !defined(__CYGWIN__) && __GNUC__ < 4 */ +# define G_MODULE_EXPORT +# define G_MODULE_IMPORT extern +#endif + +/** + * GModuleFlags: + * @G_MODULE_BIND_LAZY: specifies that symbols are only resolved when + * needed. The default action is to bind all symbols when the module + * is loaded. + * @G_MODULE_BIND_LOCAL: specifies that symbols in the module should + * not be added to the global name space. The default action on most + * platforms is to place symbols in the module in the global name space, + * which may cause conflicts with existing symbols. + * @G_MODULE_BIND_MASK: mask for all flags. + * + * Flags passed to g_module_open(). + * Note that these flags are not supported on all platforms. + */ +typedef enum +{ + G_MODULE_BIND_LAZY = 1 << 0, + G_MODULE_BIND_LOCAL = 1 << 1, + G_MODULE_BIND_MASK = 0x03 +} GModuleFlags; + +typedef struct _GModule GModule; +typedef const gchar* (*GModuleCheckInit) (GModule *module); +typedef void (*GModuleUnload) (GModule *module); + +#define G_MODULE_ERROR g_module_error_quark () GMODULE_AVAILABLE_MACRO_IN_2_70 +GMODULE_AVAILABLE_IN_2_70 +GQuark g_module_error_quark (void); + +/** + * GModuleError: + * @G_MODULE_ERROR_FAILED: there was an error loading or opening a module file + * @G_MODULE_ERROR_CHECK_FAILED: a module returned an error from its `g_module_check_init()` function + * + * Errors returned by g_module_open_full(). + * + * Since: 2.70 + */ +typedef enum +{ + G_MODULE_ERROR_FAILED, + G_MODULE_ERROR_CHECK_FAILED, +} GModuleError +GMODULE_AVAILABLE_ENUMERATOR_IN_2_70; + +/* return TRUE if dynamic module loading is supported */ +GMODULE_AVAILABLE_IN_ALL +gboolean g_module_supported (void) G_GNUC_CONST; + +/* open a module 'file_name' and return handle, which is NULL on error */ +GMODULE_AVAILABLE_IN_ALL +GModule* g_module_open (const gchar *file_name, + GModuleFlags flags); + +GMODULE_AVAILABLE_IN_2_70 +GModule *g_module_open_full (const gchar *file_name, + GModuleFlags flags, + GError **error); + +/* close a previously opened module, returns TRUE on success */ +GMODULE_AVAILABLE_IN_ALL +gboolean g_module_close (GModule *module); + +/* make a module resident so g_module_close on it will be ignored */ +GMODULE_AVAILABLE_IN_ALL +void g_module_make_resident (GModule *module); + +/* query the last module error as a string */ +GMODULE_AVAILABLE_IN_ALL +const gchar * g_module_error (void); + +/* retrieve a symbol pointer from 'module', returns TRUE on success */ +GMODULE_AVAILABLE_IN_ALL +gboolean g_module_symbol (GModule *module, + const gchar *symbol_name, + gpointer *symbol); + +/* retrieve the file name from an existing module */ +GMODULE_AVAILABLE_IN_ALL +const gchar * g_module_name (GModule *module); + +/* Build the actual file name containing a module. 'directory' is the + * directory where the module file is supposed to be, or NULL or empty + * in which case it should either be in the current directory or, on + * some operating systems, in some standard place, for instance on the + * PATH. Hence, to be absolutely sure to get the correct module, + * always pass in a directory. The file name consists of the directory, + * if supplied, and 'module_name' suitably decorated according to + * the operating system's conventions (for instance lib*.so or *.dll). + * + * No checks are made that the file exists, or is of correct type. + */ +GMODULE_DEPRECATED_IN_2_76 +gchar* g_module_build_path (const gchar *directory, + const gchar *module_name); + +G_END_DECLS + +#endif /* __GMODULE_H__ */ + +G_BEGIN_DECLS + +typedef struct _GIOModuleScope GIOModuleScope; + +GIO_AVAILABLE_IN_2_30 +GIOModuleScope * g_io_module_scope_new (GIOModuleScopeFlags flags); +GIO_AVAILABLE_IN_2_30 +void g_io_module_scope_free (GIOModuleScope *scope); +GIO_AVAILABLE_IN_2_30 +void g_io_module_scope_block (GIOModuleScope *scope, + const gchar *basename); + +#define G_IO_TYPE_MODULE (g_io_module_get_type ()) +#define G_IO_MODULE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_IO_TYPE_MODULE, GIOModule)) +#define G_IO_MODULE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_IO_TYPE_MODULE, GIOModuleClass)) +#define G_IO_IS_MODULE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_IO_TYPE_MODULE)) +#define G_IO_IS_MODULE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_IO_TYPE_MODULE)) +#define G_IO_MODULE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_IO_TYPE_MODULE, GIOModuleClass)) + +/** + * GIOModule: + * + * Opaque module base class for extending GIO. + **/ +typedef struct _GIOModuleClass GIOModuleClass; + +GIO_AVAILABLE_IN_ALL +GType g_io_module_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GIOModule *g_io_module_new (const gchar *filename); + +GIO_AVAILABLE_IN_ALL +void g_io_modules_scan_all_in_directory (const char *dirname); +GIO_AVAILABLE_IN_ALL +GList *g_io_modules_load_all_in_directory (const gchar *dirname); + +GIO_AVAILABLE_IN_2_30 +void g_io_modules_scan_all_in_directory_with_scope (const gchar *dirname, + GIOModuleScope *scope); +GIO_AVAILABLE_IN_2_30 +GList *g_io_modules_load_all_in_directory_with_scope (const gchar *dirname, + GIOModuleScope *scope); + +GIO_AVAILABLE_IN_ALL +GIOExtensionPoint *g_io_extension_point_register (const char *name); +GIO_AVAILABLE_IN_ALL +GIOExtensionPoint *g_io_extension_point_lookup (const char *name); +GIO_AVAILABLE_IN_ALL +void g_io_extension_point_set_required_type (GIOExtensionPoint *extension_point, + GType type); +GIO_AVAILABLE_IN_ALL +GType g_io_extension_point_get_required_type (GIOExtensionPoint *extension_point); +GIO_AVAILABLE_IN_ALL +GList *g_io_extension_point_get_extensions (GIOExtensionPoint *extension_point); +GIO_AVAILABLE_IN_ALL +GIOExtension * g_io_extension_point_get_extension_by_name (GIOExtensionPoint *extension_point, + const char *name); +GIO_AVAILABLE_IN_ALL +GIOExtension * g_io_extension_point_implement (const char *extension_point_name, + GType type, + const char *extension_name, + gint priority); + +GIO_AVAILABLE_IN_ALL +GType g_io_extension_get_type (GIOExtension *extension); +GIO_AVAILABLE_IN_ALL +const char * g_io_extension_get_name (GIOExtension *extension); +GIO_AVAILABLE_IN_ALL +gint g_io_extension_get_priority (GIOExtension *extension); +GIO_AVAILABLE_IN_ALL +GTypeClass* g_io_extension_ref_class (GIOExtension *extension); + + +/* API for the modules to implement. + * Note that those functions are not implemented by libgio, they are declared + * here to be implemented in modules, that's why it uses G_MODULE_EXPORT + * instead of GIO_AVAILABLE_IN_ALL. + */ + +/** + * g_io_module_load: (skip) + * @module: a #GIOModule. + * + * Required API for GIO modules to implement. + * + * This function is run after the module has been loaded into GIO, + * to initialize the module. Typically, this function will call + * g_io_extension_point_implement(). + * + * Since 2.56, this function should be named `g_io__load`, where + * `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and + * everything after the first dot removed, and with `-` replaced with `_` + * throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`. + * Using the new symbol names avoids name clashes when building modules + * statically. The old symbol names continue to be supported, but cannot be used + * for static builds. + **/ +G_MODULE_EXPORT +void g_io_module_load (GIOModule *module); + +/** + * g_io_module_unload: (skip) + * @module: a #GIOModule. + * + * Required API for GIO modules to implement. + * + * This function is run when the module is being unloaded from GIO, + * to finalize the module. + * + * Since 2.56, this function should be named `g_io__unload`, where + * `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and + * everything after the first dot removed, and with `-` replaced with `_` + * throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`. + * Using the new symbol names avoids name clashes when building modules + * statically. The old symbol names continue to be supported, but cannot be used + * for static builds. + **/ +G_MODULE_EXPORT +void g_io_module_unload (GIOModule *module); + +/** + * g_io_module_query: + * + * Optional API for GIO modules to implement. + * + * Should return a list of all the extension points that may be + * implemented in this module. + * + * This method will not be called in normal use, however it may be + * called when probing existing modules and recording which extension + * points that this model is used for. This means we won't have to + * load and initialize this module unless its needed. + * + * If this function is not implemented by the module the module will + * always be loaded, initialized and then unloaded on application + * startup so that it can register its extension points during init. + * + * Note that a module need not actually implement all the extension + * points that g_io_module_query() returns, since the exact list of + * extension may depend on runtime issues. However all extension + * points actually implemented must be returned by g_io_module_query() + * (if defined). + * + * When installing a module that implements g_io_module_query() you must + * run gio-querymodules in order to build the cache files required for + * lazy loading. + * + * Since 2.56, this function should be named `g_io__query`, where + * `modulename` is the plugin’s filename with the `lib` or `libgio` prefix and + * everything after the first dot removed, and with `-` replaced with `_` + * throughout. For example, `libgiognutls-helper.so` becomes `gnutls_helper`. + * Using the new symbol names avoids name clashes when building modules + * statically. The old symbol names continue to be supported, but cannot be used + * for static builds. + * + * Returns: (transfer full): A %NULL-terminated array of strings, + * listing the supported extension points of the module. The array + * must be suitable for freeing with g_strfreev(). + * + * Since: 2.24 + **/ +G_MODULE_EXPORT +char **g_io_module_query (void); + +G_END_DECLS + +#endif /* __G_IO_MODULE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_IO_SCHEDULER_H__ +#define __G_IO_SCHEDULER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + + +GIO_DEPRECATED_IN_2_36_FOR ("GThreadPool or g_task_run_in_thread") +void g_io_scheduler_push_job (GIOSchedulerJobFunc job_func, + gpointer user_data, + GDestroyNotify notify, + gint io_priority, + GCancellable *cancellable); +GIO_DEPRECATED_IN_2_36 +void g_io_scheduler_cancel_all_jobs (void); +GIO_DEPRECATED_IN_2_36_FOR (g_main_context_invoke) +gboolean g_io_scheduler_job_send_to_mainloop (GIOSchedulerJob *job, + GSourceFunc func, + gpointer user_data, + GDestroyNotify notify); +GIO_DEPRECATED_IN_2_36_FOR (g_main_context_invoke) +void g_io_scheduler_job_send_to_mainloop_async (GIOSchedulerJob *job, + GSourceFunc func, + gpointer user_data, + GDestroyNotify notify); + +G_END_DECLS + +#endif /* __G_IO_SCHEDULER_H__ */ +/* + * Copyright 2015 Lars Uebernickel + * Copyright 2015 Ryan Lortie + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: + * Lars Uebernickel + * Ryan Lortie + */ + +#ifndef __G_LIST_MODEL_H__ +#define __G_LIST_MODEL_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_LIST_MODEL g_list_model_get_type () +GIO_AVAILABLE_IN_2_44 +G_DECLARE_INTERFACE(GListModel, g_list_model, G, LIST_MODEL, GObject) + +struct _GListModelInterface +{ + GTypeInterface g_iface; + + GType (* get_item_type) (GListModel *list); + + guint (* get_n_items) (GListModel *list); + + gpointer (* get_item) (GListModel *list, + guint position); +}; + +GIO_AVAILABLE_IN_2_44 +GType g_list_model_get_item_type (GListModel *list); + +GIO_AVAILABLE_IN_2_44 +guint g_list_model_get_n_items (GListModel *list); + +GIO_AVAILABLE_IN_2_44 +gpointer g_list_model_get_item (GListModel *list, + guint position); + +GIO_AVAILABLE_IN_2_44 +GObject * g_list_model_get_object (GListModel *list, + guint position); + +GIO_AVAILABLE_IN_2_44 +void g_list_model_items_changed (GListModel *list, + guint position, + guint removed, + guint added); + +G_END_DECLS + +#endif /* __G_LIST_MODEL_H__ */ +/* + * Copyright 2015 Lars Uebernickel + * Copyright 2015 Ryan Lortie + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: + * Lars Uebernickel + * Ryan Lortie + */ + +#ifndef __G_LIST_STORE_H__ +#define __G_LIST_STORE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_LIST_STORE (g_list_store_get_type ()) +GIO_AVAILABLE_IN_2_44 +G_DECLARE_FINAL_TYPE(GListStore, g_list_store, G, LIST_STORE, GObject) + +GIO_AVAILABLE_IN_2_44 +GListStore * g_list_store_new (GType item_type); + +GIO_AVAILABLE_IN_2_44 +void g_list_store_insert (GListStore *store, + guint position, + gpointer item); + +GIO_AVAILABLE_IN_2_44 +guint g_list_store_insert_sorted (GListStore *store, + gpointer item, + GCompareDataFunc compare_func, + gpointer user_data); + +GIO_AVAILABLE_IN_2_46 +void g_list_store_sort (GListStore *store, + GCompareDataFunc compare_func, + gpointer user_data); + +GIO_AVAILABLE_IN_2_44 +void g_list_store_append (GListStore *store, + gpointer item); + +GIO_AVAILABLE_IN_2_44 +void g_list_store_remove (GListStore *store, + guint position); + +GIO_AVAILABLE_IN_2_44 +void g_list_store_remove_all (GListStore *store); + +GIO_AVAILABLE_IN_2_44 +void g_list_store_splice (GListStore *store, + guint position, + guint n_removals, + gpointer *additions, + guint n_additions); + +GIO_AVAILABLE_IN_2_64 +gboolean g_list_store_find (GListStore *store, + gpointer item, + guint *position); + +GIO_AVAILABLE_IN_2_64 +gboolean g_list_store_find_with_equal_func (GListStore *store, + gpointer item, + GEqualFunc equal_func, + guint *position); + +GIO_AVAILABLE_IN_2_74 +gboolean g_list_store_find_with_equal_func_full (GListStore *store, + gpointer item, + GEqualFuncFull equal_func, + gpointer user_data, + guint *position); + +G_END_DECLS + +#endif /* __G_LIST_STORE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_LOADABLE_ICON_H__ +#define __G_LOADABLE_ICON_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_LOADABLE_ICON (g_loadable_icon_get_type ()) +#define G_LOADABLE_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_LOADABLE_ICON, GLoadableIcon)) +#define G_IS_LOADABLE_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_LOADABLE_ICON)) +#define G_LOADABLE_ICON_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_LOADABLE_ICON, GLoadableIconIface)) + +/** + * GLoadableIcon: + * + * Generic type for all kinds of icons that can be loaded + * as a stream. + **/ +typedef struct _GLoadableIconIface GLoadableIconIface; + +/** + * GLoadableIconIface: + * @g_iface: The parent interface. + * @load: Loads an icon. + * @load_async: Loads an icon asynchronously. + * @load_finish: Finishes an asynchronous icon load. + * + * Interface for icons that can be loaded as a stream. + **/ +struct _GLoadableIconIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + GInputStream * (* load) (GLoadableIcon *icon, + int size, + char **type, + GCancellable *cancellable, + GError **error); + void (* load_async) (GLoadableIcon *icon, + int size, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GInputStream * (* load_finish) (GLoadableIcon *icon, + GAsyncResult *res, + char **type, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_loadable_icon_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GInputStream *g_loadable_icon_load (GLoadableIcon *icon, + int size, + char **type, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_loadable_icon_load_async (GLoadableIcon *icon, + int size, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GInputStream *g_loadable_icon_load_finish (GLoadableIcon *icon, + GAsyncResult *res, + char **type, + GError **error); + +G_END_DECLS + +#endif /* __G_LOADABLE_ICON_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Christian Kellner + */ + +#ifndef __G_MEMORY_INPUT_STREAM_H__ +#define __G_MEMORY_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_MEMORY_INPUT_STREAM (g_memory_input_stream_get_type ()) +#define G_MEMORY_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MEMORY_INPUT_STREAM, GMemoryInputStream)) +#define G_MEMORY_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MEMORY_INPUT_STREAM, GMemoryInputStreamClass)) +#define G_IS_MEMORY_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MEMORY_INPUT_STREAM)) +#define G_IS_MEMORY_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MEMORY_INPUT_STREAM)) +#define G_MEMORY_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MEMORY_INPUT_STREAM, GMemoryInputStreamClass)) + +/** + * GMemoryInputStream: + * + * Implements #GInputStream for arbitrary memory chunks. + **/ +typedef struct _GMemoryInputStreamClass GMemoryInputStreamClass; +typedef struct _GMemoryInputStreamPrivate GMemoryInputStreamPrivate; + +struct _GMemoryInputStream +{ + GInputStream parent_instance; + + /*< private >*/ + GMemoryInputStreamPrivate *priv; +}; + +struct _GMemoryInputStreamClass +{ + GInputStreamClass parent_class; + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + + +GIO_AVAILABLE_IN_ALL +GType g_memory_input_stream_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GInputStream * g_memory_input_stream_new (void); +GIO_AVAILABLE_IN_ALL +GInputStream * g_memory_input_stream_new_from_data (const void *data, + gssize len, + GDestroyNotify destroy); +GIO_AVAILABLE_IN_2_34 +GInputStream * g_memory_input_stream_new_from_bytes (GBytes *bytes); + +GIO_AVAILABLE_IN_ALL +void g_memory_input_stream_add_data (GMemoryInputStream *stream, + const void *data, + gssize len, + GDestroyNotify destroy); +GIO_AVAILABLE_IN_2_34 +void g_memory_input_stream_add_bytes (GMemoryInputStream *stream, + GBytes *bytes); + +G_END_DECLS + +#endif /* __G_MEMORY_INPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2019 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_MEMORY_MONITOR_H__ +#define __G_MEMORY_MONITOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_MEMORY_MONITOR_EXTENSION_POINT_NAME: + * + * Extension point for memory usage monitoring functionality. + * See [Extending GIO][extending-gio]. + * + * Since: 2.64 + */ +#define G_MEMORY_MONITOR_EXTENSION_POINT_NAME "gio-memory-monitor" + +#define G_TYPE_MEMORY_MONITOR (g_memory_monitor_get_type ()) +GIO_AVAILABLE_IN_2_64 +G_DECLARE_INTERFACE(GMemoryMonitor, g_memory_monitor, g, memory_monitor, GObject) + +#define G_MEMORY_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MEMORY_MONITOR, GMemoryMonitor)) +#define G_IS_MEMORY_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MEMORY_MONITOR)) +#define G_MEMORY_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_MEMORY_MONITOR, GMemoryMonitorInterface)) + +struct _GMemoryMonitorInterface { + /*< private >*/ + GTypeInterface g_iface; + + /*< public >*/ + void (*low_memory_warning) (GMemoryMonitor *monitor, + GMemoryMonitorWarningLevel level); +}; + +GIO_AVAILABLE_IN_2_64 +GMemoryMonitor *g_memory_monitor_dup_default (void); + +G_END_DECLS + +#endif /* __G_MEMORY_MONITOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Christian Kellner + */ + +#ifndef __G_MEMORY_OUTPUT_STREAM_H__ +#define __G_MEMORY_OUTPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_MEMORY_OUTPUT_STREAM (g_memory_output_stream_get_type ()) +#define G_MEMORY_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MEMORY_OUTPUT_STREAM, GMemoryOutputStream)) +#define G_MEMORY_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MEMORY_OUTPUT_STREAM, GMemoryOutputStreamClass)) +#define G_IS_MEMORY_OUTPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MEMORY_OUTPUT_STREAM)) +#define G_IS_MEMORY_OUTPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MEMORY_OUTPUT_STREAM)) +#define G_MEMORY_OUTPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MEMORY_OUTPUT_STREAM, GMemoryOutputStreamClass)) + +/** + * GMemoryOutputStream: + * + * Implements #GOutputStream for arbitrary memory chunks. + **/ +typedef struct _GMemoryOutputStreamClass GMemoryOutputStreamClass; +typedef struct _GMemoryOutputStreamPrivate GMemoryOutputStreamPrivate; + +struct _GMemoryOutputStream +{ + GOutputStream parent_instance; + + /*< private >*/ + GMemoryOutputStreamPrivate *priv; +}; + +struct _GMemoryOutputStreamClass +{ + GOutputStreamClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +/** + * GReallocFunc: + * @data: memory block to reallocate + * @size: size to reallocate @data to + * + * Changes the size of the memory block pointed to by @data to + * @size bytes. + * + * The function should have the same semantics as realloc(). + * + * Returns: a pointer to the reallocated memory + */ +typedef gpointer (* GReallocFunc) (gpointer data, + gsize size); + +GIO_AVAILABLE_IN_ALL +GType g_memory_output_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GOutputStream *g_memory_output_stream_new (gpointer data, + gsize size, + GReallocFunc realloc_function, + GDestroyNotify destroy_function); +GIO_AVAILABLE_IN_2_36 +GOutputStream *g_memory_output_stream_new_resizable (void); +GIO_AVAILABLE_IN_ALL +gpointer g_memory_output_stream_get_data (GMemoryOutputStream *ostream); +GIO_AVAILABLE_IN_ALL +gsize g_memory_output_stream_get_size (GMemoryOutputStream *ostream); +GIO_AVAILABLE_IN_ALL +gsize g_memory_output_stream_get_data_size (GMemoryOutputStream *ostream); +GIO_AVAILABLE_IN_ALL +gpointer g_memory_output_stream_steal_data (GMemoryOutputStream *ostream); + +GIO_AVAILABLE_IN_2_34 +GBytes * g_memory_output_stream_steal_as_bytes (GMemoryOutputStream *ostream); + +G_END_DECLS + +#endif /* __G_MEMORY_OUTPUT_STREAM_H__ */ +/* + * Copyright © 2011 Canonical Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_MENU_H__ +#define __G_MENU_H__ + +/* + * Copyright © 2011 Canonical Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_MENU_MODEL_H__ +#define __G_MENU_MODEL_H__ + + + +G_BEGIN_DECLS + +/** + * G_MENU_ATTRIBUTE_ACTION: + * + * The menu item attribute which holds the action name of the item. Action + * names are namespaced with an identifier for the action group in which the + * action resides. For example, "win." for window-specific actions and "app." + * for application-wide actions. + * + * See also g_menu_model_get_item_attribute() and g_menu_item_set_attribute(). + * + * Since: 2.32 + **/ +#define G_MENU_ATTRIBUTE_ACTION "action" + +/** + * G_MENU_ATTRIBUTE_ACTION_NAMESPACE: + * + * The menu item attribute that holds the namespace for all action names in + * menus that are linked from this item. + * + * Since: 2.36 + **/ +#define G_MENU_ATTRIBUTE_ACTION_NAMESPACE "action-namespace" + +/** + * G_MENU_ATTRIBUTE_TARGET: + * + * The menu item attribute which holds the target with which the item's action + * will be activated. + * + * See also g_menu_item_set_action_and_target() + * + * Since: 2.32 + **/ +#define G_MENU_ATTRIBUTE_TARGET "target" + +/** + * G_MENU_ATTRIBUTE_LABEL: + * + * The menu item attribute which holds the label of the item. + * + * Since: 2.32 + **/ +#define G_MENU_ATTRIBUTE_LABEL "label" + +/** + * G_MENU_ATTRIBUTE_ICON: + * + * The menu item attribute which holds the icon of the item. + * + * The icon is stored in the format returned by g_icon_serialize(). + * + * This attribute is intended only to represent 'noun' icons such as + * favicons for a webpage, or application icons. It should not be used + * for 'verbs' (ie: stock icons). + * + * Since: 2.38 + **/ +#define G_MENU_ATTRIBUTE_ICON "icon" + +/** + * G_MENU_LINK_SUBMENU: + * + * The name of the link that associates a menu item with a submenu. + * + * See also g_menu_item_set_link(). + * + * Since: 2.32 + **/ +#define G_MENU_LINK_SUBMENU "submenu" + +/** + * G_MENU_LINK_SECTION: + * + * The name of the link that associates a menu item with a section. The linked + * menu will usually be shown in place of the menu item, using the item's label + * as a header. + * + * See also g_menu_item_set_link(). + * + * Since: 2.32 + **/ +#define G_MENU_LINK_SECTION "section" + +#define G_TYPE_MENU_MODEL (g_menu_model_get_type ()) +#define G_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_MENU_MODEL, GMenuModel)) +#define G_MENU_MODEL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_MENU_MODEL, GMenuModelClass)) +#define G_IS_MENU_MODEL(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_MENU_MODEL)) +#define G_IS_MENU_MODEL_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_MENU_MODEL)) +#define G_MENU_MODEL_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_MENU_MODEL, GMenuModelClass)) + +typedef struct _GMenuModelPrivate GMenuModelPrivate; +typedef struct _GMenuModelClass GMenuModelClass; + +typedef struct _GMenuAttributeIterPrivate GMenuAttributeIterPrivate; +typedef struct _GMenuAttributeIterClass GMenuAttributeIterClass; +typedef struct _GMenuAttributeIter GMenuAttributeIter; + +typedef struct _GMenuLinkIterPrivate GMenuLinkIterPrivate; +typedef struct _GMenuLinkIterClass GMenuLinkIterClass; +typedef struct _GMenuLinkIter GMenuLinkIter; + +struct _GMenuModel +{ + GObject parent_instance; + GMenuModelPrivate *priv; +}; + +/** + * GMenuModelClass::get_item_attributes: + * @model: the #GMenuModel to query + * @item_index: The #GMenuItem to query + * @attributes: (out) (element-type utf8 GLib.Variant): Attributes on the item + * + * Gets all the attributes associated with the item in the menu model. + */ +/** + * GMenuModelClass::get_item_links: + * @model: the #GMenuModel to query + * @item_index: The #GMenuItem to query + * @links: (out) (element-type utf8 Gio.MenuModel): Links from the item + * + * Gets all the links associated with the item in the menu model. + */ +struct _GMenuModelClass +{ + GObjectClass parent_class; + + gboolean (*is_mutable) (GMenuModel *model); + gint (*get_n_items) (GMenuModel *model); + void (*get_item_attributes) (GMenuModel *model, + gint item_index, + GHashTable **attributes); + GMenuAttributeIter * (*iterate_item_attributes) (GMenuModel *model, + gint item_index); + GVariant * (*get_item_attribute_value) (GMenuModel *model, + gint item_index, + const gchar *attribute, + const GVariantType *expected_type); + void (*get_item_links) (GMenuModel *model, + gint item_index, + GHashTable **links); + GMenuLinkIter * (*iterate_item_links) (GMenuModel *model, + gint item_index); + GMenuModel * (*get_item_link) (GMenuModel *model, + gint item_index, + const gchar *link); +}; + +GIO_AVAILABLE_IN_2_32 +GType g_menu_model_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +gboolean g_menu_model_is_mutable (GMenuModel *model); +GIO_AVAILABLE_IN_2_32 +gint g_menu_model_get_n_items (GMenuModel *model); + +GIO_AVAILABLE_IN_2_32 +GMenuAttributeIter * g_menu_model_iterate_item_attributes (GMenuModel *model, + gint item_index); +GIO_AVAILABLE_IN_2_32 +GVariant * g_menu_model_get_item_attribute_value (GMenuModel *model, + gint item_index, + const gchar *attribute, + const GVariantType *expected_type); +GIO_AVAILABLE_IN_2_32 +gboolean g_menu_model_get_item_attribute (GMenuModel *model, + gint item_index, + const gchar *attribute, + const gchar *format_string, + ...); +GIO_AVAILABLE_IN_2_32 +GMenuLinkIter * g_menu_model_iterate_item_links (GMenuModel *model, + gint item_index); +GIO_AVAILABLE_IN_2_32 +GMenuModel * g_menu_model_get_item_link (GMenuModel *model, + gint item_index, + const gchar *link); + +GIO_AVAILABLE_IN_2_32 +void g_menu_model_items_changed (GMenuModel *model, + gint position, + gint removed, + gint added); + + +#define G_TYPE_MENU_ATTRIBUTE_ITER (g_menu_attribute_iter_get_type ()) +#define G_MENU_ATTRIBUTE_ITER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIter)) +#define G_MENU_ATTRIBUTE_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterClass)) +#define G_IS_MENU_ATTRIBUTE_ITER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_MENU_ATTRIBUTE_ITER)) +#define G_IS_MENU_ATTRIBUTE_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_MENU_ATTRIBUTE_ITER)) +#define G_MENU_ATTRIBUTE_ITER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_MENU_ATTRIBUTE_ITER, GMenuAttributeIterClass)) + +struct _GMenuAttributeIter +{ + GObject parent_instance; + GMenuAttributeIterPrivate *priv; +}; + +struct _GMenuAttributeIterClass +{ + GObjectClass parent_class; + + gboolean (*get_next) (GMenuAttributeIter *iter, + const gchar **out_name, + GVariant **value); +}; + +GIO_AVAILABLE_IN_2_32 +GType g_menu_attribute_iter_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +gboolean g_menu_attribute_iter_get_next (GMenuAttributeIter *iter, + const gchar **out_name, + GVariant **value); +GIO_AVAILABLE_IN_2_32 +gboolean g_menu_attribute_iter_next (GMenuAttributeIter *iter); +GIO_AVAILABLE_IN_2_32 +const gchar * g_menu_attribute_iter_get_name (GMenuAttributeIter *iter); +GIO_AVAILABLE_IN_2_32 +GVariant * g_menu_attribute_iter_get_value (GMenuAttributeIter *iter); + + +#define G_TYPE_MENU_LINK_ITER (g_menu_link_iter_get_type ()) +#define G_MENU_LINK_ITER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_MENU_LINK_ITER, GMenuLinkIter)) +#define G_MENU_LINK_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_MENU_LINK_ITER, GMenuLinkIterClass)) +#define G_IS_MENU_LINK_ITER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_MENU_LINK_ITER)) +#define G_IS_MENU_LINK_ITER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_MENU_LINK_ITER)) +#define G_MENU_LINK_ITER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_MENU_LINK_ITER, GMenuLinkIterClass)) + +struct _GMenuLinkIter +{ + GObject parent_instance; + GMenuLinkIterPrivate *priv; +}; + +struct _GMenuLinkIterClass +{ + GObjectClass parent_class; + + gboolean (*get_next) (GMenuLinkIter *iter, + const gchar **out_link, + GMenuModel **value); +}; + +GIO_AVAILABLE_IN_2_32 +GType g_menu_link_iter_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +gboolean g_menu_link_iter_get_next (GMenuLinkIter *iter, + const gchar **out_link, + GMenuModel **value); +GIO_AVAILABLE_IN_2_32 +gboolean g_menu_link_iter_next (GMenuLinkIter *iter); +GIO_AVAILABLE_IN_2_32 +const gchar * g_menu_link_iter_get_name (GMenuLinkIter *iter); +GIO_AVAILABLE_IN_2_32 +GMenuModel * g_menu_link_iter_get_value (GMenuLinkIter *iter); + +G_END_DECLS + +#endif /* __G_MENU_MODEL_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_MENU (g_menu_get_type ()) +#define G_MENU(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_MENU, GMenu)) +#define G_IS_MENU(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_MENU)) + +#define G_TYPE_MENU_ITEM (g_menu_item_get_type ()) +#define G_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_MENU_ITEM, GMenuItem)) +#define G_IS_MENU_ITEM(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_MENU_ITEM)) + +typedef struct _GMenuItem GMenuItem; +typedef struct _GMenu GMenu; + +GIO_AVAILABLE_IN_2_32 +GType g_menu_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_2_32 +GMenu * g_menu_new (void); + +GIO_AVAILABLE_IN_2_32 +void g_menu_freeze (GMenu *menu); + +GIO_AVAILABLE_IN_2_32 +void g_menu_insert_item (GMenu *menu, + gint position, + GMenuItem *item); +GIO_AVAILABLE_IN_2_32 +void g_menu_prepend_item (GMenu *menu, + GMenuItem *item); +GIO_AVAILABLE_IN_2_32 +void g_menu_append_item (GMenu *menu, + GMenuItem *item); +GIO_AVAILABLE_IN_2_32 +void g_menu_remove (GMenu *menu, + gint position); + +GIO_AVAILABLE_IN_2_38 +void g_menu_remove_all (GMenu *menu); + +GIO_AVAILABLE_IN_2_32 +void g_menu_insert (GMenu *menu, + gint position, + const gchar *label, + const gchar *detailed_action); +GIO_AVAILABLE_IN_2_32 +void g_menu_prepend (GMenu *menu, + const gchar *label, + const gchar *detailed_action); +GIO_AVAILABLE_IN_2_32 +void g_menu_append (GMenu *menu, + const gchar *label, + const gchar *detailed_action); + +GIO_AVAILABLE_IN_2_32 +void g_menu_insert_section (GMenu *menu, + gint position, + const gchar *label, + GMenuModel *section); +GIO_AVAILABLE_IN_2_32 +void g_menu_prepend_section (GMenu *menu, + const gchar *label, + GMenuModel *section); +GIO_AVAILABLE_IN_2_32 +void g_menu_append_section (GMenu *menu, + const gchar *label, + GMenuModel *section); + +GIO_AVAILABLE_IN_2_32 +void g_menu_insert_submenu (GMenu *menu, + gint position, + const gchar *label, + GMenuModel *submenu); +GIO_AVAILABLE_IN_2_32 +void g_menu_prepend_submenu (GMenu *menu, + const gchar *label, + GMenuModel *submenu); +GIO_AVAILABLE_IN_2_32 +void g_menu_append_submenu (GMenu *menu, + const gchar *label, + GMenuModel *submenu); + + +GIO_AVAILABLE_IN_2_32 +GType g_menu_item_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_2_32 +GMenuItem * g_menu_item_new (const gchar *label, + const gchar *detailed_action); + +GIO_AVAILABLE_IN_2_34 +GMenuItem * g_menu_item_new_from_model (GMenuModel *model, + gint item_index); + +GIO_AVAILABLE_IN_2_32 +GMenuItem * g_menu_item_new_submenu (const gchar *label, + GMenuModel *submenu); + +GIO_AVAILABLE_IN_2_32 +GMenuItem * g_menu_item_new_section (const gchar *label, + GMenuModel *section); + +GIO_AVAILABLE_IN_2_34 +GVariant * g_menu_item_get_attribute_value (GMenuItem *menu_item, + const gchar *attribute, + const GVariantType *expected_type); +GIO_AVAILABLE_IN_2_34 +gboolean g_menu_item_get_attribute (GMenuItem *menu_item, + const gchar *attribute, + const gchar *format_string, + ...); +GIO_AVAILABLE_IN_2_34 +GMenuModel *g_menu_item_get_link (GMenuItem *menu_item, + const gchar *link); + +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_attribute_value (GMenuItem *menu_item, + const gchar *attribute, + GVariant *value); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_attribute (GMenuItem *menu_item, + const gchar *attribute, + const gchar *format_string, + ...); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_link (GMenuItem *menu_item, + const gchar *link, + GMenuModel *model); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_label (GMenuItem *menu_item, + const gchar *label); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_submenu (GMenuItem *menu_item, + GMenuModel *submenu); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_section (GMenuItem *menu_item, + GMenuModel *section); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_action_and_target_value (GMenuItem *menu_item, + const gchar *action, + GVariant *target_value); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_action_and_target (GMenuItem *menu_item, + const gchar *action, + const gchar *format_string, + ...); +GIO_AVAILABLE_IN_2_32 +void g_menu_item_set_detailed_action (GMenuItem *menu_item, + const gchar *detailed_action); + +GIO_AVAILABLE_IN_2_38 +void g_menu_item_set_icon (GMenuItem *menu_item, + GIcon *icon); + +G_END_DECLS + +#endif /* __G_MENU_H__ */ +/* + * Copyright © 2011 Canonical Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_MENU_EXPORTER_H__ +#define __G_MENU_EXPORTER_H__ + + +G_BEGIN_DECLS + +GIO_AVAILABLE_IN_2_32 +guint g_dbus_connection_export_menu_model (GDBusConnection *connection, + const gchar *object_path, + GMenuModel *menu, + GError **error); + +GIO_AVAILABLE_IN_2_32 +void g_dbus_connection_unexport_menu_model (GDBusConnection *connection, + guint export_id); + +G_END_DECLS + +#endif /* __G_MENU_EXPORTER_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2008 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + * David Zeuthen + */ + +#ifndef __G_MOUNT_H__ +#define __G_MOUNT_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_MOUNT (g_mount_get_type ()) +#define G_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_MOUNT, GMount)) +#define G_IS_MOUNT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_MOUNT)) +#define G_MOUNT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_MOUNT, GMountIface)) + +typedef struct _GMountIface GMountIface; + +/** + * GMountIface: + * @g_iface: The parent interface. + * @changed: Changed signal that is emitted when the mount's state has changed. + * @unmounted: The unmounted signal that is emitted when the #GMount have been unmounted. If the recipient is holding references to the object they should release them so the object can be finalized. + * @pre_unmount: The ::pre-unmount signal that is emitted when the #GMount will soon be emitted. If the recipient is somehow holding the mount open by keeping an open file on it it should close the file. + * @get_root: Gets a #GFile to the root directory of the #GMount. + * @get_name: Gets a string containing the name of the #GMount. + * @get_icon: Gets a #GIcon for the #GMount. + * @get_uuid: Gets the UUID for the #GMount. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available. + * @get_volume: Gets a #GVolume the mount is located on. Returns %NULL if the #GMount is not associated with a #GVolume. + * @get_drive: Gets a #GDrive the volume of the mount is located on. Returns %NULL if the #GMount is not associated with a #GDrive or a #GVolume. This is convenience method for getting the #GVolume and using that to get the #GDrive. + * @can_unmount: Checks if a #GMount can be unmounted. + * @can_eject: Checks if a #GMount can be ejected. + * @unmount: Starts unmounting a #GMount. + * @unmount_finish: Finishes an unmounting operation. + * @eject: Starts ejecting a #GMount. + * @eject_finish: Finishes an eject operation. + * @remount: Starts remounting a #GMount. + * @remount_finish: Finishes a remounting operation. + * @guess_content_type: Starts guessing the type of the content of a #GMount. + * See g_mount_guess_content_type() for more information on content + * type guessing. This operation was added in 2.18. + * @guess_content_type_finish: Finishes a content type guessing operation. Added in 2.18. + * @guess_content_type_sync: Synchronous variant of @guess_content_type. Added in 2.18 + * @unmount_with_operation: Starts unmounting a #GMount using a #GMountOperation. Since 2.22. + * @unmount_with_operation_finish: Finishes an unmounting operation using a #GMountOperation. Since 2.22. + * @eject_with_operation: Starts ejecting a #GMount using a #GMountOperation. Since 2.22. + * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. + * @get_default_location: Gets a #GFile indication a start location that can be use as the entry point for this mount. Since 2.24. + * @get_sort_key: Gets a key used for sorting #GMount instance or %NULL if no such key exists. Since 2.32. + * @get_symbolic_icon: Gets a symbolic #GIcon for the #GMount. Since 2.34. + * + * Interface for implementing operations for mounts. + **/ +struct _GMountIface +{ + GTypeInterface g_iface; + + /* signals */ + + void (* changed) (GMount *mount); + void (* unmounted) (GMount *mount); + + /* Virtual Table */ + + GFile * (* get_root) (GMount *mount); + char * (* get_name) (GMount *mount); + GIcon * (* get_icon) (GMount *mount); + char * (* get_uuid) (GMount *mount); + GVolume * (* get_volume) (GMount *mount); + GDrive * (* get_drive) (GMount *mount); + gboolean (* can_unmount) (GMount *mount); + gboolean (* can_eject) (GMount *mount); + + void (* unmount) (GMount *mount, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* unmount_finish) (GMount *mount, + GAsyncResult *result, + GError **error); + + void (* eject) (GMount *mount, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_finish) (GMount *mount, + GAsyncResult *result, + GError **error); + + void (* remount) (GMount *mount, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* remount_finish) (GMount *mount, + GAsyncResult *result, + GError **error); + + void (* guess_content_type) (GMount *mount, + gboolean force_rescan, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gchar ** (* guess_content_type_finish) (GMount *mount, + GAsyncResult *result, + GError **error); + gchar ** (* guess_content_type_sync) (GMount *mount, + gboolean force_rescan, + GCancellable *cancellable, + GError **error); + + /* Signal, not VFunc */ + void (* pre_unmount) (GMount *mount); + + void (* unmount_with_operation) (GMount *mount, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* unmount_with_operation_finish) (GMount *mount, + GAsyncResult *result, + GError **error); + + void (* eject_with_operation) (GMount *mount, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_with_operation_finish) (GMount *mount, + GAsyncResult *result, + GError **error); + GFile * (* get_default_location) (GMount *mount); + + const gchar * (* get_sort_key) (GMount *mount); + GIcon * (* get_symbolic_icon) (GMount *mount); +}; + +GIO_AVAILABLE_IN_ALL +GType g_mount_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GFile * g_mount_get_root (GMount *mount); +GIO_AVAILABLE_IN_ALL +GFile * g_mount_get_default_location (GMount *mount); +GIO_AVAILABLE_IN_ALL +char * g_mount_get_name (GMount *mount); +GIO_AVAILABLE_IN_ALL +GIcon * g_mount_get_icon (GMount *mount); +GIO_AVAILABLE_IN_ALL +GIcon * g_mount_get_symbolic_icon (GMount *mount); +GIO_AVAILABLE_IN_ALL +char * g_mount_get_uuid (GMount *mount); +GIO_AVAILABLE_IN_ALL +GVolume * g_mount_get_volume (GMount *mount); +GIO_AVAILABLE_IN_ALL +GDrive * g_mount_get_drive (GMount *mount); +GIO_AVAILABLE_IN_ALL +gboolean g_mount_can_unmount (GMount *mount); +GIO_AVAILABLE_IN_ALL +gboolean g_mount_can_eject (GMount *mount); + +GIO_DEPRECATED_FOR(g_mount_unmount_with_operation) +void g_mount_unmount (GMount *mount, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_DEPRECATED_FOR(g_mount_unmount_with_operation_finish) +gboolean g_mount_unmount_finish (GMount *mount, + GAsyncResult *result, + GError **error); + +GIO_DEPRECATED_FOR(g_mount_eject_with_operation) +void g_mount_eject (GMount *mount, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_DEPRECATED_FOR(g_mount_eject_with_operation_finish) +gboolean g_mount_eject_finish (GMount *mount, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_mount_remount (GMount *mount, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_mount_remount_finish (GMount *mount, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_mount_guess_content_type (GMount *mount, + gboolean force_rescan, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gchar ** g_mount_guess_content_type_finish (GMount *mount, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +gchar ** g_mount_guess_content_type_sync (GMount *mount, + gboolean force_rescan, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_mount_is_shadowed (GMount *mount); +GIO_AVAILABLE_IN_ALL +void g_mount_shadow (GMount *mount); +GIO_AVAILABLE_IN_ALL +void g_mount_unshadow (GMount *mount); + +GIO_AVAILABLE_IN_ALL +void g_mount_unmount_with_operation (GMount *mount, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_mount_unmount_with_operation_finish (GMount *mount, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_mount_eject_with_operation (GMount *mount, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_mount_eject_with_operation_finish (GMount *mount, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +const gchar *g_mount_get_sort_key (GMount *mount); + +G_END_DECLS + +#endif /* __G_MOUNT_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_MOUNT_OPERATION_H__ +#define __G_MOUNT_OPERATION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_MOUNT_OPERATION (g_mount_operation_get_type ()) +#define G_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_MOUNT_OPERATION, GMountOperation)) +#define G_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_MOUNT_OPERATION, GMountOperationClass)) +#define G_IS_MOUNT_OPERATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_MOUNT_OPERATION)) +#define G_IS_MOUNT_OPERATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_MOUNT_OPERATION)) +#define G_MOUNT_OPERATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_MOUNT_OPERATION, GMountOperationClass)) + +/** + * GMountOperation: + * + * Class for providing authentication methods for mounting operations, + * such as mounting a file locally, or authenticating with a server. + **/ +typedef struct _GMountOperationClass GMountOperationClass; +typedef struct _GMountOperationPrivate GMountOperationPrivate; + +struct _GMountOperation +{ + GObject parent_instance; + + GMountOperationPrivate *priv; +}; + +struct _GMountOperationClass +{ + GObjectClass parent_class; + + /* signals: */ + + void (* ask_password) (GMountOperation *op, + const char *message, + const char *default_user, + const char *default_domain, + GAskPasswordFlags flags); + + /** + * GMountOperationClass::ask_question: + * @op: a #GMountOperation + * @message: string containing a message to display to the user + * @choices: (array zero-terminated=1) (element-type utf8): an array of + * strings for each possible choice + * + * Virtual implementation of #GMountOperation::ask-question. + */ + void (* ask_question) (GMountOperation *op, + const char *message, + const char *choices[]); + + void (* reply) (GMountOperation *op, + GMountOperationResult result); + + void (* aborted) (GMountOperation *op); + + /** + * GMountOperationClass::show_processes: + * @op: a #GMountOperation + * @message: string containing a message to display to the user + * @processes: (element-type GPid): an array of #GPid for processes blocking + * the operation + * @choices: (array zero-terminated=1) (element-type utf8): an array of + * strings for each possible choice + * + * Virtual implementation of #GMountOperation::show-processes. + * + * Since: 2.22 + */ + void (* show_processes) (GMountOperation *op, + const gchar *message, + GArray *processes, + const gchar *choices[]); + + void (* show_unmount_progress) (GMountOperation *op, + const gchar *message, + gint64 time_left, + gint64 bytes_left); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); + void (*_g_reserved7) (void); + void (*_g_reserved8) (void); + void (*_g_reserved9) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_mount_operation_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GMountOperation * g_mount_operation_new (void); + +GIO_AVAILABLE_IN_ALL +const char * g_mount_operation_get_username (GMountOperation *op); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_set_username (GMountOperation *op, + const char *username); +GIO_AVAILABLE_IN_ALL +const char * g_mount_operation_get_password (GMountOperation *op); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_set_password (GMountOperation *op, + const char *password); +GIO_AVAILABLE_IN_ALL +gboolean g_mount_operation_get_anonymous (GMountOperation *op); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_set_anonymous (GMountOperation *op, + gboolean anonymous); +GIO_AVAILABLE_IN_ALL +const char * g_mount_operation_get_domain (GMountOperation *op); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_set_domain (GMountOperation *op, + const char *domain); +GIO_AVAILABLE_IN_ALL +GPasswordSave g_mount_operation_get_password_save (GMountOperation *op); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_set_password_save (GMountOperation *op, + GPasswordSave save); +GIO_AVAILABLE_IN_ALL +int g_mount_operation_get_choice (GMountOperation *op); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_set_choice (GMountOperation *op, + int choice); +GIO_AVAILABLE_IN_ALL +void g_mount_operation_reply (GMountOperation *op, + GMountOperationResult result); +GIO_AVAILABLE_IN_2_58 +gboolean g_mount_operation_get_is_tcrypt_hidden_volume (GMountOperation *op); +GIO_AVAILABLE_IN_2_58 +void g_mount_operation_set_is_tcrypt_hidden_volume (GMountOperation *op, + gboolean hidden_volume); +GIO_AVAILABLE_IN_2_58 +gboolean g_mount_operation_get_is_tcrypt_system_volume (GMountOperation *op); +GIO_AVAILABLE_IN_2_58 +void g_mount_operation_set_is_tcrypt_system_volume (GMountOperation *op, + gboolean system_volume); +GIO_AVAILABLE_IN_2_58 +guint g_mount_operation_get_pim (GMountOperation *op); +GIO_AVAILABLE_IN_2_58 +void g_mount_operation_set_pim (GMountOperation *op, + guint pim); + +G_END_DECLS + +#endif /* __G_MOUNT_OPERATION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + */ + +#ifndef __G_NATIVE_SOCKET_ADDRESS_H__ +#define __G_NATIVE_SOCKET_ADDRESS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_NATIVE_SOCKET_ADDRESS (g_native_socket_address_get_type ()) +#define G_NATIVE_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddress)) +#define G_NATIVE_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddressClass)) +#define G_IS_NATIVE_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NATIVE_SOCKET_ADDRESS)) +#define G_IS_NATIVE_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NATIVE_SOCKET_ADDRESS)) +#define G_NATIVE_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NATIVE_SOCKET_ADDRESS, GNativeSocketAddressClass)) + +typedef struct _GNativeSocketAddressClass GNativeSocketAddressClass; +typedef struct _GNativeSocketAddressPrivate GNativeSocketAddressPrivate; + +struct _GNativeSocketAddress +{ + GSocketAddress parent_instance; + + /*< private >*/ + GNativeSocketAddressPrivate *priv; +}; + +struct _GNativeSocketAddressClass +{ + GSocketAddressClass parent_class; +}; + +GIO_AVAILABLE_IN_2_46 +GType g_native_socket_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_46 +GSocketAddress *g_native_socket_address_new (gpointer native, + gsize len); + +G_END_DECLS + +#endif /* __G_NATIVE_SOCKET_ADDRESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_NATIVE_VOLUME_MONITOR_H__ +#define __G_NATIVE_VOLUME_MONITOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + * David Zeuthen + */ + +#ifndef __G_VOLUME_MONITOR_H__ +#define __G_VOLUME_MONITOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_VOLUME_MONITOR (g_volume_monitor_get_type ()) +#define G_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitor)) +#define G_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass)) +#define G_VOLUME_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VOLUME_MONITOR, GVolumeMonitorClass)) +#define G_IS_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VOLUME_MONITOR)) +#define G_IS_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VOLUME_MONITOR)) + +/** + * G_VOLUME_MONITOR_EXTENSION_POINT_NAME: + * + * Extension point for volume monitor functionality. + * See [Extending GIO][extending-gio]. + */ +#define G_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-volume-monitor" + +/** + * GVolumeMonitor: + * + * A Volume Monitor that watches for volume events. + **/ +typedef struct _GVolumeMonitorClass GVolumeMonitorClass; + +struct _GVolumeMonitor +{ + GObject parent_instance; + + /*< private >*/ + gpointer priv; +}; + +struct _GVolumeMonitorClass +{ + GObjectClass parent_class; + + /*< public >*/ + /* signals */ + void (* volume_added) (GVolumeMonitor *volume_monitor, + GVolume *volume); + void (* volume_removed) (GVolumeMonitor *volume_monitor, + GVolume *volume); + void (* volume_changed) (GVolumeMonitor *volume_monitor, + GVolume *volume); + + void (* mount_added) (GVolumeMonitor *volume_monitor, + GMount *mount); + void (* mount_removed) (GVolumeMonitor *volume_monitor, + GMount *mount); + void (* mount_pre_unmount) (GVolumeMonitor *volume_monitor, + GMount *mount); + void (* mount_changed) (GVolumeMonitor *volume_monitor, + GMount *mount); + + void (* drive_connected) (GVolumeMonitor *volume_monitor, + GDrive *drive); + void (* drive_disconnected) (GVolumeMonitor *volume_monitor, + GDrive *drive); + void (* drive_changed) (GVolumeMonitor *volume_monitor, + GDrive *drive); + + /* Vtable */ + + gboolean (* is_supported) (void); + + GList * (* get_connected_drives) (GVolumeMonitor *volume_monitor); + GList * (* get_volumes) (GVolumeMonitor *volume_monitor); + GList * (* get_mounts) (GVolumeMonitor *volume_monitor); + + GVolume * (* get_volume_for_uuid) (GVolumeMonitor *volume_monitor, + const char *uuid); + + GMount * (* get_mount_for_uuid) (GVolumeMonitor *volume_monitor, + const char *uuid); + + + /* These arguments are unfortunately backwards by mistake (bug #520169). Deprecated in 2.20. */ + GVolume * (* adopt_orphan_mount) (GMount *mount, + GVolumeMonitor *volume_monitor); + + /* signal added in 2.17 */ + void (* drive_eject_button) (GVolumeMonitor *volume_monitor, + GDrive *drive); + + /* signal added in 2.21 */ + void (* drive_stop_button) (GVolumeMonitor *volume_monitor, + GDrive *drive); + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_volume_monitor_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GVolumeMonitor *g_volume_monitor_get (void); +GIO_AVAILABLE_IN_ALL +GList * g_volume_monitor_get_connected_drives (GVolumeMonitor *volume_monitor); +GIO_AVAILABLE_IN_ALL +GList * g_volume_monitor_get_volumes (GVolumeMonitor *volume_monitor); +GIO_AVAILABLE_IN_ALL +GList * g_volume_monitor_get_mounts (GVolumeMonitor *volume_monitor); +GIO_AVAILABLE_IN_ALL +GVolume * g_volume_monitor_get_volume_for_uuid (GVolumeMonitor *volume_monitor, + const char *uuid); +GIO_AVAILABLE_IN_ALL +GMount * g_volume_monitor_get_mount_for_uuid (GVolumeMonitor *volume_monitor, + const char *uuid); + +GIO_DEPRECATED +GVolume * g_volume_monitor_adopt_orphan_mount (GMount *mount); + +G_END_DECLS + +#endif /* __G_VOLUME_MONITOR_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_NATIVE_VOLUME_MONITOR (g_native_volume_monitor_get_type ()) +#define G_NATIVE_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NATIVE_VOLUME_MONITOR, GNativeVolumeMonitor)) +#define G_NATIVE_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NATIVE_VOLUME_MONITOR, GNativeVolumeMonitorClass)) +#define G_IS_NATIVE_VOLUME_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NATIVE_VOLUME_MONITOR)) +#define G_IS_NATIVE_VOLUME_MONITOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NATIVE_VOLUME_MONITOR)) + +#define G_NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME "gio-native-volume-monitor" + +typedef struct _GNativeVolumeMonitor GNativeVolumeMonitor; +typedef struct _GNativeVolumeMonitorClass GNativeVolumeMonitorClass; + +struct _GNativeVolumeMonitor +{ + GVolumeMonitor parent_instance; +}; + +struct _GNativeVolumeMonitorClass +{ + GVolumeMonitorClass parent_class; + + GMount * (* get_mount_for_mount_path) (const char *mount_path, + GCancellable *cancellable); +}; + +GIO_AVAILABLE_IN_ALL +GType g_native_volume_monitor_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __G_NATIVE_VOLUME_MONITOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_NETWORK_ADDRESS_H__ +#define __G_NETWORK_ADDRESS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_NETWORK_ADDRESS (g_network_address_get_type ()) +#define G_NETWORK_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_ADDRESS, GNetworkAddress)) +#define G_NETWORK_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NETWORK_ADDRESS, GNetworkAddressClass)) +#define G_IS_NETWORK_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_ADDRESS)) +#define G_IS_NETWORK_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NETWORK_ADDRESS)) +#define G_NETWORK_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NETWORK_ADDRESS, GNetworkAddressClass)) + +typedef struct _GNetworkAddressClass GNetworkAddressClass; +typedef struct _GNetworkAddressPrivate GNetworkAddressPrivate; + +struct _GNetworkAddress +{ + GObject parent_instance; + + /*< private >*/ + GNetworkAddressPrivate *priv; +}; + +struct _GNetworkAddressClass +{ + GObjectClass parent_class; + +}; + +GIO_AVAILABLE_IN_ALL +GType g_network_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketConnectable *g_network_address_new (const gchar *hostname, + guint16 port); +GIO_AVAILABLE_IN_2_44 +GSocketConnectable *g_network_address_new_loopback (guint16 port); +GIO_AVAILABLE_IN_ALL +GSocketConnectable *g_network_address_parse (const gchar *host_and_port, + guint16 default_port, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocketConnectable *g_network_address_parse_uri (const gchar *uri, + guint16 default_port, + GError **error); +GIO_AVAILABLE_IN_ALL +const gchar *g_network_address_get_hostname (GNetworkAddress *addr); +GIO_AVAILABLE_IN_ALL +guint16 g_network_address_get_port (GNetworkAddress *addr); +GIO_AVAILABLE_IN_ALL +const gchar *g_network_address_get_scheme (GNetworkAddress *addr); + + +G_END_DECLS + +#endif /* __G_NETWORK_ADDRESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2011 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_NETWORK_MONITOR_H__ +#define __G_NETWORK_MONITOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_NETWORK_MONITOR_EXTENSION_POINT_NAME: + * + * Extension point for network status monitoring functionality. + * See [Extending GIO][extending-gio]. + * + * Since: 2.30 + */ +#define G_NETWORK_MONITOR_EXTENSION_POINT_NAME "gio-network-monitor" + +#define G_TYPE_NETWORK_MONITOR (g_network_monitor_get_type ()) +#define G_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitor)) +#define G_IS_NETWORK_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_MONITOR)) +#define G_NETWORK_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_NETWORK_MONITOR, GNetworkMonitorInterface)) + +typedef struct _GNetworkMonitorInterface GNetworkMonitorInterface; + +struct _GNetworkMonitorInterface { + GTypeInterface g_iface; + + void (*network_changed) (GNetworkMonitor *monitor, + gboolean network_available); + + gboolean (*can_reach) (GNetworkMonitor *monitor, + GSocketConnectable *connectable, + GCancellable *cancellable, + GError **error); + void (*can_reach_async) (GNetworkMonitor *monitor, + GSocketConnectable *connectable, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*can_reach_finish) (GNetworkMonitor *monitor, + GAsyncResult *result, + GError **error); +}; + +GIO_AVAILABLE_IN_2_32 +GType g_network_monitor_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_2_32 +GNetworkMonitor *g_network_monitor_get_default (void); + +GIO_AVAILABLE_IN_2_32 +gboolean g_network_monitor_get_network_available (GNetworkMonitor *monitor); + +GIO_AVAILABLE_IN_2_46 +gboolean g_network_monitor_get_network_metered (GNetworkMonitor *monitor); + +GIO_AVAILABLE_IN_2_44 +GNetworkConnectivity g_network_monitor_get_connectivity (GNetworkMonitor *monitor); + +GIO_AVAILABLE_IN_2_32 +gboolean g_network_monitor_can_reach (GNetworkMonitor *monitor, + GSocketConnectable *connectable, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_32 +void g_network_monitor_can_reach_async (GNetworkMonitor *monitor, + GSocketConnectable *connectable, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_32 +gboolean g_network_monitor_can_reach_finish (GNetworkMonitor *monitor, + GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif /* __G_NETWORK_MONITOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_NETWORK_SERVICE_H__ +#define __G_NETWORK_SERVICE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_NETWORK_SERVICE (g_network_service_get_type ()) +#define G_NETWORK_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NETWORK_SERVICE, GNetworkService)) +#define G_NETWORK_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_NETWORK_SERVICE, GNetworkServiceClass)) +#define G_IS_NETWORK_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NETWORK_SERVICE)) +#define G_IS_NETWORK_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_NETWORK_SERVICE)) +#define G_NETWORK_SERVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_NETWORK_SERVICE, GNetworkServiceClass)) + +typedef struct _GNetworkServiceClass GNetworkServiceClass; +typedef struct _GNetworkServicePrivate GNetworkServicePrivate; + +struct _GNetworkService +{ + GObject parent_instance; + + /*< private >*/ + GNetworkServicePrivate *priv; +}; + +struct _GNetworkServiceClass +{ + GObjectClass parent_class; + +}; + +GIO_AVAILABLE_IN_ALL +GType g_network_service_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketConnectable *g_network_service_new (const gchar *service, + const gchar *protocol, + const gchar *domain); + +GIO_AVAILABLE_IN_ALL +const gchar *g_network_service_get_service (GNetworkService *srv); +GIO_AVAILABLE_IN_ALL +const gchar *g_network_service_get_protocol (GNetworkService *srv); +GIO_AVAILABLE_IN_ALL +const gchar *g_network_service_get_domain (GNetworkService *srv); +GIO_AVAILABLE_IN_ALL +const gchar *g_network_service_get_scheme (GNetworkService *srv); +GIO_AVAILABLE_IN_ALL +void g_network_service_set_scheme (GNetworkService *srv, const gchar *scheme); + +G_END_DECLS + +#endif /* __G_NETWORK_SERVICE_H__ */ +/* + * Copyright © 2013 Lars Uebernickel + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Lars Uebernickel + */ + +#ifndef __G_NOTIFICATION_H__ +#define __G_NOTIFICATION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_NOTIFICATION (g_notification_get_type ()) +#define G_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_NOTIFICATION, GNotification)) +#define G_IS_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_NOTIFICATION)) + +GIO_AVAILABLE_IN_2_40 +GType g_notification_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_40 +GNotification * g_notification_new (const gchar *title); + +GIO_AVAILABLE_IN_2_40 +void g_notification_set_title (GNotification *notification, + const gchar *title); + +GIO_AVAILABLE_IN_2_40 +void g_notification_set_body (GNotification *notification, + const gchar *body); + +GIO_AVAILABLE_IN_2_40 +void g_notification_set_icon (GNotification *notification, + GIcon *icon); + +GIO_DEPRECATED_IN_2_42_FOR(g_notification_set_priority) +void g_notification_set_urgent (GNotification *notification, + gboolean urgent); + +GIO_AVAILABLE_IN_2_42 +void g_notification_set_priority (GNotification *notification, + GNotificationPriority priority); + +GIO_AVAILABLE_IN_2_70 +void g_notification_set_category (GNotification *notification, + const gchar *category); + +GIO_AVAILABLE_IN_2_40 +void g_notification_add_button (GNotification *notification, + const gchar *label, + const gchar *detailed_action); + +GIO_AVAILABLE_IN_2_40 +void g_notification_add_button_with_target (GNotification *notification, + const gchar *label, + const gchar *action, + const gchar *target_format, + ...); + +GIO_AVAILABLE_IN_2_40 +void g_notification_add_button_with_target_value (GNotification *notification, + const gchar *label, + const gchar *action, + GVariant *target); + +GIO_AVAILABLE_IN_2_40 +void g_notification_set_default_action (GNotification *notification, + const gchar *detailed_action); + +GIO_AVAILABLE_IN_2_40 +void g_notification_set_default_action_and_target (GNotification *notification, + const gchar *action, + const gchar *target_format, + ...); + +GIO_AVAILABLE_IN_2_40 +void g_notification_set_default_action_and_target_value (GNotification *notification, + const gchar *action, + GVariant *target); + +G_END_DECLS + +#endif +/* + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_PERMISSION_H__ +#define __G_PERMISSION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_PERMISSION (g_permission_get_type ()) +#define G_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_PERMISSION, GPermission)) +#define G_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_PERMISSION, GPermissionClass)) +#define G_IS_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_PERMISSION)) +#define G_IS_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_PERMISSION)) +#define G_PERMISSION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_PERMISSION, GPermissionClass)) + +typedef struct _GPermissionPrivate GPermissionPrivate; +typedef struct _GPermissionClass GPermissionClass; + +struct _GPermission +{ + GObject parent_instance; + + /*< private >*/ + GPermissionPrivate *priv; +}; + +struct _GPermissionClass { + GObjectClass parent_class; + + gboolean (*acquire) (GPermission *permission, + GCancellable *cancellable, + GError **error); + void (*acquire_async) (GPermission *permission, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*acquire_finish) (GPermission *permission, + GAsyncResult *result, + GError **error); + + gboolean (*release) (GPermission *permission, + GCancellable *cancellable, + GError **error); + void (*release_async) (GPermission *permission, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (*release_finish) (GPermission *permission, + GAsyncResult *result, + GError **error); + + gpointer reserved[16]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_permission_get_type (void); +GIO_AVAILABLE_IN_ALL +gboolean g_permission_acquire (GPermission *permission, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_permission_acquire_async (GPermission *permission, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_permission_acquire_finish (GPermission *permission, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_permission_release (GPermission *permission, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_permission_release_async (GPermission *permission, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_permission_release_finish (GPermission *permission, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_permission_get_allowed (GPermission *permission); +GIO_AVAILABLE_IN_ALL +gboolean g_permission_get_can_acquire (GPermission *permission); +GIO_AVAILABLE_IN_ALL +gboolean g_permission_get_can_release (GPermission *permission); + +GIO_AVAILABLE_IN_ALL +void g_permission_impl_update (GPermission *permission, + gboolean allowed, + gboolean can_acquire, + gboolean can_release); + +G_END_DECLS + +#endif /* __G_PERMISSION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_POLLABLE_INPUT_STREAM_H__ +#define __G_POLLABLE_INPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_POLLABLE_INPUT_STREAM (g_pollable_input_stream_get_type ()) +#define G_POLLABLE_INPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_POLLABLE_INPUT_STREAM, GPollableInputStream)) +#define G_IS_POLLABLE_INPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_POLLABLE_INPUT_STREAM)) +#define G_POLLABLE_INPUT_STREAM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_POLLABLE_INPUT_STREAM, GPollableInputStreamInterface)) + +/** + * GPollableInputStream: + * + * An interface for a #GInputStream that can be polled for readability. + * + * Since: 2.28 + */ +typedef struct _GPollableInputStreamInterface GPollableInputStreamInterface; + +/** + * GPollableInputStreamInterface: + * @g_iface: The parent interface. + * @can_poll: Checks if the #GPollableInputStream instance is actually pollable + * @is_readable: Checks if the stream is readable + * @create_source: Creates a #GSource to poll the stream + * @read_nonblocking: Does a non-blocking read or returns + * %G_IO_ERROR_WOULD_BLOCK + * + * The interface for pollable input streams. + * + * The default implementation of @can_poll always returns %TRUE. + * + * The default implementation of @read_nonblocking calls + * g_pollable_input_stream_is_readable(), and then calls + * g_input_stream_read() if it returns %TRUE. This means you only need + * to override it if it is possible that your @is_readable + * implementation may return %TRUE when the stream is not actually + * readable. + * + * Since: 2.28 + */ +struct _GPollableInputStreamInterface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + gboolean (*can_poll) (GPollableInputStream *stream); + + gboolean (*is_readable) (GPollableInputStream *stream); + GSource * (*create_source) (GPollableInputStream *stream, + GCancellable *cancellable); + gssize (*read_nonblocking) (GPollableInputStream *stream, + void *buffer, + gsize count, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_pollable_input_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_pollable_input_stream_can_poll (GPollableInputStream *stream); + +GIO_AVAILABLE_IN_ALL +gboolean g_pollable_input_stream_is_readable (GPollableInputStream *stream); +GIO_AVAILABLE_IN_ALL +GSource *g_pollable_input_stream_create_source (GPollableInputStream *stream, + GCancellable *cancellable); + +GIO_AVAILABLE_IN_ALL +gssize g_pollable_input_stream_read_nonblocking (GPollableInputStream *stream, + void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); + +G_END_DECLS + + +#endif /* __G_POLLABLE_INPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_POLLABLE_OUTPUT_STREAM_H__ +#define __G_POLLABLE_OUTPUT_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_POLLABLE_OUTPUT_STREAM (g_pollable_output_stream_get_type ()) +#define G_POLLABLE_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM, GPollableOutputStream)) +#define G_IS_POLLABLE_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM)) +#define G_POLLABLE_OUTPUT_STREAM_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_POLLABLE_OUTPUT_STREAM, GPollableOutputStreamInterface)) + +/** + * GPollableOutputStream: + * + * An interface for a #GOutputStream that can be polled for writeability. + * + * Since: 2.28 + */ +typedef struct _GPollableOutputStreamInterface GPollableOutputStreamInterface; + +/** + * GPollableOutputStreamInterface: + * @g_iface: The parent interface. + * @can_poll: Checks if the #GPollableOutputStream instance is actually pollable + * @is_writable: Checks if the stream is writable + * @create_source: Creates a #GSource to poll the stream + * @write_nonblocking: Does a non-blocking write or returns + * %G_IO_ERROR_WOULD_BLOCK + * @writev_nonblocking: Does a vectored non-blocking write, or returns + * %G_POLLABLE_RETURN_WOULD_BLOCK + * + * The interface for pollable output streams. + * + * The default implementation of @can_poll always returns %TRUE. + * + * The default implementation of @write_nonblocking calls + * g_pollable_output_stream_is_writable(), and then calls + * g_output_stream_write() if it returns %TRUE. This means you only + * need to override it if it is possible that your @is_writable + * implementation may return %TRUE when the stream is not actually + * writable. + * + * The default implementation of @writev_nonblocking calls + * g_pollable_output_stream_write_nonblocking() for each vector, and converts + * its return value and error (if set) to a #GPollableReturn. You should + * override this where possible to avoid having to allocate a #GError to return + * %G_IO_ERROR_WOULD_BLOCK. + * + * Since: 2.28 + */ +struct _GPollableOutputStreamInterface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + gboolean (*can_poll) (GPollableOutputStream *stream); + + gboolean (*is_writable) (GPollableOutputStream *stream); + GSource * (*create_source) (GPollableOutputStream *stream, + GCancellable *cancellable); + gssize (*write_nonblocking) (GPollableOutputStream *stream, + const void *buffer, + gsize count, + GError **error); + GPollableReturn (*writev_nonblocking) (GPollableOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, + gsize *bytes_written, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_pollable_output_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_pollable_output_stream_can_poll (GPollableOutputStream *stream); + +GIO_AVAILABLE_IN_ALL +gboolean g_pollable_output_stream_is_writable (GPollableOutputStream *stream); +GIO_AVAILABLE_IN_ALL +GSource *g_pollable_output_stream_create_source (GPollableOutputStream *stream, + GCancellable *cancellable); + +GIO_AVAILABLE_IN_ALL +gssize g_pollable_output_stream_write_nonblocking (GPollableOutputStream *stream, + const void *buffer, + gsize count, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_60 +GPollableReturn g_pollable_output_stream_writev_nonblocking (GPollableOutputStream *stream, + const GOutputVector *vectors, + gsize n_vectors, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); + +G_END_DECLS + + +#endif /* __G_POLLABLE_OUTPUT_STREAM_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2012 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_POLLABLE_UTILS_H__ +#define __G_POLLABLE_UTILS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GIO_AVAILABLE_IN_ALL +GSource *g_pollable_source_new (GObject *pollable_stream); + +GIO_AVAILABLE_IN_2_34 +GSource *g_pollable_source_new_full (gpointer pollable_stream, + GSource *child_source, + GCancellable *cancellable); + +GIO_AVAILABLE_IN_2_34 +gssize g_pollable_stream_read (GInputStream *stream, + void *buffer, + gsize count, + gboolean blocking, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_34 +gssize g_pollable_stream_write (GOutputStream *stream, + const void *buffer, + gsize count, + gboolean blocking, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_34 +gboolean g_pollable_stream_write_all (GOutputStream *stream, + const void *buffer, + gsize count, + gboolean blocking, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); + +G_END_DECLS + +#endif /* _G_POLLABLE_UTILS_H_ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2019 Red Hat, Inc. + * Copyright 2021 Igalia S.L. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_POWER_PROFILE_MONITOR_H__ +#define __G_POWER_PROFILE_MONITOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME: + * + * Extension point for power profile usage monitoring functionality. + * See [Extending GIO][extending-gio]. + * + * Since: 2.70 + */ +#define G_POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME "gio-power-profile-monitor" + +#define G_TYPE_POWER_PROFILE_MONITOR (g_power_profile_monitor_get_type ()) +GIO_AVAILABLE_IN_2_70 +G_DECLARE_INTERFACE (GPowerProfileMonitor, g_power_profile_monitor, g, power_profile_monitor, GObject) + +#define G_POWER_PROFILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_POWER_PROFILE_MONITOR, GPowerProfileMonitor)) +#define G_IS_POWER_PROFILE_MONITOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_POWER_PROFILE_MONITOR)) +#define G_POWER_PROFILE_MONITOR_GET_INTERFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_POWER_PROFILE_MONITOR, GPowerProfileMonitorInterface)) + +struct _GPowerProfileMonitorInterface +{ + /*< private >*/ + GTypeInterface g_iface; +}; + +GIO_AVAILABLE_IN_2_70 +GPowerProfileMonitor *g_power_profile_monitor_dup_default (void); + +GIO_AVAILABLE_IN_2_70 +gboolean g_power_profile_monitor_get_power_saver_enabled (GPowerProfileMonitor *monitor); + +G_END_DECLS + +#endif /* __G_POWER_PROFILE_MONITOR_H__ */ +/* + * Copyright © 2013 Canonical Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_PROPERTY_ACTION_H__ +#define __G_PROPERTY_ACTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_PROPERTY_ACTION (g_property_action_get_type ()) +#define G_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_PROPERTY_ACTION, GPropertyAction)) +#define G_IS_PROPERTY_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_PROPERTY_ACTION)) + +GIO_AVAILABLE_IN_2_38 +GType g_property_action_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_38 +GPropertyAction * g_property_action_new (const gchar *name, + gpointer object, + const gchar *property_name); + +G_END_DECLS + +#endif /* __G_PROPERTY_ACTION_H__ */ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Nicolas Dufresne + */ + +#ifndef __G_PROXY_H__ +#define __G_PROXY_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_PROXY (g_proxy_get_type ()) +#define G_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY, GProxy)) +#define G_IS_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY)) +#define G_PROXY_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_PROXY, GProxyInterface)) + +/** + * G_PROXY_EXTENSION_POINT_NAME: + * + * Extension point for proxy functionality. + * See [Extending GIO][extending-gio]. + * + * Since: 2.26 + */ +#define G_PROXY_EXTENSION_POINT_NAME "gio-proxy" + +/** + * GProxy: + * + * Interface that handles proxy connection and payload. + * + * Since: 2.26 + */ +typedef struct _GProxyInterface GProxyInterface; + +/** + * GProxyInterface: + * @g_iface: The parent interface. + * @connect: Connect to proxy server and wrap (if required) the #connection + * to handle payload. + * @connect_async: Same as connect() but asynchronous. + * @connect_finish: Returns the result of connect_async() + * @supports_hostname: Returns whether the proxy supports hostname lookups. + * + * Provides an interface for handling proxy connection and payload. + * + * Since: 2.26 + */ +struct _GProxyInterface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + GIOStream * (* connect) (GProxy *proxy, + GIOStream *connection, + GProxyAddress *proxy_address, + GCancellable *cancellable, + GError **error); + + void (* connect_async) (GProxy *proxy, + GIOStream *connection, + GProxyAddress *proxy_address, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GIOStream * (* connect_finish) (GProxy *proxy, + GAsyncResult *result, + GError **error); + + gboolean (* supports_hostname) (GProxy *proxy); +}; + +GIO_AVAILABLE_IN_ALL +GType g_proxy_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GProxy *g_proxy_get_default_for_protocol (const gchar *protocol); + +GIO_AVAILABLE_IN_ALL +GIOStream *g_proxy_connect (GProxy *proxy, + GIOStream *connection, + GProxyAddress *proxy_address, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_proxy_connect_async (GProxy *proxy, + GIOStream *connection, + GProxyAddress *proxy_address, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GIOStream *g_proxy_connect_finish (GProxy *proxy, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_proxy_supports_hostname (GProxy *proxy); + +G_END_DECLS + +#endif /* __G_PROXY_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Nicolas Dufresne + */ + +#ifndef __G_PROXY_ADDRESS_H__ +#define __G_PROXY_ADDRESS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_PROXY_ADDRESS (g_proxy_address_get_type ()) +#define G_PROXY_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_ADDRESS, GProxyAddress)) +#define G_PROXY_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_PROXY_ADDRESS, GProxyAddressClass)) +#define G_IS_PROXY_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_ADDRESS)) +#define G_IS_PROXY_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_PROXY_ADDRESS)) +#define G_PROXY_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_PROXY_ADDRESS, GProxyAddressClass)) + +typedef struct _GProxyAddressClass GProxyAddressClass; +typedef struct _GProxyAddressPrivate GProxyAddressPrivate; + +struct _GProxyAddress +{ + GInetSocketAddress parent_instance; + + /*< private >*/ + GProxyAddressPrivate *priv; +}; + +struct _GProxyAddressClass +{ + GInetSocketAddressClass parent_class; +}; + + +GIO_AVAILABLE_IN_ALL +GType g_proxy_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_proxy_address_new (GInetAddress *inetaddr, + guint16 port, + const gchar *protocol, + const gchar *dest_hostname, + guint16 dest_port, + const gchar *username, + const gchar *password); + +GIO_AVAILABLE_IN_ALL +const gchar *g_proxy_address_get_protocol (GProxyAddress *proxy); +GIO_AVAILABLE_IN_2_34 +const gchar *g_proxy_address_get_destination_protocol (GProxyAddress *proxy); +GIO_AVAILABLE_IN_ALL +const gchar *g_proxy_address_get_destination_hostname (GProxyAddress *proxy); +GIO_AVAILABLE_IN_ALL +guint16 g_proxy_address_get_destination_port (GProxyAddress *proxy); +GIO_AVAILABLE_IN_ALL +const gchar *g_proxy_address_get_username (GProxyAddress *proxy); +GIO_AVAILABLE_IN_ALL +const gchar *g_proxy_address_get_password (GProxyAddress *proxy); + +GIO_AVAILABLE_IN_2_34 +const gchar *g_proxy_address_get_uri (GProxyAddress *proxy); + +G_END_DECLS + +#endif /* __G_PROXY_ADDRESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Nicolas Dufresne + */ + +#ifndef __G_PROXY_ADDRESS_ENUMERATOR_H__ +#define __G_PROXY_ADDRESS_ENUMERATOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_SOCKET_ADDRESS_ENUMERATOR_H__ +#define __G_SOCKET_ADDRESS_ENUMERATOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_ADDRESS_ENUMERATOR (g_socket_address_enumerator_get_type ()) +#define G_SOCKET_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SOCKET_ADDRESS_ENUMERATOR, GSocketAddressEnumerator)) +#define G_SOCKET_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SOCKET_ADDRESS_ENUMERATOR, GSocketAddressEnumeratorClass)) +#define G_IS_SOCKET_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SOCKET_ADDRESS_ENUMERATOR)) +#define G_IS_SOCKET_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SOCKET_ADDRESS_ENUMERATOR)) +#define G_SOCKET_ADDRESS_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SOCKET_ADDRESS_ENUMERATOR, GSocketAddressEnumeratorClass)) + +/** + * GSocketAddressEnumerator: + * + * Enumerator type for objects that contain or generate + * #GSocketAddress instances. + */ +typedef struct _GSocketAddressEnumeratorClass GSocketAddressEnumeratorClass; + +struct _GSocketAddressEnumerator +{ + /*< private >*/ + GObject parent_instance; +}; + +/** + * GSocketAddressEnumeratorClass: + * @next: Virtual method for g_socket_address_enumerator_next(). + * @next_async: Virtual method for g_socket_address_enumerator_next_async(). + * @next_finish: Virtual method for g_socket_address_enumerator_next_finish(). + * + * Class structure for #GSocketAddressEnumerator. + */ +struct _GSocketAddressEnumeratorClass +{ + /*< private >*/ + GObjectClass parent_class; + + /*< public >*/ + /* Virtual Table */ + + GSocketAddress * (* next) (GSocketAddressEnumerator *enumerator, + GCancellable *cancellable, + GError **error); + + void (* next_async) (GSocketAddressEnumerator *enumerator, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GSocketAddress * (* next_finish) (GSocketAddressEnumerator *enumerator, + GAsyncResult *result, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_address_enumerator_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_socket_address_enumerator_next (GSocketAddressEnumerator *enumerator, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_socket_address_enumerator_next_async (GSocketAddressEnumerator *enumerator, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_socket_address_enumerator_next_finish (GSocketAddressEnumerator *enumerator, + GAsyncResult *result, + GError **error); + +G_END_DECLS + + +#endif /* __G_SOCKET_ADDRESS_ENUMERATOR_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_PROXY_ADDRESS_ENUMERATOR (g_proxy_address_enumerator_get_type ()) +#define G_PROXY_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_ADDRESS_ENUMERATOR, GProxyAddressEnumerator)) +#define G_PROXY_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_PROXY_ADDRESS_ENUMERATOR, GProxyAddressEnumeratorClass)) +#define G_IS_PROXY_ADDRESS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_ADDRESS_ENUMERATOR)) +#define G_IS_PROXY_ADDRESS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_PROXY_ADDRESS_ENUMERATOR)) +#define G_PROXY_ADDRESS_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_PROXY_ADDRESS_ENUMERATOR, GProxyAddressEnumeratorClass)) + +/** + * GProxyAddressEnumerator: + * + * A subclass of #GSocketAddressEnumerator that takes another address + * enumerator and wraps each of its results in a #GProxyAddress as + * directed by the default #GProxyResolver. + */ + +typedef struct _GProxyAddressEnumeratorClass GProxyAddressEnumeratorClass; +typedef struct _GProxyAddressEnumeratorPrivate GProxyAddressEnumeratorPrivate; + +struct _GProxyAddressEnumerator +{ + /*< private >*/ + GSocketAddressEnumerator parent_instance; + GProxyAddressEnumeratorPrivate *priv; +}; + +/** + * GProxyAddressEnumeratorClass: + * + * Class structure for #GProxyAddressEnumerator. + */ +struct _GProxyAddressEnumeratorClass +{ + /*< private >*/ + GSocketAddressEnumeratorClass parent_class; + + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); + void (*_g_reserved7) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_proxy_address_enumerator_get_type (void) G_GNUC_CONST; + +G_END_DECLS + +#endif /* __G_PROXY_ADDRESS_ENUMERATOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Nicolas Dufresne + */ + +#ifndef __G_PROXY_RESOLVER_H__ +#define __G_PROXY_RESOLVER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_PROXY_RESOLVER (g_proxy_resolver_get_type ()) +#define G_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_RESOLVER, GProxyResolver)) +#define G_IS_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_RESOLVER)) +#define G_PROXY_RESOLVER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_PROXY_RESOLVER, GProxyResolverInterface)) + +/** + * G_PROXY_RESOLVER_EXTENSION_POINT_NAME: + * + * Extension point for proxy resolving functionality. + * See [Extending GIO][extending-gio]. + */ +#define G_PROXY_RESOLVER_EXTENSION_POINT_NAME "gio-proxy-resolver" + +typedef struct _GProxyResolverInterface GProxyResolverInterface; + +struct _GProxyResolverInterface { + GTypeInterface g_iface; + + /* Virtual Table */ + gboolean (* is_supported) (GProxyResolver *resolver); + + gchar ** (* lookup) (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GError **error); + + void (* lookup_async) (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + gchar ** (* lookup_finish) (GProxyResolver *resolver, + GAsyncResult *result, + GError **error); +}; + +GIO_AVAILABLE_IN_ALL +GType g_proxy_resolver_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GProxyResolver *g_proxy_resolver_get_default (void); + +GIO_AVAILABLE_IN_ALL +gboolean g_proxy_resolver_is_supported (GProxyResolver *resolver); +GIO_AVAILABLE_IN_ALL +gchar **g_proxy_resolver_lookup (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_proxy_resolver_lookup_async (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gchar **g_proxy_resolver_lookup_finish (GProxyResolver *resolver, + GAsyncResult *result, + GError **error); + + +G_END_DECLS + +#endif /* __G_PROXY_RESOLVER_H__ */ +/* + * Copyright © 2011 Canonical Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_REMOTE_ACTION_GROUP_H__ +#define __G_REMOTE_ACTION_GROUP_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + + +#define G_TYPE_REMOTE_ACTION_GROUP (g_remote_action_group_get_type ()) +#define G_REMOTE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_REMOTE_ACTION_GROUP, GRemoteActionGroup)) +#define G_IS_REMOTE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_REMOTE_ACTION_GROUP)) +#define G_REMOTE_ACTION_GROUP_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \ + G_TYPE_REMOTE_ACTION_GROUP, \ + GRemoteActionGroupInterface)) + +typedef struct _GRemoteActionGroupInterface GRemoteActionGroupInterface; + +struct _GRemoteActionGroupInterface +{ + GTypeInterface g_iface; + + void (* activate_action_full) (GRemoteActionGroup *remote, + const gchar *action_name, + GVariant *parameter, + GVariant *platform_data); + + void (* change_action_state_full) (GRemoteActionGroup *remote, + const gchar *action_name, + GVariant *value, + GVariant *platform_data); +}; + +GIO_AVAILABLE_IN_2_32 +GType g_remote_action_group_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +void g_remote_action_group_activate_action_full (GRemoteActionGroup *remote, + const gchar *action_name, + GVariant *parameter, + GVariant *platform_data); + +GIO_AVAILABLE_IN_2_32 +void g_remote_action_group_change_action_state_full (GRemoteActionGroup *remote, + const gchar *action_name, + GVariant *value, + GVariant *platform_data); + +G_END_DECLS + +#endif /* __G_REMOTE_ACTION_GROUP_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Red Hat, Inc. + * Copyright (C) 2018 Igalia S.L. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_RESOLVER_H__ +#define __G_RESOLVER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_RESOLVER (g_resolver_get_type ()) +#define G_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_RESOLVER, GResolver)) +#define G_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_RESOLVER, GResolverClass)) +#define G_IS_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_RESOLVER)) +#define G_IS_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_RESOLVER)) +#define G_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_RESOLVER, GResolverClass)) + +typedef struct _GResolverPrivate GResolverPrivate; +typedef struct _GResolverClass GResolverClass; + +struct _GResolver { + GObject parent_instance; + + GResolverPrivate *priv; +}; + +/** + * GResolverNameLookupFlags: + * @G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT: default behavior (same as g_resolver_lookup_by_name()) + * @G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY: only resolve ipv4 addresses + * @G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY: only resolve ipv6 addresses + * + * Flags to modify lookup behavior. + * + * Since: 2.60 + */ +typedef enum { + G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT = 0, + G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY = 1 << 0, + G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY = 1 << 1, +} GResolverNameLookupFlags; + +struct _GResolverClass { + GObjectClass parent_class; + + /* Signals */ + void ( *reload) (GResolver *resolver); + + /* Virtual methods */ + GList * ( *lookup_by_name) (GResolver *resolver, + const gchar *hostname, + GCancellable *cancellable, + GError **error); + void ( *lookup_by_name_async) (GResolver *resolver, + const gchar *hostname, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GList * ( *lookup_by_name_finish) (GResolver *resolver, + GAsyncResult *result, + GError **error); + + gchar * ( *lookup_by_address) (GResolver *resolver, + GInetAddress *address, + GCancellable *cancellable, + GError **error); + void ( *lookup_by_address_async) (GResolver *resolver, + GInetAddress *address, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gchar * ( *lookup_by_address_finish) (GResolver *resolver, + GAsyncResult *result, + GError **error); + + GList * ( *lookup_service) (GResolver *resolver, + const gchar *rrname, + GCancellable *cancellable, + GError **error); + void ( *lookup_service_async) (GResolver *resolver, + const gchar *rrname, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + GList * ( *lookup_service_finish) (GResolver *resolver, + GAsyncResult *result, + GError **error); + + GList * ( *lookup_records) (GResolver *resolver, + const gchar *rrname, + GResolverRecordType record_type, + GCancellable *cancellable, + GError **error); + + void ( *lookup_records_async) (GResolver *resolver, + const gchar *rrname, + GResolverRecordType record_type, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GList * ( *lookup_records_finish) (GResolver *resolver, + GAsyncResult *result, + GError **error); + /** + * GResolverClass::lookup_by_name_with_flags_async: + * @resolver: a #GResolver + * @hostname: the hostname to resolve + * @flags: extra #GResolverNameLookupFlags to modify the lookup + * @cancellable: (nullable): a #GCancellable + * @callback: (scope async): a #GAsyncReadyCallback to call when completed + * @user_data: (closure): data to pass to @callback + * + * Asynchronous version of GResolverClass::lookup_by_name_with_flags + * + * GResolverClass::lookup_by_name_with_flags_finish will be called to get + * the result. + * + * Since: 2.60 + */ + void ( *lookup_by_name_with_flags_async) (GResolver *resolver, + const gchar *hostname, + GResolverNameLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + /** + * GResolverClass::lookup_by_name_with_flags_finish: + * @resolver: a #GResolver + * @result: a #GAsyncResult + * @error: (nullable): a pointer to a %NULL #GError + * + * Gets the result from GResolverClass::lookup_by_name_with_flags_async + * + * Returns: (element-type GInetAddress) (transfer full): List of #GInetAddress. + * Since: 2.60 + */ + GList * ( *lookup_by_name_with_flags_finish) (GResolver *resolver, + GAsyncResult *result, + GError **error); + /** + * GResolverClass::lookup_by_name_with_flags: + * @resolver: a #GResolver + * @hostname: the hostname to resolve + * @flags: extra #GResolverNameLookupFlags to modify the lookup + * @cancellable: (nullable): a #GCancellable + * @error: (nullable): a pointer to a %NULL #GError + * + * This is identical to GResolverClass::lookup_by_name except it takes + * @flags which modifies the behavior of the lookup. See #GResolverNameLookupFlags + * for more details. + * + * Returns: (element-type GInetAddress) (transfer full): List of #GInetAddress. + * Since: 2.60 + */ + GList * ( *lookup_by_name_with_flags) (GResolver *resolver, + const gchar *hostname, + GResolverNameLookupFlags flags, + GCancellable *cancellable, + GError **error); + +}; + +GIO_AVAILABLE_IN_ALL +GType g_resolver_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GResolver *g_resolver_get_default (void); +GIO_AVAILABLE_IN_ALL +void g_resolver_set_default (GResolver *resolver); +GIO_AVAILABLE_IN_ALL +GList *g_resolver_lookup_by_name (GResolver *resolver, + const gchar *hostname, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_resolver_lookup_by_name_async (GResolver *resolver, + const gchar *hostname, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GList *g_resolver_lookup_by_name_finish (GResolver *resolver, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_2_60 +void g_resolver_lookup_by_name_with_flags_async (GResolver *resolver, + const gchar *hostname, + GResolverNameLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_60 +GList *g_resolver_lookup_by_name_with_flags_finish (GResolver *resolver, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_2_60 +GList *g_resolver_lookup_by_name_with_flags (GResolver *resolver, + const gchar *hostname, + GResolverNameLookupFlags flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_resolver_free_addresses (GList *addresses); +GIO_AVAILABLE_IN_ALL +gchar *g_resolver_lookup_by_address (GResolver *resolver, + GInetAddress *address, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_resolver_lookup_by_address_async (GResolver *resolver, + GInetAddress *address, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gchar *g_resolver_lookup_by_address_finish (GResolver *resolver, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +GList *g_resolver_lookup_service (GResolver *resolver, + const gchar *service, + const gchar *protocol, + const gchar *domain, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_resolver_lookup_service_async (GResolver *resolver, + const gchar *service, + const gchar *protocol, + const gchar *domain, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GList *g_resolver_lookup_service_finish (GResolver *resolver, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_2_34 +GList *g_resolver_lookup_records (GResolver *resolver, + const gchar *rrname, + GResolverRecordType record_type, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_34 +void g_resolver_lookup_records_async (GResolver *resolver, + const gchar *rrname, + GResolverRecordType record_type, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_34 +GList *g_resolver_lookup_records_finish (GResolver *resolver, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_resolver_free_targets (GList *targets); + + +/** + * G_RESOLVER_ERROR: + * + * Error domain for #GResolver. Errors in this domain will be from the + * #GResolverError enumeration. See #GError for more information on + * error domains. + */ +#define G_RESOLVER_ERROR (g_resolver_error_quark ()) +GIO_AVAILABLE_IN_ALL +GQuark g_resolver_error_quark (void); + +G_END_DECLS + +#endif /* __G_RESOLVER_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_RESOURCE_H__ +#define __G_RESOURCE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_TYPE_RESOURCE: + * + * The #GType for #GResource. + */ +#define G_TYPE_RESOURCE (g_resource_get_type ()) + + +/** + * G_RESOURCE_ERROR: + * + * Error domain for #GResource. Errors in this domain will be from the + * #GResourceError enumeration. See #GError for more information on + * error domains. + */ +#define G_RESOURCE_ERROR (g_resource_error_quark ()) +GIO_AVAILABLE_IN_2_32 +GQuark g_resource_error_quark (void); + +typedef struct _GStaticResource GStaticResource; + +struct _GStaticResource { + /*< private >*/ + const guint8 *data; + gsize data_len; + GResource *resource; + GStaticResource *next; + gpointer padding; +}; + +GIO_AVAILABLE_IN_2_32 +GType g_resource_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_2_32 +GResource * g_resource_new_from_data (GBytes *data, + GError **error); +GIO_AVAILABLE_IN_2_32 +GResource * g_resource_ref (GResource *resource); +GIO_AVAILABLE_IN_2_32 +void g_resource_unref (GResource *resource); +GIO_AVAILABLE_IN_2_32 +GResource * g_resource_load (const gchar *filename, + GError **error); +GIO_AVAILABLE_IN_2_32 +GInputStream *g_resource_open_stream (GResource *resource, + const char *path, + GResourceLookupFlags lookup_flags, + GError **error); +GIO_AVAILABLE_IN_2_32 +GBytes * g_resource_lookup_data (GResource *resource, + const char *path, + GResourceLookupFlags lookup_flags, + GError **error); +GIO_AVAILABLE_IN_2_32 +char ** g_resource_enumerate_children (GResource *resource, + const char *path, + GResourceLookupFlags lookup_flags, + GError **error); +GIO_AVAILABLE_IN_2_32 +gboolean g_resource_get_info (GResource *resource, + const char *path, + GResourceLookupFlags lookup_flags, + gsize *size, + guint32 *flags, + GError **error); + +GIO_AVAILABLE_IN_2_32 +void g_resources_register (GResource *resource); +GIO_AVAILABLE_IN_2_32 +void g_resources_unregister (GResource *resource); +GIO_AVAILABLE_IN_2_32 +GInputStream *g_resources_open_stream (const char *path, + GResourceLookupFlags lookup_flags, + GError **error); +GIO_AVAILABLE_IN_2_32 +GBytes * g_resources_lookup_data (const char *path, + GResourceLookupFlags lookup_flags, + GError **error); +GIO_AVAILABLE_IN_2_32 +char ** g_resources_enumerate_children (const char *path, + GResourceLookupFlags lookup_flags, + GError **error); +GIO_AVAILABLE_IN_2_32 +gboolean g_resources_get_info (const char *path, + GResourceLookupFlags lookup_flags, + gsize *size, + guint32 *flags, + GError **error); + + +GIO_AVAILABLE_IN_2_32 +void g_static_resource_init (GStaticResource *static_resource); +GIO_AVAILABLE_IN_2_32 +void g_static_resource_fini (GStaticResource *static_resource); +GIO_AVAILABLE_IN_2_32 +GResource *g_static_resource_get_resource (GStaticResource *static_resource); + +G_END_DECLS + +#endif /* __G_RESOURCE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_SEEKABLE_H__ +#define __G_SEEKABLE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SEEKABLE (g_seekable_get_type ()) +#define G_SEEKABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SEEKABLE, GSeekable)) +#define G_IS_SEEKABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SEEKABLE)) +#define G_SEEKABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SEEKABLE, GSeekableIface)) + +/** + * GSeekable: + * + * Seek object for streaming operations. + **/ +typedef struct _GSeekableIface GSeekableIface; + +/** + * GSeekableIface: + * @g_iface: The parent interface. + * @tell: Tells the current location within a stream. + * @can_seek: Checks if seeking is supported by the stream. + * @seek: Seeks to a location within a stream. + * @can_truncate: Checks if truncation is supported by the stream. + * @truncate_fn: Truncates a stream. + * + * Provides an interface for implementing seekable functionality on I/O Streams. + **/ +struct _GSeekableIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + goffset (* tell) (GSeekable *seekable); + + gboolean (* can_seek) (GSeekable *seekable); + gboolean (* seek) (GSeekable *seekable, + goffset offset, + GSeekType type, + GCancellable *cancellable, + GError **error); + + gboolean (* can_truncate) (GSeekable *seekable); + gboolean (* truncate_fn) (GSeekable *seekable, + goffset offset, + GCancellable *cancellable, + GError **error); + + /* TODO: Async seek/truncate */ +}; + +GIO_AVAILABLE_IN_ALL +GType g_seekable_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +goffset g_seekable_tell (GSeekable *seekable); +GIO_AVAILABLE_IN_ALL +gboolean g_seekable_can_seek (GSeekable *seekable); +GIO_AVAILABLE_IN_ALL +gboolean g_seekable_seek (GSeekable *seekable, + goffset offset, + GSeekType type, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_seekable_can_truncate (GSeekable *seekable); +GIO_AVAILABLE_IN_ALL +gboolean g_seekable_truncate (GSeekable *seekable, + goffset offset, + GCancellable *cancellable, + GError **error); + +G_END_DECLS + + +#endif /* __G_SEEKABLE_H__ */ +/* + * Copyright © 2009, 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_SETTINGS_H__ +#define __G_SETTINGS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* + * Copyright © 2010 Codethink Limited + * Copyright © 2011 Canonical Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef __G_SETTINGS_SCHEMA_H__ +#define __G_SETTINGS_SCHEMA_H__ + + +G_BEGIN_DECLS + +typedef struct _GSettingsSchemaSource GSettingsSchemaSource; +typedef struct _GSettingsSchema GSettingsSchema; +typedef struct _GSettingsSchemaKey GSettingsSchemaKey; + +#define G_TYPE_SETTINGS_SCHEMA_SOURCE (g_settings_schema_source_get_type ()) +GIO_AVAILABLE_IN_2_32 +GType g_settings_schema_source_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +GSettingsSchemaSource * g_settings_schema_source_get_default (void); +GIO_AVAILABLE_IN_2_32 +GSettingsSchemaSource * g_settings_schema_source_ref (GSettingsSchemaSource *source); +GIO_AVAILABLE_IN_2_32 +void g_settings_schema_source_unref (GSettingsSchemaSource *source); + +GIO_AVAILABLE_IN_2_32 +GSettingsSchemaSource * g_settings_schema_source_new_from_directory (const gchar *directory, + GSettingsSchemaSource *parent, + gboolean trusted, + GError **error); + +GIO_AVAILABLE_IN_2_32 +GSettingsSchema * g_settings_schema_source_lookup (GSettingsSchemaSource *source, + const gchar *schema_id, + gboolean recursive); + +GIO_AVAILABLE_IN_2_40 +void g_settings_schema_source_list_schemas (GSettingsSchemaSource *source, + gboolean recursive, + gchar ***non_relocatable, + gchar ***relocatable); + +#define G_TYPE_SETTINGS_SCHEMA (g_settings_schema_get_type ()) +GIO_AVAILABLE_IN_2_32 +GType g_settings_schema_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +GSettingsSchema * g_settings_schema_ref (GSettingsSchema *schema); +GIO_AVAILABLE_IN_2_32 +void g_settings_schema_unref (GSettingsSchema *schema); + +GIO_AVAILABLE_IN_2_32 +const gchar * g_settings_schema_get_id (GSettingsSchema *schema); +GIO_AVAILABLE_IN_2_32 +const gchar * g_settings_schema_get_path (GSettingsSchema *schema); +GIO_AVAILABLE_IN_2_40 +GSettingsSchemaKey * g_settings_schema_get_key (GSettingsSchema *schema, + const gchar *name); +GIO_AVAILABLE_IN_2_40 +gboolean g_settings_schema_has_key (GSettingsSchema *schema, + const gchar *name); +GIO_AVAILABLE_IN_2_46 +gchar** g_settings_schema_list_keys (GSettingsSchema *schema); + + +GIO_AVAILABLE_IN_2_44 +gchar ** g_settings_schema_list_children (GSettingsSchema *schema); + +#define G_TYPE_SETTINGS_SCHEMA_KEY (g_settings_schema_key_get_type ()) +GIO_AVAILABLE_IN_2_40 +GType g_settings_schema_key_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_40 +GSettingsSchemaKey * g_settings_schema_key_ref (GSettingsSchemaKey *key); +GIO_AVAILABLE_IN_2_40 +void g_settings_schema_key_unref (GSettingsSchemaKey *key); + +GIO_AVAILABLE_IN_2_40 +const GVariantType * g_settings_schema_key_get_value_type (GSettingsSchemaKey *key); +GIO_AVAILABLE_IN_2_40 +GVariant * g_settings_schema_key_get_default_value (GSettingsSchemaKey *key); +GIO_AVAILABLE_IN_2_40 +GVariant * g_settings_schema_key_get_range (GSettingsSchemaKey *key); +GIO_AVAILABLE_IN_2_40 +gboolean g_settings_schema_key_range_check (GSettingsSchemaKey *key, + GVariant *value); + +GIO_AVAILABLE_IN_2_44 +const gchar * g_settings_schema_key_get_name (GSettingsSchemaKey *key); +GIO_AVAILABLE_IN_2_40 +const gchar * g_settings_schema_key_get_summary (GSettingsSchemaKey *key); +GIO_AVAILABLE_IN_2_40 +const gchar * g_settings_schema_key_get_description (GSettingsSchemaKey *key); + +G_END_DECLS + +#endif /* __G_SETTINGS_SCHEMA_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_SETTINGS (g_settings_get_type ()) +#define G_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SETTINGS, GSettings)) +#define G_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SETTINGS, GSettingsClass)) +#define G_IS_SETTINGS(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_SETTINGS)) +#define G_IS_SETTINGS_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_SETTINGS)) +#define G_SETTINGS_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SETTINGS, GSettingsClass)) + +typedef struct _GSettingsPrivate GSettingsPrivate; +typedef struct _GSettingsClass GSettingsClass; + +struct _GSettingsClass +{ + GObjectClass parent_class; + + /* Signals */ + void (*writable_changed) (GSettings *settings, + const gchar *key); + void (*changed) (GSettings *settings, + const gchar *key); + gboolean (*writable_change_event) (GSettings *settings, + GQuark key); + gboolean (*change_event) (GSettings *settings, + const GQuark *keys, + gint n_keys); + + gpointer padding[20]; +}; + +struct _GSettings +{ + GObject parent_instance; + GSettingsPrivate *priv; +}; + + +GIO_AVAILABLE_IN_ALL +GType g_settings_get_type (void); + +GIO_DEPRECATED_IN_2_40_FOR(g_settings_schema_source_list_schemas) +const gchar * const * g_settings_list_schemas (void); +GIO_DEPRECATED_IN_2_40_FOR(g_settings_schema_source_list_schemas) +const gchar * const * g_settings_list_relocatable_schemas (void); +GIO_AVAILABLE_IN_ALL +GSettings * g_settings_new (const gchar *schema_id); +GIO_AVAILABLE_IN_ALL +GSettings * g_settings_new_with_path (const gchar *schema_id, + const gchar *path); +GIO_AVAILABLE_IN_ALL +GSettings * g_settings_new_with_backend (const gchar *schema_id, + GSettingsBackend *backend); +GIO_AVAILABLE_IN_ALL +GSettings * g_settings_new_with_backend_and_path (const gchar *schema_id, + GSettingsBackend *backend, + const gchar *path); +GIO_AVAILABLE_IN_2_32 +GSettings * g_settings_new_full (GSettingsSchema *schema, + GSettingsBackend *backend, + const gchar *path); +GIO_AVAILABLE_IN_ALL +gchar ** g_settings_list_children (GSettings *settings); +GIO_DEPRECATED_IN_2_46_FOR(g_settings_schema_list_keys) +gchar ** g_settings_list_keys (GSettings *settings); +GIO_DEPRECATED_IN_2_40_FOR(g_settings_schema_key_get_range) +GVariant * g_settings_get_range (GSettings *settings, + const gchar *key); +GIO_DEPRECATED_IN_2_40_FOR(g_settings_schema_key_range_check) +gboolean g_settings_range_check (GSettings *settings, + const gchar *key, + GVariant *value); + +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_value (GSettings *settings, + const gchar *key, + GVariant *value); +GIO_AVAILABLE_IN_ALL +GVariant * g_settings_get_value (GSettings *settings, + const gchar *key); + +GIO_AVAILABLE_IN_2_40 +GVariant * g_settings_get_user_value (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_2_40 +GVariant * g_settings_get_default_value (GSettings *settings, + const gchar *key); + +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set (GSettings *settings, + const gchar *key, + const gchar *format, + ...); +GIO_AVAILABLE_IN_ALL +void g_settings_get (GSettings *settings, + const gchar *key, + const gchar *format, + ...); +GIO_AVAILABLE_IN_ALL +void g_settings_reset (GSettings *settings, + const gchar *key); + +GIO_AVAILABLE_IN_ALL +gint g_settings_get_int (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_int (GSettings *settings, + const gchar *key, + gint value); +GIO_AVAILABLE_IN_2_50 +gint64 g_settings_get_int64 (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_2_50 +gboolean g_settings_set_int64 (GSettings *settings, + const gchar *key, + gint64 value); +GIO_AVAILABLE_IN_2_32 +guint g_settings_get_uint (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_2_32 +gboolean g_settings_set_uint (GSettings *settings, + const gchar *key, + guint value); +GIO_AVAILABLE_IN_2_50 +guint64 g_settings_get_uint64 (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_2_50 +gboolean g_settings_set_uint64 (GSettings *settings, + const gchar *key, + guint64 value); +GIO_AVAILABLE_IN_ALL +gchar * g_settings_get_string (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_string (GSettings *settings, + const gchar *key, + const gchar *value); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_get_boolean (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_boolean (GSettings *settings, + const gchar *key, + gboolean value); +GIO_AVAILABLE_IN_ALL +gdouble g_settings_get_double (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_double (GSettings *settings, + const gchar *key, + gdouble value); +GIO_AVAILABLE_IN_ALL +gchar ** g_settings_get_strv (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_strv (GSettings *settings, + const gchar *key, + const gchar *const *value); +GIO_AVAILABLE_IN_ALL +gint g_settings_get_enum (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_enum (GSettings *settings, + const gchar *key, + gint value); +GIO_AVAILABLE_IN_ALL +guint g_settings_get_flags (GSettings *settings, + const gchar *key); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_set_flags (GSettings *settings, + const gchar *key, + guint value); +GIO_AVAILABLE_IN_ALL +GSettings * g_settings_get_child (GSettings *settings, + const gchar *name); + +GIO_AVAILABLE_IN_ALL +gboolean g_settings_is_writable (GSettings *settings, + const gchar *name); + +GIO_AVAILABLE_IN_ALL +void g_settings_delay (GSettings *settings); +GIO_AVAILABLE_IN_ALL +void g_settings_apply (GSettings *settings); +GIO_AVAILABLE_IN_ALL +void g_settings_revert (GSettings *settings); +GIO_AVAILABLE_IN_ALL +gboolean g_settings_get_has_unapplied (GSettings *settings); +GIO_AVAILABLE_IN_ALL +void g_settings_sync (void); + +/** + * GSettingsBindSetMapping: + * @value: a #GValue containing the property value to map + * @expected_type: the #GVariantType to create + * @user_data: user data that was specified when the binding was created + * + * The type for the function that is used to convert an object property + * value to a #GVariant for storing it in #GSettings. + * + * Returns: a new #GVariant holding the data from @value, + * or %NULL in case of an error + */ +typedef GVariant * (*GSettingsBindSetMapping) (const GValue *value, + const GVariantType *expected_type, + gpointer user_data); + +/** + * GSettingsBindGetMapping: + * @value: return location for the property value + * @variant: the #GVariant + * @user_data: user data that was specified when the binding was created + * + * The type for the function that is used to convert from #GSettings to + * an object property. The @value is already initialized to hold values + * of the appropriate type. + * + * Returns: %TRUE if the conversion succeeded, %FALSE in case of an error + */ +typedef gboolean (*GSettingsBindGetMapping) (GValue *value, + GVariant *variant, + gpointer user_data); + +/** + * GSettingsGetMapping: + * @value: the #GVariant to map, or %NULL + * @result: (out): the result of the mapping + * @user_data: (closure): the user data that was passed to + * g_settings_get_mapped() + * + * The type of the function that is used to convert from a value stored + * in a #GSettings to a value that is useful to the application. + * + * If the value is successfully mapped, the result should be stored at + * @result and %TRUE returned. If mapping fails (for example, if @value + * is not in the right format) then %FALSE should be returned. + * + * If @value is %NULL then it means that the mapping function is being + * given a "last chance" to successfully return a valid value. %TRUE + * must be returned in this case. + * + * Returns: %TRUE if the conversion succeeded, %FALSE in case of an error + **/ +typedef gboolean (*GSettingsGetMapping) (GVariant *value, + gpointer *result, + gpointer user_data); + +/** + * GSettingsBindFlags: + * @G_SETTINGS_BIND_DEFAULT: Equivalent to `G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET` + * @G_SETTINGS_BIND_GET: Update the #GObject property when the setting changes. + * It is an error to use this flag if the property is not writable. + * @G_SETTINGS_BIND_SET: Update the setting when the #GObject property changes. + * It is an error to use this flag if the property is not readable. + * @G_SETTINGS_BIND_NO_SENSITIVITY: Do not try to bind a "sensitivity" property to the writability of the setting + * @G_SETTINGS_BIND_GET_NO_CHANGES: When set in addition to %G_SETTINGS_BIND_GET, set the #GObject property + * value initially from the setting, but do not listen for changes of the setting + * @G_SETTINGS_BIND_INVERT_BOOLEAN: When passed to g_settings_bind(), uses a pair of mapping functions that invert + * the boolean value when mapping between the setting and the property. The setting and property must both + * be booleans. You cannot pass this flag to g_settings_bind_with_mapping(). + * + * Flags used when creating a binding. These flags determine in which + * direction the binding works. The default is to synchronize in both + * directions. + */ +typedef enum +{ + G_SETTINGS_BIND_DEFAULT, + G_SETTINGS_BIND_GET = (1<<0), + G_SETTINGS_BIND_SET = (1<<1), + G_SETTINGS_BIND_NO_SENSITIVITY = (1<<2), + G_SETTINGS_BIND_GET_NO_CHANGES = (1<<3), + G_SETTINGS_BIND_INVERT_BOOLEAN = (1<<4) +} GSettingsBindFlags; + +GIO_AVAILABLE_IN_ALL +void g_settings_bind (GSettings *settings, + const gchar *key, + gpointer object, + const gchar *property, + GSettingsBindFlags flags); +GIO_AVAILABLE_IN_ALL +void g_settings_bind_with_mapping (GSettings *settings, + const gchar *key, + gpointer object, + const gchar *property, + GSettingsBindFlags flags, + GSettingsBindGetMapping get_mapping, + GSettingsBindSetMapping set_mapping, + gpointer user_data, + GDestroyNotify destroy); +GIO_AVAILABLE_IN_ALL +void g_settings_bind_writable (GSettings *settings, + const gchar *key, + gpointer object, + const gchar *property, + gboolean inverted); +GIO_AVAILABLE_IN_ALL +void g_settings_unbind (gpointer object, + const gchar *property); + +GIO_AVAILABLE_IN_2_32 +GAction * g_settings_create_action (GSettings *settings, + const gchar *key); + +GIO_AVAILABLE_IN_ALL +gpointer g_settings_get_mapped (GSettings *settings, + const gchar *key, + GSettingsGetMapping mapping, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_SETTINGS_H__ */ +/* + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_SIMPLE_ACTION_H__ +#define __G_SIMPLE_ACTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SIMPLE_ACTION (g_simple_action_get_type ()) +#define G_SIMPLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SIMPLE_ACTION, GSimpleAction)) +#define G_IS_SIMPLE_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SIMPLE_ACTION)) + +GIO_AVAILABLE_IN_ALL +GType g_simple_action_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSimpleAction * g_simple_action_new (const gchar *name, + const GVariantType *parameter_type); + +GIO_AVAILABLE_IN_ALL +GSimpleAction * g_simple_action_new_stateful (const gchar *name, + const GVariantType *parameter_type, + GVariant *state); + +GIO_AVAILABLE_IN_ALL +void g_simple_action_set_enabled (GSimpleAction *simple, + gboolean enabled); + +GIO_AVAILABLE_IN_2_30 +void g_simple_action_set_state (GSimpleAction *simple, + GVariant *value); + +GIO_AVAILABLE_IN_2_44 +void g_simple_action_set_state_hint (GSimpleAction *simple, + GVariant *state_hint); + +G_END_DECLS + +#endif /* __G_SIMPLE_ACTION_H__ */ +/* + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_SIMPLE_ACTION_GROUP_H__ +#define __G_SIMPLE_ACTION_GROUP_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SIMPLE_ACTION_GROUP (g_simple_action_group_get_type ()) +#define G_SIMPLE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SIMPLE_ACTION_GROUP, GSimpleActionGroup)) +#define G_SIMPLE_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SIMPLE_ACTION_GROUP, GSimpleActionGroupClass)) +#define G_IS_SIMPLE_ACTION_GROUP(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SIMPLE_ACTION_GROUP)) +#define G_IS_SIMPLE_ACTION_GROUP_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SIMPLE_ACTION_GROUP)) +#define G_SIMPLE_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SIMPLE_ACTION_GROUP, GSimpleActionGroupClass)) + +typedef struct _GSimpleActionGroupPrivate GSimpleActionGroupPrivate; +typedef struct _GSimpleActionGroupClass GSimpleActionGroupClass; + +/** + * GSimpleActionGroup: + * + * The #GSimpleActionGroup structure contains private data and should only be accessed using the provided API. + * + * Since: 2.28 + */ +struct _GSimpleActionGroup +{ + /*< private >*/ + GObject parent_instance; + + GSimpleActionGroupPrivate *priv; +}; + +struct _GSimpleActionGroupClass +{ + /*< private >*/ + GObjectClass parent_class; + + /*< private >*/ + gpointer padding[12]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_simple_action_group_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSimpleActionGroup * g_simple_action_group_new (void); + +GIO_DEPRECATED_IN_2_38_FOR (g_action_map_lookup_action) +GAction * g_simple_action_group_lookup (GSimpleActionGroup *simple, + const gchar *action_name); + +GIO_DEPRECATED_IN_2_38_FOR (g_action_map_add_action) +void g_simple_action_group_insert (GSimpleActionGroup *simple, + GAction *action); + +GIO_DEPRECATED_IN_2_38_FOR (g_action_map_remove_action) +void g_simple_action_group_remove (GSimpleActionGroup *simple, + const gchar *action_name); + +GIO_DEPRECATED_IN_2_38_FOR (g_action_map_add_action_entries) +void g_simple_action_group_add_entries (GSimpleActionGroup *simple, + const GActionEntry *entries, + gint n_entries, + gpointer user_data); + +G_END_DECLS + +#endif /* __G_SIMPLE_ACTION_GROUP_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_SIMPLE_ASYNC_RESULT_H__ +#define __G_SIMPLE_ASYNC_RESULT_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SIMPLE_ASYNC_RESULT (g_simple_async_result_get_type ()) +#define G_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResult)) +#define G_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass)) +#define G_IS_SIMPLE_ASYNC_RESULT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_ASYNC_RESULT)) +#define G_IS_SIMPLE_ASYNC_RESULT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_ASYNC_RESULT)) +#define G_SIMPLE_ASYNC_RESULT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_ASYNC_RESULT, GSimpleAsyncResultClass)) + +/** + * GSimpleAsyncResult: + * + * A simple implementation of #GAsyncResult. + **/ +typedef struct _GSimpleAsyncResultClass GSimpleAsyncResultClass; + + +GIO_AVAILABLE_IN_ALL +GType g_simple_async_result_get_type (void) G_GNUC_CONST; + +GIO_DEPRECATED_IN_2_46_FOR(g_task_new) +GSimpleAsyncResult *g_simple_async_result_new (GObject *source_object, + GAsyncReadyCallback callback, + gpointer user_data, + gpointer source_tag); +GIO_DEPRECATED_IN_2_46_FOR(g_task_new) +GSimpleAsyncResult *g_simple_async_result_new_error (GObject *source_object, + GAsyncReadyCallback callback, + gpointer user_data, + GQuark domain, + gint code, + const char *format, + ...) G_GNUC_PRINTF (6, 7); +GIO_DEPRECATED_IN_2_46_FOR(g_task_new) +GSimpleAsyncResult *g_simple_async_result_new_from_error (GObject *source_object, + GAsyncReadyCallback callback, + gpointer user_data, + const GError *error); +GIO_DEPRECATED_IN_2_46_FOR(g_task_new) +GSimpleAsyncResult *g_simple_async_result_new_take_error (GObject *source_object, + GAsyncReadyCallback callback, + gpointer user_data, + GError *error); + +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_op_res_gpointer (GSimpleAsyncResult *simple, + gpointer op_res, + GDestroyNotify destroy_op_res); +GIO_DEPRECATED_IN_2_46 +gpointer g_simple_async_result_get_op_res_gpointer (GSimpleAsyncResult *simple); + +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_op_res_gssize (GSimpleAsyncResult *simple, + gssize op_res); +GIO_DEPRECATED_IN_2_46 +gssize g_simple_async_result_get_op_res_gssize (GSimpleAsyncResult *simple); + +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_op_res_gboolean (GSimpleAsyncResult *simple, + gboolean op_res); +GIO_DEPRECATED_IN_2_46 +gboolean g_simple_async_result_get_op_res_gboolean (GSimpleAsyncResult *simple); + + + +GIO_AVAILABLE_IN_2_32 /* Also deprecated, but can't mark something both AVAILABLE and DEPRECATED */ +void g_simple_async_result_set_check_cancellable (GSimpleAsyncResult *simple, + GCancellable *check_cancellable); +GIO_DEPRECATED_IN_2_46 +gpointer g_simple_async_result_get_source_tag (GSimpleAsyncResult *simple); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_handle_cancellation (GSimpleAsyncResult *simple, + gboolean handle_cancellation); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_complete (GSimpleAsyncResult *simple); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_complete_in_idle (GSimpleAsyncResult *simple); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_run_in_thread (GSimpleAsyncResult *simple, + GSimpleAsyncThreadFunc func, + int io_priority, + GCancellable *cancellable); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_from_error (GSimpleAsyncResult *simple, + const GError *error); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_take_error (GSimpleAsyncResult *simple, + GError *error); +GIO_DEPRECATED_IN_2_46 +gboolean g_simple_async_result_propagate_error (GSimpleAsyncResult *simple, + GError **dest); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_error (GSimpleAsyncResult *simple, + GQuark domain, + gint code, + const char *format, + ...) G_GNUC_PRINTF (4, 5); +GIO_DEPRECATED_IN_2_46 +void g_simple_async_result_set_error_va (GSimpleAsyncResult *simple, + GQuark domain, + gint code, + const char *format, + va_list args) + G_GNUC_PRINTF(4, 0); +GIO_DEPRECATED_IN_2_46 +gboolean g_simple_async_result_is_valid (GAsyncResult *result, + GObject *source, + gpointer source_tag); + +GIO_DEPRECATED_IN_2_46_FOR(g_task_report_error) +void g_simple_async_report_error_in_idle (GObject *object, + GAsyncReadyCallback callback, + gpointer user_data, + GQuark domain, + gint code, + const char *format, + ...) G_GNUC_PRINTF(6, 7); +GIO_DEPRECATED_IN_2_46_FOR(g_task_report_error) +void g_simple_async_report_gerror_in_idle (GObject *object, + GAsyncReadyCallback callback, + gpointer user_data, + const GError *error); +GIO_DEPRECATED_IN_2_46_FOR(g_task_report_error) +void g_simple_async_report_take_gerror_in_idle (GObject *object, + GAsyncReadyCallback callback, + gpointer user_data, + GError *error); + +G_END_DECLS + + + +#endif /* __G_SIMPLE_ASYNC_RESULT_H__ */ +/* + * Copyright © 2014 NICE s.r.l. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ignacio Casal Quinteiro + */ + +#ifndef __G_SIMPLE_IO_STREAM_H__ +#define __G_SIMPLE_IO_STREAM_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SIMPLE_IO_STREAM (g_simple_io_stream_get_type ()) +#define G_SIMPLE_IO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SIMPLE_IO_STREAM, GSimpleIOStream)) +#define G_IS_SIMPLE_IO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SIMPLE_IO_STREAM)) + +GIO_AVAILABLE_IN_2_44 +GType g_simple_io_stream_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_44 +GIOStream *g_simple_io_stream_new (GInputStream *input_stream, + GOutputStream *output_stream); + +G_END_DECLS + +#endif /* __G_SIMPLE_IO_STREAM_H__ */ +/* + * Copyright © 2010 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#ifndef __G_SIMPLE_PERMISSION_H__ +#define __G_SIMPLE_PERMISSION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SIMPLE_PERMISSION (g_simple_permission_get_type ()) +#define G_SIMPLE_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SIMPLE_PERMISSION, \ + GSimplePermission)) +#define G_IS_SIMPLE_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SIMPLE_PERMISSION)) + +GIO_AVAILABLE_IN_ALL +GType g_simple_permission_get_type (void); +GIO_AVAILABLE_IN_ALL +GPermission * g_simple_permission_new (gboolean allowed); + +G_END_DECLS + +#endif /* __G_SIMPLE_PERMISSION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2010, 2013 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_SIMPLE_PROXY_RESOLVER_H__ +#define __G_SIMPLE_PROXY_RESOLVER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SIMPLE_PROXY_RESOLVER (g_simple_proxy_resolver_get_type ()) +#define G_SIMPLE_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SIMPLE_PROXY_RESOLVER, GSimpleProxyResolver)) +#define G_SIMPLE_PROXY_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_SIMPLE_PROXY_RESOLVER, GSimpleProxyResolverClass)) +#define G_IS_SIMPLE_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SIMPLE_PROXY_RESOLVER)) +#define G_IS_SIMPLE_PROXY_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_SIMPLE_PROXY_RESOLVER)) +#define G_SIMPLE_PROXY_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_SIMPLE_PROXY_RESOLVER, GSimpleProxyResolverClass)) + +/** + * GSimpleProxyResolver: + * + * A #GProxyResolver implementation for using a fixed set of proxies. + **/ +typedef struct _GSimpleProxyResolver GSimpleProxyResolver; +typedef struct _GSimpleProxyResolverPrivate GSimpleProxyResolverPrivate; +typedef struct _GSimpleProxyResolverClass GSimpleProxyResolverClass; + +struct _GSimpleProxyResolver +{ + GObject parent_instance; + + /*< private >*/ + GSimpleProxyResolverPrivate *priv; +}; + +struct _GSimpleProxyResolverClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +GIO_AVAILABLE_IN_2_36 +GType g_simple_proxy_resolver_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_36 +GProxyResolver *g_simple_proxy_resolver_new (const gchar *default_proxy, + gchar **ignore_hosts); + +GIO_AVAILABLE_IN_2_36 +void g_simple_proxy_resolver_set_default_proxy (GSimpleProxyResolver *resolver, + const gchar *default_proxy); + +GIO_AVAILABLE_IN_2_36 +void g_simple_proxy_resolver_set_ignore_hosts (GSimpleProxyResolver *resolver, + gchar **ignore_hosts); + +GIO_AVAILABLE_IN_2_36 +void g_simple_proxy_resolver_set_uri_proxy (GSimpleProxyResolver *resolver, + const gchar *uri_scheme, + const gchar *proxy); + +G_END_DECLS + +#endif /* __G_SIMPLE_PROXY_RESOLVER_H__ */ +/* + * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima + * Copyright © 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + * Ryan Lortie + */ + +#ifndef __G_SOCKET_H__ +#define __G_SOCKET_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET (g_socket_get_type ()) +#define G_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SOCKET, GSocket)) +#define G_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SOCKET, GSocketClass)) +#define G_IS_SOCKET(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SOCKET)) +#define G_IS_SOCKET_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SOCKET)) +#define G_SOCKET_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SOCKET, GSocketClass)) + +typedef struct _GSocketPrivate GSocketPrivate; +typedef struct _GSocketClass GSocketClass; + +struct _GSocketClass +{ + GObjectClass parent_class; + + /*< private >*/ + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); + void (*_g_reserved7) (void); + void (*_g_reserved8) (void); + void (*_g_reserved9) (void); + void (*_g_reserved10) (void); +}; + +struct _GSocket +{ + GObject parent_instance; + GSocketPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GSocket * g_socket_new (GSocketFamily family, + GSocketType type, + GSocketProtocol protocol, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocket * g_socket_new_from_fd (gint fd, + GError **error); +GIO_AVAILABLE_IN_ALL +int g_socket_get_fd (GSocket *socket); +GIO_AVAILABLE_IN_ALL +GSocketFamily g_socket_get_family (GSocket *socket); +GIO_AVAILABLE_IN_ALL +GSocketType g_socket_get_socket_type (GSocket *socket); +GIO_AVAILABLE_IN_ALL +GSocketProtocol g_socket_get_protocol (GSocket *socket); +GIO_AVAILABLE_IN_ALL +GSocketAddress * g_socket_get_local_address (GSocket *socket, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocketAddress * g_socket_get_remote_address (GSocket *socket, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_socket_set_blocking (GSocket *socket, + gboolean blocking); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_get_blocking (GSocket *socket); +GIO_AVAILABLE_IN_ALL +void g_socket_set_keepalive (GSocket *socket, + gboolean keepalive); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_get_keepalive (GSocket *socket); +GIO_AVAILABLE_IN_ALL +gint g_socket_get_listen_backlog (GSocket *socket); +GIO_AVAILABLE_IN_ALL +void g_socket_set_listen_backlog (GSocket *socket, + gint backlog); +GIO_AVAILABLE_IN_ALL +guint g_socket_get_timeout (GSocket *socket); +GIO_AVAILABLE_IN_ALL +void g_socket_set_timeout (GSocket *socket, + guint timeout); + +GIO_AVAILABLE_IN_2_32 +guint g_socket_get_ttl (GSocket *socket); +GIO_AVAILABLE_IN_2_32 +void g_socket_set_ttl (GSocket *socket, + guint ttl); + +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_get_broadcast (GSocket *socket); +GIO_AVAILABLE_IN_2_32 +void g_socket_set_broadcast (GSocket *socket, + gboolean broadcast); + +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_get_multicast_loopback (GSocket *socket); +GIO_AVAILABLE_IN_2_32 +void g_socket_set_multicast_loopback (GSocket *socket, + gboolean loopback); +GIO_AVAILABLE_IN_2_32 +guint g_socket_get_multicast_ttl (GSocket *socket); +GIO_AVAILABLE_IN_2_32 +void g_socket_set_multicast_ttl (GSocket *socket, + guint ttl); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_is_connected (GSocket *socket); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_bind (GSocket *socket, + GSocketAddress *address, + gboolean allow_reuse, + GError **error); +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_join_multicast_group (GSocket *socket, + GInetAddress *group, + gboolean source_specific, + const gchar *iface, + GError **error); +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_leave_multicast_group (GSocket *socket, + GInetAddress *group, + gboolean source_specific, + const gchar *iface, + GError **error); +GIO_AVAILABLE_IN_2_56 +gboolean g_socket_join_multicast_group_ssm (GSocket *socket, + GInetAddress *group, + GInetAddress *source_specific, + const gchar *iface, + GError **error); +GIO_AVAILABLE_IN_2_56 +gboolean g_socket_leave_multicast_group_ssm (GSocket *socket, + GInetAddress *group, + GInetAddress *source_specific, + const gchar *iface, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_connect (GSocket *socket, + GSocketAddress *address, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_check_connect_result (GSocket *socket, + GError **error); + +GIO_AVAILABLE_IN_ALL +gssize g_socket_get_available_bytes (GSocket *socket); + +GIO_AVAILABLE_IN_ALL +GIOCondition g_socket_condition_check (GSocket *socket, + GIOCondition condition); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_condition_wait (GSocket *socket, + GIOCondition condition, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_condition_timed_wait (GSocket *socket, + GIOCondition condition, + gint64 timeout_us, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocket * g_socket_accept (GSocket *socket, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_listen (GSocket *socket, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_receive (GSocket *socket, + gchar *buffer, + gsize size, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_receive_from (GSocket *socket, + GSocketAddress **address, + gchar *buffer, + gsize size, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_send (GSocket *socket, + const gchar *buffer, + gsize size, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_send_to (GSocket *socket, + GSocketAddress *address, + const gchar *buffer, + gsize size, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_receive_message (GSocket *socket, + GSocketAddress **address, + GInputVector *vectors, + gint num_vectors, + GSocketControlMessage ***messages, + gint *num_messages, + gint *flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_send_message (GSocket *socket, + GSocketAddress *address, + GOutputVector *vectors, + gint num_vectors, + GSocketControlMessage **messages, + gint num_messages, + gint flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_48 +gint g_socket_receive_messages (GSocket *socket, + GInputMessage *messages, + guint num_messages, + gint flags, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_44 +gint g_socket_send_messages (GSocket *socket, + GOutputMessage *messages, + guint num_messages, + gint flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_socket_close (GSocket *socket, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_shutdown (GSocket *socket, + gboolean shutdown_read, + gboolean shutdown_write, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_is_closed (GSocket *socket); +GIO_AVAILABLE_IN_ALL +GSource * g_socket_create_source (GSocket *socket, + GIOCondition condition, + GCancellable *cancellable); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_speaks_ipv4 (GSocket *socket); +GIO_AVAILABLE_IN_ALL +GCredentials *g_socket_get_credentials (GSocket *socket, + GError **error); + +GIO_AVAILABLE_IN_ALL +gssize g_socket_receive_with_blocking (GSocket *socket, + gchar *buffer, + gsize size, + gboolean blocking, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gssize g_socket_send_with_blocking (GSocket *socket, + const gchar *buffer, + gsize size, + gboolean blocking, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_60 +GPollableReturn g_socket_send_message_with_timeout (GSocket *socket, + GSocketAddress *address, + const GOutputVector *vectors, + gint num_vectors, + GSocketControlMessage **messages, + gint num_messages, + gint flags, + gint64 timeout_us, + gsize *bytes_written, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_36 +gboolean g_socket_get_option (GSocket *socket, + gint level, + gint optname, + gint *value, + GError **error); +GIO_AVAILABLE_IN_2_36 +gboolean g_socket_set_option (GSocket *socket, + gint level, + gint optname, + gint value, + GError **error); + +G_END_DECLS + +#endif /* __G_SOCKET_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2008, 2009 Codethink Limited + * Copyright © 2009 Red Hat, Inc + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + * Alexander Larsson + */ + +#ifndef __G_SOCKET_CLIENT_H__ +#define __G_SOCKET_CLIENT_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_CLIENT (g_socket_client_get_type ()) +#define G_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SOCKET_CLIENT, GSocketClient)) +#define G_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SOCKET_CLIENT, GSocketClientClass)) +#define G_IS_SOCKET_CLIENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SOCKET_CLIENT)) +#define G_IS_SOCKET_CLIENT_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SOCKET_CLIENT)) +#define G_SOCKET_CLIENT_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SOCKET_CLIENT, GSocketClientClass)) + +typedef struct _GSocketClientPrivate GSocketClientPrivate; +typedef struct _GSocketClientClass GSocketClientClass; + +struct _GSocketClientClass +{ + GObjectClass parent_class; + + void (* event) (GSocketClient *client, + GSocketClientEvent event, + GSocketConnectable *connectable, + GIOStream *connection); + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); +}; + +struct _GSocketClient +{ + GObject parent_instance; + GSocketClientPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_client_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketClient *g_socket_client_new (void); + +GIO_AVAILABLE_IN_ALL +GSocketFamily g_socket_client_get_family (GSocketClient *client); +GIO_AVAILABLE_IN_ALL +void g_socket_client_set_family (GSocketClient *client, + GSocketFamily family); +GIO_AVAILABLE_IN_ALL +GSocketType g_socket_client_get_socket_type (GSocketClient *client); +GIO_AVAILABLE_IN_ALL +void g_socket_client_set_socket_type (GSocketClient *client, + GSocketType type); +GIO_AVAILABLE_IN_ALL +GSocketProtocol g_socket_client_get_protocol (GSocketClient *client); +GIO_AVAILABLE_IN_ALL +void g_socket_client_set_protocol (GSocketClient *client, + GSocketProtocol protocol); +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_socket_client_get_local_address (GSocketClient *client); +GIO_AVAILABLE_IN_ALL +void g_socket_client_set_local_address (GSocketClient *client, + GSocketAddress *address); +GIO_AVAILABLE_IN_ALL +guint g_socket_client_get_timeout (GSocketClient *client); +GIO_AVAILABLE_IN_ALL +void g_socket_client_set_timeout (GSocketClient *client, + guint timeout); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_client_get_enable_proxy (GSocketClient *client); +GIO_AVAILABLE_IN_ALL +void g_socket_client_set_enable_proxy (GSocketClient *client, + gboolean enable); + +GIO_AVAILABLE_IN_2_28 +gboolean g_socket_client_get_tls (GSocketClient *client); +GIO_AVAILABLE_IN_2_28 +void g_socket_client_set_tls (GSocketClient *client, + gboolean tls); +GIO_DEPRECATED_IN_2_72 +GTlsCertificateFlags g_socket_client_get_tls_validation_flags (GSocketClient *client); +GIO_DEPRECATED_IN_2_72 +void g_socket_client_set_tls_validation_flags (GSocketClient *client, + GTlsCertificateFlags flags); +GIO_AVAILABLE_IN_2_36 +GProxyResolver *g_socket_client_get_proxy_resolver (GSocketClient *client); +GIO_AVAILABLE_IN_2_36 +void g_socket_client_set_proxy_resolver (GSocketClient *client, + GProxyResolver *proxy_resolver); + +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect (GSocketClient *client, + GSocketConnectable *connectable, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect_to_host (GSocketClient *client, + const gchar *host_and_port, + guint16 default_port, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect_to_service (GSocketClient *client, + const gchar *domain, + const gchar *service, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_26 +GSocketConnection * g_socket_client_connect_to_uri (GSocketClient *client, + const gchar *uri, + guint16 default_port, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_socket_client_connect_async (GSocketClient *client, + GSocketConnectable *connectable, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect_finish (GSocketClient *client, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_socket_client_connect_to_host_async (GSocketClient *client, + const gchar *host_and_port, + guint16 default_port, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect_to_host_finish (GSocketClient *client, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_socket_client_connect_to_service_async (GSocketClient *client, + const gchar *domain, + const gchar *service, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect_to_service_finish (GSocketClient *client, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_socket_client_connect_to_uri_async (GSocketClient *client, + const gchar *uri, + guint16 default_port, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_client_connect_to_uri_finish (GSocketClient *client, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_socket_client_add_application_proxy (GSocketClient *client, + const gchar *protocol); + +G_END_DECLS + +#endif /* __G_SOCKET_CLIENT_H___ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_SOCKET_CONNECTABLE_H__ +#define __G_SOCKET_CONNECTABLE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_CONNECTABLE (g_socket_connectable_get_type ()) +#define G_SOCKET_CONNECTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_SOCKET_CONNECTABLE, GSocketConnectable)) +#define G_IS_SOCKET_CONNECTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_SOCKET_CONNECTABLE)) +#define G_SOCKET_CONNECTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_SOCKET_CONNECTABLE, GSocketConnectableIface)) + +/** + * GSocketConnectable: + * + * Interface for objects that contain or generate a #GSocketAddress. + */ +typedef struct _GSocketConnectableIface GSocketConnectableIface; + +/** + * GSocketConnectableIface: + * @g_iface: The parent interface. + * @enumerate: Creates a #GSocketAddressEnumerator + * @proxy_enumerate: Creates a #GProxyAddressEnumerator + * @to_string: Format the connectable’s address as a string for debugging. + * Implementing this is optional. (Since: 2.48) + * + * Provides an interface for returning a #GSocketAddressEnumerator + * and #GProxyAddressEnumerator + */ +struct _GSocketConnectableIface +{ + GTypeInterface g_iface; + + /* Virtual Table */ + + GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable); + + GSocketAddressEnumerator * (* proxy_enumerate) (GSocketConnectable *connectable); + + gchar * (* to_string) (GSocketConnectable *connectable); +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_connectable_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketAddressEnumerator *g_socket_connectable_enumerate (GSocketConnectable *connectable); + +GIO_AVAILABLE_IN_ALL +GSocketAddressEnumerator *g_socket_connectable_proxy_enumerate (GSocketConnectable *connectable); + +GIO_AVAILABLE_IN_2_48 +gchar *g_socket_connectable_to_string (GSocketConnectable *connectable); + +G_END_DECLS + + +#endif /* __G_SOCKET_CONNECTABLE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima + * Copyright © 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + * Ryan Lortie + * Alexander Larsson + */ + +#ifndef __G_SOCKET_CONNECTION_H__ +#define __G_SOCKET_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_CONNECTION (g_socket_connection_get_type ()) +#define G_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SOCKET_CONNECTION, GSocketConnection)) +#define G_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass)) +#define G_IS_SOCKET_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SOCKET_CONNECTION)) +#define G_IS_SOCKET_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SOCKET_CONNECTION)) +#define G_SOCKET_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SOCKET_CONNECTION, GSocketConnectionClass)) + +typedef struct _GSocketConnectionPrivate GSocketConnectionPrivate; +typedef struct _GSocketConnectionClass GSocketConnectionClass; + +struct _GSocketConnectionClass +{ + GIOStreamClass parent_class; + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); +}; + +struct _GSocketConnection +{ + GIOStream parent_instance; + GSocketConnectionPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_connection_is_connected (GSocketConnection *connection); +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_connection_connect (GSocketConnection *connection, + GSocketAddress *address, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_32 +void g_socket_connection_connect_async (GSocketConnection *connection, + GSocketAddress *address, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_32 +gboolean g_socket_connection_connect_finish (GSocketConnection *connection, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +GSocket *g_socket_connection_get_socket (GSocketConnection *connection); +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_socket_connection_get_local_address (GSocketConnection *connection, + GError **error); +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_socket_connection_get_remote_address (GSocketConnection *connection, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_socket_connection_factory_register_type (GType g_type, + GSocketFamily family, + GSocketType type, + gint protocol); +GIO_AVAILABLE_IN_ALL +GType g_socket_connection_factory_lookup_type (GSocketFamily family, + GSocketType type, + gint protocol_id); +GIO_AVAILABLE_IN_ALL +GSocketConnection *g_socket_connection_factory_create_connection (GSocket *socket); + +G_END_DECLS + +#endif /* __G_SOCKET_CONNECTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_SOCKET_CONTROL_MESSAGE_H__ +#define __G_SOCKET_CONTROL_MESSAGE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_CONTROL_MESSAGE (g_socket_control_message_get_type ()) +#define G_SOCKET_CONTROL_MESSAGE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SOCKET_CONTROL_MESSAGE, \ + GSocketControlMessage)) +#define G_SOCKET_CONTROL_MESSAGE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SOCKET_CONTROL_MESSAGE, \ + GSocketControlMessageClass)) +#define G_IS_SOCKET_CONTROL_MESSAGE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SOCKET_CONTROL_MESSAGE)) +#define G_IS_SOCKET_CONTROL_MESSAGE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SOCKET_CONTROL_MESSAGE)) +#define G_SOCKET_CONTROL_MESSAGE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SOCKET_CONTROL_MESSAGE, \ + GSocketControlMessageClass)) + +typedef struct _GSocketControlMessagePrivate GSocketControlMessagePrivate; +typedef struct _GSocketControlMessageClass GSocketControlMessageClass; + +/** + * GSocketControlMessageClass: + * @get_size: gets the size of the message. + * @get_level: gets the protocol of the message. + * @get_type: gets the protocol specific type of the message. + * @serialize: Writes out the message data. + * @deserialize: Tries to deserialize a message. + * + * Class structure for #GSocketControlMessage. + **/ + +struct _GSocketControlMessageClass +{ + GObjectClass parent_class; + + gsize (* get_size) (GSocketControlMessage *message); + int (* get_level) (GSocketControlMessage *message); + int (* get_type) (GSocketControlMessage *message); + void (* serialize) (GSocketControlMessage *message, + gpointer data); + GSocketControlMessage *(* deserialize) (int level, + int type, + gsize size, + gpointer data); + + /*< private >*/ + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +struct _GSocketControlMessage +{ + GObject parent_instance; + GSocketControlMessagePrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_control_message_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +gsize g_socket_control_message_get_size (GSocketControlMessage *message); +GIO_AVAILABLE_IN_ALL +int g_socket_control_message_get_level (GSocketControlMessage *message); +GIO_AVAILABLE_IN_ALL +int g_socket_control_message_get_msg_type (GSocketControlMessage *message); +GIO_AVAILABLE_IN_ALL +void g_socket_control_message_serialize (GSocketControlMessage *message, + gpointer data); +GIO_AVAILABLE_IN_ALL +GSocketControlMessage *g_socket_control_message_deserialize (int level, + int type, + gsize size, + gpointer data); + + +G_END_DECLS + +#endif /* __G_SOCKET_CONTROL_MESSAGE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2008 Christian Kellner, Samuel Cormier-Iijima + * Copyright © 2009 Codethink Limited + * Copyright © 2009 Red Hat, Inc + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + * Ryan Lortie + * Alexander Larsson + */ + +#ifndef __G_SOCKET_LISTENER_H__ +#define __G_SOCKET_LISTENER_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_LISTENER (g_socket_listener_get_type ()) +#define G_SOCKET_LISTENER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SOCKET_LISTENER, GSocketListener)) +#define G_SOCKET_LISTENER_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SOCKET_LISTENER, GSocketListenerClass)) +#define G_IS_SOCKET_LISTENER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SOCKET_LISTENER)) +#define G_IS_SOCKET_LISTENER_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SOCKET_LISTENER)) +#define G_SOCKET_LISTENER_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SOCKET_LISTENER, GSocketListenerClass)) + +typedef struct _GSocketListenerPrivate GSocketListenerPrivate; +typedef struct _GSocketListenerClass GSocketListenerClass; + +/** + * GSocketListenerClass: + * @changed: virtual method called when the set of socket listened to changes + * + * Class structure for #GSocketListener. + **/ +struct _GSocketListenerClass +{ + GObjectClass parent_class; + + void (* changed) (GSocketListener *listener); + + void (* event) (GSocketListener *listener, + GSocketListenerEvent event, + GSocket *socket); + + /* Padding for future expansion */ + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); +}; + +struct _GSocketListener +{ + GObject parent_instance; + GSocketListenerPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_listener_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketListener * g_socket_listener_new (void); + +GIO_AVAILABLE_IN_ALL +void g_socket_listener_set_backlog (GSocketListener *listener, + int listen_backlog); + +GIO_AVAILABLE_IN_ALL +gboolean g_socket_listener_add_socket (GSocketListener *listener, + GSocket *socket, + GObject *source_object, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_listener_add_address (GSocketListener *listener, + GSocketAddress *address, + GSocketType type, + GSocketProtocol protocol, + GObject *source_object, + GSocketAddress **effective_address, + GError **error); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_listener_add_inet_port (GSocketListener *listener, + guint16 port, + GObject *source_object, + GError **error); +GIO_AVAILABLE_IN_ALL +guint16 g_socket_listener_add_any_inet_port (GSocketListener *listener, + GObject *source_object, + GError **error); + +GIO_AVAILABLE_IN_ALL +GSocket * g_socket_listener_accept_socket (GSocketListener *listener, + GObject **source_object, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +void g_socket_listener_accept_socket_async (GSocketListener *listener, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GSocket * g_socket_listener_accept_socket_finish (GSocketListener *listener, + GAsyncResult *result, + GObject **source_object, + GError **error); + + +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_listener_accept (GSocketListener *listener, + GObject **source_object, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_socket_listener_accept_async (GSocketListener *listener, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GSocketConnection * g_socket_listener_accept_finish (GSocketListener *listener, + GAsyncResult *result, + GObject **source_object, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_socket_listener_close (GSocketListener *listener); + +G_END_DECLS + +#endif /* __G_SOCKET_LISTENER_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2009 Codethink Limited + * Copyright © 2009 Red Hat, Inc + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + * Alexander Larsson + */ + +#ifndef __G_SOCKET_SERVICE_H__ +#define __G_SOCKET_SERVICE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_SOCKET_SERVICE (g_socket_service_get_type ()) +#define G_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_SOCKET_SERVICE, GSocketService)) +#define G_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_SOCKET_SERVICE, GSocketServiceClass)) +#define G_IS_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_SOCKET_SERVICE)) +#define G_IS_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_SOCKET_SERVICE)) +#define G_SOCKET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_SOCKET_SERVICE, GSocketServiceClass)) + +typedef struct _GSocketServicePrivate GSocketServicePrivate; +typedef struct _GSocketServiceClass GSocketServiceClass; + +/** + * GSocketServiceClass: + * @incoming: signal emitted when new connections are accepted + * + * Class structure for #GSocketService. + */ +struct _GSocketServiceClass +{ + GSocketListenerClass parent_class; + + gboolean (* incoming) (GSocketService *service, + GSocketConnection *connection, + GObject *source_object); + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); +}; + +struct _GSocketService +{ + GSocketListener parent_instance; + GSocketServicePrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_socket_service_get_type (void); + +GIO_AVAILABLE_IN_ALL +GSocketService *g_socket_service_new (void); +GIO_AVAILABLE_IN_ALL +void g_socket_service_start (GSocketService *service); +GIO_AVAILABLE_IN_ALL +void g_socket_service_stop (GSocketService *service); +GIO_AVAILABLE_IN_ALL +gboolean g_socket_service_is_active (GSocketService *service); + + +G_END_DECLS + +#endif /* __G_SOCKET_SERVICE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_SRV_TARGET_H__ +#define __G_SRV_TARGET_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +GIO_AVAILABLE_IN_ALL +GType g_srv_target_get_type (void) G_GNUC_CONST; +#define G_TYPE_SRV_TARGET (g_srv_target_get_type ()) + +GIO_AVAILABLE_IN_ALL +GSrvTarget *g_srv_target_new (const gchar *hostname, + guint16 port, + guint16 priority, + guint16 weight); +GIO_AVAILABLE_IN_ALL +GSrvTarget *g_srv_target_copy (GSrvTarget *target); +GIO_AVAILABLE_IN_ALL +void g_srv_target_free (GSrvTarget *target); + +GIO_AVAILABLE_IN_ALL +const gchar *g_srv_target_get_hostname (GSrvTarget *target); +GIO_AVAILABLE_IN_ALL +guint16 g_srv_target_get_port (GSrvTarget *target); +GIO_AVAILABLE_IN_ALL +guint16 g_srv_target_get_priority (GSrvTarget *target); +GIO_AVAILABLE_IN_ALL +guint16 g_srv_target_get_weight (GSrvTarget *target); + +GIO_AVAILABLE_IN_ALL +GList *g_srv_target_list_sort (GList *targets); + +G_END_DECLS + +#endif /* __G_SRV_TARGET_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2012 Colin Walters + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Colin Walters + */ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_SUBPROCESS_H__ +#define __G_SUBPROCESS_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_SUBPROCESS (g_subprocess_get_type ()) +#define G_SUBPROCESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SUBPROCESS, GSubprocess)) +#define G_IS_SUBPROCESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SUBPROCESS)) + +GIO_AVAILABLE_IN_2_40 +GType g_subprocess_get_type (void) G_GNUC_CONST; + +/**** Core API ****/ + +GIO_AVAILABLE_IN_2_40 +GSubprocess * g_subprocess_new (GSubprocessFlags flags, + GError **error, + const gchar *argv0, + ...) G_GNUC_NULL_TERMINATED; +GIO_AVAILABLE_IN_2_40 +GSubprocess * g_subprocess_newv (const gchar * const *argv, + GSubprocessFlags flags, + GError **error); + +GIO_AVAILABLE_IN_2_40 +GOutputStream * g_subprocess_get_stdin_pipe (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +GInputStream * g_subprocess_get_stdout_pipe (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +GInputStream * g_subprocess_get_stderr_pipe (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +const gchar * g_subprocess_get_identifier (GSubprocess *subprocess); + +#ifdef G_OS_UNIX +GIO_AVAILABLE_IN_2_40 +void g_subprocess_send_signal (GSubprocess *subprocess, + gint signal_num); +#endif + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_force_exit (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_wait (GSubprocess *subprocess, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_wait_async (GSubprocess *subprocess, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_wait_finish (GSubprocess *subprocess, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_wait_check (GSubprocess *subprocess, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_wait_check_async (GSubprocess *subprocess, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_wait_check_finish (GSubprocess *subprocess, + GAsyncResult *result, + GError **error); + + +GIO_AVAILABLE_IN_2_40 +gint g_subprocess_get_status (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_get_successful (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_get_if_exited (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gint g_subprocess_get_exit_status (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_get_if_signaled (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gint g_subprocess_get_term_sig (GSubprocess *subprocess); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_communicate (GSubprocess *subprocess, + GBytes *stdin_buf, + GCancellable *cancellable, + GBytes **stdout_buf, + GBytes **stderr_buf, + GError **error); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_communicate_async (GSubprocess *subprocess, + GBytes *stdin_buf, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_communicate_finish (GSubprocess *subprocess, + GAsyncResult *result, + GBytes **stdout_buf, + GBytes **stderr_buf, + GError **error); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_communicate_utf8 (GSubprocess *subprocess, + const char *stdin_buf, + GCancellable *cancellable, + char **stdout_buf, + char **stderr_buf, + GError **error); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_communicate_utf8_async (GSubprocess *subprocess, + const char *stdin_buf, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_40 +gboolean g_subprocess_communicate_utf8_finish (GSubprocess *subprocess, + GAsyncResult *result, + char **stdout_buf, + char **stderr_buf, + GError **error); + +G_END_DECLS + +#endif /* __G_SUBPROCESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2012,2013 Colin Walters + * Copyright © 2012,2013 Canonical Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Ryan Lortie + * Author: Colin Walters + */ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_SUBPROCESS_LAUNCHER_H__ +#define __G_SUBPROCESS_LAUNCHER_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_SUBPROCESS_LAUNCHER (g_subprocess_launcher_get_type ()) +#define G_SUBPROCESS_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_SUBPROCESS_LAUNCHER, GSubprocessLauncher)) +#define G_IS_SUBPROCESS_LAUNCHER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_SUBPROCESS_LAUNCHER)) + +GIO_AVAILABLE_IN_2_40 +GType g_subprocess_launcher_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_40 +GSubprocessLauncher * g_subprocess_launcher_new (GSubprocessFlags flags); + +GIO_AVAILABLE_IN_2_40 +GSubprocess * g_subprocess_launcher_spawn (GSubprocessLauncher *self, + GError **error, + const gchar *argv0, + ...) G_GNUC_NULL_TERMINATED; + +GIO_AVAILABLE_IN_2_40 +GSubprocess * g_subprocess_launcher_spawnv (GSubprocessLauncher *self, + const gchar * const *argv, + GError **error); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_environ (GSubprocessLauncher *self, + gchar **env); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_setenv (GSubprocessLauncher *self, + const gchar *variable, + const gchar *value, + gboolean overwrite); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_unsetenv (GSubprocessLauncher *self, + const gchar *variable); + +GIO_AVAILABLE_IN_2_40 +const gchar * g_subprocess_launcher_getenv (GSubprocessLauncher *self, + const gchar *variable); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_cwd (GSubprocessLauncher *self, + const gchar *cwd); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_flags (GSubprocessLauncher *self, + GSubprocessFlags flags); + +/* Extended I/O control, only available on UNIX */ +#ifdef G_OS_UNIX +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_stdin_file_path (GSubprocessLauncher *self, + const gchar *path); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_take_stdin_fd (GSubprocessLauncher *self, + gint fd); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_stdout_file_path (GSubprocessLauncher *self, + const gchar *path); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_take_stdout_fd (GSubprocessLauncher *self, + gint fd); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_stderr_file_path (GSubprocessLauncher *self, + const gchar *path); +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_take_stderr_fd (GSubprocessLauncher *self, + gint fd); + +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_take_fd (GSubprocessLauncher *self, + gint source_fd, + gint target_fd); + +GIO_AVAILABLE_IN_2_68 +void g_subprocess_launcher_close (GSubprocessLauncher *self); + +/* Child setup, only available on UNIX */ +GIO_AVAILABLE_IN_2_40 +void g_subprocess_launcher_set_child_setup (GSubprocessLauncher *self, + GSpawnChildSetupFunc child_setup, + gpointer user_data, + GDestroyNotify destroy_notify); +#endif + +G_END_DECLS + +#endif /* __G_SUBPROCESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright 2011 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_TASK_H__ +#define __G_TASK_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TASK (g_task_get_type ()) +#define G_TASK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TASK, GTask)) +#define G_TASK_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TASK, GTaskClass)) +#define G_IS_TASK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TASK)) +#define G_IS_TASK_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TASK)) +#define G_TASK_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TASK, GTaskClass)) + +typedef struct _GTaskClass GTaskClass; + +GIO_AVAILABLE_IN_2_36 +GType g_task_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_36 +GTask *g_task_new (gpointer source_object, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer callback_data); + +GIO_AVAILABLE_IN_2_36 +void g_task_report_error (gpointer source_object, + GAsyncReadyCallback callback, + gpointer callback_data, + gpointer source_tag, + GError *error); +GIO_AVAILABLE_IN_2_36 +void g_task_report_new_error (gpointer source_object, + GAsyncReadyCallback callback, + gpointer callback_data, + gpointer source_tag, + GQuark domain, + gint code, + const char *format, + ...) G_GNUC_PRINTF(7, 8); + +GIO_AVAILABLE_IN_2_36 +void g_task_set_task_data (GTask *task, + gpointer task_data, + GDestroyNotify task_data_destroy); +GIO_AVAILABLE_IN_2_36 +void g_task_set_priority (GTask *task, + gint priority); +GIO_AVAILABLE_IN_2_36 +void g_task_set_check_cancellable (GTask *task, + gboolean check_cancellable); +GIO_AVAILABLE_IN_2_36 +void g_task_set_source_tag (GTask *task, + gpointer source_tag); +GIO_AVAILABLE_IN_2_60 +void g_task_set_name (GTask *task, + const gchar *name); +GIO_AVAILABLE_IN_2_76 +void g_task_set_static_name (GTask *task, + const gchar *name); + +/* Macro wrapper to set the task name when setting the source tag. */ +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_76 +#undef g_task_set_source_tag +#define g_task_set_source_tag(task, tag) G_STMT_START { \ + GTask *_task = (task); \ + (_frida_g_task_set_source_tag) (_task, tag); \ + if (g_task_get_name (_task) == NULL) \ + g_task_set_static_name (_task, G_STRINGIFY (tag)); \ +} G_STMT_END +#endif + +#if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_76 +#if defined (__GNUC__) && (__GNUC__ >= 2) +#undef g_task_set_name +#define g_task_set_name(task, name) G_STMT_START { \ + GTask *_task = (task); \ + if (__builtin_constant_p (name)) \ + g_task_set_static_name (_task, name); \ + else \ + _frida_g_task_set_name (_task, name); \ +} G_STMT_END +#endif +#endif + +GIO_AVAILABLE_IN_2_36 +gpointer g_task_get_source_object (GTask *task); +GIO_AVAILABLE_IN_2_36 +gpointer g_task_get_task_data (GTask *task); +GIO_AVAILABLE_IN_2_36 +gint g_task_get_priority (GTask *task); +GIO_AVAILABLE_IN_2_36 +GMainContext *g_task_get_context (GTask *task); +GIO_AVAILABLE_IN_2_36 +GCancellable *g_task_get_cancellable (GTask *task); +GIO_AVAILABLE_IN_2_36 +gboolean g_task_get_check_cancellable (GTask *task); +GIO_AVAILABLE_IN_2_36 +gpointer g_task_get_source_tag (GTask *task); +GIO_AVAILABLE_IN_2_60 +const gchar *g_task_get_name (GTask *task); + +GIO_AVAILABLE_IN_2_36 +gboolean g_task_is_valid (gpointer result, + gpointer source_object); + + +typedef void (*GTaskThreadFunc) (GTask *task, + gpointer source_object, + gpointer task_data, + GCancellable *cancellable); +GIO_AVAILABLE_IN_2_36 +void g_task_run_in_thread (GTask *task, + GTaskThreadFunc task_func); +GIO_AVAILABLE_IN_2_36 +void g_task_run_in_thread_sync (GTask *task, + GTaskThreadFunc task_func); +GIO_AVAILABLE_IN_2_36 +gboolean g_task_set_return_on_cancel (GTask *task, + gboolean return_on_cancel); +GIO_AVAILABLE_IN_2_36 +gboolean g_task_get_return_on_cancel (GTask *task); + +GIO_AVAILABLE_IN_2_36 +void g_task_attach_source (GTask *task, + GSource *source, + GSourceFunc callback); + + +GIO_AVAILABLE_IN_2_36 +void g_task_return_pointer (GTask *task, + gpointer result, + GDestroyNotify result_destroy); +GIO_AVAILABLE_IN_2_36 +void g_task_return_boolean (GTask *task, + gboolean result); +GIO_AVAILABLE_IN_2_36 +void g_task_return_int (GTask *task, + gssize result); + +GIO_AVAILABLE_IN_2_36 +void g_task_return_error (GTask *task, + GError *error); +GIO_AVAILABLE_IN_2_36 +void g_task_return_new_error (GTask *task, + GQuark domain, + gint code, + const char *format, + ...) G_GNUC_PRINTF (4, 5); +GIO_AVAILABLE_IN_2_64 +void g_task_return_value (GTask *task, + GValue *result); + +GIO_AVAILABLE_IN_2_36 +gboolean g_task_return_error_if_cancelled (GTask *task); + +GIO_AVAILABLE_IN_2_36 +gpointer g_task_propagate_pointer (GTask *task, + GError **error); +GIO_AVAILABLE_IN_2_36 +gboolean g_task_propagate_boolean (GTask *task, + GError **error); +GIO_AVAILABLE_IN_2_36 +gssize g_task_propagate_int (GTask *task, + GError **error); +GIO_AVAILABLE_IN_2_64 +gboolean g_task_propagate_value (GTask *task, + GValue *value, + GError **error); +GIO_AVAILABLE_IN_2_36 +gboolean g_task_had_error (GTask *task); +GIO_AVAILABLE_IN_2_44 +gboolean g_task_get_completed (GTask *task); + +G_END_DECLS + +#endif /* __G_TASK_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2008, 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_TCP_CONNECTION_H__ +#define __G_TCP_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TCP_CONNECTION (g_tcp_connection_get_type ()) +#define G_TCP_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_TCP_CONNECTION, GTcpConnection)) +#define G_TCP_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_TCP_CONNECTION, GTcpConnectionClass)) +#define G_IS_TCP_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_TCP_CONNECTION)) +#define G_IS_TCP_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_TCP_CONNECTION)) +#define G_TCP_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_TCP_CONNECTION, GTcpConnectionClass)) + +typedef struct _GTcpConnectionPrivate GTcpConnectionPrivate; +typedef struct _GTcpConnectionClass GTcpConnectionClass; + +struct _GTcpConnectionClass +{ + GSocketConnectionClass parent_class; +}; + +struct _GTcpConnection +{ + GSocketConnection parent_instance; + GTcpConnectionPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tcp_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +void g_tcp_connection_set_graceful_disconnect (GTcpConnection *connection, + gboolean graceful_disconnect); +GIO_AVAILABLE_IN_ALL +gboolean g_tcp_connection_get_graceful_disconnect (GTcpConnection *connection); + +G_END_DECLS + +#endif /* __G_TCP_CONNECTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * Copyright © 2010 Collabora Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Nicolas Dufresne + * + */ + +#ifndef __G_TCP_WRAPPER_CONNECTION_H__ +#define __G_TCP_WRAPPER_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TCP_WRAPPER_CONNECTION (g_tcp_wrapper_connection_get_type ()) +#define G_TCP_WRAPPER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_TCP_WRAPPER_CONNECTION, GTcpWrapperConnection)) +#define G_TCP_WRAPPER_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_TCP_WRAPPER_CONNECTION, GTcpWrapperConnectionClass)) +#define G_IS_TCP_WRAPPER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_TCP_WRAPPER_CONNECTION)) +#define G_IS_TCP_WRAPPER_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_TCP_WRAPPER_CONNECTION)) +#define G_TCP_WRAPPER_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_TCP_WRAPPER_CONNECTION, GTcpWrapperConnectionClass)) + +typedef struct _GTcpWrapperConnectionPrivate GTcpWrapperConnectionPrivate; +typedef struct _GTcpWrapperConnectionClass GTcpWrapperConnectionClass; + +struct _GTcpWrapperConnectionClass +{ + GTcpConnectionClass parent_class; +}; + +struct _GTcpWrapperConnection +{ + GTcpConnection parent_instance; + GTcpWrapperConnectionPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tcp_wrapper_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketConnection *g_tcp_wrapper_connection_new (GIOStream *base_io_stream, + GSocket *socket); +GIO_AVAILABLE_IN_ALL +GIOStream *g_tcp_wrapper_connection_get_base_io_stream (GTcpWrapperConnection *conn); + +G_END_DECLS + +#endif /* __G_TCP_WRAPPER_CONNECTION_H__ */ +/* GIO testing utilities + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * Copyright (C) 2012 Collabora Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: David Zeuthen + * Xavier Claessens + */ + +#ifndef __G_TEST_DBUS_H__ +#define __G_TEST_DBUS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TEST_DBUS \ + (g_test_dbus_get_type ()) +#define G_TEST_DBUS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TEST_DBUS, \ + GTestDBus)) +#define G_IS_TEST_DBUS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TEST_DBUS)) + +GIO_AVAILABLE_IN_2_34 +GType g_test_dbus_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_2_34 +GTestDBus * g_test_dbus_new (GTestDBusFlags flags); + +GIO_AVAILABLE_IN_2_34 +GTestDBusFlags g_test_dbus_get_flags (GTestDBus *self); + +GIO_AVAILABLE_IN_2_34 +const gchar * g_test_dbus_get_bus_address (GTestDBus *self); + +GIO_AVAILABLE_IN_2_34 +void g_test_dbus_add_service_dir (GTestDBus *self, + const gchar *path); + +GIO_AVAILABLE_IN_2_34 +void g_test_dbus_up (GTestDBus *self); + +GIO_AVAILABLE_IN_2_34 +void g_test_dbus_stop (GTestDBus *self); + +GIO_AVAILABLE_IN_2_34 +void g_test_dbus_down (GTestDBus *self); + +GIO_AVAILABLE_IN_2_34 +void g_test_dbus_unset (void); + +G_END_DECLS + +#endif /* __G_TEST_DBUS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_THEMED_ICON_H__ +#define __G_THEMED_ICON_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_THEMED_ICON (g_themed_icon_get_type ()) +#define G_THEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_THEMED_ICON, GThemedIcon)) +#define G_THEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_THEMED_ICON, GThemedIconClass)) +#define G_IS_THEMED_ICON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_THEMED_ICON)) +#define G_IS_THEMED_ICON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_THEMED_ICON)) +#define G_THEMED_ICON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_THEMED_ICON, GThemedIconClass)) + +/** + * GThemedIcon: + * + * An implementation of #GIcon for themed icons. + **/ +typedef struct _GThemedIconClass GThemedIconClass; + +GIO_AVAILABLE_IN_ALL +GType g_themed_icon_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GIcon *g_themed_icon_new (const char *iconname); +GIO_AVAILABLE_IN_ALL +GIcon *g_themed_icon_new_with_default_fallbacks (const char *iconname); +GIO_AVAILABLE_IN_ALL +GIcon *g_themed_icon_new_from_names (char **iconnames, + int len); +GIO_AVAILABLE_IN_ALL +void g_themed_icon_prepend_name (GThemedIcon *icon, + const char *iconname); +GIO_AVAILABLE_IN_ALL +void g_themed_icon_append_name (GThemedIcon *icon, + const char *iconname); + +GIO_AVAILABLE_IN_ALL +const gchar* const * g_themed_icon_get_names (GThemedIcon *icon); + +G_END_DECLS + +#endif /* __G_THEMED_ICON_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2009 Codethink Limited + * Copyright © 2009 Red Hat, Inc + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + * Alexander Larsson + */ + +#ifndef __G_THREADED_SOCKET_SERVICE_H__ +#define __G_THREADED_SOCKET_SERVICE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_THREADED_SOCKET_SERVICE (g_threaded_socket_service_get_type ()) +#define G_THREADED_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_THREADED_SOCKET_SERVICE, \ + GThreadedSocketService)) +#define G_THREADED_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_THREADED_SOCKET_SERVICE, \ + GThreadedSocketServiceClass)) +#define G_IS_THREADED_SOCKET_SERVICE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_THREADED_SOCKET_SERVICE)) +#define G_IS_THREADED_SOCKET_SERVICE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_THREADED_SOCKET_SERVICE)) +#define G_THREADED_SOCKET_SERVICE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_THREADED_SOCKET_SERVICE, \ + GThreadedSocketServiceClass)) + +typedef struct _GThreadedSocketServicePrivate GThreadedSocketServicePrivate; +typedef struct _GThreadedSocketServiceClass GThreadedSocketServiceClass; + +struct _GThreadedSocketServiceClass +{ + GSocketServiceClass parent_class; + + gboolean (* run) (GThreadedSocketService *service, + GSocketConnection *connection, + GObject *source_object); + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +struct _GThreadedSocketService +{ + GSocketService parent_instance; + GThreadedSocketServicePrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_threaded_socket_service_get_type (void); +GIO_AVAILABLE_IN_ALL +GSocketService * g_threaded_socket_service_new (int max_threads); + +G_END_DECLS + +#endif /* __G_THREADED_SOCKET_SERVICE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * Copyright © 2015 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_TLS_BACKEND_H__ +#define __G_TLS_BACKEND_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_TLS_BACKEND_EXTENSION_POINT_NAME: + * + * Extension point for TLS functionality via #GTlsBackend. + * See [Extending GIO][extending-gio]. + */ +#define G_TLS_BACKEND_EXTENSION_POINT_NAME "gio-tls-backend" + +#define G_TYPE_TLS_BACKEND (g_tls_backend_get_type ()) +#define G_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_TLS_BACKEND, GTlsBackend)) +#define G_IS_TLS_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_TLS_BACKEND)) +#define G_TLS_BACKEND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_TLS_BACKEND, GTlsBackendInterface)) + +typedef struct _GTlsBackend GTlsBackend; +typedef struct _GTlsBackendInterface GTlsBackendInterface; + +/** + * GTlsBackendInterface: + * @g_iface: The parent interface. + * @supports_tls: returns whether the backend supports TLS. + * @supports_dtls: returns whether the backend supports DTLS + * @get_default_database: returns a default #GTlsDatabase instance. + * @get_certificate_type: returns the #GTlsCertificate implementation type + * @get_client_connection_type: returns the #GTlsClientConnection implementation type + * @get_server_connection_type: returns the #GTlsServerConnection implementation type + * @get_file_database_type: returns the #GTlsFileDatabase implementation type. + * @get_dtls_client_connection_type: returns the #GDtlsClientConnection implementation type + * @get_dtls_server_connection_type: returns the #GDtlsServerConnection implementation type + * + * Provides an interface for describing TLS-related types. + * + * Since: 2.28 + */ +struct _GTlsBackendInterface +{ + GTypeInterface g_iface; + + /* methods */ + gboolean ( *supports_tls) (GTlsBackend *backend); + GType ( *get_certificate_type) (void); + GType ( *get_client_connection_type) (void); + GType ( *get_server_connection_type) (void); + GType ( *get_file_database_type) (void); + GTlsDatabase * ( *get_default_database) (GTlsBackend *backend); + gboolean ( *supports_dtls) (GTlsBackend *backend); + GType ( *get_dtls_client_connection_type) (void); + GType ( *get_dtls_server_connection_type) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_backend_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GTlsBackend * g_tls_backend_get_default (void); + +GIO_AVAILABLE_IN_ALL +GTlsDatabase * g_tls_backend_get_default_database (GTlsBackend *backend); +GIO_AVAILABLE_IN_2_60 +void g_tls_backend_set_default_database (GTlsBackend *backend, + GTlsDatabase *database); + +GIO_AVAILABLE_IN_ALL +gboolean g_tls_backend_supports_tls (GTlsBackend *backend); +GIO_AVAILABLE_IN_2_48 +gboolean g_tls_backend_supports_dtls (GTlsBackend *backend); + +GIO_AVAILABLE_IN_ALL +GType g_tls_backend_get_certificate_type (GTlsBackend *backend); +GIO_AVAILABLE_IN_ALL +GType g_tls_backend_get_client_connection_type (GTlsBackend *backend); +GIO_AVAILABLE_IN_ALL +GType g_tls_backend_get_server_connection_type (GTlsBackend *backend); +GIO_AVAILABLE_IN_ALL +GType g_tls_backend_get_file_database_type (GTlsBackend *backend); + +GIO_AVAILABLE_IN_2_48 +GType g_tls_backend_get_dtls_client_connection_type (GTlsBackend *backend); +GIO_AVAILABLE_IN_2_48 +GType g_tls_backend_get_dtls_server_connection_type (GTlsBackend *backend); + +G_END_DECLS + +#endif /* __G_TLS_BACKEND_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_TLS_CERTIFICATE_H__ +#define __G_TLS_CERTIFICATE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TLS_CERTIFICATE (g_tls_certificate_get_type ()) +#define G_TLS_CERTIFICATE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificate)) +#define G_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass)) +#define G_IS_TLS_CERTIFICATE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CERTIFICATE)) +#define G_IS_TLS_CERTIFICATE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CERTIFICATE)) +#define G_TLS_CERTIFICATE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CERTIFICATE, GTlsCertificateClass)) + +typedef struct _GTlsCertificateClass GTlsCertificateClass; +typedef struct _GTlsCertificatePrivate GTlsCertificatePrivate; + +struct _GTlsCertificate { + GObject parent_instance; + + GTlsCertificatePrivate *priv; +}; + +struct _GTlsCertificateClass +{ + GObjectClass parent_class; + + GTlsCertificateFlags (* verify) (GTlsCertificate *cert, + GSocketConnectable *identity, + GTlsCertificate *trusted_ca); + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[8]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_certificate_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GTlsCertificate *g_tls_certificate_new_from_pem (const gchar *data, + gssize length, + GError **error); +GIO_AVAILABLE_IN_2_72 +GTlsCertificate *g_tls_certificate_new_from_pkcs12 (const guint8 *data, + gsize length, + const gchar *password, + GError **error); +GIO_AVAILABLE_IN_2_72 +GTlsCertificate *g_tls_certificate_new_from_file_with_password (const gchar *file, + const gchar *password, + GError **error); +GIO_AVAILABLE_IN_ALL +GTlsCertificate *g_tls_certificate_new_from_file (const gchar *file, + GError **error); +GIO_AVAILABLE_IN_ALL +GTlsCertificate *g_tls_certificate_new_from_files (const gchar *cert_file, + const gchar *key_file, + GError **error); +GIO_AVAILABLE_IN_2_68 +GTlsCertificate *g_tls_certificate_new_from_pkcs11_uris (const gchar *pkcs11_uri, + const gchar *private_key_pkcs11_uri, + GError **error); + +GIO_AVAILABLE_IN_ALL +GList *g_tls_certificate_list_new_from_file (const gchar *file, + GError **error); + +GIO_AVAILABLE_IN_ALL +GTlsCertificate *g_tls_certificate_get_issuer (GTlsCertificate *cert); + +GIO_AVAILABLE_IN_ALL +GTlsCertificateFlags g_tls_certificate_verify (GTlsCertificate *cert, + GSocketConnectable *identity, + GTlsCertificate *trusted_ca); + +GIO_AVAILABLE_IN_2_34 +gboolean g_tls_certificate_is_same (GTlsCertificate *cert_one, + GTlsCertificate *cert_two); + +GIO_AVAILABLE_IN_2_70 +GDateTime *g_tls_certificate_get_not_valid_before (GTlsCertificate *cert); + +GIO_AVAILABLE_IN_2_70 +GDateTime *g_tls_certificate_get_not_valid_after (GTlsCertificate *cert); + +GIO_AVAILABLE_IN_2_70 +gchar *g_tls_certificate_get_subject_name (GTlsCertificate *cert); + +GIO_AVAILABLE_IN_2_70 +gchar *g_tls_certificate_get_issuer_name (GTlsCertificate *cert); + +GIO_AVAILABLE_IN_2_70 +GPtrArray *g_tls_certificate_get_dns_names (GTlsCertificate *cert); + +GIO_AVAILABLE_IN_2_70 +GPtrArray *g_tls_certificate_get_ip_addresses (GTlsCertificate *cert); + +G_END_DECLS + +#endif /* __G_TLS_CERTIFICATE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_TLS_CLIENT_CONNECTION_H__ +#define __G_TLS_CLIENT_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_TLS_CONNECTION_H__ +#define __G_TLS_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TLS_CONNECTION (g_tls_connection_get_type ()) +#define G_TLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CONNECTION, GTlsConnection)) +#define G_TLS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_CONNECTION, GTlsConnectionClass)) +#define G_IS_TLS_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CONNECTION)) +#define G_IS_TLS_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_CONNECTION)) +#define G_TLS_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_CONNECTION, GTlsConnectionClass)) + +typedef struct _GTlsConnectionClass GTlsConnectionClass; +typedef struct _GTlsConnectionPrivate GTlsConnectionPrivate; + +struct _GTlsConnection { + GIOStream parent_instance; + + GTlsConnectionPrivate *priv; +}; + +/** + * GTlsConnectionClass: + * @parent_class: The parent class. + * @accept_certificate: Check whether to accept a certificate. + * @handshake: Perform a handshake operation. + * @handshake_async: Start an asynchronous handshake operation. + * @handshake_finish: Finish an asynchronous handshake operation. + * @get_binding_data: Retrieve TLS channel binding data (Since: 2.66) + * @get_negotiated_protocol: Get ALPN-negotiated protocol (Since: 2.70) + * + * The class structure for the #GTlsConnection type. + * + * Since: 2.28 + */ +struct _GTlsConnectionClass +{ + GIOStreamClass parent_class; + + /* signals */ + gboolean ( *accept_certificate) (GTlsConnection *connection, + GTlsCertificate *peer_cert, + GTlsCertificateFlags errors); + + /* methods */ + gboolean ( *handshake ) (GTlsConnection *conn, + GCancellable *cancellable, + GError **error); + + void ( *handshake_async ) (GTlsConnection *conn, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean ( *handshake_finish ) (GTlsConnection *conn, + GAsyncResult *result, + GError **error); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS + gboolean ( *get_binding_data) (GTlsConnection *conn, + GTlsChannelBindingType type, + GByteArray *data, + GError **error); +G_GNUC_END_IGNORE_DEPRECATIONS + + const gchar *(*get_negotiated_protocol) (GTlsConnection *conn); + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[6]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_connection_get_type (void) G_GNUC_CONST; + +GIO_DEPRECATED +void g_tls_connection_set_use_system_certdb (GTlsConnection *conn, + gboolean use_system_certdb); +GIO_DEPRECATED +gboolean g_tls_connection_get_use_system_certdb (GTlsConnection *conn); + +GIO_AVAILABLE_IN_ALL +void g_tls_connection_set_database (GTlsConnection *conn, + GTlsDatabase *database); +GIO_AVAILABLE_IN_ALL +GTlsDatabase * g_tls_connection_get_database (GTlsConnection *conn); + +GIO_AVAILABLE_IN_ALL +void g_tls_connection_set_certificate (GTlsConnection *conn, + GTlsCertificate *certificate); +GIO_AVAILABLE_IN_ALL +GTlsCertificate *g_tls_connection_get_certificate (GTlsConnection *conn); + +GIO_AVAILABLE_IN_ALL +void g_tls_connection_set_interaction (GTlsConnection *conn, + GTlsInteraction *interaction); +GIO_AVAILABLE_IN_ALL +GTlsInteraction * g_tls_connection_get_interaction (GTlsConnection *conn); + +GIO_AVAILABLE_IN_ALL +GTlsCertificate *g_tls_connection_get_peer_certificate (GTlsConnection *conn); +GIO_AVAILABLE_IN_ALL +GTlsCertificateFlags g_tls_connection_get_peer_certificate_errors (GTlsConnection *conn); + +GIO_AVAILABLE_IN_ALL +void g_tls_connection_set_require_close_notify (GTlsConnection *conn, + gboolean require_close_notify); +GIO_AVAILABLE_IN_ALL +gboolean g_tls_connection_get_require_close_notify (GTlsConnection *conn); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GIO_DEPRECATED_IN_2_60 +void g_tls_connection_set_rehandshake_mode (GTlsConnection *conn, + GTlsRehandshakeMode mode); +GIO_DEPRECATED_IN_2_60 +GTlsRehandshakeMode g_tls_connection_get_rehandshake_mode (GTlsConnection *conn); +G_GNUC_END_IGNORE_DEPRECATIONS + +GIO_AVAILABLE_IN_2_60 +void g_tls_connection_set_advertised_protocols (GTlsConnection *conn, + const gchar * const *protocols); + +GIO_AVAILABLE_IN_2_60 +const gchar * g_tls_connection_get_negotiated_protocol (GTlsConnection *conn); + +G_GNUC_BEGIN_IGNORE_DEPRECATIONS +GIO_AVAILABLE_IN_2_66 +gboolean g_tls_connection_get_channel_binding_data (GTlsConnection *conn, + GTlsChannelBindingType type, + GByteArray *data, + GError **error); +G_GNUC_END_IGNORE_DEPRECATIONS + +GIO_AVAILABLE_IN_ALL +gboolean g_tls_connection_handshake (GTlsConnection *conn, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_tls_connection_handshake_async (GTlsConnection *conn, + int io_priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_tls_connection_handshake_finish (GTlsConnection *conn, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_70 +GTlsProtocolVersion g_tls_connection_get_protocol_version (GTlsConnection *conn); + +GIO_AVAILABLE_IN_2_70 +gchar * g_tls_connection_get_ciphersuite_name (GTlsConnection *conn); + +/** + * G_TLS_ERROR: + * + * Error domain for TLS. Errors in this domain will be from the + * #GTlsError enumeration. See #GError for more information on error + * domains. + */ +#define G_TLS_ERROR (g_tls_error_quark ()) +GIO_AVAILABLE_IN_ALL +GQuark g_tls_error_quark (void); + +/** + * G_TLS_CHANNEL_BINDING_ERROR: + * + * Error domain for TLS channel binding. Errors in this domain will be from the + * #GTlsChannelBindingError enumeration. See #GError for more information on error + * domains. + * + * Since: 2.66 + */ +#define G_TLS_CHANNEL_BINDING_ERROR (g_tls_channel_binding_error_quark ()) +GIO_AVAILABLE_IN_2_66 +GQuark g_tls_channel_binding_error_quark (void); + +/*< protected >*/ +GIO_AVAILABLE_IN_ALL +gboolean g_tls_connection_emit_accept_certificate (GTlsConnection *conn, + GTlsCertificate *peer_cert, + GTlsCertificateFlags errors); + +G_END_DECLS + +#endif /* __G_TLS_CONNECTION_H__ */ + +G_BEGIN_DECLS + +#define G_TYPE_TLS_CLIENT_CONNECTION (g_tls_client_connection_get_type ()) +#define G_TLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_CLIENT_CONNECTION, GTlsClientConnection)) +#define G_IS_TLS_CLIENT_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_CLIENT_CONNECTION)) +#define G_TLS_CLIENT_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TLS_CLIENT_CONNECTION, GTlsClientConnectionInterface)) + +typedef struct _GTlsClientConnectionInterface GTlsClientConnectionInterface; + +/** + * GTlsClientConnectionInterface: + * @g_iface: The parent interface. + * @copy_session_state: Copies session state from one #GTlsClientConnection to another. + * + * vtable for a #GTlsClientConnection implementation. + * + * Since: 2.26 + */ +struct _GTlsClientConnectionInterface +{ + GTypeInterface g_iface; + + void ( *copy_session_state ) (GTlsClientConnection *conn, + GTlsClientConnection *source); +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_client_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GIOStream * g_tls_client_connection_new (GIOStream *base_io_stream, + GSocketConnectable *server_identity, + GError **error); + +GIO_DEPRECATED_IN_2_72 +GTlsCertificateFlags g_tls_client_connection_get_validation_flags (GTlsClientConnection *conn); +GIO_DEPRECATED_IN_2_72 +void g_tls_client_connection_set_validation_flags (GTlsClientConnection *conn, + GTlsCertificateFlags flags); +GIO_AVAILABLE_IN_ALL +GSocketConnectable *g_tls_client_connection_get_server_identity (GTlsClientConnection *conn); +GIO_AVAILABLE_IN_ALL +void g_tls_client_connection_set_server_identity (GTlsClientConnection *conn, + GSocketConnectable *identity); +GIO_DEPRECATED_IN_2_56 +gboolean g_tls_client_connection_get_use_ssl3 (GTlsClientConnection *conn); +GIO_DEPRECATED_IN_2_56 +void g_tls_client_connection_set_use_ssl3 (GTlsClientConnection *conn, + gboolean use_ssl3); +GIO_AVAILABLE_IN_ALL +GList * g_tls_client_connection_get_accepted_cas (GTlsClientConnection *conn); + +GIO_AVAILABLE_IN_2_46 +void g_tls_client_connection_copy_session_state (GTlsClientConnection *conn, + GTlsClientConnection *source); + +G_END_DECLS + +#endif /* __G_TLS_CLIENT_CONNECTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Stef Walter + */ + +#ifndef __G_TLS_DATABASE_H__ +#define __G_TLS_DATABASE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER "1.3.6.1.5.5.7.3.1" +#define G_TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT "1.3.6.1.5.5.7.3.2" + +#define G_TYPE_TLS_DATABASE (g_tls_database_get_type ()) +#define G_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_DATABASE, GTlsDatabase)) +#define G_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), G_TYPE_TLS_DATABASE, GTlsDatabaseClass)) +#define G_IS_TLS_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_DATABASE)) +#define G_IS_TLS_DATABASE_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), G_TYPE_TLS_DATABASE)) +#define G_TLS_DATABASE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), G_TYPE_TLS_DATABASE, GTlsDatabaseClass)) + +typedef struct _GTlsDatabaseClass GTlsDatabaseClass; +typedef struct _GTlsDatabasePrivate GTlsDatabasePrivate; + +struct _GTlsDatabase +{ + GObject parent_instance; + + GTlsDatabasePrivate *priv; +}; + +struct _GTlsDatabaseClass +{ + GObjectClass parent_class; + + /* virtual methods */ + + GTlsCertificateFlags (*verify_chain) (GTlsDatabase *self, + GTlsCertificate *chain, + const gchar *purpose, + GSocketConnectable *identity, + GTlsInteraction *interaction, + GTlsDatabaseVerifyFlags flags, + GCancellable *cancellable, + GError **error); + + void (*verify_chain_async) (GTlsDatabase *self, + GTlsCertificate *chain, + const gchar *purpose, + GSocketConnectable *identity, + GTlsInteraction *interaction, + GTlsDatabaseVerifyFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GTlsCertificateFlags (*verify_chain_finish) (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + + gchar* (*create_certificate_handle) (GTlsDatabase *self, + GTlsCertificate *certificate); + + GTlsCertificate* (*lookup_certificate_for_handle) (GTlsDatabase *self, + const gchar *handle, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GError **error); + + void (*lookup_certificate_for_handle_async) (GTlsDatabase *self, + const gchar *handle, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GTlsCertificate* (*lookup_certificate_for_handle_finish) (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + + GTlsCertificate* (*lookup_certificate_issuer) (GTlsDatabase *self, + GTlsCertificate *certificate, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GError **error); + + void (*lookup_certificate_issuer_async) (GTlsDatabase *self, + GTlsCertificate *certificate, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GTlsCertificate* (*lookup_certificate_issuer_finish) (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + + GList* (*lookup_certificates_issued_by) (GTlsDatabase *self, + GByteArray *issuer_raw_dn, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GError **error); + + void (*lookup_certificates_issued_by_async) (GTlsDatabase *self, + GByteArray *issuer_raw_dn, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GList* (*lookup_certificates_issued_by_finish) (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[16]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_database_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GTlsCertificateFlags g_tls_database_verify_chain (GTlsDatabase *self, + GTlsCertificate *chain, + const gchar *purpose, + GSocketConnectable *identity, + GTlsInteraction *interaction, + GTlsDatabaseVerifyFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_tls_database_verify_chain_async (GTlsDatabase *self, + GTlsCertificate *chain, + const gchar *purpose, + GSocketConnectable *identity, + GTlsInteraction *interaction, + GTlsDatabaseVerifyFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GTlsCertificateFlags g_tls_database_verify_chain_finish (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +gchar* g_tls_database_create_certificate_handle (GTlsDatabase *self, + GTlsCertificate *certificate); + +GIO_AVAILABLE_IN_ALL +GTlsCertificate* g_tls_database_lookup_certificate_for_handle (GTlsDatabase *self, + const gchar *handle, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_tls_database_lookup_certificate_for_handle_async (GTlsDatabase *self, + const gchar *handle, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GTlsCertificate* g_tls_database_lookup_certificate_for_handle_finish (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +GTlsCertificate* g_tls_database_lookup_certificate_issuer (GTlsDatabase *self, + GTlsCertificate *certificate, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_tls_database_lookup_certificate_issuer_async (GTlsDatabase *self, + GTlsCertificate *certificate, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GTlsCertificate* g_tls_database_lookup_certificate_issuer_finish (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_ALL +GList* g_tls_database_lookup_certificates_issued_by (GTlsDatabase *self, + GByteArray *issuer_raw_dn, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_tls_database_lookup_certificates_issued_by_async (GTlsDatabase *self, + GByteArray *issuer_raw_dn, + GTlsInteraction *interaction, + GTlsDatabaseLookupFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GList* g_tls_database_lookup_certificates_issued_by_finish (GTlsDatabase *self, + GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif /* __G_TLS_DATABASE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2010 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * See the included COPYING file for more information. + * + * Author: Stef Walter + */ + +#ifndef __G_TLS_FILE_DATABASE_H__ +#define __G_TLS_FILE_DATABASE_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TLS_FILE_DATABASE (g_tls_file_database_get_type ()) +#define G_TLS_FILE_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_FILE_DATABASE, GTlsFileDatabase)) +#define G_IS_TLS_FILE_DATABASE(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_FILE_DATABASE)) +#define G_TLS_FILE_DATABASE_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TLS_FILE_DATABASE, GTlsFileDatabaseInterface)) + +typedef struct _GTlsFileDatabaseInterface GTlsFileDatabaseInterface; + +/** + * GTlsFileDatabaseInterface: + * @g_iface: The parent interface. + * + * Provides an interface for #GTlsFileDatabase implementations. + * + */ +struct _GTlsFileDatabaseInterface +{ + GTypeInterface g_iface; + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[8]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_file_database_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GTlsDatabase* g_tls_file_database_new (const gchar *anchors, + GError **error); + +G_END_DECLS + +#endif /* __G_TLS_FILE_DATABASE_H___ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2011 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Stef Walter + */ + +#ifndef __G_TLS_INTERACTION_H__ +#define __G_TLS_INTERACTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TLS_INTERACTION (g_tls_interaction_get_type ()) +#define G_TLS_INTERACTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TLS_INTERACTION, GTlsInteraction)) +#define G_TLS_INTERACTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TLS_INTERACTION, GTlsInteractionClass)) +#define G_IS_TLS_INTERACTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TLS_INTERACTION)) +#define G_IS_TLS_INTERACTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TLS_INTERACTION)) +#define G_TLS_INTERACTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TLS_INTERACTION, GTlsInteractionClass)) + +typedef struct _GTlsInteractionClass GTlsInteractionClass; +typedef struct _GTlsInteractionPrivate GTlsInteractionPrivate; + +struct _GTlsInteraction +{ + /*< private >*/ + GObject parent_instance; + GTlsInteractionPrivate *priv; +}; + +struct _GTlsInteractionClass +{ + /*< private >*/ + GObjectClass parent_class; + + /*< public >*/ + GTlsInteractionResult (* ask_password) (GTlsInteraction *interaction, + GTlsPassword *password, + GCancellable *cancellable, + GError **error); + + void (* ask_password_async) (GTlsInteraction *interaction, + GTlsPassword *password, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GTlsInteractionResult (* ask_password_finish) (GTlsInteraction *interaction, + GAsyncResult *result, + GError **error); + + GTlsInteractionResult (* request_certificate) (GTlsInteraction *interaction, + GTlsConnection *connection, + GTlsCertificateRequestFlags flags, + GCancellable *cancellable, + GError **error); + + void (* request_certificate_async) (GTlsInteraction *interaction, + GTlsConnection *connection, + GTlsCertificateRequestFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + GTlsInteractionResult (* request_certificate_finish) (GTlsInteraction *interaction, + GAsyncResult *result, + GError **error); + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[21]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_interaction_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GTlsInteractionResult g_tls_interaction_invoke_ask_password (GTlsInteraction *interaction, + GTlsPassword *password, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +GTlsInteractionResult g_tls_interaction_ask_password (GTlsInteraction *interaction, + GTlsPassword *password, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +void g_tls_interaction_ask_password_async (GTlsInteraction *interaction, + GTlsPassword *password, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_ALL +GTlsInteractionResult g_tls_interaction_ask_password_finish (GTlsInteraction *interaction, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_40 +GTlsInteractionResult g_tls_interaction_invoke_request_certificate (GTlsInteraction *interaction, + GTlsConnection *connection, + GTlsCertificateRequestFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_40 +GTlsInteractionResult g_tls_interaction_request_certificate (GTlsInteraction *interaction, + GTlsConnection *connection, + GTlsCertificateRequestFlags flags, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_2_40 +void g_tls_interaction_request_certificate_async (GTlsInteraction *interaction, + GTlsConnection *connection, + GTlsCertificateRequestFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_AVAILABLE_IN_2_40 +GTlsInteractionResult g_tls_interaction_request_certificate_finish (GTlsInteraction *interaction, + GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif /* __G_TLS_INTERACTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2011 Collabora, Ltd. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Stef Walter + */ + +#ifndef __G_TLS_PASSWORD_H__ +#define __G_TLS_PASSWORD_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TLS_PASSWORD (g_tls_password_get_type ()) +#define G_TLS_PASSWORD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_TLS_PASSWORD, GTlsPassword)) +#define G_TLS_PASSWORD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_TLS_PASSWORD, GTlsPasswordClass)) +#define G_IS_TLS_PASSWORD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_TLS_PASSWORD)) +#define G_IS_TLS_PASSWORD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_TLS_PASSWORD)) +#define G_TLS_PASSWORD_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_TLS_PASSWORD, GTlsPasswordClass)) + +typedef struct _GTlsPasswordClass GTlsPasswordClass; +typedef struct _GTlsPasswordPrivate GTlsPasswordPrivate; + +struct _GTlsPassword +{ + GObject parent_instance; + + GTlsPasswordPrivate *priv; +}; + +/** + * GTlsPasswordClass: + * @get_value: virtual method for g_tls_password_get_value() + * @set_value: virtual method for g_tls_password_set_value() + * @get_default_warning: virtual method for g_tls_password_get_warning() if no + * value has been set using g_tls_password_set_warning() + * + * Class structure for #GTlsPassword. + */ +struct _GTlsPasswordClass +{ + GObjectClass parent_class; + + /* methods */ + + const guchar * ( *get_value) (GTlsPassword *password, + gsize *length); + + void ( *set_value) (GTlsPassword *password, + guchar *value, + gssize length, + GDestroyNotify destroy); + + const gchar* ( *get_default_warning) (GTlsPassword *password); + + /*< private >*/ + /* Padding for future expansion */ + gpointer padding[4]; +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_password_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GTlsPassword * g_tls_password_new (GTlsPasswordFlags flags, + const gchar *description); + +GIO_AVAILABLE_IN_ALL +const guchar * g_tls_password_get_value (GTlsPassword *password, + gsize *length); +GIO_AVAILABLE_IN_ALL +void g_tls_password_set_value (GTlsPassword *password, + const guchar *value, + gssize length); +GIO_AVAILABLE_IN_ALL +void g_tls_password_set_value_full (GTlsPassword *password, + guchar *value, + gssize length, + GDestroyNotify destroy); + +GIO_AVAILABLE_IN_ALL +GTlsPasswordFlags g_tls_password_get_flags (GTlsPassword *password); +GIO_AVAILABLE_IN_ALL +void g_tls_password_set_flags (GTlsPassword *password, + GTlsPasswordFlags flags); + +GIO_AVAILABLE_IN_ALL +const gchar* g_tls_password_get_description (GTlsPassword *password); +GIO_AVAILABLE_IN_ALL +void g_tls_password_set_description (GTlsPassword *password, + const gchar *description); + +GIO_AVAILABLE_IN_ALL +const gchar * g_tls_password_get_warning (GTlsPassword *password); +GIO_AVAILABLE_IN_ALL +void g_tls_password_set_warning (GTlsPassword *password, + const gchar *warning); + +G_END_DECLS + +#endif /* __G_TLS_PASSWORD_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + */ + +#ifndef __G_TLS_SERVER_CONNECTION_H__ +#define __G_TLS_SERVER_CONNECTION_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_TLS_SERVER_CONNECTION (g_tls_server_connection_get_type ()) +#define G_TLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), G_TYPE_TLS_SERVER_CONNECTION, GTlsServerConnection)) +#define G_IS_TLS_SERVER_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_TLS_SERVER_CONNECTION)) +#define G_TLS_SERVER_CONNECTION_GET_INTERFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), G_TYPE_TLS_SERVER_CONNECTION, GTlsServerConnectionInterface)) + +/** + * GTlsServerConnection: + * + * TLS server-side connection. This is the server-side implementation + * of a #GTlsConnection. + * + * Since: 2.28 + */ +typedef struct _GTlsServerConnectionInterface GTlsServerConnectionInterface; + +/** + * GTlsServerConnectionInterface: + * @g_iface: The parent interface. + * + * vtable for a #GTlsServerConnection implementation. + * + * Since: 2.26 + */ +struct _GTlsServerConnectionInterface +{ + GTypeInterface g_iface; + +}; + +GIO_AVAILABLE_IN_ALL +GType g_tls_server_connection_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GIOStream * g_tls_server_connection_new (GIOStream *base_io_stream, + GTlsCertificate *certificate, + GError **error); + +G_END_DECLS + +#endif /* __G_TLS_SERVER_CONNECTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_UNIX_CONNECTION_H__ +#define __G_UNIX_CONNECTION_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_UNIX_CONNECTION (g_unix_connection_get_type ()) +#define G_UNIX_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_UNIX_CONNECTION, GUnixConnection)) +#define G_UNIX_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_UNIX_CONNECTION, GUnixConnectionClass)) +#define G_IS_UNIX_CONNECTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_UNIX_CONNECTION)) +#define G_IS_UNIX_CONNECTION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_UNIX_CONNECTION)) +#define G_UNIX_CONNECTION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_UNIX_CONNECTION, GUnixConnectionClass)) + +typedef struct _GUnixConnection GUnixConnection; +typedef struct _GUnixConnectionPrivate GUnixConnectionPrivate; +typedef struct _GUnixConnectionClass GUnixConnectionClass; + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixConnection, g_object_unref) + +struct _GUnixConnectionClass +{ + GSocketConnectionClass parent_class; +}; + +struct _GUnixConnection +{ + GSocketConnection parent_instance; + GUnixConnectionPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_unix_connection_get_type (void); + +GIO_AVAILABLE_IN_ALL +gboolean g_unix_connection_send_fd (GUnixConnection *connection, + gint fd, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_ALL +gint g_unix_connection_receive_fd (GUnixConnection *connection, + GCancellable *cancellable, + GError **error); + +GIO_AVAILABLE_IN_ALL +gboolean g_unix_connection_send_credentials (GUnixConnection *connection, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_32 +void g_unix_connection_send_credentials_async (GUnixConnection *connection, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_2_32 +gboolean g_unix_connection_send_credentials_finish (GUnixConnection *connection, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_32 +GCredentials *g_unix_connection_receive_credentials (GUnixConnection *connection, + GCancellable *cancellable, + GError **error); +GIO_AVAILABLE_IN_2_32 +void g_unix_connection_receive_credentials_async (GUnixConnection *connection, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +GCredentials *g_unix_connection_receive_credentials_finish (GUnixConnection *connection, + GAsyncResult *result, + GError **error); + +G_END_DECLS + +#endif /* __G_UNIX_CONNECTION_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Red Hat, Inc. + * Copyright (C) 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: David Zeuthen + */ + +#ifndef __G_UNIX_CREDENTIALS_MESSAGE_H__ +#define __G_UNIX_CREDENTIALS_MESSAGE_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_UNIX_CREDENTIALS_MESSAGE (g_unix_credentials_message_get_type ()) +#define G_UNIX_CREDENTIALS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_UNIX_CREDENTIALS_MESSAGE, GUnixCredentialsMessage)) +#define G_UNIX_CREDENTIALS_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), G_TYPE_UNIX_CREDENTIALS_MESSAGE, GUnixCredentialsMessageClass)) +#define G_IS_UNIX_CREDENTIALS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_UNIX_CREDENTIALS_MESSAGE)) +#define G_IS_UNIX_CREDENTIALS_MESSAGE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), G_TYPE_UNIX_CREDENTIALS_MESSAGE)) +#define G_UNIX_CREDENTIALS_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_UNIX_CREDENTIALS_MESSAGE, GUnixCredentialsMessageClass)) + +typedef struct _GUnixCredentialsMessagePrivate GUnixCredentialsMessagePrivate; +typedef struct _GUnixCredentialsMessageClass GUnixCredentialsMessageClass; + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixCredentialsMessage, g_object_unref) + +/** + * GUnixCredentialsMessageClass: + * + * Class structure for #GUnixCredentialsMessage. + * + * Since: 2.26 + */ +struct _GUnixCredentialsMessageClass +{ + GSocketControlMessageClass parent_class; + + /*< private >*/ + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); +}; + +/** + * GUnixCredentialsMessage: + * + * The #GUnixCredentialsMessage structure contains only private data + * and should only be accessed using the provided API. + * + * Since: 2.26 + */ +struct _GUnixCredentialsMessage +{ + GSocketControlMessage parent_instance; + GUnixCredentialsMessagePrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_unix_credentials_message_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GSocketControlMessage *g_unix_credentials_message_new (void); +GIO_AVAILABLE_IN_ALL +GSocketControlMessage *g_unix_credentials_message_new_with_credentials (GCredentials *credentials); +GIO_AVAILABLE_IN_ALL +GCredentials *g_unix_credentials_message_get_credentials (GUnixCredentialsMessage *message); + +GIO_AVAILABLE_IN_ALL +gboolean g_unix_credentials_message_is_supported (void); + +G_END_DECLS + +#endif /* __G_UNIX_CREDENTIALS_MESSAGE_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright © 2009 Codethink Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Ryan Lortie + */ + +#ifndef __G_UNIX_FD_LIST_H__ +#define __G_UNIX_FD_LIST_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_UNIX_FD_LIST (g_unix_fd_list_get_type ()) +#define G_UNIX_FD_LIST(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \ + G_TYPE_UNIX_FD_LIST, GUnixFDList)) +#define G_UNIX_FD_LIST_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \ + G_TYPE_UNIX_FD_LIST, GUnixFDListClass)) +#define G_IS_UNIX_FD_LIST(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \ + G_TYPE_UNIX_FD_LIST)) +#define G_IS_UNIX_FD_LIST_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \ + G_TYPE_UNIX_FD_LIST)) +#define G_UNIX_FD_LIST_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \ + G_TYPE_UNIX_FD_LIST, GUnixFDListClass)) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixFDList, g_object_unref) + +typedef struct _GUnixFDListPrivate GUnixFDListPrivate; +typedef struct _GUnixFDListClass GUnixFDListClass; + +struct _GUnixFDListClass +{ + GObjectClass parent_class; + + /*< private >*/ + + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); +}; + +struct _GUnixFDList +{ + GObject parent_instance; + GUnixFDListPrivate *priv; +}; + +GIO_AVAILABLE_IN_ALL +GType g_unix_fd_list_get_type (void) G_GNUC_CONST; +GIO_AVAILABLE_IN_ALL +GUnixFDList * g_unix_fd_list_new (void); +GIO_AVAILABLE_IN_ALL +GUnixFDList * g_unix_fd_list_new_from_array (const gint *fds, + gint n_fds); + +GIO_AVAILABLE_IN_ALL +gint g_unix_fd_list_append (GUnixFDList *list, + gint fd, + GError **error); + +GIO_AVAILABLE_IN_ALL +gint g_unix_fd_list_get_length (GUnixFDList *list); + +GIO_AVAILABLE_IN_ALL +gint g_unix_fd_list_get (GUnixFDList *list, + gint index_, + GError **error); + +GIO_AVAILABLE_IN_ALL +const gint * g_unix_fd_list_peek_fds (GUnixFDList *list, + gint *length); + +GIO_AVAILABLE_IN_ALL +gint * g_unix_fd_list_steal_fds (GUnixFDList *list, + gint *length); + +G_END_DECLS + +#endif /* __G_UNIX_FD_LIST_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2008 Christian Kellner, Samuel Cormier-Iijima + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Authors: Christian Kellner + * Samuel Cormier-Iijima + */ + +#ifndef __G_UNIX_SOCKET_ADDRESS_H__ +#define __G_UNIX_SOCKET_ADDRESS_H__ + + +G_BEGIN_DECLS + +#define G_TYPE_UNIX_SOCKET_ADDRESS (g_unix_socket_address_get_type ()) +#define G_UNIX_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_UNIX_SOCKET_ADDRESS, GUnixSocketAddress)) +#define G_UNIX_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_UNIX_SOCKET_ADDRESS, GUnixSocketAddressClass)) +#define G_IS_UNIX_SOCKET_ADDRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_UNIX_SOCKET_ADDRESS)) +#define G_IS_UNIX_SOCKET_ADDRESS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_UNIX_SOCKET_ADDRESS)) +#define G_UNIX_SOCKET_ADDRESS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_UNIX_SOCKET_ADDRESS, GUnixSocketAddressClass)) + +typedef struct _GUnixSocketAddress GUnixSocketAddress; +typedef struct _GUnixSocketAddressClass GUnixSocketAddressClass; +typedef struct _GUnixSocketAddressPrivate GUnixSocketAddressPrivate; + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GUnixSocketAddress, g_object_unref) + +struct _GUnixSocketAddress +{ + GSocketAddress parent_instance; + + /*< private >*/ + GUnixSocketAddressPrivate *priv; +}; + +struct _GUnixSocketAddressClass +{ + GSocketAddressClass parent_class; +}; + +GIO_AVAILABLE_IN_ALL +GType g_unix_socket_address_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_unix_socket_address_new (const gchar *path); +GIO_DEPRECATED_FOR(g_unix_socket_address_new_with_type) +GSocketAddress *g_unix_socket_address_new_abstract (const gchar *path, + gint path_len); +GIO_AVAILABLE_IN_ALL +GSocketAddress *g_unix_socket_address_new_with_type (const gchar *path, + gint path_len, + GUnixSocketAddressType type); +GIO_AVAILABLE_IN_ALL +const char * g_unix_socket_address_get_path (GUnixSocketAddress *address); +GIO_AVAILABLE_IN_ALL +gsize g_unix_socket_address_get_path_len (GUnixSocketAddress *address); +GIO_AVAILABLE_IN_ALL +GUnixSocketAddressType g_unix_socket_address_get_address_type (GUnixSocketAddress *address); +GIO_DEPRECATED +gboolean g_unix_socket_address_get_is_abstract (GUnixSocketAddress *address); + +GIO_AVAILABLE_IN_ALL +gboolean g_unix_socket_address_abstract_names_supported (void); + +G_END_DECLS + +#endif /* __G_UNIX_SOCKET_ADDRESS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_VFS_H__ +#define __G_VFS_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_VFS (g_vfs_get_type ()) +#define G_VFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_VFS, GVfs)) +#define G_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_VFS, GVfsClass)) +#define G_VFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_VFS, GVfsClass)) +#define G_IS_VFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_VFS)) +#define G_IS_VFS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_VFS)) + +/** + * GVfsFileLookupFunc: + * @vfs: a #GVfs + * @identifier: the identifier to look up a #GFile for. This can either + * be an URI or a parse name as returned by g_file_get_parse_name() + * @user_data: user data passed to the function + * + * This function type is used by g_vfs_register_uri_scheme() to make it + * possible for a client to associate an URI scheme to a different #GFile + * implementation. + * + * The client should return a reference to the new file that has been + * created for @uri, or %NULL to continue with the default implementation. + * + * Returns: (transfer full): a #GFile for @identifier. + * + * Since: 2.50 + */ +typedef GFile * (* GVfsFileLookupFunc) (GVfs *vfs, + const char *identifier, + gpointer user_data); + +/** + * G_VFS_EXTENSION_POINT_NAME: + * + * Extension point for #GVfs functionality. + * See [Extending GIO][extending-gio]. + */ +#define G_VFS_EXTENSION_POINT_NAME "gio-vfs" + +/** + * GVfs: + * + * Virtual File System object. + **/ +typedef struct _GVfsClass GVfsClass; + +struct _GVfs +{ + GObject parent_instance; +}; + +struct _GVfsClass +{ + GObjectClass parent_class; + + /* Virtual Table */ + + gboolean (* is_active) (GVfs *vfs); + GFile * (* get_file_for_path) (GVfs *vfs, + const char *path); + GFile * (* get_file_for_uri) (GVfs *vfs, + const char *uri); + const gchar * const * (* get_supported_uri_schemes) (GVfs *vfs); + GFile * (* parse_name) (GVfs *vfs, + const char *parse_name); + + /*< private >*/ + void (* local_file_add_info) (GVfs *vfs, + const char *filename, + guint64 device, + GFileAttributeMatcher *attribute_matcher, + GFileInfo *info, + GCancellable *cancellable, + gpointer *extra_data, + GDestroyNotify *free_extra_data); + void (* add_writable_namespaces) (GVfs *vfs, + GFileAttributeInfoList *list); + gboolean (* local_file_set_attributes) (GVfs *vfs, + const char *filename, + GFileInfo *info, + GFileQueryInfoFlags flags, + GCancellable *cancellable, + GError **error); + void (* local_file_removed) (GVfs *vfs, + const char *filename); + void (* local_file_moved) (GVfs *vfs, + const char *source, + const char *dest); + GIcon * (* deserialize_icon) (GVfs *vfs, + GVariant *value); + /* Padding for future expansion */ + void (*_g_reserved1) (void); + void (*_g_reserved2) (void); + void (*_g_reserved3) (void); + void (*_g_reserved4) (void); + void (*_g_reserved5) (void); + void (*_g_reserved6) (void); +}; + +GIO_AVAILABLE_IN_ALL +GType g_vfs_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +gboolean g_vfs_is_active (GVfs *vfs); +GIO_AVAILABLE_IN_ALL +GFile * g_vfs_get_file_for_path (GVfs *vfs, + const char *path); +GIO_AVAILABLE_IN_ALL +GFile * g_vfs_get_file_for_uri (GVfs *vfs, + const char *uri); +GIO_AVAILABLE_IN_ALL +const gchar* const * g_vfs_get_supported_uri_schemes (GVfs *vfs); + +GIO_AVAILABLE_IN_ALL +GFile * g_vfs_parse_name (GVfs *vfs, + const char *parse_name); + +GIO_AVAILABLE_IN_ALL +GVfs * g_vfs_get_default (void); +GIO_AVAILABLE_IN_ALL +GVfs * g_vfs_get_local (void); + +GIO_AVAILABLE_IN_2_50 +gboolean g_vfs_register_uri_scheme (GVfs *vfs, + const char *scheme, + GVfsFileLookupFunc uri_func, + gpointer uri_data, + GDestroyNotify uri_destroy, + GVfsFileLookupFunc parse_name_func, + gpointer parse_name_data, + GDestroyNotify parse_name_destroy); +GIO_AVAILABLE_IN_2_50 +gboolean g_vfs_unregister_uri_scheme (GVfs *vfs, + const char *scheme); + + +G_END_DECLS + +#endif /* __G_VFS_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2006-2007 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + * David Zeuthen + */ + +#ifndef __G_VOLUME_H__ +#define __G_VOLUME_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +/** + * G_VOLUME_IDENTIFIER_KIND_HAL_UDI: + * + * The string used to obtain a Hal UDI with g_volume_get_identifier(). + * + * Deprecated: 2.58: Do not use, HAL is deprecated. + */ +#define G_VOLUME_IDENTIFIER_KIND_HAL_UDI "hal-udi" GIO_DEPRECATED_MACRO_IN_2_58 + +/** + * G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE: + * + * The string used to obtain a Unix device path with g_volume_get_identifier(). + */ +#define G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE "unix-device" + +/** + * G_VOLUME_IDENTIFIER_KIND_LABEL: + * + * The string used to obtain a filesystem label with g_volume_get_identifier(). + */ +#define G_VOLUME_IDENTIFIER_KIND_LABEL "label" + +/** + * G_VOLUME_IDENTIFIER_KIND_UUID: + * + * The string used to obtain a UUID with g_volume_get_identifier(). + */ +#define G_VOLUME_IDENTIFIER_KIND_UUID "uuid" + +/** + * G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT: + * + * The string used to obtain a NFS mount with g_volume_get_identifier(). + */ +#define G_VOLUME_IDENTIFIER_KIND_NFS_MOUNT "nfs-mount" + +/** + * G_VOLUME_IDENTIFIER_KIND_CLASS: + * + * The string used to obtain the volume class with g_volume_get_identifier(). + * + * Known volume classes include `device`, `network`, and `loop`. Other + * classes may be added in the future. + * + * This is intended to be used by applications to classify #GVolume + * instances into different sections - for example a file manager or + * file chooser can use this information to show `network` volumes under + * a "Network" heading and `device` volumes under a "Devices" heading. + */ +#define G_VOLUME_IDENTIFIER_KIND_CLASS "class" + + +#define G_TYPE_VOLUME (g_volume_get_type ()) +#define G_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_VOLUME, GVolume)) +#define G_IS_VOLUME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_VOLUME)) +#define G_VOLUME_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_VOLUME, GVolumeIface)) + +/** + * GVolumeIface: + * @g_iface: The parent interface. + * @changed: Changed signal that is emitted when the volume's state has changed. + * @removed: The removed signal that is emitted when the #GVolume have been removed. If the recipient is holding references to the object they should release them so the object can be finalized. + * @get_name: Gets a string containing the name of the #GVolume. + * @get_icon: Gets a #GIcon for the #GVolume. + * @get_uuid: Gets the UUID for the #GVolume. The reference is typically based on the file system UUID for the mount in question and should be considered an opaque string. Returns %NULL if there is no UUID available. + * @get_drive: Gets a #GDrive the volume is located on. Returns %NULL if the #GVolume is not associated with a #GDrive. + * @get_mount: Gets a #GMount representing the mounted volume. Returns %NULL if the #GVolume is not mounted. + * @can_mount: Returns %TRUE if the #GVolume can be mounted. + * @can_eject: Checks if a #GVolume can be ejected. + * @mount_fn: Mounts a given #GVolume. + * #GVolume implementations must emit the #GMountOperation::aborted + * signal before completing a mount operation that is aborted while + * awaiting input from the user through a #GMountOperation instance. + * @mount_finish: Finishes a mount operation. + * @eject: Ejects a given #GVolume. + * @eject_finish: Finishes an eject operation. + * @get_identifier: Returns the [identifier][volume-identifier] of the given kind, or %NULL if + * the #GVolume doesn't have one. + * @enumerate_identifiers: Returns an array strings listing the kinds + * of [identifiers][volume-identifier] which the #GVolume has. + * @should_automount: Returns %TRUE if the #GVolume should be automatically mounted. + * @get_activation_root: Returns the activation root for the #GVolume if it is known in advance or %NULL if + * it is not known. + * @eject_with_operation: Starts ejecting a #GVolume using a #GMountOperation. Since 2.22. + * @eject_with_operation_finish: Finishes an eject operation using a #GMountOperation. Since 2.22. + * @get_sort_key: Gets a key used for sorting #GVolume instance or %NULL if no such key exists. Since 2.32. + * @get_symbolic_icon: Gets a symbolic #GIcon for the #GVolume. Since 2.34. + * + * Interface for implementing operations for mountable volumes. + **/ +typedef struct _GVolumeIface GVolumeIface; + +struct _GVolumeIface +{ + GTypeInterface g_iface; + + /* signals */ + + void (* changed) (GVolume *volume); + void (* removed) (GVolume *volume); + + /* Virtual Table */ + + char * (* get_name) (GVolume *volume); + GIcon * (* get_icon) (GVolume *volume); + char * (* get_uuid) (GVolume *volume); + GDrive * (* get_drive) (GVolume *volume); + GMount * (* get_mount) (GVolume *volume); + gboolean (* can_mount) (GVolume *volume); + gboolean (* can_eject) (GVolume *volume); + void (* mount_fn) (GVolume *volume, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* mount_finish) (GVolume *volume, + GAsyncResult *result, + GError **error); + void (* eject) (GVolume *volume, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_finish) (GVolume *volume, + GAsyncResult *result, + GError **error); + + char * (* get_identifier) (GVolume *volume, + const char *kind); + char ** (* enumerate_identifiers) (GVolume *volume); + + gboolean (* should_automount) (GVolume *volume); + + GFile * (* get_activation_root) (GVolume *volume); + + void (* eject_with_operation) (GVolume *volume, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + gboolean (* eject_with_operation_finish) (GVolume *volume, + GAsyncResult *result, + GError **error); + + const gchar * (* get_sort_key) (GVolume *volume); + GIcon * (* get_symbolic_icon) (GVolume *volume); +}; + +GIO_AVAILABLE_IN_ALL +GType g_volume_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +char * g_volume_get_name (GVolume *volume); +GIO_AVAILABLE_IN_ALL +GIcon * g_volume_get_icon (GVolume *volume); +GIO_AVAILABLE_IN_ALL +GIcon * g_volume_get_symbolic_icon (GVolume *volume); +GIO_AVAILABLE_IN_ALL +char * g_volume_get_uuid (GVolume *volume); +GIO_AVAILABLE_IN_ALL +GDrive * g_volume_get_drive (GVolume *volume); +GIO_AVAILABLE_IN_ALL +GMount * g_volume_get_mount (GVolume *volume); +GIO_AVAILABLE_IN_ALL +gboolean g_volume_can_mount (GVolume *volume); +GIO_AVAILABLE_IN_ALL +gboolean g_volume_can_eject (GVolume *volume); +GIO_AVAILABLE_IN_ALL +gboolean g_volume_should_automount (GVolume *volume); +GIO_AVAILABLE_IN_ALL +void g_volume_mount (GVolume *volume, + GMountMountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_volume_mount_finish (GVolume *volume, + GAsyncResult *result, + GError **error); +GIO_DEPRECATED_FOR(g_volume_eject_with_operation) +void g_volume_eject (GVolume *volume, + GMountUnmountFlags flags, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +GIO_DEPRECATED_FOR(g_volume_eject_with_operation_finish) +gboolean g_volume_eject_finish (GVolume *volume, + GAsyncResult *result, + GError **error); +GIO_AVAILABLE_IN_ALL +char * g_volume_get_identifier (GVolume *volume, + const char *kind); +GIO_AVAILABLE_IN_ALL +char ** g_volume_enumerate_identifiers (GVolume *volume); + +GIO_AVAILABLE_IN_ALL +GFile * g_volume_get_activation_root (GVolume *volume); + +GIO_AVAILABLE_IN_ALL +void g_volume_eject_with_operation (GVolume *volume, + GMountUnmountFlags flags, + GMountOperation *mount_operation, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +GIO_AVAILABLE_IN_ALL +gboolean g_volume_eject_with_operation_finish (GVolume *volume, + GAsyncResult *result, + GError **error); + +GIO_AVAILABLE_IN_2_32 +const gchar *g_volume_get_sort_key (GVolume *volume); + +G_END_DECLS + +#endif /* __G_VOLUME_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_ZLIB_COMPRESSOR_H__ +#define __G_ZLIB_COMPRESSOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_ZLIB_COMPRESSOR (g_zlib_compressor_get_type ()) +#define G_ZLIB_COMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_ZLIB_COMPRESSOR, GZlibCompressor)) +#define G_ZLIB_COMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_ZLIB_COMPRESSOR, GZlibCompressorClass)) +#define G_IS_ZLIB_COMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_ZLIB_COMPRESSOR)) +#define G_IS_ZLIB_COMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_ZLIB_COMPRESSOR)) +#define G_ZLIB_COMPRESSOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_ZLIB_COMPRESSOR, GZlibCompressorClass)) + +typedef struct _GZlibCompressorClass GZlibCompressorClass; + +struct _GZlibCompressorClass +{ + GObjectClass parent_class; +}; + +GIO_AVAILABLE_IN_ALL +GType g_zlib_compressor_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GZlibCompressor *g_zlib_compressor_new (GZlibCompressorFormat format, + int level); + +GIO_AVAILABLE_IN_ALL +GFileInfo *g_zlib_compressor_get_file_info (GZlibCompressor *compressor); +GIO_AVAILABLE_IN_ALL +void g_zlib_compressor_set_file_info (GZlibCompressor *compressor, + GFileInfo *file_info); + +G_END_DECLS + +#endif /* __G_ZLIB_COMPRESSOR_H__ */ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2009 Red Hat, Inc. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, see . + * + * Author: Alexander Larsson + */ + +#ifndef __G_ZLIB_DECOMPRESSOR_H__ +#define __G_ZLIB_DECOMPRESSOR_H__ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define G_TYPE_ZLIB_DECOMPRESSOR (g_zlib_decompressor_get_type ()) +#define G_ZLIB_DECOMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_ZLIB_DECOMPRESSOR, GZlibDecompressor)) +#define G_ZLIB_DECOMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_ZLIB_DECOMPRESSOR, GZlibDecompressorClass)) +#define G_IS_ZLIB_DECOMPRESSOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_ZLIB_DECOMPRESSOR)) +#define G_IS_ZLIB_DECOMPRESSOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_ZLIB_DECOMPRESSOR)) +#define G_ZLIB_DECOMPRESSOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_ZLIB_DECOMPRESSOR, GZlibDecompressorClass)) + +typedef struct _GZlibDecompressorClass GZlibDecompressorClass; + +struct _GZlibDecompressorClass +{ + GObjectClass parent_class; +}; + +GIO_AVAILABLE_IN_ALL +GType g_zlib_decompressor_get_type (void) G_GNUC_CONST; + +GIO_AVAILABLE_IN_ALL +GZlibDecompressor *g_zlib_decompressor_new (GZlibCompressorFormat format); + +GIO_AVAILABLE_IN_ALL +GFileInfo *g_zlib_decompressor_get_file_info (GZlibDecompressor *decompressor); + +G_END_DECLS + +#endif /* __G_ZLIB_DECOMPRESSOR_H__ */ + +/* + * Copyright © 2015 Canonical Limited + * + * SPDX-License-Identifier: LGPL-2.1-or-later + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + * + * Author: Ryan Lortie + */ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAction, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GActionMap, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppInfo, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppLaunchContext, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAppInfoMonitor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GApplicationCommandLine, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GApplication, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncInitable, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GAsyncResult, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBufferedInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBufferedOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GBytesIcon, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCancellable, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCharsetConverter, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverter, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GConverterOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GCredentials, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDatagramBased, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDataOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusActionGroup, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusAuthObserver, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusInterface, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusInterfaceSkeleton, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMenuModel, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMessage, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusMethodInvocation, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusNodeInfo, g_dbus_node_info_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObject, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectManagerClient, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectManager, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectManagerServer, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectProxy, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusObjectSkeleton, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusProxy, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDBusServer, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDrive, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEmblemedIcon, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GEmblem, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileEnumerator, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFile, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileAttributeInfoList, g_file_attribute_info_list_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIcon, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInfo, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileIOStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileMonitor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFilenameCompleter, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFilterInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFilterOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIcon, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInetAddress, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInetAddressMask, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInetSocketAddress, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitable, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOModule, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GIOStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GLoadableIcon, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMemoryOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenu, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuItem, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuModel, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuAttributeIter, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMenuLinkIter, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMount, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GMountOperation, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNativeVolumeMonitor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNetworkAddress, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNetworkMonitor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNetworkService, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GNotification, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPermission, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPollableInputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPollableOutputStream, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GPropertyAction, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxyAddressEnumerator, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxyAddress, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxy, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GProxyResolver, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GRemoteActionGroup, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GResolver, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GResource, g_resource_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSeekable, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsBackend, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsSchema, g_settings_schema_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsSchemaKey, g_settings_schema_key_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettingsSchemaSource, g_settings_schema_source_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSettings, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleActionGroup, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleAction, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleAsyncResult, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimplePermission, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSimpleProxyResolver, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddressEnumerator, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketAddress, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketClient, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketConnectable, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketControlMessage, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocket, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketListener, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSocketService, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocess, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GSubprocessLauncher, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTask, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTcpConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTcpWrapperConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTestDBus, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThemedIcon, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GThreadedSocketService, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsBackend, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsCertificate, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsClientConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsDatabase, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsFileDatabase, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsInteraction, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsPassword, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GTlsServerConnection, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVfs, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolume, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GVolumeMonitor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibCompressor, g_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC(GZlibDecompressor, g_object_unref) + +#undef __GIO_GIO_H_INSIDE__ + +G_BEGIN_DECLS + +GIO_AVAILABLE_IN_2_68 +void gio_init (void); + +GIO_AVAILABLE_IN_2_68 +void gio_shutdown (void); + +GIO_AVAILABLE_IN_2_68 +void gio_deinit (void); + +GIO_AVAILABLE_IN_2_68 +void gio_prepare_to_fork (void); + +GIO_AVAILABLE_IN_2_68 +void gio_recover_from_fork_in_parent (void); + +GIO_AVAILABLE_IN_2_68 +void gio_recover_from_fork_in_child (void); + +G_END_DECLS + +#endif /* __G_IO_H__ */ +/* + * Copyright (C) 2008-2023 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_H__ +#define __GUM_H__ + +/* + * Copyright (C) 2008-2023 Ole André Vadla Ravnås + * Copyright (C) 2023 Håvard Sørbø + * Copyright (C) 2024 Yannis Juglaret + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUMDEFS_H__ +#define __GUMDEFS_H__ + + +/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ + +#ifndef __GUM_ENUM_TYPES_H__ +#define __GUM_ENUM_TYPES_H__ + +#ifndef GUM_DIET + + +G_BEGIN_DECLS + +/* Enumerations from "gumdarwingrafter.h" */ +GType gum_darwin_grafter_flags_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_DARWIN_GRAFTER_FLAGS (gum_darwin_grafter_flags_get_type ()) + +/* Enumerations from "gumdarwinmodule.h" */ +GType gum_darwin_module_flags_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_DARWIN_MODULE_FLAGS (gum_darwin_module_flags_get_type ()) + +/* Enumerations from "gumdefs.h" */ +GType gum_error_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ERROR (gum_error_get_type ()) +GType gum_cpu_type_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_CPU_TYPE (gum_cpu_type_get_type ()) +GType gum_memory_access_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_MEMORY_ACCESS (gum_memory_access_get_type ()) + +/* Enumerations from "gumelfmodule.h" */ +GType gum_elf_type_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_TYPE (gum_elf_type_get_type ()) +GType gum_elf_osabi_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_OSABI (gum_elf_osabi_get_type ()) +GType gum_elf_machine_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_MACHINE (gum_elf_machine_get_type ()) +GType gum_elf_source_mode_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_SOURCE_MODE (gum_elf_source_mode_get_type ()) +GType gum_elf_section_type_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_SECTION_TYPE (gum_elf_section_type_get_type ()) +GType gum_elf_dynamic_tag_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_DYNAMIC_TAG (gum_elf_dynamic_tag_get_type ()) +GType gum_elf_shdr_index_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_SHDR_INDEX (gum_elf_shdr_index_get_type ()) +GType gum_elf_symbol_type_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_SYMBOL_TYPE (gum_elf_symbol_type_get_type ()) +GType gum_elf_symbol_bind_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_SYMBOL_BIND (gum_elf_symbol_bind_get_type ()) +GType gum_elf_ia32_relocation_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_IA32_RELOCATION (gum_elf_ia32_relocation_get_type ()) +GType gum_elf_x64_relocation_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_X64_RELOCATION (gum_elf_x64_relocation_get_type ()) +GType gum_elf_arm_relocation_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_ARM_RELOCATION (gum_elf_arm_relocation_get_type ()) +GType gum_elf_arm64_relocation_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_ARM64_RELOCATION (gum_elf_arm64_relocation_get_type ()) +GType gum_elf_mips_relocation_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ELF_MIPS_RELOCATION (gum_elf_mips_relocation_get_type ()) + +/* Enumerations from "guminterceptor.h" */ +GType gum_attach_return_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_ATTACH_RETURN (gum_attach_return_get_type ()) +GType gum_replace_return_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_REPLACE_RETURN (gum_replace_return_get_type ()) + +/* Enumerations from "gumprocess.h" */ +GType gum_teardown_requirement_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_TEARDOWN_REQUIREMENT (gum_teardown_requirement_get_type ()) +GType gum_code_signing_policy_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_CODE_SIGNING_POLICY (gum_code_signing_policy_get_type ()) +GType gum_modify_thread_flags_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_MODIFY_THREAD_FLAGS (gum_modify_thread_flags_get_type ()) +GType gum_thread_state_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_THREAD_STATE (gum_thread_state_get_type ()) +GType gum_watch_conditions_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_WATCH_CONDITIONS (gum_watch_conditions_get_type ()) +GType gum_dependency_type_get_type (void) G_GNUC_CONST; +#define GUM_TYPE_DEPENDENCY_TYPE (gum_dependency_type_get_type ()) +G_END_DECLS + +#endif + +#endif /* __GUM_ENUM_TYPES_H__ */ + +/* Generated data ends here */ + + +#if !defined (GUM_STATIC) && defined (G_OS_WIN32) +# ifdef GUM_EXPORTS +# define GUM_API __declspec(dllexport) +# else +# define GUM_API __declspec(dllimport) +# endif +#else +# define GUM_API +#endif + +G_BEGIN_DECLS + +#define GUM_ERROR gum_error_quark () + +typedef enum { + GUM_ERROR_FAILED, + GUM_ERROR_NOT_FOUND, + GUM_ERROR_EXISTS, + GUM_ERROR_PERMISSION_DENIED, + GUM_ERROR_INVALID_ARGUMENT, + GUM_ERROR_NOT_SUPPORTED, + GUM_ERROR_INVALID_DATA, +} GumError; + +typedef guint64 GumAddress; +#define GUM_ADDRESS(a) ((GumAddress) (guintptr) (a)) +#define GUM_TYPE_ADDRESS (gum_address_get_type ()) +typedef guint GumOS; +typedef guint GumCallingConvention; +typedef guint GumAbiType; +typedef guint GumCpuFeatures; +typedef guint GumInstructionEncoding; +typedef guint GumArgType; +typedef struct _GumArgument GumArgument; +typedef guint GumBranchHint; +typedef struct _GumIA32CpuContext GumIA32CpuContext; +typedef struct _GumX64CpuContext GumX64CpuContext; +typedef struct _GumArmCpuContext GumArmCpuContext; +typedef union _GumArmVectorReg GumArmVectorReg; +typedef struct _GumArm64CpuContext GumArm64CpuContext; +typedef union _GumArm64VectorReg GumArm64VectorReg; +typedef struct _GumMipsCpuContext GumMipsCpuContext; +typedef guint GumRelocationScenario; + +#if defined (_M_IX86) || defined (__i386__) +# define GUM_NATIVE_CPU GUM_CPU_IA32 +# define GUM_DEFAULT_CS_ARCH CS_ARCH_X86 +# define gum_cs_arch_register_native cs_arch_register_x86 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE CS_MODE_32 +typedef GumIA32CpuContext GumCpuContext; +#elif defined (_M_X64) || defined (__x86_64__) +# define GUM_NATIVE_CPU GUM_CPU_AMD64 +# define GUM_DEFAULT_CS_ARCH CS_ARCH_X86 +# define gum_cs_arch_register_native cs_arch_register_x86 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE CS_MODE_64 +typedef GumX64CpuContext GumCpuContext; +#elif defined (_M_ARM) || defined (__arm__) +# define GUM_NATIVE_CPU GUM_CPU_ARM +# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM +# define gum_cs_arch_register_native cs_arch_register_arm +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE \ + ((cs_mode) (CS_MODE_ARM | CS_MODE_V8 | GUM_DEFAULT_CS_ENDIAN)) +# define GUM_PSR_T_BIT 0x20 +typedef GumArmCpuContext GumCpuContext; +#elif defined (_M_ARM64) || defined (__aarch64__) +# define GUM_NATIVE_CPU GUM_CPU_ARM64 +# define GUM_DEFAULT_CS_ARCH CS_ARCH_ARM64 +# define gum_cs_arch_register_native cs_arch_register_arm64 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE GUM_DEFAULT_CS_ENDIAN +typedef GumArm64CpuContext GumCpuContext; +#elif defined (__mips__) +# define GUM_NATIVE_CPU GUM_CPU_MIPS +# define GUM_DEFAULT_CS_ARCH CS_ARCH_MIPS +# define gum_cs_arch_register_native cs_arch_register_mips +# if GLIB_SIZEOF_VOID_P == 4 +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE ((cs_mode) \ + (CS_MODE_MIPS32 | GUM_DEFAULT_CS_ENDIAN)) +# else +/** + * GUM_DEFAULT_CS_MODE: (skip) + */ +# define GUM_DEFAULT_CS_MODE ((cs_mode) \ + (CS_MODE_MIPS64 | GUM_DEFAULT_CS_ENDIAN)) +# endif +typedef GumMipsCpuContext GumCpuContext; +#else +# error Unsupported architecture. +#endif +/* + * The only non-legacy big-endian configuration on 32-bit ARM systems is BE8. + * In this configuration, whilst the data is in big-endian, the code stream is + * still in little-endian. Since Capstone is disassembling the code stream, it + * should work in little-endian even on BE8 systems. + */ +#if G_BYTE_ORDER == G_LITTLE_ENDIAN || defined (__arm__) +# define GUM_DEFAULT_CS_ENDIAN CS_MODE_LITTLE_ENDIAN +#else +# define GUM_DEFAULT_CS_ENDIAN CS_MODE_BIG_ENDIAN +#endif +#ifdef G_OS_WIN32 +# define GUM_NATIVE_ABI GUM_ABI_WINDOWS +# define GUM_NATIVE_ABI_IS_WINDOWS 1 +# define GUM_NATIVE_ABI_IS_UNIX 0 +#else +# define GUM_NATIVE_ABI GUM_ABI_UNIX +# define GUM_NATIVE_ABI_IS_WINDOWS 0 +# define GUM_NATIVE_ABI_IS_UNIX 1 +#endif + +enum _GumOS +{ + GUM_OS_WINDOWS, + GUM_OS_MACOS, + GUM_OS_LINUX, + GUM_OS_IOS, + GUM_OS_WATCHOS, + GUM_OS_TVOS, + GUM_OS_ANDROID, + GUM_OS_FREEBSD, + GUM_OS_QNX +}; + +enum _GumCallingConvention +{ + GUM_CALL_CAPI, + GUM_CALL_SYSAPI +}; + +enum _GumAbiType +{ + GUM_ABI_UNIX, + GUM_ABI_WINDOWS +}; + +typedef enum { + GUM_CPU_INVALID, + GUM_CPU_IA32, + GUM_CPU_AMD64, + GUM_CPU_ARM, + GUM_CPU_ARM64, + GUM_CPU_MIPS +} GumCpuType; + +enum _GumCpuFeatures +{ + GUM_CPU_AVX2 = 1 << 0, + GUM_CPU_CET_SS = 1 << 1, + GUM_CPU_THUMB_INTERWORK = 1 << 2, + GUM_CPU_VFP2 = 1 << 3, + GUM_CPU_VFP3 = 1 << 4, + GUM_CPU_VFPD32 = 1 << 5, + GUM_CPU_PTRAUTH = 1 << 6, +}; + +typedef enum { + GUM_MEMORY_ACCESS_OPEN, + GUM_MEMORY_ACCESS_EXCLUSIVE, +} GumMemoryAccess; + +enum _GumInstructionEncoding +{ + GUM_INSTRUCTION_DEFAULT, + GUM_INSTRUCTION_SPECIAL +}; + +enum _GumArgType +{ + GUM_ARG_ADDRESS, + GUM_ARG_REGISTER +}; + +struct _GumArgument +{ + GumArgType type; + + union + { + GumAddress address; + gint reg; + } value; +}; + +enum _GumBranchHint +{ + GUM_NO_HINT, + GUM_LIKELY, + GUM_UNLIKELY +}; + +struct _GumIA32CpuContext +{ + guint32 eip; + + guint32 edi; + guint32 esi; + guint32 ebp; + guint32 esp; + guint32 ebx; + guint32 edx; + guint32 ecx; + guint32 eax; +}; + +struct _GumX64CpuContext +{ + guint64 rip; + + guint64 r15; + guint64 r14; + guint64 r13; + guint64 r12; + guint64 r11; + guint64 r10; + guint64 r9; + guint64 r8; + + guint64 rdi; + guint64 rsi; + guint64 rbp; + guint64 rsp; + guint64 rbx; + guint64 rdx; + guint64 rcx; + guint64 rax; +}; + +union _GumArmVectorReg +{ + guint8 q[16]; + gdouble d[2]; + gfloat s[4]; +}; + +struct _GumArmCpuContext +{ + guint32 pc; + guint32 sp; + guint32 cpsr; + + guint32 r8; + guint32 r9; + guint32 r10; + guint32 r11; + guint32 r12; + + GumArmVectorReg v[16]; + + guint32 _padding; + + guint32 r[8]; + guint32 lr; +}; + +union _GumArm64VectorReg +{ + guint8 q[16]; + gdouble d; + gfloat s; + guint16 h; + guint8 b; +}; + +struct _GumArm64CpuContext +{ + guint64 pc; + guint64 sp; + guint64 nzcv; + + guint64 x[29]; + guint64 fp; + guint64 lr; + + GumArm64VectorReg v[32]; +}; + +struct _GumMipsCpuContext +{ + /* + * This structure represents the register state pushed onto the stack by the + * trampoline which allows us to vector from the original minimal assembly + * hook to architecture agnostic C code inside frida-gum. These registers are + * natively sized. Even if some have not been expanded to 64-bits from the + * MIPS32 architecture MIPS can only perform aligned data access and as such + * pushing zero extended values is simpler than attempting to push minimally + * sized data types. + */ + gsize pc; + + gsize gp; + gsize sp; + gsize fp; + gsize ra; + + gsize hi; + gsize lo; + + gsize at; + + gsize v0; + gsize v1; + + gsize a0; + gsize a1; + gsize a2; + gsize a3; + + gsize t0; + gsize t1; + gsize t2; + gsize t3; + gsize t4; + gsize t5; + gsize t6; + gsize t7; + gsize t8; + gsize t9; + + gsize s0; + gsize s1; + gsize s2; + gsize s3; + gsize s4; + gsize s5; + gsize s6; + gsize s7; + + gsize k0; + gsize k1; +}; + +enum _GumRelocationScenario +{ + GUM_SCENARIO_OFFLINE, + GUM_SCENARIO_ONLINE +}; + +#ifndef __arm__ +# if GLIB_SIZEOF_VOID_P == 8 +# define GUM_CPU_CONTEXT_XAX(c) ((c)->rax) +# define GUM_CPU_CONTEXT_XCX(c) ((c)->rcx) +# define GUM_CPU_CONTEXT_XDX(c) ((c)->rdx) +# define GUM_CPU_CONTEXT_XBX(c) ((c)->rbx) +# define GUM_CPU_CONTEXT_XSP(c) ((c)->rsp) +# define GUM_CPU_CONTEXT_XBP(c) ((c)->rbp) +# define GUM_CPU_CONTEXT_XSI(c) ((c)->rsi) +# define GUM_CPU_CONTEXT_XDI(c) ((c)->rdi) +# define GUM_CPU_CONTEXT_XIP(c) ((c)->rip) +# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, rax)) +# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, rcx)) +# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, rdx)) +# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, rbx)) +# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, rsp)) +# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, rbp)) +# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, rsi)) +# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, rdi)) +# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, rip)) +# else +# define GUM_CPU_CONTEXT_XAX(c) ((c)->eax) +# define GUM_CPU_CONTEXT_XCX(c) ((c)->ecx) +# define GUM_CPU_CONTEXT_XDX(c) ((c)->edx) +# define GUM_CPU_CONTEXT_XBX(c) ((c)->ebx) +# define GUM_CPU_CONTEXT_XSP(c) ((c)->esp) +# define GUM_CPU_CONTEXT_XBP(c) ((c)->ebp) +# define GUM_CPU_CONTEXT_XSI(c) ((c)->esi) +# define GUM_CPU_CONTEXT_XDI(c) ((c)->edi) +# define GUM_CPU_CONTEXT_XIP(c) ((c)->eip) +# define GUM_CPU_CONTEXT_OFFSET_XAX (G_STRUCT_OFFSET (GumCpuContext, eax)) +# define GUM_CPU_CONTEXT_OFFSET_XCX (G_STRUCT_OFFSET (GumCpuContext, ecx)) +# define GUM_CPU_CONTEXT_OFFSET_XDX (G_STRUCT_OFFSET (GumCpuContext, edx)) +# define GUM_CPU_CONTEXT_OFFSET_XBX (G_STRUCT_OFFSET (GumCpuContext, ebx)) +# define GUM_CPU_CONTEXT_OFFSET_XSP (G_STRUCT_OFFSET (GumCpuContext, esp)) +# define GUM_CPU_CONTEXT_OFFSET_XBP (G_STRUCT_OFFSET (GumCpuContext, ebp)) +# define GUM_CPU_CONTEXT_OFFSET_XSI (G_STRUCT_OFFSET (GumCpuContext, esi)) +# define GUM_CPU_CONTEXT_OFFSET_XDI (G_STRUCT_OFFSET (GumCpuContext, edi)) +# define GUM_CPU_CONTEXT_OFFSET_XIP (G_STRUCT_OFFSET (GumCpuContext, eip)) +# endif +#endif + +#define GUM_MAX_PATH 260 +#define GUM_MAX_TYPE_NAME 16 +#define GUM_MAX_SYMBOL_NAME 2048 + +#define GUM_MAX_THREADS 768 +#define GUM_MAX_CALL_DEPTH 32 +#define GUM_MAX_BACKTRACE_DEPTH 16 +#define GUM_MAX_WORST_CASE_INFO_SIZE 128 + +#define GUM_MAX_LISTENERS_PER_FUNCTION 2 +#define GUM_MAX_LISTENER_DATA 1024 + +#define GUM_MAX_THREAD_RANGES 2 + +#if defined (HAVE_I386) +# if GLIB_SIZEOF_VOID_P == 8 +# define GUM_CPU_MODE CS_MODE_64 +# define GUM_X86_THUNK +# else +# define GUM_CPU_MODE CS_MODE_32 +# define GUM_X86_THUNK GUM_FASTCALL +# endif +#else +# if G_BYTE_ORDER == G_LITTLE_ENDIAN +# define GUM_CPU_MODE CS_MODE_LITTLE_ENDIAN +# else +# define GUM_CPU_MODE CS_MODE_BIG_ENDIAN +# endif +#endif +#if !defined (G_OS_WIN32) && GLIB_SIZEOF_VOID_P == 8 +# define GUM_X86_THUNK_REG_ARG0 GUM_X86_XDI +# define GUM_X86_THUNK_REG_ARG1 GUM_X86_XSI +#else +# define GUM_X86_THUNK_REG_ARG0 GUM_X86_XCX +# define GUM_X86_THUNK_REG_ARG1 GUM_X86_XDX +#endif +#define GUM_RED_ZONE_SIZE 128 + +#if defined (_M_IX86) || defined (__i386__) +# ifdef _MSC_VER +# define GUM_CDECL __cdecl +# define GUM_STDCALL __stdcall +# define GUM_FASTCALL __fastcall +# else +# define GUM_CDECL __attribute__ ((cdecl)) +# define GUM_STDCALL __attribute__ ((stdcall)) +# define GUM_FASTCALL __attribute__ ((fastcall)) +# endif +#else +# define GUM_CDECL +# define GUM_STDCALL +# define GUM_FASTCALL +#endif + +#ifdef _MSC_VER +# define GUM_NOINLINE __declspec (noinline) +#else +# define GUM_NOINLINE __attribute__ ((noinline)) +#endif + +#define GUM_ALIGN_POINTER(t, p, b) \ + ((t) GSIZE_TO_POINTER (((GPOINTER_TO_SIZE (p) + ((gsize) (b - 1))) & \ + ~((gsize) (b - 1))))) +#define GUM_ALIGN_SIZE(s, b) \ + ((((gsize) s) + ((gsize) (b - 1))) & ~((gsize) (b - 1))) + +#define GUM_FUNCPTR_TO_POINTER(f) (GSIZE_TO_POINTER (f)) +#define GUM_POINTER_TO_FUNCPTR(t, p) ((t) GPOINTER_TO_SIZE (p)) + +#define GUM_INT2_MASK 0x00000003U +#define GUM_INT3_MASK 0x00000007U +#define GUM_INT4_MASK 0x0000000fU +#define GUM_INT5_MASK 0x0000001fU +#define GUM_INT6_MASK 0x0000003fU +#define GUM_INT8_MASK 0x000000ffU +#define GUM_INT10_MASK 0x000003ffU +#define GUM_INT11_MASK 0x000007ffU +#define GUM_INT12_MASK 0x00000fffU +#define GUM_INT14_MASK 0x00003fffU +#define GUM_INT16_MASK 0x0000ffffU +#define GUM_INT18_MASK 0x0003ffffU +#define GUM_INT19_MASK 0x0007ffffU +#define GUM_INT24_MASK 0x00ffffffU +#define GUM_INT26_MASK 0x03ffffffU +#define GUM_INT28_MASK 0x0fffffffU +#define GUM_INT32_MASK 0xffffffffU + +#define GUM_IS_WITHIN_UINT7_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (127)) +#define GUM_IS_WITHIN_UINT8_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (0) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (255)) +#define GUM_IS_WITHIN_INT8_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-128) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (127)) +#define GUM_IS_WITHIN_INT11_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-1024) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (1023)) +#define GUM_IS_WITHIN_INT14_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-8192) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (8191)) +#define GUM_IS_WITHIN_INT16_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-32768) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (32767)) +#define GUM_IS_WITHIN_INT18_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-131072) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (131071)) +#define GUM_IS_WITHIN_INT19_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-262144) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (262143)) +#define GUM_IS_WITHIN_INT20_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-524288) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (524287)) +#define GUM_IS_WITHIN_INT21_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-1048576) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (1048575)) +#define GUM_IS_WITHIN_INT24_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-8388608) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (8388607)) +#define GUM_IS_WITHIN_INT26_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-33554432) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (33554431)) +#define GUM_IS_WITHIN_INT28_RANGE(i) \ + (((gint64) (i)) >= G_GINT64_CONSTANT (-134217728) && \ + ((gint64) (i)) <= G_GINT64_CONSTANT (134217727)) +#define GUM_IS_WITHIN_INT32_RANGE(i) \ + (((gint64) (i)) >= (gint64) G_MININT32 && \ + ((gint64) (i)) <= (gint64) G_MAXINT32) + +#ifndef GUM_DIET + +# define GUM_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, \ + OBJ_NAME, ParentName) \ + G_DECLARE_FINAL_TYPE (ModuleObjName, module_obj_name, MODULE, OBJ_NAME, \ + ParentName) +# define GUM_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, \ + OBJ_NAME, PrerequisiteName) \ + G_DECLARE_INTERFACE (ModuleObjName, module_obj_name, MODULE, OBJ_NAME, \ + PrerequisiteName) +# define GUM_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) \ + G_DEFINE_BOXED_TYPE (TypeName, type_name, copy_func, free_func) +# define gum_object_ref(object) g_object_ref (object) +# define gum_object_unref(object) g_object_unref (object) +# define gum_clear_object(object_ptr) \ + g_clear_pointer ((object_ptr), g_object_unref) + +#else + +# define GUM_DECLARE_FINAL_TYPE(ModuleObjName, module_obj_name, MODULE, \ + OBJ_NAME, ParentName) \ + typedef struct _##ModuleObjName ModuleObjName; \ + \ + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME ( \ + gpointer obj) \ + { \ + return obj; \ + } +# define GUM_DECLARE_INTERFACE(ModuleObjName, module_obj_name, MODULE, \ + OBJ_NAME, PrerequisiteName) \ + typedef struct _##ModuleObjName ModuleObjName; \ + \ + G_GNUC_UNUSED static inline ModuleObjName * MODULE##_##OBJ_NAME ( \ + gpointer obj) \ + { \ + return obj; \ + } +# define GUM_DEFINE_BOXED_TYPE(TypeName, type_name, copy_func, free_func) +# define gum_clear_object(object_ptr) \ + g_clear_pointer ((object_ptr), gum_object_unref) + +typedef struct _GumObject GumObject; + +struct _GumObject +{ + gint ref_count; + void (* finalize) (GumObject * object); +}; + +GUM_API gpointer gum_object_ref (gpointer object); +GUM_API void gum_object_unref (gpointer object); + +#endif + +#ifdef G_NORETURN +# define GUM_NORETURN G_NORETURN +#else +# define GUM_NORETURN +#endif + +GUM_API GQuark gum_error_quark (void); + +GUM_API GUM_NORETURN void gum_panic (const gchar * format, ...) + G_ANALYZER_NORETURN; + +GUM_API GumCpuFeatures gum_query_cpu_features (void); + +GUM_API gpointer gum_cpu_context_get_nth_argument (GumCpuContext * self, + guint n); +GUM_API void gum_cpu_context_replace_nth_argument (GumCpuContext * self, + guint n, gpointer value); +GUM_API gpointer gum_cpu_context_get_return_value (GumCpuContext * self); +GUM_API void gum_cpu_context_replace_return_value (GumCpuContext * self, + gpointer value); + +#ifndef GUM_DIET +GUM_API GType gum_address_get_type (void) G_GNUC_CONST; +#endif + +G_END_DECLS + +#endif + +/* + * Copyright (C) 2016-2023 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_API_RESOLVER_H__ +#define __GUM_API_RESOLVER_H__ + + +G_BEGIN_DECLS + +#define GUM_API_SIZE_NONE -1 + +#define GUM_TYPE_API_RESOLVER (gum_api_resolver_get_type ()) +GUM_DECLARE_INTERFACE (GumApiResolver, gum_api_resolver, GUM, API_RESOLVER, + GObject) + +typedef struct _GumApiDetails GumApiDetails; + +typedef gboolean (* GumFoundApiFunc) (const GumApiDetails * details, + gpointer user_data); + +#ifndef GUM_DIET + +struct _GumApiResolverInterface +{ + GTypeInterface parent; + + void (* enumerate_matches) (GumApiResolver * self, const gchar * query, + GumFoundApiFunc func, gpointer user_data, GError ** error); +}; + +#endif + +struct _GumApiDetails +{ + const gchar * name; + GumAddress address; + gssize size; +}; + +GUM_API GumApiResolver * gum_api_resolver_make (const gchar * type); + +GUM_API void gum_api_resolver_enumerate_matches (GumApiResolver * self, + const gchar * query, GumFoundApiFunc func, gpointer user_data, + GError ** error); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2022 Ole André Vadla Ravnås + * Copyright (C) 2021 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_BACKTRACER_H__ +#define __GUM_BACKTRACER_H__ + +/* + * Copyright (C) 2008-2010 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_RETURN_ADDRESS_H__ +#define __GUM_RETURN_ADDRESS_H__ + + +typedef struct _GumReturnAddressDetails GumReturnAddressDetails; +typedef gpointer GumReturnAddress; +typedef struct _GumReturnAddressArray GumReturnAddressArray; + +struct _GumReturnAddressDetails +{ + GumReturnAddress address; + gchar module_name[GUM_MAX_PATH + 1]; + gchar function_name[GUM_MAX_SYMBOL_NAME + 1]; + gchar file_name[GUM_MAX_PATH + 1]; + guint line_number; + guint column; +}; + +struct _GumReturnAddressArray +{ + guint len; + GumReturnAddress items[GUM_MAX_BACKTRACE_DEPTH]; +}; + +G_BEGIN_DECLS + +GUM_API gboolean gum_return_address_details_from_address ( + GumReturnAddress address, GumReturnAddressDetails * details); + +GUM_API gboolean gum_return_address_array_is_equal ( + const GumReturnAddressArray * array1, + const GumReturnAddressArray * array2); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_BACKTRACER (gum_backtracer_get_type ()) +GUM_DECLARE_INTERFACE (GumBacktracer, gum_backtracer, GUM, BACKTRACER, GObject) + +#ifndef GUM_DIET + +struct _GumBacktracerInterface +{ + GTypeInterface parent; + + void (* generate) (GumBacktracer * self, const GumCpuContext * cpu_context, + GumReturnAddressArray * return_addresses, guint limit); +}; + +#endif + +GUM_API GumBacktracer * gum_backtracer_make_accurate (void); +GUM_API GumBacktracer * gum_backtracer_make_fuzzy (void); + +GUM_API void gum_backtracer_generate (GumBacktracer * self, + const GumCpuContext * cpu_context, + GumReturnAddressArray * return_addresses); +GUM_API void gum_backtracer_generate_with_limit (GumBacktracer * self, + const GumCpuContext * cpu_context, + GumReturnAddressArray * return_addresses, guint limit); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2017-2023 Ole André Vadla Ravnås + * Copyright (C) 2024 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_CLOAK_H__ +#define __GUM_CLOAK_H__ + +/* + * Copyright (C) 2008-2022 Ole André Vadla Ravnås + * Copyright (C) 2008 Christian Berentsen + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MEMORY_H__ +#define __GUM_MEMORY_H__ + + +#define GUM_TYPE_MATCH_PATTERN (gum_match_pattern_get_type ()) +#define GUM_TYPE_MEMORY_RANGE (gum_memory_range_get_type ()) +#define GUM_MEMORY_RANGE_INCLUDES(r, a) ((a) >= (r)->base_address && \ + (a) < ((r)->base_address + (r)->size)) + +#define GUM_PAGE_RW ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE)) +#define GUM_PAGE_RX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_EXECUTE)) +#define GUM_PAGE_RWX ((GumPageProtection) (GUM_PAGE_READ | GUM_PAGE_WRITE | \ + GUM_PAGE_EXECUTE)) + +G_BEGIN_DECLS + +typedef guint GumPtrauthSupport; +typedef guint GumRwxSupport; +typedef guint GumMemoryOperation; +typedef guint GumPageProtection; +typedef struct _GumAddressSpec GumAddressSpec; +typedef struct _GumMemoryRange GumMemoryRange; +typedef struct _GumMatchPattern GumMatchPattern; + +typedef gboolean (* GumMemoryIsNearFunc) (gpointer memory, gpointer address); + +enum _GumPtrauthSupport +{ + GUM_PTRAUTH_INVALID, + GUM_PTRAUTH_UNSUPPORTED, + GUM_PTRAUTH_SUPPORTED +}; + +enum _GumRwxSupport +{ + GUM_RWX_NONE, + GUM_RWX_ALLOCATIONS_ONLY, + GUM_RWX_FULL +}; + +enum _GumMemoryOperation +{ + GUM_MEMOP_INVALID, + GUM_MEMOP_READ, + GUM_MEMOP_WRITE, + GUM_MEMOP_EXECUTE +}; + +enum _GumPageProtection +{ + GUM_PAGE_NO_ACCESS = 0, + GUM_PAGE_READ = (1 << 0), + GUM_PAGE_WRITE = (1 << 1), + GUM_PAGE_EXECUTE = (1 << 2), +}; + +struct _GumAddressSpec +{ + gpointer near_address; + gsize max_distance; +}; + +struct _GumMemoryRange +{ + GumAddress base_address; + gsize size; +}; + +typedef void (* GumMemoryPatchApplyFunc) (gpointer mem, gpointer user_data); +typedef gboolean (* GumMemoryScanMatchFunc) (GumAddress address, gsize size, + gpointer user_data); + +GUM_API void gum_internal_heap_ref (void); +GUM_API void gum_internal_heap_unref (void); + +GUM_API gpointer gum_sign_code_pointer (gpointer value); +GUM_API gpointer gum_strip_code_pointer (gpointer value); +GUM_API GumAddress gum_sign_code_address (GumAddress value); +GUM_API GumAddress gum_strip_code_address (GumAddress value); +GUM_API GumPtrauthSupport gum_query_ptrauth_support (void); +GUM_API guint gum_query_page_size (void); +GUM_API gboolean gum_query_is_rwx_supported (void); +GUM_API GumRwxSupport gum_query_rwx_support (void); +GUM_API gboolean gum_memory_is_readable (gconstpointer address, gsize len); +GUM_API gboolean gum_memory_query_protection (gconstpointer address, + GumPageProtection * prot); +GUM_API guint8 * gum_memory_read (gconstpointer address, gsize len, + gsize * n_bytes_read); +GUM_API gboolean gum_memory_write (gpointer address, const guint8 * bytes, + gsize len); +GUM_API gboolean gum_memory_patch_code (gpointer address, gsize size, + GumMemoryPatchApplyFunc apply, gpointer apply_data); +GUM_API gboolean gum_memory_mark_code (gpointer address, gsize size); + +GUM_API void gum_memory_scan (const GumMemoryRange * range, + const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, + gpointer user_data); + +#ifndef GUM_DIET +GUM_API GType gum_match_pattern_get_type (void) G_GNUC_CONST; +#endif +GUM_API GumMatchPattern * gum_match_pattern_new_from_string ( + const gchar * pattern_str); +GUM_API GumMatchPattern * gum_match_pattern_ref (GumMatchPattern * pattern); +GUM_API void gum_match_pattern_unref (GumMatchPattern * pattern); +GUM_API guint gum_match_pattern_get_size (const GumMatchPattern * pattern); +GUM_API GPtrArray * gum_match_pattern_get_tokens ( + const GumMatchPattern * pattern); + +GUM_API void gum_ensure_code_readable (gconstpointer address, gsize size); + +GUM_API void gum_mprotect (gpointer address, gsize size, + GumPageProtection prot); +GUM_API gboolean gum_try_mprotect (gpointer address, gsize size, + GumPageProtection prot); + +GUM_API void gum_clear_cache (gpointer address, gsize size); + +#define gum_new(struct_type, n_structs) \ + ((struct_type *) gum_malloc (n_structs * sizeof (struct_type))) +#define gum_new0(struct_type, n_structs) \ + ((struct_type *) gum_malloc0 (n_structs * sizeof (struct_type))) + +GUM_API guint gum_peek_private_memory_usage (void); + +GUM_API gpointer gum_malloc (gsize size); +GUM_API gpointer gum_malloc0 (gsize size); +GUM_API gsize gum_malloc_usable_size (gconstpointer mem); +GUM_API gpointer gum_calloc (gsize count, gsize size); +GUM_API gpointer gum_realloc (gpointer mem, gsize size); +GUM_API gpointer gum_memalign (gsize alignment, gsize size); +GUM_API gpointer gum_memdup (gconstpointer mem, gsize byte_size); +GUM_API void gum_free (gpointer mem); + +GUM_API gpointer gum_alloc_n_pages (guint n_pages, GumPageProtection prot); +GUM_API gpointer gum_try_alloc_n_pages (guint n_pages, GumPageProtection prot); +GUM_API gpointer gum_alloc_n_pages_near (guint n_pages, GumPageProtection prot, + const GumAddressSpec * spec); +GUM_API gpointer gum_try_alloc_n_pages_near (guint n_pages, + GumPageProtection prot, const GumAddressSpec * spec); +GUM_API void gum_query_page_allocation_range (gconstpointer mem, guint size, + GumMemoryRange * range); +GUM_API void gum_free_pages (gpointer mem); + +GUM_API gpointer gum_memory_allocate (gpointer address, gsize size, + gsize alignment, GumPageProtection prot); +GUM_API gpointer gum_memory_allocate_near (const GumAddressSpec * spec, + gsize size, gsize alignment, GumPageProtection prot); +GUM_API gboolean gum_memory_free (gpointer address, gsize size); +GUM_API gboolean gum_memory_release (gpointer address, gsize size); +GUM_API gboolean gum_memory_recommit (gpointer address, gsize size, + GumPageProtection prot); +GUM_API gboolean gum_memory_discard (gpointer address, gsize size); +GUM_API gboolean gum_memory_decommit (gpointer address, gsize size); + +GUM_API gboolean gum_address_spec_is_satisfied_by (const GumAddressSpec * spec, + gconstpointer address); + +#ifndef GUM_DIET +GUM_API GType gum_memory_range_get_type (void) G_GNUC_CONST; +#endif +GUM_API GumMemoryRange * gum_memory_range_copy (const GumMemoryRange * range); +GUM_API void gum_memory_range_free (GumMemoryRange * range); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2023 Ole André Vadla Ravnås + * Copyright (C) 2020-2024 Francesco Tamagni + * Copyright (C) 2023 Grant Douglas + * Copyright (C) 2024 Håvard Sørbø + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_PROCESS_H__ +#define __GUM_PROCESS_H__ + + +#define GUM_THREAD_ID_INVALID ((GumThreadId) -1) + +#define GUM_TYPE_MODULE_DETAILS (gum_module_details_get_type ()) + +G_BEGIN_DECLS + +typedef guint GumProcessId; +typedef gsize GumThreadId; +typedef struct _GumThreadDetails GumThreadDetails; +typedef struct _GumModuleDetails GumModuleDetails; +typedef guint GumImportType; +typedef guint GumExportType; +typedef guint GumSymbolType; +typedef struct _GumImportDetails GumImportDetails; +typedef struct _GumExportDetails GumExportDetails; +typedef struct _GumSymbolDetails GumSymbolDetails; +typedef struct _GumSymbolSection GumSymbolSection; +typedef struct _GumRangeDetails GumRangeDetails; +typedef struct _GumFileMapping GumFileMapping; +typedef struct _GumSectionDetails GumSectionDetails; +typedef struct _GumDependencyDetails GumDependencyDetails; +typedef struct _GumMallocRangeDetails GumMallocRangeDetails; + +typedef enum { + GUM_TEARDOWN_REQUIREMENT_FULL, + GUM_TEARDOWN_REQUIREMENT_MINIMAL +} GumTeardownRequirement; + +typedef enum { + GUM_CODE_SIGNING_OPTIONAL, + GUM_CODE_SIGNING_REQUIRED +} GumCodeSigningPolicy; + +typedef enum { + GUM_MODIFY_THREAD_FLAGS_NONE = 0, + GUM_MODIFY_THREAD_FLAGS_ABORT_SAFELY = (1 << 0), +} GumModifyThreadFlags; + +typedef enum { + GUM_THREAD_RUNNING = 1, + GUM_THREAD_STOPPED, + GUM_THREAD_WAITING, + GUM_THREAD_UNINTERRUPTIBLE, + GUM_THREAD_HALTED +} GumThreadState; + +struct _GumThreadDetails +{ + GumThreadId id; + const gchar * name; + GumThreadState state; + GumCpuContext cpu_context; +}; + +typedef enum { + GUM_WATCH_READ = (1 << 0), + GUM_WATCH_WRITE = (1 << 1), +} GumWatchConditions; + +struct _GumModuleDetails +{ + const gchar * name; + const GumMemoryRange * range; + const gchar * path; +}; + +enum _GumImportType +{ + GUM_IMPORT_UNKNOWN, + GUM_IMPORT_FUNCTION, + GUM_IMPORT_VARIABLE +}; + +enum _GumExportType +{ + GUM_EXPORT_FUNCTION = 1, + GUM_EXPORT_VARIABLE +}; + +enum _GumSymbolType +{ + /* Common */ + GUM_SYMBOL_UNKNOWN, + GUM_SYMBOL_SECTION, + + /* Mach-O */ + GUM_SYMBOL_UNDEFINED, + GUM_SYMBOL_ABSOLUTE, + GUM_SYMBOL_PREBOUND_UNDEFINED, + GUM_SYMBOL_INDIRECT, + + /* ELF */ + GUM_SYMBOL_OBJECT, + GUM_SYMBOL_FUNCTION, + GUM_SYMBOL_FILE, + GUM_SYMBOL_COMMON, + GUM_SYMBOL_TLS, +}; + +struct _GumImportDetails +{ + GumImportType type; + const gchar * name; + const gchar * module; + GumAddress address; + GumAddress slot; +}; + +struct _GumExportDetails +{ + GumExportType type; + const gchar * name; + GumAddress address; +}; + +struct _GumSymbolDetails +{ + gboolean is_global; + GumSymbolType type; + const GumSymbolSection * section; + const gchar * name; + GumAddress address; + gssize size; +}; + +struct _GumSymbolSection +{ + const gchar * id; + GumPageProtection protection; +}; + +struct _GumRangeDetails +{ + const GumMemoryRange * range; + GumPageProtection protection; + const GumFileMapping * file; +}; + +struct _GumFileMapping +{ + const gchar * path; + guint64 offset; + gsize size; +}; + +struct _GumSectionDetails +{ + const gchar * id; + const gchar * name; + GumAddress address; + gsize size; +}; + +typedef enum { + GUM_DEPENDENCY_REGULAR, + GUM_DEPENDENCY_WEAK, + GUM_DEPENDENCY_REEXPORT, + GUM_DEPENDENCY_UPWARD, +} GumDependencyType; + +struct _GumDependencyDetails +{ + const gchar * name; + GumDependencyType type; +}; + +struct _GumMallocRangeDetails +{ + const GumMemoryRange * range; +}; + +typedef void (* GumModifyThreadFunc) (GumThreadId thread_id, + GumCpuContext * cpu_context, gpointer user_data); +typedef gboolean (* GumFoundThreadFunc) (const GumThreadDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundModuleFunc) (const GumModuleDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundImportFunc) (const GumImportDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundExportFunc) (const GumExportDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundSymbolFunc) (const GumSymbolDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundRangeFunc) (const GumRangeDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundSectionFunc) (const GumSectionDetails * details, + gpointer user_data); +typedef gboolean (* GumFoundDependencyFunc) ( + const GumDependencyDetails * details, gpointer user_data); +typedef gboolean (* GumFoundMallocRangeFunc) ( + const GumMallocRangeDetails * details, gpointer user_data); +typedef GumAddress (* GumResolveExportFunc) (const char * module_name, + const char * symbol_name, gpointer user_data); + +GUM_API GumOS gum_process_get_native_os (void); +GUM_API GumTeardownRequirement gum_process_get_teardown_requirement (void); +GUM_API void gum_process_set_teardown_requirement ( + GumTeardownRequirement requirement); +GUM_API GumCodeSigningPolicy gum_process_get_code_signing_policy (void); +GUM_API void gum_process_set_code_signing_policy (GumCodeSigningPolicy policy); +GUM_API const gchar * gum_process_query_libc_name (void); +GUM_API gboolean gum_process_is_debugger_attached (void); +GUM_API GumProcessId gum_process_get_id (void); +GUM_API GumThreadId gum_process_get_current_thread_id (void); +GUM_API gboolean gum_process_has_thread (GumThreadId thread_id); +GUM_API gboolean gum_process_modify_thread (GumThreadId thread_id, + GumModifyThreadFunc func, gpointer user_data, GumModifyThreadFlags flags); +GUM_API void gum_process_enumerate_threads (GumFoundThreadFunc func, + gpointer user_data); +GUM_API const GumModuleDetails * gum_process_get_main_module (void); +GUM_API gboolean gum_process_resolve_module_pointer (gconstpointer ptr, + gchar ** path, GumMemoryRange * range); +GUM_API void gum_process_enumerate_modules (GumFoundModuleFunc func, + gpointer user_data); +GUM_API void gum_process_enumerate_ranges (GumPageProtection prot, + GumFoundRangeFunc func, gpointer user_data); +GUM_API void gum_process_enumerate_malloc_ranges ( + GumFoundMallocRangeFunc func, gpointer user_data); +GUM_API guint gum_thread_try_get_ranges (GumMemoryRange * ranges, + guint max_length); +GUM_API gint gum_thread_get_system_error (void); +GUM_API void gum_thread_set_system_error (gint value); +GUM_API gboolean gum_thread_suspend (GumThreadId thread_id, GError ** error); +GUM_API gboolean gum_thread_resume (GumThreadId thread_id, GError ** error); +GUM_API gboolean gum_thread_set_hardware_breakpoint (GumThreadId thread_id, + guint breakpoint_id, GumAddress address, GError ** error); +GUM_API gboolean gum_thread_unset_hardware_breakpoint (GumThreadId thread_id, + guint breakpoint_id, GError ** error); +GUM_API gboolean gum_thread_set_hardware_watchpoint (GumThreadId thread_id, + guint watchpoint_id, GumAddress address, gsize size, GumWatchConditions wc, + GError ** error); +GUM_API gboolean gum_thread_unset_hardware_watchpoint (GumThreadId thread_id, + guint watchpoint_id, GError ** error); +GUM_API gboolean gum_module_load (const gchar * module_name, GError ** error); +GUM_API gboolean gum_module_ensure_initialized (const gchar * module_name); +GUM_API void gum_module_enumerate_imports (const gchar * module_name, + GumFoundImportFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_exports (const gchar * module_name, + GumFoundExportFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_symbols (const gchar * module_name, + GumFoundSymbolFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_ranges (const gchar * module_name, + GumPageProtection prot, GumFoundRangeFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_sections (const gchar * module_name, + GumFoundSectionFunc func, gpointer user_data); +GUM_API void gum_module_enumerate_dependencies (const gchar * module_name, + GumFoundDependencyFunc func, gpointer user_data); +GUM_API GumAddress gum_module_find_base_address (const gchar * module_name); +GUM_API GumAddress gum_module_find_export_by_name (const gchar * module_name, + const gchar * symbol_name); +GUM_API GumAddress gum_module_find_symbol_by_name (const gchar * module_name, + const gchar * symbol_name); + +GUM_API const gchar * gum_code_signing_policy_to_string ( + GumCodeSigningPolicy policy); + +#ifndef GUM_DIET +GUM_API GType gum_module_details_get_type (void) G_GNUC_CONST; +#endif +GUM_API GumModuleDetails * gum_module_details_copy ( + const GumModuleDetails * module); +GUM_API void gum_module_details_free (GumModuleDetails * module); + +GUM_API const gchar * gum_symbol_type_to_string (GumSymbolType type); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +typedef struct _GumCloak GumCloak; + +typedef gboolean (* GumCloakFoundThreadFunc) (GumThreadId id, + gpointer user_data); +typedef gboolean (* GumCloakFoundRangeFunc) (const GumMemoryRange * range, + gpointer user_data); +typedef gboolean (* GumCloakFoundFDFunc) (gint fd, gpointer user_data); +typedef void (* GumCloakLockedFunc) (gpointer user_data); + +GUM_API void gum_cloak_add_thread (GumThreadId id); +GUM_API void gum_cloak_remove_thread (GumThreadId id); +GUM_API gboolean gum_cloak_has_thread (GumThreadId id); +GUM_API void gum_cloak_enumerate_threads (GumCloakFoundThreadFunc func, + gpointer user_data); + +GUM_API void gum_cloak_add_range (const GumMemoryRange * range); +GUM_API void gum_cloak_remove_range (const GumMemoryRange * range); +GUM_API gboolean gum_cloak_has_range_containing (GumAddress address); +GUM_API GArray * gum_cloak_clip_range (const GumMemoryRange * range); +GUM_API void gum_cloak_enumerate_ranges (GumCloakFoundRangeFunc func, + gpointer user_data); + +GUM_API void gum_cloak_add_file_descriptor (gint fd); +GUM_API void gum_cloak_remove_file_descriptor (gint fd); +GUM_API gboolean gum_cloak_has_file_descriptor (gint fd); +GUM_API void gum_cloak_enumerate_file_descriptors (GumCloakFoundFDFunc func, + gpointer user_data); + +GUM_API void gum_cloak_with_lock_held (GumCloakLockedFunc func, + gpointer user_data); +GUM_API gboolean gum_cloak_is_locked (void); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2021 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_CODE_ALLOCATOR_H__ +#define __GUM_CODE_ALLOCATOR_H__ + + +#define GUM_TYPE_CODE_SLICE (gum_code_slice_get_type ()) +#define GUM_TYPE_CODE_DEFLECTOR (gum_code_deflector_get_type ()) + +G_BEGIN_DECLS + +typedef struct _GumCodeAllocator GumCodeAllocator; +typedef struct _GumCodeSlice GumCodeSlice; +typedef struct _GumCodeDeflector GumCodeDeflector; + +struct _GumCodeAllocator +{ + gsize slice_size; + gsize pages_per_batch; + gsize slices_per_batch; + gsize pages_metadata_size; + + GSList * uncommitted_pages; + GHashTable * dirty_pages; + GList * free_slices; + + GSList * dispatchers; +}; + +struct _GumCodeSlice +{ + gpointer data; + guint size; + + /*< private >*/ + gint ref_count; +}; + +struct _GumCodeDeflector +{ + gpointer return_address; + gpointer target; + gpointer trampoline; + + /*< private >*/ + gint ref_count; +}; + +GUM_API void gum_code_allocator_init (GumCodeAllocator * allocator, + gsize slice_size); +GUM_API void gum_code_allocator_free (GumCodeAllocator * allocator); + +GUM_API GumCodeSlice * gum_code_allocator_alloc_slice (GumCodeAllocator * self); +GUM_API GumCodeSlice * gum_code_allocator_try_alloc_slice_near ( + GumCodeAllocator * self, const GumAddressSpec * spec, gsize alignment); +GUM_API void gum_code_allocator_commit (GumCodeAllocator * self); +#ifndef GUM_DIET +GUM_API GType gum_code_slice_get_type (void) G_GNUC_CONST; +#endif +GUM_API GumCodeSlice * gum_code_slice_ref (GumCodeSlice * slice); +GUM_API void gum_code_slice_unref (GumCodeSlice * slice); + +GUM_API GumCodeDeflector * gum_code_allocator_alloc_deflector ( + GumCodeAllocator * self, const GumAddressSpec * caller, + gpointer return_address, gpointer target, gboolean dedicated); +#ifndef GUM_DIET +GUM_API GType gum_code_deflector_get_type (void) G_GNUC_CONST; +#endif +GUM_API GumCodeDeflector * gum_code_deflector_ref ( + GumCodeDeflector * deflector); +GUM_API void gum_code_deflector_unref (GumCodeDeflector * deflector); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2016-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_CODE_SEGMENT_H__ +#define __GUM_CODE_SEGMENT_H__ + + +G_BEGIN_DECLS + +typedef struct _GumCodeSegment GumCodeSegment; + +GUM_API gboolean gum_code_segment_is_supported (void); + +GUM_API GumCodeSegment * gum_code_segment_new (gsize size, + const GumAddressSpec * spec); +GUM_API void gum_code_segment_free (GumCodeSegment * segment); + +GUM_API gpointer gum_code_segment_get_address (GumCodeSegment * self); +GUM_API gsize gum_code_segment_get_size (GumCodeSegment * self); +GUM_API gsize gum_code_segment_get_virtual_size (GumCodeSegment * self); + +GUM_API void gum_code_segment_realize (GumCodeSegment * self); +GUM_API void gum_code_segment_map (GumCodeSegment * self, gsize source_offset, + gsize source_size, gpointer target_address); + +GUM_API gboolean gum_code_segment_mark (gpointer code, gsize size, + GError ** error); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2021-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_DARWIN_GRAFTER_H__ +#define __GUM_DARWIN_GRAFTER_H__ + + +G_BEGIN_DECLS + +typedef enum { + GUM_DARWIN_GRAFTER_FLAGS_NONE = 0, + GUM_DARWIN_GRAFTER_FLAGS_INGEST_FUNCTION_STARTS = (1 << 0), + GUM_DARWIN_GRAFTER_FLAGS_INGEST_IMPORTS = (1 << 1), + GUM_DARWIN_GRAFTER_FLAGS_TRANSFORM_LAZY_BINDS = (1 << 2), +} GumDarwinGrafterFlags; + +#define GUM_TYPE_DARWIN_GRAFTER (gum_darwin_grafter_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumDarwinGrafter, gum_darwin_grafter, GUM, + DARWIN_GRAFTER, GObject) + +GUM_API GumDarwinGrafter * gum_darwin_grafter_new_from_file ( + const gchar * path, GumDarwinGrafterFlags flags); + +GUM_API void gum_darwin_grafter_add (GumDarwinGrafter * self, + guint32 code_offset); + +GUM_API gboolean gum_darwin_grafter_graft (GumDarwinGrafter * self, + GError ** error); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2023 Ole André Vadla Ravnås + * Copyright (C) 2023 Fabian Freyer + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_DARWIN_MODULE_H__ +#define __GUM_DARWIN_MODULE_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_DARWIN_MODULE (gum_darwin_module_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumDarwinModule, gum_darwin_module, GUM, DARWIN_MODULE, + GObject) + +#define GUM_TYPE_DARWIN_MODULE_IMAGE (gum_darwin_module_image_get_type ()) + +#define GUM_DARWIN_PORT_NULL 0 +#define GUM_DARWIN_EXPORT_KIND_MASK 3 + +typedef guint GumDarwinModuleFiletype; +typedef gint GumDarwinCpuType; +typedef gint GumDarwinCpuSubtype; + +typedef struct _GumDarwinModuleImage GumDarwinModuleImage; + +typedef struct _GumDarwinModuleImageSegment GumDarwinModuleImageSegment; +typedef struct _GumDarwinSectionDetails GumDarwinSectionDetails; +typedef struct _GumDarwinChainedFixupsDetails GumDarwinChainedFixupsDetails; +typedef struct _GumDarwinRebaseDetails GumDarwinRebaseDetails; +typedef struct _GumDarwinBindDetails GumDarwinBindDetails; +typedef struct _GumDarwinThreadedItem GumDarwinThreadedItem; +typedef struct _GumDarwinTlvParameters GumDarwinTlvParameters; +typedef struct _GumDarwinTlvDescriptorDetails GumDarwinTlvDescriptorDetails; +typedef struct _GumDarwinInitPointersDetails GumDarwinInitPointersDetails; +typedef struct _GumDarwinInitOffsetsDetails GumDarwinInitOffsetsDetails; +typedef struct _GumDarwinTermPointersDetails GumDarwinTermPointersDetails; +typedef struct _GumDarwinFunctionStartsDetails GumDarwinFunctionStartsDetails; +typedef struct _GumDarwinSegment GumDarwinSegment; +typedef struct _GumDarwinExportDetails GumDarwinExportDetails; +typedef struct _GumDarwinSymbolDetails GumDarwinSymbolDetails; + +typedef guint8 GumDarwinRebaseType; +typedef guint8 GumDarwinBindType; +typedef guint8 GumDarwinThreadedItemType; +typedef gint GumDarwinBindOrdinal; +typedef guint8 GumDarwinBindSymbolFlags; +typedef guint8 GumDarwinExportSymbolKind; +typedef guint8 GumDarwinExportSymbolFlags; + +typedef guint GumDarwinPort; +typedef gint GumDarwinPageProtection; + +typedef gboolean (* GumFoundDarwinExportFunc) ( + const GumDarwinExportDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinSymbolFunc) ( + const GumDarwinSymbolDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinSectionFunc) ( + const GumDarwinSectionDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinChainedFixupsFunc) ( + const GumDarwinChainedFixupsDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinRebaseFunc) ( + const GumDarwinRebaseDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinBindFunc) ( + const GumDarwinBindDetails * details, gpointer user_data); + +typedef gboolean (* GumFoundDarwinTlvDescriptorFunc) ( + const GumDarwinTlvDescriptorDetails * details, gpointer user_data); + +typedef gboolean (* GumFoundDarwinInitPointersFunc) ( + const GumDarwinInitPointersDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinInitOffsetsFunc) ( + const GumDarwinInitOffsetsDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinTermPointersFunc) ( + const GumDarwinTermPointersDetails * details, gpointer user_data); +typedef gboolean (* GumFoundDarwinFunctionStartsFunc) ( + const GumDarwinFunctionStartsDetails * details, gpointer user_data); + +typedef struct _GumDyldInfoCommand GumDyldInfoCommand; +typedef struct _GumSymtabCommand GumSymtabCommand; +typedef struct _GumDysymtabCommand GumDysymtabCommand; + +typedef enum { + GUM_DARWIN_MODULE_FLAGS_NONE = 0, + GUM_DARWIN_MODULE_FLAGS_HEADER_ONLY = (1 << 0), +} GumDarwinModuleFlags; + +typedef struct _GumChainedFixupsHeader GumChainedFixupsHeader; +typedef struct _GumChainedStartsInImage GumChainedStartsInImage; +typedef struct _GumChainedStartsInSegment GumChainedStartsInSegment; + +typedef guint32 GumChainedImportFormat; +typedef guint32 GumChainedSymbolFormat; +typedef guint16 GumChainedPtrFormat; + +typedef struct _GumChainedImport GumChainedImport; +typedef struct _GumChainedImportAddend GumChainedImportAddend; +typedef struct _GumChainedImportAddend64 GumChainedImportAddend64; + +typedef struct _GumChainedPtr64Rebase GumChainedPtr64Rebase; +typedef struct _GumChainedPtr64Bind GumChainedPtr64Bind; +typedef struct _GumChainedPtrArm64eRebase GumChainedPtrArm64eRebase; +typedef struct _GumChainedPtrArm64eBind GumChainedPtrArm64eBind; +typedef struct _GumChainedPtrArm64eBind24 GumChainedPtrArm64eBind24; +typedef struct _GumChainedPtrArm64eAuthRebase GumChainedPtrArm64eAuthRebase; +typedef struct _GumChainedPtrArm64eAuthBind GumChainedPtrArm64eAuthBind; +typedef struct _GumChainedPtrArm64eAuthBind24 GumChainedPtrArm64eAuthBind24; + +struct _GumDarwinModule +{ +#ifndef GUM_DIET + GObject parent; +#else + GumObject parent; +#endif + + GumDarwinModuleFiletype filetype; + gchar * name; + gchar * uuid; + + GumDarwinPort task; + gboolean is_local; + gboolean is_kernel; + GumCpuType cpu_type; + GumPtrauthSupport ptrauth_support; + gsize pointer_size; + GumAddress base_address; + gchar * source_path; + GBytes * source_blob; + GumDarwinModuleFlags flags; + + GumDarwinModuleImage * image; + + const GumDyldInfoCommand * info; + const GumSymtabCommand * symtab; + const GumDysymtabCommand * dysymtab; + + GumAddress preferred_address; + + GArray * segments; + GArray * text_ranges; + + const guint8 * rebases; + const guint8 * rebases_end; + gpointer rebases_malloc_data; + + const guint8 * binds; + const guint8 * binds_end; + gpointer binds_malloc_data; + + const guint8 * lazy_binds; + const guint8 * lazy_binds_end; + gpointer lazy_binds_malloc_data; + + const guint8 * exports; + const guint8 * exports_end; + gpointer exports_malloc_data; + + GArray * dependencies; + GPtrArray * reexports; +}; + +enum _GumDarwinModuleFiletype +{ + GUM_DARWIN_MODULE_FILETYPE_OBJECT = 1, + GUM_DARWIN_MODULE_FILETYPE_EXECUTE, + GUM_DARWIN_MODULE_FILETYPE_FVMLIB, + GUM_DARWIN_MODULE_FILETYPE_CORE, + GUM_DARWIN_MODULE_FILETYPE_PRELOAD, + GUM_DARWIN_MODULE_FILETYPE_DYLIB, + GUM_DARWIN_MODULE_FILETYPE_DYLINKER, + GUM_DARWIN_MODULE_FILETYPE_BUNDLE, + GUM_DARWIN_MODULE_FILETYPE_DYLIB_STUB, + GUM_DARWIN_MODULE_FILETYPE_DSYM, + GUM_DARWIN_MODULE_FILETYPE_KEXT_BUNDLE, + GUM_DARWIN_MODULE_FILETYPE_FILESET, +}; + +enum _GumDarwinCpuArchType +{ + GUM_DARWIN_CPU_ARCH_ABI64 = 0x01000000, + GUM_DARWIN_CPU_ARCH_ABI64_32 = 0x02000000, +}; + +enum _GumDarwinCpuType +{ + GUM_DARWIN_CPU_X86 = 7, + GUM_DARWIN_CPU_X86_64 = 7 | GUM_DARWIN_CPU_ARCH_ABI64, + GUM_DARWIN_CPU_ARM = 12, + GUM_DARWIN_CPU_ARM64 = 12 | GUM_DARWIN_CPU_ARCH_ABI64, + GUM_DARWIN_CPU_ARM64_32 = 12 | GUM_DARWIN_CPU_ARCH_ABI64_32, +}; + +enum _GumDarwinCpuSubtype +{ + GUM_DARWIN_CPU_SUBTYPE_ARM64E = 2, + + GUM_DARWIN_CPU_SUBTYPE_MASK = 0x00ffffff, +}; + +struct _GumDarwinModuleImage +{ + gpointer data; + guint64 size; + gconstpointer linkedit; + + guint64 source_offset; + guint64 source_size; + guint64 shared_offset; + guint64 shared_size; + GArray * shared_segments; + + GBytes * bytes; + gpointer malloc_data; +}; + +struct _GumDarwinModuleImageSegment +{ + guint64 offset; + guint64 size; + GumDarwinPageProtection protection; +}; + +struct _GumDarwinSectionDetails +{ + gchar segment_name[17]; + gchar section_name[17]; + GumAddress vm_address; + guint64 size; + GumDarwinPageProtection protection; + guint32 file_offset; + guint32 flags; +}; + +struct _GumDarwinChainedFixupsDetails +{ + GumAddress vm_address; + guint64 file_offset; + guint32 size; +}; + +struct _GumDarwinRebaseDetails +{ + const GumDarwinSegment * segment; + guint64 offset; + GumDarwinRebaseType type; + GumAddress slide; +}; + +struct _GumDarwinBindDetails +{ + const GumDarwinSegment * segment; + guint64 offset; + GumDarwinBindType type; + GumDarwinBindOrdinal library_ordinal; + const gchar * symbol_name; + GumDarwinBindSymbolFlags symbol_flags; + gint64 addend; + guint16 threaded_table_size; +}; + +struct _GumDarwinThreadedItem +{ + gboolean is_authenticated; + GumDarwinThreadedItemType type; + guint16 delta; + guint8 key; + gboolean has_address_diversity; + guint16 diversity; + + guint16 bind_ordinal; + + GumAddress rebase_address; +}; + +struct _GumDarwinTlvParameters +{ + guint num_descriptors; + guint descriptors_offset; + guint data_offset; + gsize data_size; + gsize bss_size; +}; + +struct _GumDarwinTlvDescriptorDetails +{ + guint64 file_offset; + GumAddress thunk; + guint64 key; + gsize offset; +}; + +struct _GumDarwinInitPointersDetails +{ + GumAddress address; + guint64 count; +}; + +struct _GumDarwinInitOffsetsDetails +{ + GumAddress address; + guint64 count; +}; + +struct _GumDarwinTermPointersDetails +{ + GumAddress address; + guint64 count; +}; + +struct _GumDarwinFunctionStartsDetails +{ + GumAddress vm_address; + guint64 file_offset; + guint32 size; +}; + +struct _GumDarwinSegment +{ + gchar name[17]; + GumAddress vm_address; + guint64 vm_size; + guint64 file_offset; + guint64 file_size; + GumDarwinPageProtection protection; +}; + +struct _GumDarwinExportDetails +{ + const gchar * name; + guint64 flags; + + union + { + struct + { + guint64 offset; + }; + + struct + { + guint64 stub; + guint64 resolver; + }; + + struct + { + gint reexport_library_ordinal; + const gchar * reexport_symbol; + }; + }; +}; + +struct _GumDarwinSymbolDetails +{ + const gchar * name; + GumAddress address; + + /* These map 1:1 to their struct nlist / nlist_64 equivalents. */ + guint8 type; + guint8 section; + guint16 description; +}; + +enum _GumDarwinRebaseType +{ + GUM_DARWIN_REBASE_POINTER = 1, + GUM_DARWIN_REBASE_TEXT_ABSOLUTE32, + GUM_DARWIN_REBASE_TEXT_PCREL32, +}; + +enum _GumDarwinBindType +{ + GUM_DARWIN_BIND_POINTER = 1, + GUM_DARWIN_BIND_TEXT_ABSOLUTE32, + GUM_DARWIN_BIND_TEXT_PCREL32, + GUM_DARWIN_BIND_THREADED_TABLE, + GUM_DARWIN_BIND_THREADED_ITEMS, +}; + +enum _GumDarwinThreadedItemType +{ + GUM_DARWIN_THREADED_REBASE, + GUM_DARWIN_THREADED_BIND +}; + +enum _GumDarwinBindOrdinal +{ + GUM_DARWIN_BIND_SELF = 0, + GUM_DARWIN_BIND_MAIN_EXECUTABLE = -1, + GUM_DARWIN_BIND_FLAT_LOOKUP = -2, + GUM_DARWIN_BIND_WEAK_LOOKUP = -3, +}; + +enum _GumDarwinBindSymbolFlags +{ + GUM_DARWIN_BIND_WEAK_IMPORT = 0x1, + GUM_DARWIN_BIND_NON_WEAK_DEFINITION = 0x8, +}; + +enum _GumDarwinExportSymbolKind +{ + GUM_DARWIN_EXPORT_REGULAR, + GUM_DARWIN_EXPORT_THREAD_LOCAL, + GUM_DARWIN_EXPORT_ABSOLUTE +}; + +enum _GumDarwinExportSymbolFlags +{ + GUM_DARWIN_EXPORT_WEAK_DEFINITION = 0x04, + GUM_DARWIN_EXPORT_REEXPORT = 0x08, + GUM_DARWIN_EXPORT_STUB_AND_RESOLVER = 0x10, +}; + +#ifdef _MSC_VER +# pragma warning (push) +# pragma warning (disable: 4214) +#endif + +struct _GumChainedFixupsHeader +{ + guint32 fixups_version; + guint32 starts_offset; + guint32 imports_offset; + guint32 symbols_offset; + guint32 imports_count; + GumChainedImportFormat imports_format; + GumChainedSymbolFormat symbols_format; +}; + +enum _GumChainedImportFormat +{ + GUM_CHAINED_IMPORT = 1, + GUM_CHAINED_IMPORT_ADDEND = 2, + GUM_CHAINED_IMPORT_ADDEND64 = 3, +}; + +struct _GumChainedImport +{ + guint32 lib_ordinal : 8, + weak_import : 1, + name_offset : 23; +}; + +struct _GumChainedImportAddend +{ + guint32 lib_ordinal : 8, + weak_import : 1, + name_offset : 23; + gint32 addend; +}; + +struct _GumChainedImportAddend64 +{ + guint64 lib_ordinal : 16, + weak_import : 1, + reserved : 15, + name_offset : 32; + guint64 addend; +}; + +struct _GumChainedStartsInImage +{ + guint32 seg_count; + guint32 seg_info_offset[1]; +}; + +struct _GumChainedStartsInSegment +{ + guint32 size; + guint16 page_size; + GumChainedPtrFormat pointer_format; + guint64 segment_offset; + guint32 max_valid_pointer; + guint16 page_count; + guint16 page_start[1]; +}; + +enum _GumChainedPtrStart +{ + GUM_CHAINED_PTR_START_NONE = 0xffff, + GUM_CHAINED_PTR_START_MULTI = 0x8000, + GUM_CHAINED_PTR_START_LAST = 0x8000, +}; + +enum _GumChainedPtrFormat +{ + GUM_CHAINED_PTR_ARM64E = 1, + GUM_CHAINED_PTR_64 = 2, + GUM_CHAINED_PTR_32 = 3, + GUM_CHAINED_PTR_32_CACHE = 4, + GUM_CHAINED_PTR_32_FIRMWARE = 5, + GUM_CHAINED_PTR_64_OFFSET = 6, + GUM_CHAINED_PTR_ARM64E_OFFSET = 7, + GUM_CHAINED_PTR_ARM64E_KERNEL = 7, + GUM_CHAINED_PTR_64_KERNEL_CACHE = 8, + GUM_CHAINED_PTR_ARM64E_USERLAND = 9, + GUM_CHAINED_PTR_ARM64E_FIRMWARE = 10, + GUM_CHAINED_PTR_X86_64_KERNEL_CACHE = 11, + GUM_CHAINED_PTR_ARM64E_USERLAND24 = 12, +}; + +struct _GumChainedPtr64Rebase +{ + guint64 target : 36, + high8 : 8, + reserved : 7, + next : 12, + bind : 1; +}; + +struct _GumChainedPtr64Bind +{ + guint64 ordinal : 24, + addend : 8, + reserved : 19, + next : 12, + bind : 1; +}; + +struct _GumChainedPtrArm64eRebase +{ + guint64 target : 43, + high8 : 8, + next : 11, + bind : 1, + auth : 1; +}; + +struct _GumChainedPtrArm64eBind +{ + guint64 ordinal : 16, + zero : 16, + addend : 19, + next : 11, + bind : 1, + auth : 1; +}; + +struct _GumChainedPtrArm64eBind24 +{ + guint64 ordinal : 24, + zero : 8, + addend : 19, + next : 11, + bind : 1, + auth : 1; +}; + +struct _GumChainedPtrArm64eAuthRebase +{ + guint64 target : 32, + diversity : 16, + addr_div : 1, + key : 2, + next : 11, + bind : 1, + auth : 1; +}; + +struct _GumChainedPtrArm64eAuthBind +{ + guint64 ordinal : 16, + zero : 16, + diversity : 16, + addr_div : 1, + key : 2, + next : 11, + bind : 1, + auth : 1; +}; + +struct _GumChainedPtrArm64eAuthBind24 +{ + guint64 ordinal : 24, + zero : 8, + diversity : 16, + addr_div : 1, + key : 2, + next : 11, + bind : 1, + auth : 1; +}; + +#ifdef _MSC_VER +# pragma warning (pop) +#endif + +GUM_API GumDarwinModule * gum_darwin_module_new_from_file (const gchar * path, + GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, + GumDarwinModuleFlags flags, GError ** error); +GUM_API GumDarwinModule * gum_darwin_module_new_from_blob (GBytes * blob, + GumCpuType cpu_type, GumPtrauthSupport ptrauth_support, + GumDarwinModuleFlags flags, GError ** error); +GUM_API GumDarwinModule * gum_darwin_module_new_from_memory (const gchar * name, + GumDarwinPort task, GumAddress base_address, GumDarwinModuleFlags flags, + GError ** error); + +GUM_API gboolean gum_darwin_module_load (GumDarwinModule * self, + GError ** error); + +GUM_API gboolean gum_darwin_module_resolve_export (GumDarwinModule * self, + const gchar * symbol, GumDarwinExportDetails * details); +GUM_API GumAddress gum_darwin_module_resolve_symbol_address ( + GumDarwinModule * self, const gchar * symbol); +GUM_API gboolean gum_darwin_module_get_lacks_exports_for_reexports ( + GumDarwinModule * self); +GUM_API void gum_darwin_module_enumerate_imports (GumDarwinModule * self, + GumFoundImportFunc func, GumResolveExportFunc resolver, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_exports (GumDarwinModule * self, + GumFoundDarwinExportFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_symbols (GumDarwinModule * self, + GumFoundDarwinSymbolFunc func, gpointer user_data); +GUM_API GumAddress gum_darwin_module_get_slide (GumDarwinModule * self); +GUM_API const GumDarwinSegment * gum_darwin_module_get_nth_segment ( + GumDarwinModule * self, gsize index); +GUM_API void gum_darwin_module_enumerate_sections (GumDarwinModule * self, + GumFoundDarwinSectionFunc func, gpointer user_data); +GUM_API gboolean gum_darwin_module_is_address_in_text_section ( + GumDarwinModule * self, GumAddress address); +GUM_API void gum_darwin_module_enumerate_chained_fixups (GumDarwinModule * self, + GumFoundDarwinChainedFixupsFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_rebases (GumDarwinModule * self, + GumFoundDarwinRebaseFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_binds (GumDarwinModule * self, + GumFoundDarwinBindFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_lazy_binds (GumDarwinModule * self, + GumFoundDarwinBindFunc func, gpointer user_data); +GUM_API void gum_darwin_module_query_tlv_parameters (GumDarwinModule * self, + GumDarwinTlvParameters * params); +GUM_API void gum_darwin_module_enumerate_tlv_descriptors ( + GumDarwinModule * self, GumFoundDarwinTlvDescriptorFunc func, + gpointer user_data); +GUM_API void gum_darwin_module_enumerate_init_pointers (GumDarwinModule * self, + GumFoundDarwinInitPointersFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_init_offsets (GumDarwinModule * self, + GumFoundDarwinInitOffsetsFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_term_pointers (GumDarwinModule * self, + GumFoundDarwinTermPointersFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_dependencies (GumDarwinModule * self, + GumFoundDependencyFunc func, gpointer user_data); +GUM_API void gum_darwin_module_enumerate_function_starts ( + GumDarwinModule * self, GumFoundDarwinFunctionStartsFunc func, + gpointer user_data); +GUM_API const gchar * gum_darwin_module_get_dependency_by_ordinal ( + GumDarwinModule * self, gint ordinal); +GUM_API gboolean gum_darwin_module_ensure_image_loaded (GumDarwinModule * self, + GError ** error); + +GUM_API void gum_darwin_threaded_item_parse (guint64 value, + GumDarwinThreadedItem * result); + +#ifndef GUM_DIET +GUM_API GType gum_darwin_module_image_get_type (void) G_GNUC_CONST; +#endif +GUM_API GumDarwinModuleImage * gum_darwin_module_image_new (void); +GUM_API GumDarwinModuleImage * gum_darwin_module_image_dup ( + const GumDarwinModuleImage * other); +GUM_API void gum_darwin_module_image_free (GumDarwinModuleImage * image); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2023 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_ELF_MODULE_H__ +#define __GUM_ELF_MODULE_H__ + + +G_BEGIN_DECLS + +#define GUM_ELF_TYPE_MODULE (gum_elf_module_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumElfModule, gum_elf_module, GUM_ELF, MODULE, GObject) + +typedef enum { + GUM_ELF_NONE, + GUM_ELF_REL, + GUM_ELF_EXEC, + GUM_ELF_DYN, + GUM_ELF_CORE, +} GumElfType; + +typedef enum { + GUM_ELF_OS_SYSV, + GUM_ELF_OS_HPUX, + GUM_ELF_OS_NETBSD, + GUM_ELF_OS_LINUX, + GUM_ELF_OS_SOLARIS = 6, + GUM_ELF_OS_AIX, + GUM_ELF_OS_IRIX, + GUM_ELF_OS_FREEBSD, + GUM_ELF_OS_TRU64, + GUM_ELF_OS_MODESTO, + GUM_ELF_OS_OPENBSD, + GUM_ELF_OS_ARM_AEABI = 64, + GUM_ELF_OS_ARM = 97, + GUM_ELF_OS_STANDALONE = 255, +} GumElfOSABI; + +typedef enum { + GUM_ELF_MACHINE_NONE, + GUM_ELF_MACHINE_M32, + GUM_ELF_MACHINE_SPARC, + GUM_ELF_MACHINE_386, + GUM_ELF_MACHINE_68K, + GUM_ELF_MACHINE_88K, + GUM_ELF_MACHINE_IAMCU, + GUM_ELF_MACHINE_860, + GUM_ELF_MACHINE_MIPS, + GUM_ELF_MACHINE_S370, + GUM_ELF_MACHINE_MIPS_RS3_LE, + + GUM_ELF_MACHINE_PARISC = 15, + + GUM_ELF_MACHINE_VPP500 = 17, + GUM_ELF_MACHINE_SPARC32PLUS, + GUM_ELF_MACHINE_960, + GUM_ELF_MACHINE_PPC, + GUM_ELF_MACHINE_PPC64, + GUM_ELF_MACHINE_S390, + GUM_ELF_MACHINE_SPU, + + GUM_ELF_MACHINE_V800 = 36, + GUM_ELF_MACHINE_FR20, + GUM_ELF_MACHINE_RH32, + GUM_ELF_MACHINE_RCE, + GUM_ELF_MACHINE_ARM, + GUM_ELF_MACHINE_FAKE_ALPHA, + GUM_ELF_MACHINE_SH, + GUM_ELF_MACHINE_SPARCV9, + GUM_ELF_MACHINE_TRICORE, + GUM_ELF_MACHINE_ARC, + GUM_ELF_MACHINE_H8_300, + GUM_ELF_MACHINE_H8_300H, + GUM_ELF_MACHINE_H8S, + GUM_ELF_MACHINE_H8_500, + GUM_ELF_MACHINE_IA_64, + GUM_ELF_MACHINE_MIPS_X, + GUM_ELF_MACHINE_COLDFIRE, + GUM_ELF_MACHINE_68HC12, + GUM_ELF_MACHINE_MMA, + GUM_ELF_MACHINE_PCP, + GUM_ELF_MACHINE_NCPU, + GUM_ELF_MACHINE_NDR1, + GUM_ELF_MACHINE_STARCORE, + GUM_ELF_MACHINE_ME16, + GUM_ELF_MACHINE_ST100, + GUM_ELF_MACHINE_TINYJ, + GUM_ELF_MACHINE_X86_64, + GUM_ELF_MACHINE_PDSP, + GUM_ELF_MACHINE_PDP10, + GUM_ELF_MACHINE_PDP11, + GUM_ELF_MACHINE_FX66, + GUM_ELF_MACHINE_ST9PLUS, + GUM_ELF_MACHINE_ST7, + GUM_ELF_MACHINE_68HC16, + GUM_ELF_MACHINE_68HC11, + GUM_ELF_MACHINE_68HC08, + GUM_ELF_MACHINE_68HC05, + GUM_ELF_MACHINE_SVX, + GUM_ELF_MACHINE_ST19, + GUM_ELF_MACHINE_VAX, + GUM_ELF_MACHINE_CRIS, + GUM_ELF_MACHINE_JAVELIN, + GUM_ELF_MACHINE_FIREPATH, + GUM_ELF_MACHINE_ZSP, + GUM_ELF_MACHINE_MMIX, + GUM_ELF_MACHINE_HUANY, + GUM_ELF_MACHINE_PRISM, + GUM_ELF_MACHINE_AVR, + GUM_ELF_MACHINE_FR30, + GUM_ELF_MACHINE_D10V, + GUM_ELF_MACHINE_D30V, + GUM_ELF_MACHINE_V850, + GUM_ELF_MACHINE_M32R, + GUM_ELF_MACHINE_MN10300, + GUM_ELF_MACHINE_MN10200, + GUM_ELF_MACHINE_PJ, + GUM_ELF_MACHINE_OPENRISC, + GUM_ELF_MACHINE_ARC_COMPACT, + GUM_ELF_MACHINE_XTENSA, + GUM_ELF_MACHINE_VIDEOCORE, + GUM_ELF_MACHINE_TMM_GPP, + GUM_ELF_MACHINE_NS32K, + GUM_ELF_MACHINE_TPC, + GUM_ELF_MACHINE_SNP1K, + GUM_ELF_MACHINE_ST200, + GUM_ELF_MACHINE_IP2K, + GUM_ELF_MACHINE_MAX, + GUM_ELF_MACHINE_CR, + GUM_ELF_MACHINE_F2MC16, + GUM_ELF_MACHINE_MSP430, + GUM_ELF_MACHINE_BLACKFIN, + GUM_ELF_MACHINE_SE_C33, + GUM_ELF_MACHINE_SEP, + GUM_ELF_MACHINE_ARCA, + GUM_ELF_MACHINE_UNICORE, + GUM_ELF_MACHINE_EXCESS, + GUM_ELF_MACHINE_DXP, + GUM_ELF_MACHINE_ALTERA_NIOS2, + GUM_ELF_MACHINE_CRX, + GUM_ELF_MACHINE_XGATE, + GUM_ELF_MACHINE_C166, + GUM_ELF_MACHINE_M16C, + GUM_ELF_MACHINE_DSPIC30F, + GUM_ELF_MACHINE_CE, + GUM_ELF_MACHINE_M32C, + + GUM_ELF_MACHINE_TSK3000 = 131, + GUM_ELF_MACHINE_RS08, + GUM_ELF_MACHINE_SHARC, + GUM_ELF_MACHINE_ECOG2, + GUM_ELF_MACHINE_SCORE7, + GUM_ELF_MACHINE_DSP24, + GUM_ELF_MACHINE_VIDEOCORE3, + GUM_ELF_MACHINE_LATTICEMICO32, + GUM_ELF_MACHINE_SE_C17, + GUM_ELF_MACHINE_TI_C6000, + GUM_ELF_MACHINE_TI_C2000, + GUM_ELF_MACHINE_TI_C5500, + GUM_ELF_MACHINE_TI_ARP32, + GUM_ELF_MACHINE_TI_PRU, + + GUM_ELF_MACHINE_MMDSP_PLUS = 160, + GUM_ELF_MACHINE_CYPRESS_M8C, + GUM_ELF_MACHINE_R32C, + GUM_ELF_MACHINE_TRIMEDIA, + GUM_ELF_MACHINE_QDSP6, + GUM_ELF_MACHINE_8051, + GUM_ELF_MACHINE_STXP7X, + GUM_ELF_MACHINE_NDS32, + GUM_ELF_MACHINE_ECOG1X, + GUM_ELF_MACHINE_MAXQ30, + GUM_ELF_MACHINE_XIMO16, + GUM_ELF_MACHINE_MANIK, + GUM_ELF_MACHINE_CRAYNV2, + GUM_ELF_MACHINE_RX, + GUM_ELF_MACHINE_METAG, + GUM_ELF_MACHINE_MCST_ELBRUS, + GUM_ELF_MACHINE_ECOG16, + GUM_ELF_MACHINE_CR16, + GUM_ELF_MACHINE_ETPU, + GUM_ELF_MACHINE_SLE9X, + GUM_ELF_MACHINE_L10M, + GUM_ELF_MACHINE_K10M, + + GUM_ELF_MACHINE_AARCH64 = 183, + + GUM_ELF_MACHINE_AVR32 = 185, + GUM_ELF_MACHINE_STM8, + GUM_ELF_MACHINE_TILE64, + GUM_ELF_MACHINE_TILEPRO, + GUM_ELF_MACHINE_MICROBLAZE, + GUM_ELF_MACHINE_CUDA, + GUM_ELF_MACHINE_TILEGX, + GUM_ELF_MACHINE_CLOUDSHIELD, + GUM_ELF_MACHINE_COREA_1ST, + GUM_ELF_MACHINE_COREA_2ND, + GUM_ELF_MACHINE_ARCV2, + GUM_ELF_MACHINE_OPEN8, + GUM_ELF_MACHINE_RL78, + GUM_ELF_MACHINE_VIDEOCORE5, + GUM_ELF_MACHINE_78KOR, + GUM_ELF_MACHINE_56800EX, + GUM_ELF_MACHINE_BA1, + GUM_ELF_MACHINE_BA2, + GUM_ELF_MACHINE_XCORE, + GUM_ELF_MACHINE_MCHP_PIC, + + GUM_ELF_MACHINE_KM32 = 210, + GUM_ELF_MACHINE_KMX32, + GUM_ELF_MACHINE_EMX16, + GUM_ELF_MACHINE_EMX8, + GUM_ELF_MACHINE_KVARC, + GUM_ELF_MACHINE_CDP, + GUM_ELF_MACHINE_COGE, + GUM_ELF_MACHINE_COOL, + GUM_ELF_MACHINE_NORC, + GUM_ELF_MACHINE_CSR_KALIMBA, + GUM_ELF_MACHINE_Z80, + GUM_ELF_MACHINE_VISIUM, + GUM_ELF_MACHINE_FT32, + GUM_ELF_MACHINE_MOXIE, + GUM_ELF_MACHINE_AMDGPU, + + GUM_ELF_MACHINE_RISCV = 243, + + GUM_ELF_MACHINE_BPF = 247, + + GUM_ELF_MACHINE_CSKY = 252, + + GUM_ELF_MACHINE_ALPHA = 0x9026, +} GumElfMachine; + +typedef enum { + GUM_ELF_SOURCE_MODE_OFFLINE, + GUM_ELF_SOURCE_MODE_ONLINE, +} GumElfSourceMode; + +typedef enum { + GUM_ELF_SECTION_NULL, + GUM_ELF_SECTION_PROGBITS, + GUM_ELF_SECTION_SYMTAB, + GUM_ELF_SECTION_STRTAB, + GUM_ELF_SECTION_RELA, + GUM_ELF_SECTION_HASH, + GUM_ELF_SECTION_DYNAMIC, + GUM_ELF_SECTION_NOTE, + GUM_ELF_SECTION_NOBITS, + GUM_ELF_SECTION_REL, + GUM_ELF_SECTION_SHLIB, + GUM_ELF_SECTION_DYNSYM, + GUM_ELF_SECTION_INIT_ARRAY = 14, + GUM_ELF_SECTION_FINI_ARRAY, + GUM_ELF_SECTION_PREINIT_ARRAY, + GUM_ELF_SECTION_GROUP, + GUM_ELF_SECTION_SYMTAB_SHNDX, + GUM_ELF_SECTION_RELR, + GUM_ELF_SECTION_NUM, + GUM_ELF_SECTION_GNU_ATTRIBUTES = 0x6ffffff5, + GUM_ELF_SECTION_GNU_HASH = 0x6ffffff6, + GUM_ELF_SECTION_GNU_LIBLIST = 0x6ffffff7, + GUM_ELF_SECTION_CHECKSUM = 0x6ffffff8, + GUM_ELF_SECTION_SUNW_MOVE = 0x6ffffffa, + GUM_ELF_SECTION_SUNW_COMDAT = 0x6ffffffb, + GUM_ELF_SECTION_SUNW_SYMINFO = 0x6ffffffc, + GUM_ELF_SECTION_GNU_VERDEF = 0x6ffffffd, + GUM_ELF_SECTION_GNU_VERNEED = 0x6ffffffe, + GUM_ELF_SECTION_GNU_VERSYM = 0x6fffffff, +} GumElfSectionType; + +typedef enum { + GUM_ELF_DYNAMIC_NULL, + GUM_ELF_DYNAMIC_NEEDED, + GUM_ELF_DYNAMIC_PLTRELSZ, + GUM_ELF_DYNAMIC_PLTGOT, + GUM_ELF_DYNAMIC_HASH, + GUM_ELF_DYNAMIC_STRTAB, + GUM_ELF_DYNAMIC_SYMTAB, + GUM_ELF_DYNAMIC_RELA, + GUM_ELF_DYNAMIC_RELASZ, + GUM_ELF_DYNAMIC_RELAENT, + GUM_ELF_DYNAMIC_STRSZ, + GUM_ELF_DYNAMIC_SYMENT, + GUM_ELF_DYNAMIC_INIT, + GUM_ELF_DYNAMIC_FINI, + GUM_ELF_DYNAMIC_SONAME, + GUM_ELF_DYNAMIC_RPATH, + GUM_ELF_DYNAMIC_SYMBOLIC, + GUM_ELF_DYNAMIC_REL, + GUM_ELF_DYNAMIC_RELSZ, + GUM_ELF_DYNAMIC_RELENT, + GUM_ELF_DYNAMIC_PLTREL, + GUM_ELF_DYNAMIC_DEBUG, + GUM_ELF_DYNAMIC_TEXTREL, + GUM_ELF_DYNAMIC_JMPREL, + GUM_ELF_DYNAMIC_BIND_NOW, + GUM_ELF_DYNAMIC_INIT_ARRAY, + GUM_ELF_DYNAMIC_FINI_ARRAY, + GUM_ELF_DYNAMIC_INIT_ARRAYSZ, + GUM_ELF_DYNAMIC_FINI_ARRAYSZ, + GUM_ELF_DYNAMIC_RUNPATH, + GUM_ELF_DYNAMIC_FLAGS, + GUM_ELF_DYNAMIC_ENCODING = 32, + GUM_ELF_DYNAMIC_PREINIT_ARRAY = 32, + GUM_ELF_DYNAMIC_PREINIT_ARRAYSZ, + GUM_ELF_DYNAMIC_MAXPOSTAGS, + + GUM_ELF_DYNAMIC_LOOS = 0x6000000d, + GUM_ELF_DYNAMIC_SUNW_AUXILIARY = 0x6000000d, + GUM_ELF_DYNAMIC_SUNW_RTLDINF = 0x6000000e, + GUM_ELF_DYNAMIC_SUNW_FILTER = 0x6000000f, + GUM_ELF_DYNAMIC_SUNW_CAP = 0x60000010, + GUM_ELF_DYNAMIC_SUNW_ASLR = 0x60000023, + GUM_ELF_DYNAMIC_HIOS = 0x6ffff000, + + GUM_ELF_DYNAMIC_VALRNGLO = 0x6ffffd00, + GUM_ELF_DYNAMIC_GNU_PRELINKED = 0x6ffffdf5, + GUM_ELF_DYNAMIC_GNU_CONFLICTSZ = 0x6ffffdf6, + GUM_ELF_DYNAMIC_GNU_LIBLISTSZ = 0x6ffffdf7, + GUM_ELF_DYNAMIC_CHECKSUM = 0x6ffffdf8, + GUM_ELF_DYNAMIC_PLTPADSZ = 0x6ffffdf9, + GUM_ELF_DYNAMIC_MOVEENT = 0x6ffffdfa, + GUM_ELF_DYNAMIC_MOVESZ = 0x6ffffdfb, + GUM_ELF_DYNAMIC_FEATURE = 0x6ffffdfc, + GUM_ELF_DYNAMIC_FEATURE_1 = 0x6ffffdfc, + GUM_ELF_DYNAMIC_POSFLAG_1 = 0x6ffffdfd, + + GUM_ELF_DYNAMIC_SYMINSZ = 0x6ffffdfe, + GUM_ELF_DYNAMIC_SYMINENT = 0x6ffffdff, + GUM_ELF_DYNAMIC_VALRNGHI = 0x6ffffdff, + + GUM_ELF_DYNAMIC_ADDRRNGLO = 0x6ffffe00, + GUM_ELF_DYNAMIC_GNU_HASH = 0x6ffffef5, + GUM_ELF_DYNAMIC_TLSDESC_PLT = 0x6ffffef6, + GUM_ELF_DYNAMIC_TLSDESC_GOT = 0x6ffffef7, + GUM_ELF_DYNAMIC_GNU_CONFLICT = 0x6ffffef8, + GUM_ELF_DYNAMIC_GNU_LIBLIST = 0x6ffffef9, + GUM_ELF_DYNAMIC_CONFIG = 0x6ffffefa, + GUM_ELF_DYNAMIC_DEPAUDIT = 0x6ffffefb, + GUM_ELF_DYNAMIC_AUDIT = 0x6ffffefc, + GUM_ELF_DYNAMIC_PLTPAD = 0x6ffffefd, + GUM_ELF_DYNAMIC_MOVETAB = 0x6ffffefe, + GUM_ELF_DYNAMIC_SYMINFO = 0x6ffffeff, + GUM_ELF_DYNAMIC_ADDRRNGHI = 0x6ffffeff, + + GUM_ELF_DYNAMIC_VERSYM = 0x6ffffff0, + GUM_ELF_DYNAMIC_RELACOUNT = 0x6ffffff9, + GUM_ELF_DYNAMIC_RELCOUNT = 0x6ffffffa, + GUM_ELF_DYNAMIC_FLAGS_1 = 0x6ffffffb, + GUM_ELF_DYNAMIC_VERDEF = 0x6ffffffc, + GUM_ELF_DYNAMIC_VERDEFNUM = 0x6ffffffd, + GUM_ELF_DYNAMIC_VERNEED = 0x6ffffffe, + GUM_ELF_DYNAMIC_VERNEEDNUM = 0x6fffffff, + + GUM_ELF_DYNAMIC_LOPROC = 0x70000000, + + GUM_ELF_DYNAMIC_ARM_SYMTABSZ = 0x70000001, + GUM_ELF_DYNAMIC_ARM_PREEMPTMAP = 0x70000002, + + GUM_ELF_DYNAMIC_SPARC_REGISTER = 0x70000001, + GUM_ELF_DYNAMIC_DEPRECATED_SPARC_REGISTER = 0x7000001, + + GUM_ELF_DYNAMIC_MIPS_RLD_VERSION = 0x70000001, + GUM_ELF_DYNAMIC_MIPS_TIME_STAMP = 0x70000002, + GUM_ELF_DYNAMIC_MIPS_ICHECKSUM = 0x70000003, + GUM_ELF_DYNAMIC_MIPS_IVERSION = 0x70000004, + GUM_ELF_DYNAMIC_MIPS_FLAGS = 0x70000005, + GUM_ELF_DYNAMIC_MIPS_BASE_ADDRESS = 0x70000006, + GUM_ELF_DYNAMIC_MIPS_CONFLICT = 0x70000008, + GUM_ELF_DYNAMIC_MIPS_LIBLIST = 0x70000009, + GUM_ELF_DYNAMIC_MIPS_LOCAL_GOTNO = 0x7000000a, + GUM_ELF_DYNAMIC_MIPS_CONFLICTNO = 0x7000000b, + GUM_ELF_DYNAMIC_MIPS_LIBLISTNO = 0x70000010, + GUM_ELF_DYNAMIC_MIPS_SYMTABNO = 0x70000011, + GUM_ELF_DYNAMIC_MIPS_UNREFEXTNO = 0x70000012, + GUM_ELF_DYNAMIC_MIPS_GOTSYM = 0x70000013, + GUM_ELF_DYNAMIC_MIPS_HIPAGENO = 0x70000014, + GUM_ELF_DYNAMIC_MIPS_RLD_MAP = 0x70000016, + GUM_ELF_DYNAMIC_MIPS_DELTA_CLASS = 0x70000017, + GUM_ELF_DYNAMIC_MIPS_DELTA_CLASS_NO = 0x70000018, + GUM_ELF_DYNAMIC_MIPS_DELTA_INSTANCE = 0x70000019, + GUM_ELF_DYNAMIC_MIPS_DELTA_INSTANCE_NO = 0x7000001a, + GUM_ELF_DYNAMIC_MIPS_DELTA_RELOC = 0x7000001b, + GUM_ELF_DYNAMIC_MIPS_DELTA_RELOC_NO = 0x7000001c, + GUM_ELF_DYNAMIC_MIPS_DELTA_SYM = 0x7000001d, + GUM_ELF_DYNAMIC_MIPS_DELTA_SYM_NO = 0x7000001e, + GUM_ELF_DYNAMIC_MIPS_DELTA_CLASSSYM = 0x70000020, + GUM_ELF_DYNAMIC_MIPS_DELTA_CLASSSYM_NO = 0x70000021, + GUM_ELF_DYNAMIC_MIPS_CXX_FLAGS = 0x70000022, + GUM_ELF_DYNAMIC_MIPS_PIXIE_INIT = 0x70000023, + GUM_ELF_DYNAMIC_MIPS_SYMBOL_LIB = 0x70000024, + GUM_ELF_DYNAMIC_MIPS_LOCALPAGE_GOTIDX = 0x70000025, + GUM_ELF_DYNAMIC_MIPS_LOCAL_GOTIDX = 0x70000026, + GUM_ELF_DYNAMIC_MIPS_HIDDEN_GOTIDX = 0x70000027, + GUM_ELF_DYNAMIC_MIPS_PROTECTED_GOTIDX = 0x70000028, + GUM_ELF_DYNAMIC_MIPS_OPTIONS = 0x70000029, + GUM_ELF_DYNAMIC_MIPS_INTERFACE = 0x7000002a, + GUM_ELF_DYNAMIC_MIPS_DYNSTR_ALIGN = 0x7000002b, + GUM_ELF_DYNAMIC_MIPS_INTERFACE_SIZE = 0x7000002c, + GUM_ELF_DYNAMIC_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002d, + GUM_ELF_DYNAMIC_MIPS_PERF_SUFFIX = 0x7000002e, + GUM_ELF_DYNAMIC_MIPS_COMPACT_SIZE = 0x7000002f, + GUM_ELF_DYNAMIC_MIPS_GP_VALUE = 0x70000030, + GUM_ELF_DYNAMIC_MIPS_AUX_DYNAMIC = 0x70000031, + GUM_ELF_DYNAMIC_MIPS_PLTGOT = 0x70000032, + GUM_ELF_DYNAMIC_MIPS_RLD_OBJ_UPDATE = 0x70000033, + GUM_ELF_DYNAMIC_MIPS_RWPLT = 0x70000034, + GUM_ELF_DYNAMIC_MIPS_RLD_MAP_REL = 0x70000035, + + GUM_ELF_DYNAMIC_PPC_GOT = 0x70000000, + GUM_ELF_DYNAMIC_PPC_TLSOPT = 0x70000001, + + GUM_ELF_DYNAMIC_PPC64_GLINK = 0x70000000, + GUM_ELF_DYNAMIC_PPC64_OPD = 0x70000001, + GUM_ELF_DYNAMIC_PPC64_OPDSZ = 0x70000002, + GUM_ELF_DYNAMIC_PPC64_TLSOPT = 0x70000003, + + GUM_ELF_DYNAMIC_AUXILIARY = 0x7ffffffd, + GUM_ELF_DYNAMIC_USED = 0x7ffffffe, + GUM_ELF_DYNAMIC_FILTER = 0x7fffffff, + + GUM_ELF_DYNAMIC_HIPROC = 0x7fffffff, +} GumElfDynamicTag; + +typedef enum { + GUM_ELF_SHDR_INDEX_UNDEF, + GUM_ELF_SHDR_INDEX_BEFORE = 0xff00, + GUM_ELF_SHDR_INDEX_AFTER = 0xff01, + GUM_ELF_SHDR_INDEX_ABS = 0xfff1, + GUM_ELF_SHDR_INDEX_COMMON = 0xfff2, + GUM_ELF_SHDR_INDEX_XINDEX = 0xffff, +} GumElfShdrIndex; + +typedef enum { + GUM_ELF_SYMBOL_NOTYPE, + GUM_ELF_SYMBOL_OBJECT, + GUM_ELF_SYMBOL_FUNC, + GUM_ELF_SYMBOL_SECTION, + GUM_ELF_SYMBOL_FILE, + GUM_ELF_SYMBOL_COMMON, + GUM_ELF_SYMBOL_TLS, + GUM_ELF_SYMBOL_NUM, + GUM_ELF_SYMBOL_LOOS = 10, + GUM_ELF_SYMBOL_GNU_IFUNC = 10, + GUM_ELF_SYMBOL_HIOS = 12, + GUM_ELF_SYMBOL_LOPROC, + GUM_ELF_SYMBOL_SPARC_REGISTER = 13, + GUM_ELF_SYMBOL_HIPROC = 15, +} GumElfSymbolType; + +typedef enum { + GUM_ELF_BIND_LOCAL, + GUM_ELF_BIND_GLOBAL, + GUM_ELF_BIND_WEAK, + + GUM_ELF_BIND_LOOS = 10, + GUM_ELF_BIND_GNU_UNIQUE = 10, + GUM_ELF_BIND_HIOS = 12, + + GUM_ELF_BIND_LOPROC, + GUM_ELF_BIND_HIPROC = 15, +} GumElfSymbolBind; + +typedef enum { + GUM_ELF_IA32_NONE, + GUM_ELF_IA32_32, + GUM_ELF_IA32_PC32, + GUM_ELF_IA32_GOT32, + GUM_ELF_IA32_PLT32, + GUM_ELF_IA32_COPY, + GUM_ELF_IA32_GLOB_DAT, + GUM_ELF_IA32_JMP_SLOT, + GUM_ELF_IA32_RELATIVE, + GUM_ELF_IA32_GOTOFF, + GUM_ELF_IA32_GOTPC, + GUM_ELF_IA32_32PLT, + GUM_ELF_IA32_TLS_TPOFF = 14, + GUM_ELF_IA32_TLS_IE, + GUM_ELF_IA32_TLS_GOTIE, + GUM_ELF_IA32_TLS_LE, + GUM_ELF_IA32_TLS_GD, + GUM_ELF_IA32_TLS_LDM, + GUM_ELF_IA32_16, + GUM_ELF_IA32_PC16, + GUM_ELF_IA32_8, + GUM_ELF_IA32_PC8, + GUM_ELF_IA32_TLS_GD_32, + GUM_ELF_IA32_TLS_GD_PUSH, + GUM_ELF_IA32_TLS_GD_CALL, + GUM_ELF_IA32_TLS_GD_POP, + GUM_ELF_IA32_TLS_LDM_32, + GUM_ELF_IA32_TLS_LDM_PUSH, + GUM_ELF_IA32_TLS_LDM_CALL, + GUM_ELF_IA32_TLS_LDM_POP, + GUM_ELF_IA32_TLS_LDO_32, + GUM_ELF_IA32_TLS_IE_32, + GUM_ELF_IA32_TLS_LE_32, + GUM_ELF_IA32_TLS_DTPMOD32, + GUM_ELF_IA32_TLS_DTPOFF32, + GUM_ELF_IA32_TLS_TPOFF32, + GUM_ELF_IA32_SIZE32, + GUM_ELF_IA32_TLS_GOTDESC, + GUM_ELF_IA32_TLS_DESC_CALL, + GUM_ELF_IA32_TLS_DESC, + GUM_ELF_IA32_IRELATIVE, + GUM_ELF_IA32_GOT32X, +} GumElfIA32Relocation; + +typedef enum { + GUM_ELF_X64_NONE, + GUM_ELF_X64_64, + GUM_ELF_X64_PC32, + GUM_ELF_X64_GOT32, + GUM_ELF_X64_PLT32, + GUM_ELF_X64_COPY, + GUM_ELF_X64_GLOB_DAT, + GUM_ELF_X64_JUMP_SLOT, + GUM_ELF_X64_RELATIVE, + GUM_ELF_X64_GOTPCREL, + GUM_ELF_X64_32, + GUM_ELF_X64_32S, + GUM_ELF_X64_16, + GUM_ELF_X64_PC16, + GUM_ELF_X64_8, + GUM_ELF_X64_PC8, + GUM_ELF_X64_DTPMOD64, + GUM_ELF_X64_DTPOFF64, + GUM_ELF_X64_TPOFF64, + GUM_ELF_X64_TLSGD, + GUM_ELF_X64_TLSLD, + GUM_ELF_X64_DTPOFF32, + GUM_ELF_X64_GOTTPOFF, + GUM_ELF_X64_TPOFF32, + GUM_ELF_X64_PC64, + GUM_ELF_X64_GOTOFF64, + GUM_ELF_X64_GOTPC32, + GUM_ELF_X64_GOT64, + GUM_ELF_X64_GOTPCREL64, + GUM_ELF_X64_GOTPC64, + GUM_ELF_X64_GOTPLT64, + GUM_ELF_X64_PLTOFF64, + GUM_ELF_X64_SIZE32, + GUM_ELF_X64_SIZE64, + GUM_ELF_X64_GOTPC32_TLSDESC, + GUM_ELF_X64_TLSDESC_CALL, + GUM_ELF_X64_TLSDESC, + GUM_ELF_X64_IRELATIVE, + GUM_ELF_X64_RELATIVE64, + GUM_ELF_X64_GOTPCRELX = 41, + GUM_ELF_X64_REX_GOTPCRELX, +} GumElfX64Relocation; + +typedef enum { + GUM_ELF_ARM_NONE, + GUM_ELF_ARM_PC24, + GUM_ELF_ARM_ABS32, + GUM_ELF_ARM_REL32, + GUM_ELF_ARM_PC13, + GUM_ELF_ARM_ABS16, + GUM_ELF_ARM_ABS12, + GUM_ELF_ARM_THM_ABS5, + GUM_ELF_ARM_ABS8, + GUM_ELF_ARM_SBREL32, + GUM_ELF_ARM_THM_PC22, + GUM_ELF_ARM_THM_PC8, + GUM_ELF_ARM_AMP_VCALL9, + GUM_ELF_ARM_SWI24, + GUM_ELF_ARM_TLS_DESC = 13, + GUM_ELF_ARM_THM_SWI8, + GUM_ELF_ARM_XPC25, + GUM_ELF_ARM_THM_XPC22, + GUM_ELF_ARM_TLS_DTPMOD32, + GUM_ELF_ARM_TLS_DTPOFF32, + GUM_ELF_ARM_TLS_TPOFF32, + GUM_ELF_ARM_COPY, + GUM_ELF_ARM_GLOB_DAT, + GUM_ELF_ARM_JUMP_SLOT, + GUM_ELF_ARM_RELATIVE, + GUM_ELF_ARM_GOTOFF, + GUM_ELF_ARM_GOTPC, + GUM_ELF_ARM_GOT32, + GUM_ELF_ARM_PLT32, + GUM_ELF_ARM_CALL, + GUM_ELF_ARM_JUMP24, + GUM_ELF_ARM_THM_JUMP24, + GUM_ELF_ARM_BASE_ABS, + GUM_ELF_ARM_ALU_PCREL_7_0, + GUM_ELF_ARM_ALU_PCREL_15_8, + GUM_ELF_ARM_ALU_PCREL_23_15, + GUM_ELF_ARM_LDR_SBREL_11_0, + GUM_ELF_ARM_ALU_SBREL_19_12, + GUM_ELF_ARM_ALU_SBREL_27_20, + GUM_ELF_ARM_TARGET1, + GUM_ELF_ARM_SBREL31, + GUM_ELF_ARM_V4BX, + GUM_ELF_ARM_TARGET2, + GUM_ELF_ARM_PREL31, + GUM_ELF_ARM_MOVW_ABS_NC, + GUM_ELF_ARM_MOVT_ABS, + GUM_ELF_ARM_MOVW_PREL_NC, + GUM_ELF_ARM_MOVT_PREL, + GUM_ELF_ARM_THM_MOVW_ABS_NC, + GUM_ELF_ARM_THM_MOVT_ABS, + GUM_ELF_ARM_THM_MOVW_PREL_NC, + GUM_ELF_ARM_THM_MOVT_PREL, + GUM_ELF_ARM_THM_JUMP19, + GUM_ELF_ARM_THM_JUMP6, + GUM_ELF_ARM_THM_ALU_PREL_11_0, + GUM_ELF_ARM_THM_PC12, + GUM_ELF_ARM_ABS32_NOI, + GUM_ELF_ARM_REL32_NOI, + GUM_ELF_ARM_ALU_PC_G0_NC, + GUM_ELF_ARM_ALU_PC_G0, + GUM_ELF_ARM_ALU_PC_G1_NC, + GUM_ELF_ARM_ALU_PC_G1, + GUM_ELF_ARM_ALU_PC_G2, + GUM_ELF_ARM_LDR_PC_G1, + GUM_ELF_ARM_LDR_PC_G2, + GUM_ELF_ARM_LDRS_PC_G0, + GUM_ELF_ARM_LDRS_PC_G1, + GUM_ELF_ARM_LDRS_PC_G2, + GUM_ELF_ARM_LDC_PC_G0, + GUM_ELF_ARM_LDC_PC_G1, + GUM_ELF_ARM_LDC_PC_G2, + GUM_ELF_ARM_ALU_SB_G0_NC, + GUM_ELF_ARM_ALU_SB_G0, + GUM_ELF_ARM_ALU_SB_G1_NC, + GUM_ELF_ARM_ALU_SB_G1, + GUM_ELF_ARM_ALU_SB_G2, + GUM_ELF_ARM_LDR_SB_G0, + GUM_ELF_ARM_LDR_SB_G1, + GUM_ELF_ARM_LDR_SB_G2, + GUM_ELF_ARM_LDRS_SB_G0, + GUM_ELF_ARM_LDRS_SB_G1, + GUM_ELF_ARM_LDRS_SB_G2, + GUM_ELF_ARM_LDC_SB_G0, + GUM_ELF_ARM_LDC_SB_G1, + GUM_ELF_ARM_LDC_SB_G2, + GUM_ELF_ARM_MOVW_BREL_NC, + GUM_ELF_ARM_MOVT_BREL, + GUM_ELF_ARM_MOVW_BREL, + GUM_ELF_ARM_THM_MOVW_BREL_NC, + GUM_ELF_ARM_THM_MOVT_BREL, + GUM_ELF_ARM_THM_MOVW_BREL, + GUM_ELF_ARM_TLS_GOTDESC, + GUM_ELF_ARM_TLS_CALL, + GUM_ELF_ARM_TLS_DESCSEQ, + GUM_ELF_ARM_THM_TLS_CALL, + GUM_ELF_ARM_PLT32_ABS, + GUM_ELF_ARM_GOT_ABS, + GUM_ELF_ARM_GOT_PREL, + GUM_ELF_ARM_GOT_BREL12, + GUM_ELF_ARM_GOTOFF12, + GUM_ELF_ARM_GOTRELAX, + GUM_ELF_ARM_GNU_VTENTRY, + GUM_ELF_ARM_GNU_VTINHERIT, + GUM_ELF_ARM_THM_PC11, + GUM_ELF_ARM_THM_PC9, + GUM_ELF_ARM_TLS_GD32, + GUM_ELF_ARM_TLS_LDM32, + GUM_ELF_ARM_TLS_LDO32, + GUM_ELF_ARM_TLS_IE32, + GUM_ELF_ARM_TLS_LE32, + GUM_ELF_ARM_TLS_LDO12, + GUM_ELF_ARM_TLS_LE12, + GUM_ELF_ARM_TLS_IE12GP, + GUM_ELF_ARM_ME_TOO = 128, + GUM_ELF_ARM_THM_TLS_DESCSEQ, + GUM_ELF_ARM_THM_TLS_DESCSEQ16 = 129, + GUM_ELF_ARM_THM_TLS_DESCSEQ32, + GUM_ELF_ARM_THM_GOT_BREL12, + GUM_ELF_ARM_IRELATIVE = 160, + GUM_ELF_ARM_RXPC25 = 249, + GUM_ELF_ARM_RSBREL32, + GUM_ELF_ARM_THM_RPC22, + GUM_ELF_ARM_RREL32, + GUM_ELF_ARM_RABS22, + GUM_ELF_ARM_RPC24, + GUM_ELF_ARM_RBASE, +} GumElfArmRelocation; + +typedef enum { + GUM_ELF_ARM64_NONE, + GUM_ELF_ARM64_P32_ABS32, + GUM_ELF_ARM64_P32_COPY = 180, + GUM_ELF_ARM64_P32_GLOB_DAT, + GUM_ELF_ARM64_P32_JUMP_SLOT, + GUM_ELF_ARM64_P32_RELATIVE, + GUM_ELF_ARM64_P32_TLS_DTPMOD, + GUM_ELF_ARM64_P32_TLS_DTPREL, + GUM_ELF_ARM64_P32_TLS_TPREL, + GUM_ELF_ARM64_P32_TLSDESC, + GUM_ELF_ARM64_P32_IRELATIVE, + GUM_ELF_ARM64_ABS64 = 257, + GUM_ELF_ARM64_ABS32, + GUM_ELF_ARM64_ABS16, + GUM_ELF_ARM64_PREL64, + GUM_ELF_ARM64_PREL32, + GUM_ELF_ARM64_PREL16, + GUM_ELF_ARM64_MOVW_UABS_G0, + GUM_ELF_ARM64_MOVW_UABS_G0_NC, + GUM_ELF_ARM64_MOVW_UABS_G1, + GUM_ELF_ARM64_MOVW_UABS_G1_NC, + GUM_ELF_ARM64_MOVW_UABS_G2, + GUM_ELF_ARM64_MOVW_UABS_G2_NC, + GUM_ELF_ARM64_MOVW_UABS_G3, + GUM_ELF_ARM64_MOVW_SABS_G0, + GUM_ELF_ARM64_MOVW_SABS_G1, + GUM_ELF_ARM64_MOVW_SABS_G2, + GUM_ELF_ARM64_LD_PREL_LO19, + GUM_ELF_ARM64_ADR_PREL_LO21, + GUM_ELF_ARM64_ADR_PREL_PG_HI21, + GUM_ELF_ARM64_ADR_PREL_PG_HI21_NC, + GUM_ELF_ARM64_ADD_ABS_LO12_NC, + GUM_ELF_ARM64_LDST8_ABS_LO12_NC, + GUM_ELF_ARM64_TSTBR14, + GUM_ELF_ARM64_CONDBR19, + GUM_ELF_ARM64_JUMP26 = 282, + GUM_ELF_ARM64_CALL26, + GUM_ELF_ARM64_LDST16_ABS_LO12_NC, + GUM_ELF_ARM64_LDST32_ABS_LO12_NC, + GUM_ELF_ARM64_LDST64_ABS_LO12_NC, + GUM_ELF_ARM64_MOVW_PREL_G0, + GUM_ELF_ARM64_MOVW_PREL_G0_NC, + GUM_ELF_ARM64_MOVW_PREL_G1, + GUM_ELF_ARM64_MOVW_PREL_G1_NC, + GUM_ELF_ARM64_MOVW_PREL_G2, + GUM_ELF_ARM64_MOVW_PREL_G2_NC, + GUM_ELF_ARM64_MOVW_PREL_G3, + GUM_ELF_ARM64_LDST128_ABS_LO12_NC = 299, + GUM_ELF_ARM64_MOVW_GOTOFF_G0, + GUM_ELF_ARM64_MOVW_GOTOFF_G0_NC, + GUM_ELF_ARM64_MOVW_GOTOFF_G1, + GUM_ELF_ARM64_MOVW_GOTOFF_G1_NC, + GUM_ELF_ARM64_MOVW_GOTOFF_G2, + GUM_ELF_ARM64_MOVW_GOTOFF_G2_NC, + GUM_ELF_ARM64_MOVW_GOTOFF_G3, + GUM_ELF_ARM64_GOTREL64, + GUM_ELF_ARM64_GOTREL32, + GUM_ELF_ARM64_GOT_LD_PREL19, + GUM_ELF_ARM64_LD64_GOTOFF_LO15, + GUM_ELF_ARM64_ADR_GOT_PAGE, + GUM_ELF_ARM64_LD64_GOT_LO12_NC, + GUM_ELF_ARM64_LD64_GOTPAGE_LO15, + GUM_ELF_ARM64_TLSGD_ADR_PREL21 = 512, + GUM_ELF_ARM64_TLSGD_ADR_PAGE21, + GUM_ELF_ARM64_TLSGD_ADD_LO12_NC, + GUM_ELF_ARM64_TLSGD_MOVW_G1, + GUM_ELF_ARM64_TLSGD_MOVW_G0_NC, + GUM_ELF_ARM64_TLSLD_ADR_PREL21, + GUM_ELF_ARM64_TLSLD_ADR_PAGE21, + GUM_ELF_ARM64_TLSLD_ADD_LO12_NC, + GUM_ELF_ARM64_TLSLD_MOVW_G1, + GUM_ELF_ARM64_TLSLD_MOVW_G0_NC, + GUM_ELF_ARM64_TLSLD_LD_PREL19, + GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G2, + GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G1, + GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G1_NC, + GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G0, + GUM_ELF_ARM64_TLSLD_MOVW_DTPREL_G0_NC, + GUM_ELF_ARM64_TLSLD_ADD_DTPREL_HI12, + GUM_ELF_ARM64_TLSLD_ADD_DTPREL_LO12, + GUM_ELF_ARM64_TLSLD_ADD_DTPREL_LO12_NC, + GUM_ELF_ARM64_TLSLD_LDST8_DTPREL_LO12, + GUM_ELF_ARM64_TLSLD_LDST8_DTPREL_LO12_NC, + GUM_ELF_ARM64_TLSLD_LDST16_DTPREL_LO12, + GUM_ELF_ARM64_TLSLD_LDST16_DTPREL_LO12_NC, + GUM_ELF_ARM64_TLSLD_LDST32_DTPREL_LO12, + GUM_ELF_ARM64_TLSLD_LDST32_DTPREL_LO12_NC, + GUM_ELF_ARM64_TLSLD_LDST64_DTPREL_LO12, + GUM_ELF_ARM64_TLSLD_LDST64_DTPREL_LO12_NC, + GUM_ELF_ARM64_TLSIE_MOVW_GOTTPREL_G1, + GUM_ELF_ARM64_TLSIE_MOVW_GOTTPREL_G0_NC, + GUM_ELF_ARM64_TLSIE_ADR_GOTTPREL_PAGE21, + GUM_ELF_ARM64_TLSIE_LD64_GOTTPREL_LO12_NC, + GUM_ELF_ARM64_TLSIE_LD_GOTTPREL_PREL19, + GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G2, + GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G1, + GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G1_NC, + GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G0, + GUM_ELF_ARM64_TLSLE_MOVW_TPREL_G0_NC, + GUM_ELF_ARM64_TLSLE_ADD_TPREL_HI12, + GUM_ELF_ARM64_TLSLE_ADD_TPREL_LO12, + GUM_ELF_ARM64_TLSLE_ADD_TPREL_LO12_NC, + GUM_ELF_ARM64_TLSLE_LDST8_TPREL_LO12, + GUM_ELF_ARM64_TLSLE_LDST8_TPREL_LO12_NC, + GUM_ELF_ARM64_TLSLE_LDST16_TPREL_LO12, + GUM_ELF_ARM64_TLSLE_LDST16_TPREL_LO12_NC, + GUM_ELF_ARM64_TLSLE_LDST32_TPREL_LO12, + GUM_ELF_ARM64_TLSLE_LDST32_TPREL_LO12_NC, + GUM_ELF_ARM64_TLSLE_LDST64_TPREL_LO12, + GUM_ELF_ARM64_TLSLE_LDST64_TPREL_LO12_NC, + GUM_ELF_ARM64_TLSDESC_LD_PREL19, + GUM_ELF_ARM64_TLSDESC_ADR_PREL21, + GUM_ELF_ARM64_TLSDESC_ADR_PAGE21, + GUM_ELF_ARM64_TLSDESC_LD64_LO12, + GUM_ELF_ARM64_TLSDESC_ADD_LO12, + GUM_ELF_ARM64_TLSDESC_OFF_G1, + GUM_ELF_ARM64_TLSDESC_OFF_G0_NC, + GUM_ELF_ARM64_TLSDESC_LDR, + GUM_ELF_ARM64_TLSDESC_ADD, + GUM_ELF_ARM64_TLSDESC_CALL, + GUM_ELF_ARM64_TLSLE_LDST128_TPREL_LO12, + GUM_ELF_ARM64_TLSLE_LDST128_TPREL_LO12_NC, + GUM_ELF_ARM64_TLSLD_LDST128_DTPREL_LO12, + GUM_ELF_ARM64_TLSLD_LDST128_DTPREL_LO12_NC, + GUM_ELF_ARM64_COPY = 1024, + GUM_ELF_ARM64_GLOB_DAT, + GUM_ELF_ARM64_JUMP_SLOT, + GUM_ELF_ARM64_RELATIVE, + GUM_ELF_ARM64_TLS_DTPMOD, + GUM_ELF_ARM64_TLS_DTPREL, + GUM_ELF_ARM64_TLS_TPREL, + GUM_ELF_ARM64_TLSDESC, + GUM_ELF_ARM64_IRELATIVE, +} GumElfArm64Relocation; + +typedef enum { + GUM_ELF_MIPS_NONE, + GUM_ELF_MIPS_16, + GUM_ELF_MIPS_32, + GUM_ELF_MIPS_REL32, + GUM_ELF_MIPS_26, + GUM_ELF_MIPS_HI16, + GUM_ELF_MIPS_LO16, + GUM_ELF_MIPS_GPREL16, + GUM_ELF_MIPS_LITERAL, + GUM_ELF_MIPS_GOT16, + GUM_ELF_MIPS_PC16, + GUM_ELF_MIPS_CALL16, + GUM_ELF_MIPS_GPREL32, + GUM_ELF_MIPS_SHIFT5 = 16, + GUM_ELF_MIPS_SHIFT6, + GUM_ELF_MIPS_64, + GUM_ELF_MIPS_GOT_DISP, + GUM_ELF_MIPS_GOT_PAGE, + GUM_ELF_MIPS_GOT_OFST, + GUM_ELF_MIPS_GOT_HI16, + GUM_ELF_MIPS_GOT_LO16, + GUM_ELF_MIPS_SUB, + GUM_ELF_MIPS_INSERT_A, + GUM_ELF_MIPS_INSERT_B, + GUM_ELF_MIPS_DELETE, + GUM_ELF_MIPS_HIGHER, + GUM_ELF_MIPS_HIGHEST, + GUM_ELF_MIPS_CALL_HI16, + GUM_ELF_MIPS_CALL_LO16, + GUM_ELF_MIPS_SCN_DISP, + GUM_ELF_MIPS_REL16, + GUM_ELF_MIPS_ADD_IMMEDIATE, + GUM_ELF_MIPS_PJUMP, + GUM_ELF_MIPS_RELGOT, + GUM_ELF_MIPS_JALR, + GUM_ELF_MIPS_TLS_DTPMOD32, + GUM_ELF_MIPS_TLS_DTPREL32, + GUM_ELF_MIPS_TLS_DTPMOD64, + GUM_ELF_MIPS_TLS_DTPREL64, + GUM_ELF_MIPS_TLS_GD, + GUM_ELF_MIPS_TLS_LDM, + GUM_ELF_MIPS_TLS_DTPREL_HI16, + GUM_ELF_MIPS_TLS_DTPREL_LO16, + GUM_ELF_MIPS_TLS_GOTTPREL, + GUM_ELF_MIPS_TLS_TPREL32, + GUM_ELF_MIPS_TLS_TPREL64, + GUM_ELF_MIPS_TLS_TPREL_HI16, + GUM_ELF_MIPS_TLS_TPREL_LO16, + GUM_ELF_MIPS_GLOB_DAT, + GUM_ELF_MIPS_COPY = 126, + GUM_ELF_MIPS_JUMP_SLOT, +} GumElfMipsRelocation; + +typedef struct _GumElfSegmentDetails GumElfSegmentDetails; +typedef struct _GumElfSectionDetails GumElfSectionDetails; +typedef struct _GumElfRelocationDetails GumElfRelocationDetails; +typedef struct _GumElfDynamicEntryDetails GumElfDynamicEntryDetails; +typedef struct _GumElfSymbolDetails GumElfSymbolDetails; + +typedef gboolean (* GumFoundElfSegmentFunc) ( + const GumElfSegmentDetails * details, gpointer user_data); +typedef gboolean (* GumFoundElfSectionFunc) ( + const GumElfSectionDetails * details, gpointer user_data); +typedef gboolean (* GumFoundElfRelocationFunc) ( + const GumElfRelocationDetails * details, gpointer user_data); +typedef gboolean (* GumFoundElfDynamicEntryFunc) ( + const GumElfDynamicEntryDetails * details, gpointer user_data); +typedef gboolean (* GumFoundElfSymbolFunc) (const GumElfSymbolDetails * details, + gpointer user_data); + +struct _GumElfSegmentDetails +{ + GumAddress vm_address; + guint64 vm_size; + guint64 file_offset; + guint64 file_size; + GumPageProtection protection; +}; + +struct _GumElfSectionDetails +{ + const gchar * id; + const gchar * name; + GumElfSectionType type; + guint64 flags; + GumAddress address; + guint64 offset; + gsize size; + guint32 link; + guint32 info; + guint64 alignment; + guint64 entry_size; + GumPageProtection protection; +}; + +struct _GumElfRelocationDetails +{ + GumAddress address; + guint32 type; + const GumElfSymbolDetails * symbol; + gint64 addend; + const GumElfSectionDetails * parent; +}; + +struct _GumElfDynamicEntryDetails +{ + GumElfDynamicTag tag; + guint64 val; +}; + +struct _GumElfSymbolDetails +{ + const gchar * name; + GumAddress address; + gsize size; + GumElfSymbolType type; + GumElfSymbolBind bind; + guint16 shdr_index; + const GumElfSectionDetails * section; +}; + +GUM_API GumElfModule * gum_elf_module_new_from_file (const gchar * path, + GError ** error); +GUM_API GumElfModule * gum_elf_module_new_from_blob (GBytes * blob, + GError ** error); +GUM_API GumElfModule * gum_elf_module_new_from_memory (const gchar * path, + GumAddress base_address, GError ** error); + +GUM_API gboolean gum_elf_module_load (GumElfModule * self, GError ** error); + +GUM_API GumElfType gum_elf_module_get_etype (GumElfModule * self); +GUM_API guint gum_elf_module_get_pointer_size (GumElfModule * self); +GUM_API gint gum_elf_module_get_byte_order (GumElfModule * self); +GUM_API GumElfOSABI gum_elf_module_get_os_abi (GumElfModule * self); +GUM_API guint8 gum_elf_module_get_os_abi_version (GumElfModule * self); +GUM_API GumElfMachine gum_elf_module_get_machine (GumElfModule * self); +GUM_API GumAddress gum_elf_module_get_base_address (GumElfModule * self); +GUM_API GumAddress gum_elf_module_get_preferred_address (GumElfModule * self); +GUM_API guint64 gum_elf_module_get_mapped_size (GumElfModule * self); +GUM_API GumAddress gum_elf_module_get_entrypoint (GumElfModule * self); +GUM_API const gchar * gum_elf_module_get_interpreter (GumElfModule * self); +GUM_API const gchar * gum_elf_module_get_source_path (GumElfModule * self); +GUM_API GBytes * gum_elf_module_get_source_blob (GumElfModule * self); +GUM_API GumElfSourceMode gum_elf_module_get_source_mode (GumElfModule * self); +GUM_API gconstpointer gum_elf_module_get_file_data (GumElfModule * self, + gsize * size); + +GUM_API void gum_elf_module_enumerate_segments (GumElfModule * self, + GumFoundElfSegmentFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_sections (GumElfModule * self, + GumFoundElfSectionFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_relocations (GumElfModule * self, + GumFoundElfRelocationFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_dynamic_entries (GumElfModule * self, + GumFoundElfDynamicEntryFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_imports (GumElfModule * self, + GumFoundImportFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_exports (GumElfModule * self, + GumFoundExportFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_dynamic_symbols (GumElfModule * self, + GumFoundElfSymbolFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_symbols (GumElfModule * self, + GumFoundElfSymbolFunc func, gpointer user_data); +GUM_API void gum_elf_module_enumerate_dependencies (GumElfModule * self, + GumFoundDependencyFunc func, gpointer user_data); + +GUM_API GumAddress gum_elf_module_translate_to_offline (GumElfModule * self, + GumAddress online_address); +GUM_API GumAddress gum_elf_module_translate_to_online (GumElfModule * self, + GumAddress offline_address); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_EVENT_H__ +#define __GUM_EVENT_H__ + + +G_BEGIN_DECLS + +typedef guint GumEventType; + +typedef union _GumEvent GumEvent; + +typedef struct _GumAnyEvent GumAnyEvent; +typedef struct _GumCallEvent GumCallEvent; +typedef struct _GumRetEvent GumRetEvent; +typedef struct _GumExecEvent GumExecEvent; +typedef struct _GumBlockEvent GumBlockEvent; +typedef struct _GumCompileEvent GumCompileEvent; + +enum _GumEventType +{ + GUM_NOTHING = 0, + GUM_CALL = 1 << 0, + GUM_RET = 1 << 1, + GUM_EXEC = 1 << 2, + GUM_BLOCK = 1 << 3, + GUM_COMPILE = 1 << 4, +}; + +struct _GumAnyEvent +{ + GumEventType type; +}; + +struct _GumCallEvent +{ + GumEventType type; + + gpointer location; + gpointer target; + gint depth; +}; + +struct _GumRetEvent +{ + GumEventType type; + + gpointer location; + gpointer target; + gint depth; +}; + +struct _GumExecEvent +{ + GumEventType type; + + gpointer location; +}; + +struct _GumBlockEvent +{ + GumEventType type; + + gpointer start; + gpointer end; +}; + +struct _GumCompileEvent +{ + GumEventType type; + + gpointer start; + gpointer end; +}; + +union _GumEvent +{ + GumEventType type; + + GumAnyEvent any; + GumCallEvent call; + GumRetEvent ret; + GumExecEvent exec; + GumBlockEvent block; + GumCompileEvent compile; +}; + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_EVENT_SINK_H__ +#define __GUM_EVENT_SINK_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_EVENT_SINK (gum_event_sink_get_type ()) +GUM_DECLARE_INTERFACE (GumEventSink, gum_event_sink, GUM, EVENT_SINK, GObject) + +#define GUM_TYPE_DEFAULT_EVENT_SINK (gum_default_event_sink_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumDefaultEventSink, gum_default_event_sink, GUM, + DEFAULT_EVENT_SINK, GObject) + +#define GUM_TYPE_CALLBACK_EVENT_SINK (gum_callback_event_sink_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumCallbackEventSink, gum_callback_event_sink, GUM, + CALLBACK_EVENT_SINK, GObject) + +typedef void (* GumEventSinkCallback) (const GumEvent * event, + GumCpuContext * cpu_context, gpointer user_data); + +#ifndef GUM_DIET + +struct _GumEventSinkInterface +{ + GTypeInterface parent; + + GumEventType (* query_mask) (GumEventSink * self); + void (* start) (GumEventSink * self); + void (* process) (GumEventSink * self, const GumEvent * event, + GumCpuContext * cpu_context); + void (* flush) (GumEventSink * self); + void (* stop) (GumEventSink * self); +}; + +#endif + +GUM_API GumEventType gum_event_sink_query_mask (GumEventSink * self); +GUM_API void gum_event_sink_start (GumEventSink * self); +GUM_API void gum_event_sink_process (GumEventSink * self, + const GumEvent * event, GumCpuContext * cpu_context); +GUM_API void gum_event_sink_flush (GumEventSink * self); +GUM_API void gum_event_sink_stop (GumEventSink * self); + +GUM_API GumEventSink * gum_event_sink_make_default (void); +GUM_API GumEventSink * gum_event_sink_make_from_callback (GumEventType mask, + GumEventSinkCallback callback, gpointer data, GDestroyNotify data_destroy); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2024 Ole André Vadla Ravnås + * Copyright (C) 2020 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_EXCEPTOR_H__ +#define __GUM_EXCEPTOR_H__ + +#include + +G_BEGIN_DECLS + +#define GUM_TYPE_EXCEPTOR (gum_exceptor_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumExceptor, gum_exceptor, GUM, EXCEPTOR, GObject) + +#if defined (G_OS_WIN32) || defined (__APPLE__) +# define GUM_NATIVE_SETJMP(env) setjmp (env) +# define GUM_NATIVE_LONGJMP longjmp +# ifndef GUM_GIR_COMPILATION + typedef jmp_buf GumExceptorNativeJmpBuf; +# endif +#else +# define GUM_NATIVE_SETJMP(env) sigsetjmp (env, TRUE) +# define GUM_NATIVE_LONGJMP siglongjmp +# ifndef GUM_GIR_COMPILATION + typedef sigjmp_buf GumExceptorNativeJmpBuf; +# endif +#endif +#ifdef GUM_GIR_COMPILATION +typedef int GumExceptorNativeJmpBuf; +#endif + +typedef struct _GumExceptionDetails GumExceptionDetails; +typedef guint GumExceptionType; +typedef struct _GumExceptionMemoryDetails GumExceptionMemoryDetails; +typedef gboolean (* GumExceptionHandler) (GumExceptionDetails * details, + gpointer user_data); + +typedef struct _GumExceptorScope GumExceptorScope; + +enum _GumExceptionType +{ + GUM_EXCEPTION_ABORT = 1, + GUM_EXCEPTION_ACCESS_VIOLATION, + GUM_EXCEPTION_GUARD_PAGE, + GUM_EXCEPTION_ILLEGAL_INSTRUCTION, + GUM_EXCEPTION_STACK_OVERFLOW, + GUM_EXCEPTION_ARITHMETIC, + GUM_EXCEPTION_BREAKPOINT, + GUM_EXCEPTION_SINGLE_STEP, + GUM_EXCEPTION_SYSTEM +}; + +struct _GumExceptionMemoryDetails +{ + GumMemoryOperation operation; + gpointer address; +}; + +struct _GumExceptionDetails +{ + GumThreadId thread_id; + GumExceptionType type; + gpointer address; + GumExceptionMemoryDetails memory; + GumCpuContext context; + gpointer native_context; +}; + +struct _GumExceptorScope +{ + GumExceptionDetails exception; + + /*< private */ + gboolean exception_occurred; + gpointer padding[2]; + GumExceptorNativeJmpBuf env; +#ifdef __ANDROID__ + sigset_t mask; +#endif + + GumExceptorScope * next; +}; + +GUM_API void gum_exceptor_disable (void); + +GUM_API GumExceptor * gum_exceptor_obtain (void); + +GUM_API void gum_exceptor_reset (GumExceptor * self); + +GUM_API void gum_exceptor_add (GumExceptor * self, GumExceptionHandler func, + gpointer user_data); +GUM_API void gum_exceptor_remove (GumExceptor * self, GumExceptionHandler func, + gpointer user_data); + +#if defined (_MSC_VER) && defined (HAVE_I386) && GLIB_SIZEOF_VOID_P == 8 +/* + * On MSVC/x86_64 setjmp() is actually an intrinsic that calls _setjmp() with a + * a hidden second argument specifying the frame pointer. This makes sense when + * the longjmp() is guaranteed to happen from code we control, but is not + * reliable otherwise. + */ +# define gum_exceptor_try(self, scope) ( \ + _gum_exceptor_prepare_try (self, scope), \ + ((int (*) (jmp_buf env, void * frame_pointer)) _setjmp) ( \ + (scope)->env, NULL) == 0) +#else +# define gum_exceptor_try(self, scope) ( \ + _gum_exceptor_prepare_try (self, scope), \ + GUM_NATIVE_SETJMP ((scope)->env) == 0) +#endif +GUM_API gboolean gum_exceptor_catch (GumExceptor * self, + GumExceptorScope * scope); +GUM_API gboolean gum_exceptor_has_scope (GumExceptor * self, + GumThreadId thread_id); + +GUM_API gchar * gum_exception_details_to_string ( + const GumExceptionDetails * details); + +GUM_API void _gum_exceptor_prepare_try (GumExceptor * self, + GumExceptorScope * scope); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_FUNCTION_H__ +#define __GUM_FUNCTION_H__ + +G_BEGIN_DECLS + +typedef struct _GumFunctionDetails GumFunctionDetails; + +struct _GumFunctionDetails +{ + const gchar * name; + gpointer address; + gint num_arguments; +}; + +G_END_DECLS + +#endif +/* + * Copyright (C) 2008-2024 Ole André Vadla Ravnås + * Copyright (C) 2008 Christian Berentsen + * Copyright (C) 2024 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INTERCEPTOR_H__ +#define __GUM_INTERCEPTOR_H__ + +/* + * Copyright (C) 2008-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INVOCATION_LISTENER_H__ +#define __GUM_INVOCATION_LISTENER_H__ + +/* + * Copyright (C) 2008-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INVOCATION_CONTEXT_H__ +#define __GUM_INVOCATION_CONTEXT_H__ + + + +#define GUM_IC_GET_THREAD_DATA(context, data_type) \ + ((data_type *) gum_invocation_context_get_listener_thread_data (context, \ + sizeof (data_type))) +#define GUM_IC_GET_FUNC_DATA(context, data_type) \ + ((data_type) gum_invocation_context_get_listener_function_data (context)) +#define GUM_IC_GET_INVOCATION_DATA(context, data_type) \ + ((data_type *) \ + gum_invocation_context_get_listener_invocation_data (context,\ + sizeof (data_type))) + +#define GUM_IC_GET_REPLACEMENT_DATA(ctx, data_type) \ + ((data_type) gum_invocation_context_get_replacement_data (ctx)) + +typedef struct _GumInvocationBackend GumInvocationBackend; +typedef struct _GumInvocationContext GumInvocationContext; +typedef guint GumPointCut; + +struct _GumInvocationBackend +{ + GumPointCut (* get_point_cut) (GumInvocationContext * context); + + GumThreadId (* get_thread_id) (GumInvocationContext * context); + guint (* get_depth) (GumInvocationContext * context); + + gpointer (* get_listener_thread_data) (GumInvocationContext * context, + gsize required_size); + gpointer (* get_listener_function_data) (GumInvocationContext * context); + gpointer (* get_listener_invocation_data) ( + GumInvocationContext * context, gsize required_size); + + gpointer (* get_replacement_data) (GumInvocationContext * context); + + gpointer state; + gpointer data; +}; + +struct _GumInvocationContext +{ + gpointer function; + GumCpuContext * cpu_context; + gint system_error; + + /*< private */ + GumInvocationBackend * backend; +}; + +enum _GumPointCut +{ + GUM_POINT_ENTER, + GUM_POINT_LEAVE +}; + +G_BEGIN_DECLS + +GUM_API GumPointCut gum_invocation_context_get_point_cut ( + GumInvocationContext * context); + +GUM_API gpointer gum_invocation_context_get_nth_argument ( + GumInvocationContext * context, guint n); +GUM_API void gum_invocation_context_replace_nth_argument ( + GumInvocationContext * context, guint n, gpointer value); +GUM_API gpointer gum_invocation_context_get_return_value ( + GumInvocationContext * context); +GUM_API void gum_invocation_context_replace_return_value ( + GumInvocationContext * context, gpointer value); + +GUM_API gpointer gum_invocation_context_get_return_address ( + GumInvocationContext * context); + +GUM_API guint gum_invocation_context_get_thread_id ( + GumInvocationContext * context); +GUM_API guint gum_invocation_context_get_depth ( + GumInvocationContext * context); + +GUM_API gpointer gum_invocation_context_get_listener_thread_data ( + GumInvocationContext * context, gsize required_size); +GUM_API gpointer gum_invocation_context_get_listener_function_data ( + GumInvocationContext * context); +GUM_API gpointer gum_invocation_context_get_listener_invocation_data ( + GumInvocationContext * context, gsize required_size); + +GUM_API gpointer gum_invocation_context_get_replacement_data ( + GumInvocationContext * context); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_INVOCATION_LISTENER (gum_invocation_listener_get_type ()) +GUM_DECLARE_INTERFACE (GumInvocationListener, gum_invocation_listener, GUM, + INVOCATION_LISTENER, GObject) + +typedef void (* GumInvocationCallback) (GumInvocationContext * context, + gpointer user_data); + +#ifndef GUM_DIET + +struct _GumInvocationListenerInterface +{ + GTypeInterface parent; + + void (* on_enter) (GumInvocationListener * self, + GumInvocationContext * context); + void (* on_leave) (GumInvocationListener * self, + GumInvocationContext * context); +}; + +#else + +struct _GumInvocationListener +{ + GumObject parent; + + GumInvocationCallback on_enter; + GumInvocationCallback on_leave; + + gpointer data; + GDestroyNotify data_destroy; +}; + +#endif + +GUM_API GumInvocationListener * gum_make_call_listener ( + GumInvocationCallback on_enter, GumInvocationCallback on_leave, + gpointer data, GDestroyNotify data_destroy); +GUM_API GumInvocationListener * gum_make_probe_listener ( + GumInvocationCallback on_hit, gpointer data, GDestroyNotify data_destroy); + +GUM_API void gum_invocation_listener_on_enter (GumInvocationListener * self, + GumInvocationContext * context); +GUM_API void gum_invocation_listener_on_leave (GumInvocationListener * self, + GumInvocationContext * context); + +G_END_DECLS + +#endif + +G_BEGIN_DECLS + +#define GUM_TYPE_INTERCEPTOR (gum_interceptor_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumInterceptor, gum_interceptor, GUM, INTERCEPTOR, + GObject) + +typedef GArray GumInvocationStack; +typedef guint GumInvocationState; +typedef void (* GumInterceptorLockedFunc) (gpointer user_data); + +typedef enum +{ + GUM_ATTACH_OK = 0, + GUM_ATTACH_WRONG_SIGNATURE = -1, + GUM_ATTACH_ALREADY_ATTACHED = -2, + GUM_ATTACH_POLICY_VIOLATION = -3, + GUM_ATTACH_WRONG_TYPE = -4, +} GumAttachReturn; + +typedef enum +{ + GUM_REPLACE_OK = 0, + GUM_REPLACE_WRONG_SIGNATURE = -1, + GUM_REPLACE_ALREADY_REPLACED = -2, + GUM_REPLACE_POLICY_VIOLATION = -3, + GUM_REPLACE_WRONG_TYPE = -4, +} GumReplaceReturn; + +GUM_API GumInterceptor * gum_interceptor_obtain (void); + +GUM_API GumAttachReturn gum_interceptor_attach (GumInterceptor * self, + gpointer function_address, GumInvocationListener * listener, + gpointer listener_function_data); +GUM_API void gum_interceptor_detach (GumInterceptor * self, + GumInvocationListener * listener); + +GUM_API GumReplaceReturn gum_interceptor_replace (GumInterceptor * self, + gpointer function_address, gpointer replacement_function, + gpointer replacement_data, gpointer * original_function); +GumReplaceReturn gum_interceptor_replace_fast (GumInterceptor * self, + gpointer function_address, gpointer replacement_function, + gpointer * original_function); +GUM_API void gum_interceptor_revert (GumInterceptor * self, + gpointer function_address); + +GUM_API void gum_interceptor_begin_transaction (GumInterceptor * self); +GUM_API void gum_interceptor_end_transaction (GumInterceptor * self); +GUM_API gboolean gum_interceptor_flush (GumInterceptor * self); + +GUM_API GumInvocationContext * gum_interceptor_get_current_invocation (void); +GUM_API GumInvocationContext * gum_interceptor_get_live_replacement_invocation ( + gpointer replacement_function); +GUM_API GumInvocationStack * gum_interceptor_get_current_stack (void); + +GUM_API void gum_interceptor_ignore_current_thread (GumInterceptor * self); +GUM_API void gum_interceptor_unignore_current_thread (GumInterceptor * self); +GUM_API gboolean gum_interceptor_maybe_unignore_current_thread ( + GumInterceptor * self); + +GUM_API void gum_interceptor_ignore_other_threads (GumInterceptor * self); +GUM_API void gum_interceptor_unignore_other_threads (GumInterceptor * self); + +GUM_API gpointer gum_invocation_stack_translate (GumInvocationStack * self, + gpointer return_address); + +GUM_API void gum_interceptor_save (GumInvocationState * state); +GUM_API void gum_interceptor_restore (GumInvocationState * state); + +GUM_API void gum_interceptor_with_lock_held (GumInterceptor * self, + GumInterceptorLockedFunc func, gpointer user_data); +GUM_API gboolean gum_interceptor_is_locked (GumInterceptor * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2021 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_KERNEL_H__ +#define __GUM_KERNEL_H__ + + +G_BEGIN_DECLS + +typedef struct _GumKernelModuleRangeDetails GumKernelModuleRangeDetails; + +struct _GumKernelModuleRangeDetails +{ + gchar name[48]; + GumAddress address; + guint64 size; + GumPageProtection protection; +}; + +typedef gboolean (* GumFoundKernelModuleRangeFunc) ( + const GumKernelModuleRangeDetails * details, gpointer user_data); + +GUM_API gboolean gum_kernel_api_is_available (void); +GUM_API guint gum_kernel_query_page_size (void); +GUM_API GumAddress gum_kernel_alloc_n_pages (guint n_pages); +GUM_API void gum_kernel_free_pages (GumAddress mem); +GUM_API gboolean gum_kernel_try_mprotect (GumAddress address, gsize size, + GumPageProtection prot); +GUM_API guint8 * gum_kernel_read (GumAddress address, gsize len, + gsize * n_bytes_read); +GUM_API gboolean gum_kernel_write (GumAddress address, const guint8 * bytes, + gsize len); +GUM_API void gum_kernel_scan (const GumMemoryRange * range, + const GumMatchPattern * pattern, GumMemoryScanMatchFunc func, + gpointer user_data); +GUM_API void gum_kernel_enumerate_ranges (GumPageProtection prot, + GumFoundRangeFunc func, gpointer user_data); +GUM_API void gum_kernel_enumerate_module_ranges (const gchar * module_name, + GumPageProtection prot, GumFoundKernelModuleRangeFunc func, + gpointer user_data); +GUM_API void gum_kernel_enumerate_modules (GumFoundModuleFunc func, + gpointer user_data); +GUM_API GumAddress gum_kernel_find_base_address (void); +GUM_API void gum_kernel_set_base_address (GumAddress base); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2021 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_LIBC_H__ +#define __GUM_LIBC_H__ + + +G_BEGIN_DECLS + +GUM_API gpointer gum_memset (gpointer dst, gint c, gsize n); +GUM_API gpointer gum_memcpy (gpointer dst, gconstpointer src, gsize n); +GUM_API gpointer gum_memmove (gpointer dst, gconstpointer src, gsize n); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MEMORY_ACCESS_MONITOR_H__ +#define __GUM_MEMORY_ACCESS_MONITOR_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MEMORY_ACCESS_MONITOR (gum_memory_access_monitor_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumMemoryAccessMonitor, gum_memory_access_monitor, GUM, + MEMORY_ACCESS_MONITOR, GObject) + +typedef struct _GumMemoryAccessDetails GumMemoryAccessDetails; + +typedef void (* GumMemoryAccessNotify) (GumMemoryAccessMonitor * monitor, + const GumMemoryAccessDetails * details, gpointer user_data); + +struct _GumMemoryAccessDetails +{ + GumMemoryOperation operation; + gpointer from; + gpointer address; + + guint range_index; + guint page_index; + guint pages_completed; + guint pages_total; +}; + +GUM_API GumMemoryAccessMonitor * gum_memory_access_monitor_new ( + const GumMemoryRange * ranges, guint num_ranges, + GumPageProtection access_mask, gboolean auto_reset, + GumMemoryAccessNotify func, gpointer data, + GDestroyNotify data_destroy); + +GUM_API gboolean gum_memory_access_monitor_enable ( + GumMemoryAccessMonitor * self, GError ** error); +GUM_API void gum_memory_access_monitor_disable (GumMemoryAccessMonitor * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2013-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MEMORY_MAP_H__ +#define __GUM_MEMORY_MAP_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MEMORY_MAP (gum_memory_map_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumMemoryMap, gum_memory_map, GUM, MEMORY_MAP, GObject) + +GUM_API GumMemoryMap * gum_memory_map_new (GumPageProtection prot); + +GUM_API gboolean gum_memory_map_contains (GumMemoryMap * self, + const GumMemoryRange * range); + +GUM_API void gum_memory_map_update (GumMemoryMap * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2017-2019 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_METAL_ARRAY_H__ +#define __GUM_METAL_ARRAY_H__ + + +typedef struct _GumMetalArray GumMetalArray; + +struct _GumMetalArray +{ + gpointer data; + guint length; + guint capacity; + + guint element_size; +}; + +G_BEGIN_DECLS + +GUM_API void gum_metal_array_init (GumMetalArray * array, guint element_size); +GUM_API void gum_metal_array_free (GumMetalArray * array); + +GUM_API gpointer gum_metal_array_element_at (GumMetalArray * self, + guint index_); +GUM_API gpointer gum_metal_array_insert_at (GumMetalArray * self, guint index_); +GUM_API void gum_metal_array_remove_at (GumMetalArray * self, guint index_); +GUM_API void gum_metal_array_remove_all (GumMetalArray * self); +GUM_API gpointer gum_metal_array_append (GumMetalArray * self); + +GUM_API void gum_metal_array_get_extents (GumMetalArray * self, + gpointer * start, gpointer * end); +GUM_API void gum_metal_array_ensure_capacity (GumMetalArray * self, + guint capacity); + +G_END_DECLS + +#endif +/* GLIB - Library of useful routines for C programming + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +/* + * Modified by the GLib Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +#ifndef __GUM_METAL_HASH_H__ +#define __GUM_METAL_HASH_H__ + + +G_BEGIN_DECLS + +typedef struct _GumMetalHashTable GumMetalHashTable; +typedef struct _GumMetalHashTableIter GumMetalHashTableIter; + +struct _GumMetalHashTableIter +{ + gpointer dummy1; + gpointer dummy2; + gpointer dummy3; + int dummy4; + gboolean dummy5; + gpointer dummy6; +}; + +GUM_API GumMetalHashTable * gum_metal_hash_table_new (GHashFunc hash_func, + GEqualFunc key_equal_func); +GUM_API GumMetalHashTable * gum_metal_hash_table_new_full (GHashFunc hash_func, + GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, + GDestroyNotify value_destroy_func); +GUM_API void gum_metal_hash_table_destroy (GumMetalHashTable * hash_table); +GUM_API gboolean gum_metal_hash_table_insert (GumMetalHashTable * hash_table, + gpointer key, gpointer value); +GUM_API gboolean gum_metal_hash_table_replace (GumMetalHashTable * hash_table, + gpointer key, gpointer value); +GUM_API gboolean gum_metal_hash_table_add (GumMetalHashTable * hash_table, + gpointer key); +GUM_API gboolean gum_metal_hash_table_remove (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API void gum_metal_hash_table_remove_all (GumMetalHashTable * hash_table); +GUM_API gboolean gum_metal_hash_table_steal (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API void gum_metal_hash_table_steal_all (GumMetalHashTable * hash_table); +GUM_API gpointer gum_metal_hash_table_lookup (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API gboolean gum_metal_hash_table_contains (GumMetalHashTable * hash_table, + gconstpointer key); +GUM_API gboolean gum_metal_hash_table_lookup_extended ( + GumMetalHashTable * hash_table, gconstpointer lookup_key, + gpointer * orig_key, gpointer * value); +GUM_API void gum_metal_hash_table_foreach (GumMetalHashTable * hash_table, + GHFunc func, gpointer user_data); +GUM_API gpointer gum_metal_hash_table_find (GumMetalHashTable * hash_table, + GHRFunc predicate, gpointer user_data); +GUM_API guint gum_metal_hash_table_foreach_remove ( + GumMetalHashTable * hash_table, GHRFunc func, gpointer user_data); +GUM_API guint gum_metal_hash_table_foreach_steal (GumMetalHashTable * hash_table, + GHRFunc func, gpointer user_data); +GUM_API guint gum_metal_hash_table_size (GumMetalHashTable * hash_table); + +GUM_API void gum_metal_hash_table_iter_init (GumMetalHashTableIter * iter, + GumMetalHashTable * hash_table); +GUM_API gboolean gum_metal_hash_table_iter_next (GumMetalHashTableIter * iter, + gpointer * key, gpointer * value); +GUM_API GumMetalHashTable* gum_metal_hash_table_iter_get_hash_table ( + GumMetalHashTableIter * iter); +GUM_API void gum_metal_hash_table_iter_remove (GumMetalHashTableIter * iter); +GUM_API void gum_metal_hash_table_iter_replace (GumMetalHashTableIter * iter, + gpointer value); +GUM_API void gum_metal_hash_table_iter_steal (GumMetalHashTableIter * iter); + +GUM_API GumMetalHashTable * gum_metal_hash_table_ref ( + GumMetalHashTable * hash_table); +GUM_API void gum_metal_hash_table_unref (GumMetalHashTable * hash_table); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2016-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MODULE_API_RESOLVER_H__ +#define __GUM_MODULE_API_RESOLVER_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MODULE_API_RESOLVER (gum_module_api_resolver_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumModuleApiResolver, gum_module_api_resolver, GUM, + MODULE_API_RESOLVER, GObject) + +GUM_API GumApiResolver * gum_module_api_resolver_new (void); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2015-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_MODULE_MAP_H__ +#define __GUM_MODULE_MAP_H__ + + +G_BEGIN_DECLS + +#define GUM_TYPE_MODULE_MAP (gum_module_map_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumModuleMap, gum_module_map, GUM, MODULE_MAP, GObject) + +typedef gboolean (* GumModuleMapFilterFunc) (const GumModuleDetails * details, + gpointer user_data); + +GUM_API GumModuleMap * gum_module_map_new (void); +GUM_API GumModuleMap * gum_module_map_new_filtered (GumModuleMapFilterFunc func, + gpointer data, GDestroyNotify data_destroy); + +GUM_API const GumModuleDetails * gum_module_map_find (GumModuleMap * self, + GumAddress address); + +GUM_API void gum_module_map_update (GumModuleMap * self); + +GUM_API GArray * gum_module_map_get_values (GumModuleMap * self); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2014 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_PRINTF_H__ +#define __GUM_PRINTF_H__ + + +G_BEGIN_DECLS + +gint gum_vsnprintf (gchar * str, gsize size, const gchar * format, + va_list args); +gint gum_snprintf (gchar * str, gsize size, const gchar * format, ...); +gint gum_vasprintf (gchar ** ret, const gchar * format, va_list ap); +gint gum_asprintf (gchar ** ret, const gchar * format, ...); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2010-2024 Ole André Vadla Ravnås + * Copyright (C) 2024 Francesco Tamagni + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_SPINLOCK_H__ +#define __GUM_SPINLOCK_H__ + + +#define GUM_SPINLOCK_INIT { NULL } + +G_BEGIN_DECLS + +typedef struct _GumSpinlock GumSpinlock; + +struct _GumSpinlock +{ + gpointer data; +}; + +GUM_API void gum_spinlock_init (GumSpinlock * spinlock); + +GUM_API void gum_spinlock_acquire (GumSpinlock * spinlock); +GUM_API gboolean gum_spinlock_try_acquire (GumSpinlock * spinlock); +GUM_API void gum_spinlock_release (GumSpinlock * spinlock); + +G_END_DECLS + +#endif +/* + * Copyright (C) 2009-2024 Ole André Vadla Ravnås + * Copyright (C) 2010 Karl Trygve Kalleberg + * Copyright (C) 2023 Håvard Sørbø + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_STALKER_H__ +#define __GUM_STALKER_H__ + +#ifndef CAPSTONE_ENGINE_H +#define CAPSTONE_ENGINE_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2016 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#if defined(CAPSTONE_HAS_OSXKERNEL) +#include +#else +#include +#include +#endif + +/* Capstone Disassembly Engine */ +/* By Axel Souchet & Nguyen Anh Quynh, 2014 */ + +#ifndef CAPSTONE_PLATFORM_H +#define CAPSTONE_PLATFORM_H + + +// handle C99 issue (for pre-2013 VisualStudio) +#if !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) +// MSVC + +// stdbool.h +#if (_MSC_VER < 1800) || defined(_KERNEL_MODE) +// this system does not have stdbool.h +#ifndef __cplusplus +typedef unsigned char bool; +#define false 0 +#define true 1 +#endif // __cplusplus + +#else +// VisualStudio 2013+ -> C99 is supported +#include +#endif // (_MSC_VER < 1800) || defined(_KERNEL_MODE) + +#else +// not MSVC -> C99 is supported +#include +#endif // !defined(__CYGWIN__) && !defined(__MINGW32__) && !defined(__MINGW64__) && (defined (WIN32) || defined (WIN64) || defined (_WIN32) || defined (_WIN64)) + + +// handle inttypes.h / stdint.h compatibility +#if defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) +#include "windowsce/stdint.h" +#endif // defined(_WIN32_WCE) && (_WIN32_WCE < 0x800) + +#if defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) +// this system does not have inttypes.h + +#if defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) +// this system does not have stdint.h +typedef signed char int8_t; +typedef signed short int16_t; +typedef signed int int32_t; +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#endif // defined(_MSC_VER) && (_MSC_VER <= 1600 || defined(_KERNEL_MODE)) + +#if defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) +#define INT8_MIN (-127i8 - 1) +#define INT16_MIN (-32767i16 - 1) +#define INT32_MIN (-2147483647i32 - 1) +#define INT64_MIN (-9223372036854775807i64 - 1) +#define INT8_MAX 127i8 +#define INT16_MAX 32767i16 +#define INT32_MAX 2147483647i32 +#define INT64_MAX 9223372036854775807i64 +#define UINT8_MAX 0xffui8 +#define UINT16_MAX 0xffffui16 +#define UINT32_MAX 0xffffffffui32 +#define UINT64_MAX 0xffffffffffffffffui64 +#endif // defined(_MSC_VER) && (_MSC_VER < 1600 || defined(_KERNEL_MODE)) + +#ifdef CAPSTONE_HAS_OSXKERNEL +// this system has stdint.h +#include +#endif + +#define __PRI_8_LENGTH_MODIFIER__ "hh" +#define __PRI_64_LENGTH_MODIFIER__ "ll" + +#define PRId8 __PRI_8_LENGTH_MODIFIER__ "d" +#define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i" +#define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o" +#define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u" +#define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x" +#define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X" + +#define PRId16 "hd" +#define PRIi16 "hi" +#define PRIo16 "ho" +#define PRIu16 "hu" +#define PRIx16 "hx" +#define PRIX16 "hX" + +#if defined(_MSC_VER) && _MSC_VER <= 1700 +#define PRId32 "ld" +#define PRIi32 "li" +#define PRIo32 "lo" +#define PRIu32 "lu" +#define PRIx32 "lx" +#define PRIX32 "lX" +#else // OSX +#define PRId32 "d" +#define PRIi32 "i" +#define PRIo32 "o" +#define PRIu32 "u" +#define PRIx32 "x" +#define PRIX32 "X" +#endif // defined(_MSC_VER) && _MSC_VER <= 1700 + +#if defined(_MSC_VER) && _MSC_VER <= 1700 +// redefine functions from inttypes.h used in cstool +#define strtoull _strtoui64 +#endif + +#define PRId64 __PRI_64_LENGTH_MODIFIER__ "d" +#define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i" +#define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o" +#define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u" +#define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x" +#define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X" + +#else +// this system has inttypes.h by default +#include +#endif // defined(CAPSTONE_HAS_OSXKERNEL) || (defined(_MSC_VER) && (_MSC_VER <= 1700 || defined(_KERNEL_MODE))) + +#endif + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#pragma warning(disable:4100) +#define CAPSTONE_API __cdecl +#ifdef CAPSTONE_SHARED +#define CAPSTONE_EXPORT __declspec(dllexport) +#else // defined(CAPSTONE_STATIC) +#define CAPSTONE_EXPORT +#endif +#else +#define CAPSTONE_API +#if (defined(__GNUC__) || defined(__IBMC__)) && !defined(CAPSTONE_STATIC) +#define CAPSTONE_EXPORT __attribute__((visibility("default"))) +#else // defined(CAPSTONE_STATIC) +#define CAPSTONE_EXPORT +#endif +#endif + +#if (defined(__GNUC__) || defined(__IBMC__)) +#define CAPSTONE_DEPRECATED __attribute__((deprecated)) +#elif defined(_MSC_VER) +#define CAPSTONE_DEPRECATED __declspec(deprecated) +#else +#pragma message("WARNING: You need to implement CAPSTONE_DEPRECATED for this compiler") +#define CAPSTONE_DEPRECATED +#endif + +// Capstone API version +#define CS_API_MAJOR 5 +#define CS_API_MINOR 0 + +// Version for bleeding edge code of the Github's "next" branch. +// Use this if you want the absolutely latest development code. +// This version number will be bumped up whenever we have a new major change. +#define CS_NEXT_VERSION 5 + +// Capstone package version +#define CS_VERSION_MAJOR CS_API_MAJOR +#define CS_VERSION_MINOR CS_API_MINOR +#define CS_VERSION_EXTRA 1 + +/// Macro for meta programming. +/// Meant for projects using Capstone and need to support multiple +/// versions of it. +/// These macros replace several instances of the old "ARM64" with +/// the new "AArch64" name depending on the CS version. +#if CS_NEXT_VERSION < 6 +#define CS_AARCH64(x) ARM64##x +#else +#define CS_AARCH64(x) AArch64##x +#endif + +#if CS_NEXT_VERSION < 6 +#define CS_AARCH64pre(x) x##ARM64 +#else +#define CS_AARCH64pre(x) x##AARCH64 +#endif + +#if CS_NEXT_VERSION < 6 +#define CS_AARCH64CC(x) ARM64_CC##x +#else +#define CS_AARCH64CC(x) AArch64CC##x +#endif + +#if CS_NEXT_VERSION < 6 +#define CS_AARCH64_VL_(x) ARM64_VAS_##x +#else +#define CS_AARCH64_VL_(x) AArch64Layout_VL_##x +#endif + +#if CS_NEXT_VERSION < 6 +#define CS_aarch64_ arm64 +#else +#define CS_aarch64_ aarch64 +#endif + +#if CS_NEXT_VERSION < 6 +#define CS_aarch64(x) arm64##x +#else +#define CS_aarch64(x) aarch64##x +#endif + +#if CS_NEXT_VERSION < 6 +#define CS_aarch64_op() cs_arm64_op +#define CS_aarch64_reg() arm64_reg +#define CS_aarch64_cc() arm64_cc +#define CS_cs_aarch64() cs_arm64 +#define CS_aarch64_extender() arm64_extender +#define CS_aarch64_shifter() arm64_shifter +#define CS_aarch64_vas() arm64_vas +#else +#define CS_aarch64_op() cs_aarch64_op +#define CS_aarch64_reg() aarch64_reg +#define CS_aarch64_cc() AArch64CC_CondCode +#define CS_cs_aarch64() cs_aarch64 +#define CS_aarch64_extender() aarch64_extender +#define CS_aarch64_shifter() aarch64_shifter +#define CS_aarch64_vas() AArch64Layout_VectorLayout +#endif + +/// Macro to create combined version which can be compared to +/// result of cs_version() API. +#define CS_MAKE_VERSION(major, minor) ((major << 8) + minor) + +/// Maximum size of an instruction mnemonic string. +#define CS_MNEMONIC_SIZE 32 + +// Handle using with all API +typedef size_t csh; + +/// Architecture type +typedef enum cs_arch { + CS_ARCH_ARM = 0, ///< ARM architecture (including Thumb, Thumb-2) + CS_ARCH_ARM64, ///< ARM-64, also called AArch64 + CS_ARCH_MIPS, ///< Mips architecture + CS_ARCH_X86, ///< X86 architecture (including x86 & x86-64) + CS_ARCH_PPC, ///< PowerPC architecture + CS_ARCH_SPARC, ///< Sparc architecture + CS_ARCH_SYSZ, ///< SystemZ architecture + CS_ARCH_XCORE, ///< XCore architecture + CS_ARCH_M68K, ///< 68K architecture + CS_ARCH_TMS320C64X, ///< TMS320C64x architecture + CS_ARCH_M680X, ///< 680X architecture + CS_ARCH_EVM, ///< Ethereum architecture + CS_ARCH_MOS65XX, ///< MOS65XX architecture (including MOS6502) + CS_ARCH_WASM, ///< WebAssembly architecture + CS_ARCH_BPF, ///< Berkeley Packet Filter architecture (including eBPF) + CS_ARCH_RISCV, ///< RISCV architecture + CS_ARCH_SH, ///< SH architecture + CS_ARCH_TRICORE, ///< TriCore architecture + CS_ARCH_MAX, + CS_ARCH_ALL = 0xFFFF, // All architectures - for cs_support() +} cs_arch; + +// Support value to verify diet mode of the engine. +// If cs_support(CS_SUPPORT_DIET) return True, the engine was compiled +// in diet mode. +#define CS_SUPPORT_DIET (CS_ARCH_ALL + 1) + +// Support value to verify X86 reduce mode of the engine. +// If cs_support(CS_SUPPORT_X86_REDUCE) return True, the engine was compiled +// in X86 reduce mode. +#define CS_SUPPORT_X86_REDUCE (CS_ARCH_ALL + 2) + +/// Mode type +typedef enum cs_mode { + CS_MODE_LITTLE_ENDIAN = 0, ///< little-endian mode (default mode) + CS_MODE_ARM = 0, ///< 32-bit ARM + CS_MODE_16 = 1 << 1, ///< 16-bit mode (X86) + CS_MODE_32 = 1 << 2, ///< 32-bit mode (X86) + CS_MODE_64 = 1 << 3, ///< 64-bit mode (X86, PPC) + CS_MODE_THUMB = 1 << 4, ///< ARM's Thumb mode, including Thumb-2 + CS_MODE_MCLASS = 1 << 5, ///< ARM's Cortex-M series + CS_MODE_V8 = 1 << 6, ///< ARMv8 A32 encodings for ARM + CS_MODE_MICRO = 1 << 4, ///< MicroMips mode (MIPS) + CS_MODE_MIPS3 = 1 << 5, ///< Mips III ISA + CS_MODE_MIPS32R6 = 1 << 6, ///< Mips32r6 ISA + CS_MODE_MIPS2 = 1 << 7, ///< Mips II ISA + CS_MODE_V9 = 1 << 4, ///< SparcV9 mode (Sparc) + CS_MODE_QPX = 1 << 4, ///< Quad Processing eXtensions mode (PPC) + CS_MODE_SPE = 1 << 5, ///< Signal Processing Engine mode (PPC) + CS_MODE_BOOKE = 1 << 6, ///< Book-E mode (PPC) + CS_MODE_PS = 1 << 7, ///< Paired-singles mode (PPC) + CS_MODE_M68K_000 = 1 << 1, ///< M68K 68000 mode + CS_MODE_M68K_010 = 1 << 2, ///< M68K 68010 mode + CS_MODE_M68K_020 = 1 << 3, ///< M68K 68020 mode + CS_MODE_M68K_030 = 1 << 4, ///< M68K 68030 mode + CS_MODE_M68K_040 = 1 << 5, ///< M68K 68040 mode + CS_MODE_M68K_060 = 1 << 6, ///< M68K 68060 mode + CS_MODE_BIG_ENDIAN = 1U << 31, ///< big-endian mode + CS_MODE_MIPS32 = CS_MODE_32, ///< Mips32 ISA (Mips) + CS_MODE_MIPS64 = CS_MODE_64, ///< Mips64 ISA (Mips) + CS_MODE_M680X_6301 = 1 << 1, ///< M680X Hitachi 6301,6303 mode + CS_MODE_M680X_6309 = 1 << 2, ///< M680X Hitachi 6309 mode + CS_MODE_M680X_6800 = 1 << 3, ///< M680X Motorola 6800,6802 mode + CS_MODE_M680X_6801 = 1 << 4, ///< M680X Motorola 6801,6803 mode + CS_MODE_M680X_6805 = 1 << 5, ///< M680X Motorola/Freescale 6805 mode + CS_MODE_M680X_6808 = 1 << 6, ///< M680X Motorola/Freescale/NXP 68HC08 mode + CS_MODE_M680X_6809 = 1 << 7, ///< M680X Motorola 6809 mode + CS_MODE_M680X_6811 = 1 << 8, ///< M680X Motorola/Freescale/NXP 68HC11 mode + CS_MODE_M680X_CPU12 = 1 << 9, ///< M680X Motorola/Freescale/NXP CPU12 + ///< used on M68HC12/HCS12 + CS_MODE_M680X_HCS08 = 1 << 10, ///< M680X Freescale/NXP HCS08 mode + CS_MODE_BPF_CLASSIC = 0, ///< Classic BPF mode (default) + CS_MODE_BPF_EXTENDED = 1 << 0, ///< Extended BPF mode + CS_MODE_RISCV32 = 1 << 0, ///< RISCV RV32G + CS_MODE_RISCV64 = 1 << 1, ///< RISCV RV64G + CS_MODE_RISCVC = 1 << 2, ///< RISCV compressed instructure mode + CS_MODE_MOS65XX_6502 = 1 << 1, ///< MOS65XXX MOS 6502 + CS_MODE_MOS65XX_65C02 = 1 << 2, ///< MOS65XXX WDC 65c02 + CS_MODE_MOS65XX_W65C02 = 1 << 3, ///< MOS65XXX WDC W65c02 + CS_MODE_MOS65XX_65816 = 1 << 4, ///< MOS65XXX WDC 65816, 8-bit m/x + CS_MODE_MOS65XX_65816_LONG_M = (1 << 5), ///< MOS65XXX WDC 65816, 16-bit m, 8-bit x + CS_MODE_MOS65XX_65816_LONG_X = (1 << 6), ///< MOS65XXX WDC 65816, 8-bit m, 16-bit x + CS_MODE_MOS65XX_65816_LONG_MX = CS_MODE_MOS65XX_65816_LONG_M | CS_MODE_MOS65XX_65816_LONG_X, + CS_MODE_SH2 = 1 << 1, ///< SH2 + CS_MODE_SH2A = 1 << 2, ///< SH2A + CS_MODE_SH3 = 1 << 3, ///< SH3 + CS_MODE_SH4 = 1 << 4, ///< SH4 + CS_MODE_SH4A = 1 << 5, ///< SH4A + CS_MODE_SHFPU = 1 << 6, ///< w/ FPU + CS_MODE_SHDSP = 1 << 7, ///< w/ DSP + CS_MODE_TRICORE_110 = 1 << 1, ///< Tricore 1.1 + CS_MODE_TRICORE_120 = 1 << 2, ///< Tricore 1.2 + CS_MODE_TRICORE_130 = 1 << 3, ///< Tricore 1.3 + CS_MODE_TRICORE_131 = 1 << 4, ///< Tricore 1.3.1 + CS_MODE_TRICORE_160 = 1 << 5, ///< Tricore 1.6 + CS_MODE_TRICORE_161 = 1 << 6, ///< Tricore 1.6.1 + CS_MODE_TRICORE_162 = 1 << 7, ///< Tricore 1.6.2 +} cs_mode; + +typedef void* (CAPSTONE_API *cs_malloc_t)(size_t size); +typedef void* (CAPSTONE_API *cs_calloc_t)(size_t nmemb, size_t size); +typedef void* (CAPSTONE_API *cs_realloc_t)(void *ptr, size_t size); +typedef void (CAPSTONE_API *cs_free_t)(void *ptr); +typedef int (CAPSTONE_API *cs_vsnprintf_t)(char *str, size_t size, const char *format, va_list ap); + + +/// User-defined dynamic memory related functions: malloc/calloc/realloc/free/vsnprintf() +/// By default, Capstone uses system's malloc(), calloc(), realloc(), free() & vsnprintf(). +typedef struct cs_opt_mem { + cs_malloc_t malloc; + cs_calloc_t calloc; + cs_realloc_t realloc; + cs_free_t free; + cs_vsnprintf_t vsnprintf; +} cs_opt_mem; + +/// Customize mnemonic for instructions with alternative name. +/// To reset existing customized instruction to its default mnemonic, +/// call cs_option(CS_OPT_MNEMONIC) again with the same @id and NULL value +/// for @mnemonic. +typedef struct cs_opt_mnem { + /// ID of instruction to be customized. + unsigned int id; + /// Customized instruction mnemonic. + const char *mnemonic; +} cs_opt_mnem; + +/// Runtime option for the disassembled engine +typedef enum cs_opt_type { + CS_OPT_INVALID = 0, ///< No option specified + CS_OPT_SYNTAX, ///< Assembly output syntax + CS_OPT_DETAIL, ///< Break down instruction structure into details + CS_OPT_MODE, ///< Change engine's mode at run-time + CS_OPT_MEM, ///< User-defined dynamic memory related functions + CS_OPT_SKIPDATA, ///< Skip data when disassembling. Then engine is in SKIPDATA mode. + CS_OPT_SKIPDATA_SETUP, ///< Setup user-defined function for SKIPDATA option + CS_OPT_MNEMONIC, ///< Customize instruction mnemonic + CS_OPT_UNSIGNED, ///< print immediate operands in unsigned form + CS_OPT_NO_BRANCH_OFFSET, ///< ARM, prints branch immediates without offset. +} cs_opt_type; + +/// Runtime option value (associated with option type above) +typedef enum cs_opt_value { + CS_OPT_OFF = 0, ///< Turn OFF an option - default for CS_OPT_DETAIL, CS_OPT_SKIPDATA, CS_OPT_UNSIGNED. + CS_OPT_ON = 3, ///< Turn ON an option (CS_OPT_DETAIL, CS_OPT_SKIPDATA). + CS_OPT_SYNTAX_DEFAULT = 0, ///< Default asm syntax (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_INTEL, ///< X86 Intel asm syntax - default on X86 (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_ATT, ///< X86 ATT asm syntax (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_NOREGNAME, ///< Prints register name with only number (CS_OPT_SYNTAX) + CS_OPT_SYNTAX_MASM, ///< X86 Intel Masm syntax (CS_OPT_SYNTAX). + CS_OPT_SYNTAX_MOTOROLA, ///< MOS65XX use $ as hex prefix +} cs_opt_value; + +/// Common instruction operand types - to be consistent across all architectures. +typedef enum cs_op_type { + CS_OP_INVALID = 0, ///< uninitialized/invalid operand. + CS_OP_REG, ///< Register operand. + CS_OP_IMM, ///< Immediate operand. + CS_OP_FP, ///< Floating-Point operand. + CS_OP_MEM = + 0x80, ///< Memory operand. Can be ORed with another operand type. +} cs_op_type; + +/// Common instruction operand access types - to be consistent across all architectures. +/// It is possible to combine access types, for example: CS_AC_READ | CS_AC_WRITE +typedef enum cs_ac_type { + CS_AC_INVALID = 0, ///< Uninitialized/invalid access type. + CS_AC_READ = 1 << 0, ///< Operand read from memory or register. + CS_AC_WRITE = 1 << 1, ///< Operand write to memory or register. +} cs_ac_type; + +/// Common instruction groups - to be consistent across all architectures. +typedef enum cs_group_type { + CS_GRP_INVALID = 0, ///< uninitialized/invalid group. + CS_GRP_JUMP, ///< all jump instructions (conditional+direct+indirect jumps) + CS_GRP_CALL, ///< all call instructions + CS_GRP_RET, ///< all return instructions + CS_GRP_INT, ///< all interrupt instructions (int+syscall) + CS_GRP_IRET, ///< all interrupt return instructions + CS_GRP_PRIVILEGE, ///< all privileged instructions + CS_GRP_BRANCH_RELATIVE, ///< all relative branching instructions +} cs_group_type; + +/** + User-defined callback function for SKIPDATA option. + See tests/test_skipdata.c for sample code demonstrating this API. + + @code: the input buffer containing code to be disassembled. + This is the same buffer passed to cs_disasm(). + @code_size: size (in bytes) of the above @code buffer. + @offset: the position of the currently-examining byte in the input + buffer @code mentioned above. + @user_data: user-data passed to cs_option() via @user_data field in + cs_opt_skipdata struct below. + + @return: return number of bytes to skip, or 0 to immediately stop disassembling. +*/ +typedef size_t (CAPSTONE_API *cs_skipdata_cb_t)(const uint8_t *code, size_t code_size, size_t offset, void *user_data); + +/// User-customized setup for SKIPDATA option +typedef struct cs_opt_skipdata { + /// Capstone considers data to skip as special "instructions". + /// User can specify the string for this instruction's "mnemonic" here. + /// By default (if @mnemonic is NULL), Capstone use ".byte". + const char *mnemonic; + + /// User-defined callback function to be called when Capstone hits data. + /// If the returned value from this callback is positive (>0), Capstone + /// will skip exactly that number of bytes & continue. Otherwise, if + /// the callback returns 0, Capstone stops disassembling and returns + /// immediately from cs_disasm() + /// NOTE: if this callback pointer is NULL, Capstone would skip a number + /// of bytes depending on architectures, as following: + /// Arm: 2 bytes (Thumb mode) or 4 bytes. + /// Arm64: 4 bytes. + /// Mips: 4 bytes. + /// M680x: 1 byte. + /// PowerPC: 4 bytes. + /// Sparc: 4 bytes. + /// SystemZ: 2 bytes. + /// X86: 1 bytes. + /// XCore: 2 bytes. + /// EVM: 1 bytes. + /// RISCV: 4 bytes. + /// WASM: 1 bytes. + /// MOS65XX: 1 bytes. + /// BPF: 8 bytes. + /// TriCore: 2 bytes. + cs_skipdata_cb_t callback; // default value is NULL + + /// User-defined data to be passed to @callback function pointer. + void *user_data; +} cs_opt_skipdata; + + +#ifndef CAPSTONE_ARM_H +#define CAPSTONE_ARM_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// ARM shift type +typedef enum arm_shifter { + ARM_SFT_INVALID = 0, + ARM_SFT_ASR, ///< shift with immediate const + ARM_SFT_LSL, ///< shift with immediate const + ARM_SFT_LSR, ///< shift with immediate const + ARM_SFT_ROR, ///< shift with immediate const + ARM_SFT_RRX, ///< shift with immediate const + ARM_SFT_ASR_REG, ///< shift with register + ARM_SFT_LSL_REG, ///< shift with register + ARM_SFT_LSR_REG, ///< shift with register + ARM_SFT_ROR_REG, ///< shift with register + ARM_SFT_RRX_REG, ///< shift with register +} arm_shifter; + +/// ARM condition code +typedef enum arm_cc { + ARM_CC_INVALID = 0, + ARM_CC_EQ, ///< Equal Equal + ARM_CC_NE, ///< Not equal Not equal, or unordered + ARM_CC_HS, ///< Carry set >, ==, or unordered + ARM_CC_LO, ///< Carry clear Less than + ARM_CC_MI, ///< Minus, negative Less than + ARM_CC_PL, ///< Plus, positive or zero >, ==, or unordered + ARM_CC_VS, ///< Overflow Unordered + ARM_CC_VC, ///< No overflow Not unordered + ARM_CC_HI, ///< Unsigned higher Greater than, or unordered + ARM_CC_LS, ///< Unsigned lower or same Less than or equal + ARM_CC_GE, ///< Greater than or equal Greater than or equal + ARM_CC_LT, ///< Less than Less than, or unordered + ARM_CC_GT, ///< Greater than Greater than + ARM_CC_LE, ///< Less than or equal <, ==, or unordered + ARM_CC_AL ///< Always (unconditional) Always (unconditional) +} arm_cc; + +typedef enum arm_sysreg { + /// Special registers for MSR + ARM_SYSREG_INVALID = 0, + + // SPSR* registers can be OR combined + ARM_SYSREG_SPSR_C = 1, + ARM_SYSREG_SPSR_X = 2, + ARM_SYSREG_SPSR_S = 4, + ARM_SYSREG_SPSR_F = 8, + + // CPSR* registers can be OR combined + ARM_SYSREG_CPSR_C = 16, + ARM_SYSREG_CPSR_X = 32, + ARM_SYSREG_CPSR_S = 64, + ARM_SYSREG_CPSR_F = 128, + + // independent registers + ARM_SYSREG_APSR = 256, + ARM_SYSREG_APSR_G, + ARM_SYSREG_APSR_NZCVQ, + ARM_SYSREG_APSR_NZCVQG, + + ARM_SYSREG_IAPSR, + ARM_SYSREG_IAPSR_G, + ARM_SYSREG_IAPSR_NZCVQG, + ARM_SYSREG_IAPSR_NZCVQ, + + ARM_SYSREG_EAPSR, + ARM_SYSREG_EAPSR_G, + ARM_SYSREG_EAPSR_NZCVQG, + ARM_SYSREG_EAPSR_NZCVQ, + + ARM_SYSREG_XPSR, + ARM_SYSREG_XPSR_G, + ARM_SYSREG_XPSR_NZCVQG, + ARM_SYSREG_XPSR_NZCVQ, + + ARM_SYSREG_IPSR, + ARM_SYSREG_EPSR, + ARM_SYSREG_IEPSR, + + ARM_SYSREG_MSP, + ARM_SYSREG_PSP, + ARM_SYSREG_PRIMASK, + ARM_SYSREG_BASEPRI, + ARM_SYSREG_BASEPRI_MAX, + ARM_SYSREG_FAULTMASK, + ARM_SYSREG_CONTROL, + ARM_SYSREG_MSPLIM, + ARM_SYSREG_PSPLIM, + ARM_SYSREG_MSP_NS, + ARM_SYSREG_PSP_NS, + ARM_SYSREG_MSPLIM_NS, + ARM_SYSREG_PSPLIM_NS, + ARM_SYSREG_PRIMASK_NS, + ARM_SYSREG_BASEPRI_NS, + ARM_SYSREG_FAULTMASK_NS, + ARM_SYSREG_CONTROL_NS, + ARM_SYSREG_SP_NS, + + // Banked Registers + ARM_SYSREG_R8_USR, + ARM_SYSREG_R9_USR, + ARM_SYSREG_R10_USR, + ARM_SYSREG_R11_USR, + ARM_SYSREG_R12_USR, + ARM_SYSREG_SP_USR, + ARM_SYSREG_LR_USR, + ARM_SYSREG_R8_FIQ, + ARM_SYSREG_R9_FIQ, + ARM_SYSREG_R10_FIQ, + ARM_SYSREG_R11_FIQ, + ARM_SYSREG_R12_FIQ, + ARM_SYSREG_SP_FIQ, + ARM_SYSREG_LR_FIQ, + ARM_SYSREG_LR_IRQ, + ARM_SYSREG_SP_IRQ, + ARM_SYSREG_LR_SVC, + ARM_SYSREG_SP_SVC, + ARM_SYSREG_LR_ABT, + ARM_SYSREG_SP_ABT, + ARM_SYSREG_LR_UND, + ARM_SYSREG_SP_UND, + ARM_SYSREG_LR_MON, + ARM_SYSREG_SP_MON, + ARM_SYSREG_ELR_HYP, + ARM_SYSREG_SP_HYP, + + ARM_SYSREG_SPSR_FIQ, + ARM_SYSREG_SPSR_IRQ, + ARM_SYSREG_SPSR_SVC, + ARM_SYSREG_SPSR_ABT, + ARM_SYSREG_SPSR_UND, + ARM_SYSREG_SPSR_MON, + ARM_SYSREG_SPSR_HYP, +} arm_sysreg; + +/// The memory barrier constants map directly to the 4-bit encoding of +/// the option field for Memory Barrier operations. +typedef enum arm_mem_barrier { + ARM_MB_INVALID = 0, + ARM_MB_RESERVED_0, + ARM_MB_OSHLD, + ARM_MB_OSHST, + ARM_MB_OSH, + ARM_MB_RESERVED_4, + ARM_MB_NSHLD, + ARM_MB_NSHST, + ARM_MB_NSH, + ARM_MB_RESERVED_8, + ARM_MB_ISHLD, + ARM_MB_ISHST, + ARM_MB_ISH, + ARM_MB_RESERVED_12, + ARM_MB_LD, + ARM_MB_ST, + ARM_MB_SY, +} arm_mem_barrier; + +/// Operand type for instruction's operands +typedef enum arm_op_type { + ARM_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + ARM_OP_REG, ///< = CS_OP_REG (Register operand). + ARM_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + ARM_OP_MEM, ///< = CS_OP_MEM (Memory operand). + ARM_OP_FP, ///< = CS_OP_FP (Floating-Point operand). + ARM_OP_CIMM = 64, ///< C-Immediate (coprocessor registers) + ARM_OP_PIMM, ///< P-Immediate (coprocessor registers) + ARM_OP_SETEND, ///< operand for SETEND instruction + ARM_OP_SYSREG, ///< MSR/MRS special register operand +} arm_op_type; + +/// Operand type for SETEND instruction +typedef enum arm_setend_type { + ARM_SETEND_INVALID = 0, ///< Uninitialized. + ARM_SETEND_BE, ///< BE operand. + ARM_SETEND_LE, ///< LE operand +} arm_setend_type; + +typedef enum arm_cpsmode_type { + ARM_CPSMODE_INVALID = 0, + ARM_CPSMODE_IE = 2, + ARM_CPSMODE_ID = 3 +} arm_cpsmode_type; + +/// Operand type for SETEND instruction +typedef enum arm_cpsflag_type { + ARM_CPSFLAG_INVALID = 0, + ARM_CPSFLAG_F = 1, + ARM_CPSFLAG_I = 2, + ARM_CPSFLAG_A = 4, + ARM_CPSFLAG_NONE = 16, ///< no flag +} arm_cpsflag_type; + +/// Data type for elements of vector instructions. +typedef enum arm_vectordata_type { + ARM_VECTORDATA_INVALID = 0, + + // Integer type + ARM_VECTORDATA_I8, + ARM_VECTORDATA_I16, + ARM_VECTORDATA_I32, + ARM_VECTORDATA_I64, + + // Signed integer type + ARM_VECTORDATA_S8, + ARM_VECTORDATA_S16, + ARM_VECTORDATA_S32, + ARM_VECTORDATA_S64, + + // Unsigned integer type + ARM_VECTORDATA_U8, + ARM_VECTORDATA_U16, + ARM_VECTORDATA_U32, + ARM_VECTORDATA_U64, + + // Data type for VMUL/VMULL + ARM_VECTORDATA_P8, + + // Floating type + ARM_VECTORDATA_F16, + ARM_VECTORDATA_F32, + ARM_VECTORDATA_F64, + + // Convert float <-> float + ARM_VECTORDATA_F16F64, // f16.f64 + ARM_VECTORDATA_F64F16, // f64.f16 + ARM_VECTORDATA_F32F16, // f32.f16 + ARM_VECTORDATA_F16F32, // f32.f16 + ARM_VECTORDATA_F64F32, // f64.f32 + ARM_VECTORDATA_F32F64, // f32.f64 + + // Convert integer <-> float + ARM_VECTORDATA_S32F32, // s32.f32 + ARM_VECTORDATA_U32F32, // u32.f32 + ARM_VECTORDATA_F32S32, // f32.s32 + ARM_VECTORDATA_F32U32, // f32.u32 + ARM_VECTORDATA_F64S16, // f64.s16 + ARM_VECTORDATA_F32S16, // f32.s16 + ARM_VECTORDATA_F64S32, // f64.s32 + ARM_VECTORDATA_S16F64, // s16.f64 + ARM_VECTORDATA_S16F32, // s16.f64 + ARM_VECTORDATA_S32F64, // s32.f64 + ARM_VECTORDATA_U16F64, // u16.f64 + ARM_VECTORDATA_U16F32, // u16.f32 + ARM_VECTORDATA_U32F64, // u32.f64 + ARM_VECTORDATA_F64U16, // f64.u16 + ARM_VECTORDATA_F32U16, // f32.u16 + ARM_VECTORDATA_F64U32, // f64.u32 + ARM_VECTORDATA_F16U16, // f16.u16 + ARM_VECTORDATA_U16F16, // u16.f16 + ARM_VECTORDATA_F16U32, // f16.u32 + ARM_VECTORDATA_U32F16, // u32.f16 +} arm_vectordata_type; + +/// ARM registers +typedef enum arm_reg { + ARM_REG_INVALID = 0, + ARM_REG_APSR, + ARM_REG_APSR_NZCV, + ARM_REG_CPSR, + ARM_REG_FPEXC, + ARM_REG_FPINST, + ARM_REG_FPSCR, + ARM_REG_FPSCR_NZCV, + ARM_REG_FPSID, + ARM_REG_ITSTATE, + ARM_REG_LR, + ARM_REG_PC, + ARM_REG_SP, + ARM_REG_SPSR, + ARM_REG_D0, + ARM_REG_D1, + ARM_REG_D2, + ARM_REG_D3, + ARM_REG_D4, + ARM_REG_D5, + ARM_REG_D6, + ARM_REG_D7, + ARM_REG_D8, + ARM_REG_D9, + ARM_REG_D10, + ARM_REG_D11, + ARM_REG_D12, + ARM_REG_D13, + ARM_REG_D14, + ARM_REG_D15, + ARM_REG_D16, + ARM_REG_D17, + ARM_REG_D18, + ARM_REG_D19, + ARM_REG_D20, + ARM_REG_D21, + ARM_REG_D22, + ARM_REG_D23, + ARM_REG_D24, + ARM_REG_D25, + ARM_REG_D26, + ARM_REG_D27, + ARM_REG_D28, + ARM_REG_D29, + ARM_REG_D30, + ARM_REG_D31, + ARM_REG_FPINST2, + ARM_REG_MVFR0, + ARM_REG_MVFR1, + ARM_REG_MVFR2, + ARM_REG_Q0, + ARM_REG_Q1, + ARM_REG_Q2, + ARM_REG_Q3, + ARM_REG_Q4, + ARM_REG_Q5, + ARM_REG_Q6, + ARM_REG_Q7, + ARM_REG_Q8, + ARM_REG_Q9, + ARM_REG_Q10, + ARM_REG_Q11, + ARM_REG_Q12, + ARM_REG_Q13, + ARM_REG_Q14, + ARM_REG_Q15, + ARM_REG_R0, + ARM_REG_R1, + ARM_REG_R2, + ARM_REG_R3, + ARM_REG_R4, + ARM_REG_R5, + ARM_REG_R6, + ARM_REG_R7, + ARM_REG_R8, + ARM_REG_R9, + ARM_REG_R10, + ARM_REG_R11, + ARM_REG_R12, + ARM_REG_S0, + ARM_REG_S1, + ARM_REG_S2, + ARM_REG_S3, + ARM_REG_S4, + ARM_REG_S5, + ARM_REG_S6, + ARM_REG_S7, + ARM_REG_S8, + ARM_REG_S9, + ARM_REG_S10, + ARM_REG_S11, + ARM_REG_S12, + ARM_REG_S13, + ARM_REG_S14, + ARM_REG_S15, + ARM_REG_S16, + ARM_REG_S17, + ARM_REG_S18, + ARM_REG_S19, + ARM_REG_S20, + ARM_REG_S21, + ARM_REG_S22, + ARM_REG_S23, + ARM_REG_S24, + ARM_REG_S25, + ARM_REG_S26, + ARM_REG_S27, + ARM_REG_S28, + ARM_REG_S29, + ARM_REG_S30, + ARM_REG_S31, + + ARM_REG_ENDING, // <-- mark the end of the list or registers + + // alias registers + ARM_REG_R13 = ARM_REG_SP, + ARM_REG_R14 = ARM_REG_LR, + ARM_REG_R15 = ARM_REG_PC, + + ARM_REG_SB = ARM_REG_R9, + ARM_REG_SL = ARM_REG_R10, + ARM_REG_FP = ARM_REG_R11, + ARM_REG_IP = ARM_REG_R12, +} arm_reg; + +/// Instruction's operand referring to memory +/// This is associated with ARM_OP_MEM operand type above +typedef struct arm_op_mem { + arm_reg base; ///< base register + arm_reg index; ///< index register + int scale; ///< scale for index register (can be 1, or -1) + int disp; ///< displacement/offset value + /// left-shift on index register, or 0 if irrelevant + /// NOTE: this value can also be fetched via operand.shift.value + int lshift; +} arm_op_mem; + +/// Instruction operand +typedef struct cs_arm_op { + int vector_index; ///< Vector Index for some vector operands (or -1 if irrelevant) + + struct { + arm_shifter type; + unsigned int value; + } shift; + + arm_op_type type; ///< operand type + + union { + int reg; ///< register value for REG/SYSREG operand + int32_t imm; ///< immediate value for C-IMM, P-IMM or IMM operand + double fp; ///< floating point value for FP operand + arm_op_mem mem; ///< base/index/scale/disp value for MEM operand + arm_setend_type setend; ///< SETEND instruction's operand type + }; + + /// in some instructions, an operand can be subtracted or added to + /// the base register, + /// if TRUE, this operand is subtracted. otherwise, it is added. + bool subtracted; + + /// How is this operand accessed? (READ, WRITE or READ|WRITE) + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; + + /// Neon lane index for NEON instructions (or -1 if irrelevant) + int8_t neon_lane; +} cs_arm_op; + +/// Instruction structure +typedef struct cs_arm { + bool usermode; ///< User-mode registers to be loaded (for LDM/STM instructions) + int vector_size; ///< Scalar size for vector instructions + arm_vectordata_type vector_data; ///< Data type for elements of vector instructions + arm_cpsmode_type cps_mode; ///< CPS mode for CPS instruction + arm_cpsflag_type cps_flag; ///< CPS mode for CPS instruction + arm_cc cc; ///< conditional code for this insn + bool update_flags; ///< does this insn update flags? + bool writeback; ///< does this insn write-back? + bool post_index; ///< only set if writeback is 'True', if 'False' pre-index, otherwise post. + arm_mem_barrier mem_barrier; ///< Option for some memory barrier instructions + + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + + cs_arm_op operands[36]; ///< operands for this instruction. +} cs_arm; + +/// ARM instruction +typedef enum arm_insn { + ARM_INS_INVALID = 0, + + ARM_INS_ADC, + ARM_INS_ADD, + ARM_INS_ADDW, + ARM_INS_ADR, + ARM_INS_AESD, + ARM_INS_AESE, + ARM_INS_AESIMC, + ARM_INS_AESMC, + ARM_INS_AND, + ARM_INS_ASR, + ARM_INS_B, + ARM_INS_BFC, + ARM_INS_BFI, + ARM_INS_BIC, + ARM_INS_BKPT, + ARM_INS_BL, + ARM_INS_BLX, + ARM_INS_BLXNS, + ARM_INS_BX, + ARM_INS_BXJ, + ARM_INS_BXNS, + ARM_INS_CBNZ, + ARM_INS_CBZ, + ARM_INS_CDP, + ARM_INS_CDP2, + ARM_INS_CLREX, + ARM_INS_CLZ, + ARM_INS_CMN, + ARM_INS_CMP, + ARM_INS_CPS, + ARM_INS_CRC32B, + ARM_INS_CRC32CB, + ARM_INS_CRC32CH, + ARM_INS_CRC32CW, + ARM_INS_CRC32H, + ARM_INS_CRC32W, + ARM_INS_CSDB, + ARM_INS_DBG, + ARM_INS_DCPS1, + ARM_INS_DCPS2, + ARM_INS_DCPS3, + ARM_INS_DFB, + ARM_INS_DMB, + ARM_INS_DSB, + ARM_INS_EOR, + ARM_INS_ERET, + ARM_INS_ESB, + ARM_INS_FADDD, + ARM_INS_FADDS, + ARM_INS_FCMPZD, + ARM_INS_FCMPZS, + ARM_INS_FCONSTD, + ARM_INS_FCONSTS, + ARM_INS_FLDMDBX, + ARM_INS_FLDMIAX, + ARM_INS_FMDHR, + ARM_INS_FMDLR, + ARM_INS_FMSTAT, + ARM_INS_FSTMDBX, + ARM_INS_FSTMIAX, + ARM_INS_FSUBD, + ARM_INS_FSUBS, + ARM_INS_HINT, + ARM_INS_HLT, + ARM_INS_HVC, + ARM_INS_ISB, + ARM_INS_IT, + ARM_INS_LDA, + ARM_INS_LDAB, + ARM_INS_LDAEX, + ARM_INS_LDAEXB, + ARM_INS_LDAEXD, + ARM_INS_LDAEXH, + ARM_INS_LDAH, + ARM_INS_LDC, + ARM_INS_LDC2, + ARM_INS_LDC2L, + ARM_INS_LDCL, + ARM_INS_LDM, + ARM_INS_LDMDA, + ARM_INS_LDMDB, + ARM_INS_LDMIB, + ARM_INS_LDR, + ARM_INS_LDRB, + ARM_INS_LDRBT, + ARM_INS_LDRD, + ARM_INS_LDREX, + ARM_INS_LDREXB, + ARM_INS_LDREXD, + ARM_INS_LDREXH, + ARM_INS_LDRH, + ARM_INS_LDRHT, + ARM_INS_LDRSB, + ARM_INS_LDRSBT, + ARM_INS_LDRSH, + ARM_INS_LDRSHT, + ARM_INS_LDRT, + ARM_INS_LSL, + ARM_INS_LSR, + ARM_INS_MCR, + ARM_INS_MCR2, + ARM_INS_MCRR, + ARM_INS_MCRR2, + ARM_INS_MLA, + ARM_INS_MLS, + ARM_INS_MOV, + ARM_INS_MOVS, + ARM_INS_MOVT, + ARM_INS_MOVW, + ARM_INS_MRC, + ARM_INS_MRC2, + ARM_INS_MRRC, + ARM_INS_MRRC2, + ARM_INS_MRS, + ARM_INS_MSR, + ARM_INS_MUL, + ARM_INS_MVN, + ARM_INS_NEG, + ARM_INS_NOP, + ARM_INS_ORN, + ARM_INS_ORR, + ARM_INS_PKHBT, + ARM_INS_PKHTB, + ARM_INS_PLD, + ARM_INS_PLDW, + ARM_INS_PLI, + ARM_INS_POP, + ARM_INS_PUSH, + ARM_INS_QADD, + ARM_INS_QADD16, + ARM_INS_QADD8, + ARM_INS_QASX, + ARM_INS_QDADD, + ARM_INS_QDSUB, + ARM_INS_QSAX, + ARM_INS_QSUB, + ARM_INS_QSUB16, + ARM_INS_QSUB8, + ARM_INS_RBIT, + ARM_INS_REV, + ARM_INS_REV16, + ARM_INS_REVSH, + ARM_INS_RFEDA, + ARM_INS_RFEDB, + ARM_INS_RFEIA, + ARM_INS_RFEIB, + ARM_INS_ROR, + ARM_INS_RRX, + ARM_INS_RSB, + ARM_INS_RSC, + ARM_INS_SADD16, + ARM_INS_SADD8, + ARM_INS_SASX, + ARM_INS_SBC, + ARM_INS_SBFX, + ARM_INS_SDIV, + ARM_INS_SEL, + ARM_INS_SETEND, + ARM_INS_SETPAN, + ARM_INS_SEV, + ARM_INS_SEVL, + ARM_INS_SG, + ARM_INS_SHA1C, + ARM_INS_SHA1H, + ARM_INS_SHA1M, + ARM_INS_SHA1P, + ARM_INS_SHA1SU0, + ARM_INS_SHA1SU1, + ARM_INS_SHA256H, + ARM_INS_SHA256H2, + ARM_INS_SHA256SU0, + ARM_INS_SHA256SU1, + ARM_INS_SHADD16, + ARM_INS_SHADD8, + ARM_INS_SHASX, + ARM_INS_SHSAX, + ARM_INS_SHSUB16, + ARM_INS_SHSUB8, + ARM_INS_SMC, + ARM_INS_SMLABB, + ARM_INS_SMLABT, + ARM_INS_SMLAD, + ARM_INS_SMLADX, + ARM_INS_SMLAL, + ARM_INS_SMLALBB, + ARM_INS_SMLALBT, + ARM_INS_SMLALD, + ARM_INS_SMLALDX, + ARM_INS_SMLALTB, + ARM_INS_SMLALTT, + ARM_INS_SMLATB, + ARM_INS_SMLATT, + ARM_INS_SMLAWB, + ARM_INS_SMLAWT, + ARM_INS_SMLSD, + ARM_INS_SMLSDX, + ARM_INS_SMLSLD, + ARM_INS_SMLSLDX, + ARM_INS_SMMLA, + ARM_INS_SMMLAR, + ARM_INS_SMMLS, + ARM_INS_SMMLSR, + ARM_INS_SMMUL, + ARM_INS_SMMULR, + ARM_INS_SMUAD, + ARM_INS_SMUADX, + ARM_INS_SMULBB, + ARM_INS_SMULBT, + ARM_INS_SMULL, + ARM_INS_SMULTB, + ARM_INS_SMULTT, + ARM_INS_SMULWB, + ARM_INS_SMULWT, + ARM_INS_SMUSD, + ARM_INS_SMUSDX, + ARM_INS_SRSDA, + ARM_INS_SRSDB, + ARM_INS_SRSIA, + ARM_INS_SRSIB, + ARM_INS_SSAT, + ARM_INS_SSAT16, + ARM_INS_SSAX, + ARM_INS_SSUB16, + ARM_INS_SSUB8, + ARM_INS_STC, + ARM_INS_STC2, + ARM_INS_STC2L, + ARM_INS_STCL, + ARM_INS_STL, + ARM_INS_STLB, + ARM_INS_STLEX, + ARM_INS_STLEXB, + ARM_INS_STLEXD, + ARM_INS_STLEXH, + ARM_INS_STLH, + ARM_INS_STM, + ARM_INS_STMDA, + ARM_INS_STMDB, + ARM_INS_STMIB, + ARM_INS_STR, + ARM_INS_STRB, + ARM_INS_STRBT, + ARM_INS_STRD, + ARM_INS_STREX, + ARM_INS_STREXB, + ARM_INS_STREXD, + ARM_INS_STREXH, + ARM_INS_STRH, + ARM_INS_STRHT, + ARM_INS_STRT, + ARM_INS_SUB, + ARM_INS_SUBS, + ARM_INS_SUBW, + ARM_INS_SVC, + ARM_INS_SWP, + ARM_INS_SWPB, + ARM_INS_SXTAB, + ARM_INS_SXTAB16, + ARM_INS_SXTAH, + ARM_INS_SXTB, + ARM_INS_SXTB16, + ARM_INS_SXTH, + ARM_INS_TBB, + ARM_INS_TBH, + ARM_INS_TEQ, + ARM_INS_TRAP, + ARM_INS_TSB, + ARM_INS_TST, + ARM_INS_TT, + ARM_INS_TTA, + ARM_INS_TTAT, + ARM_INS_TTT, + ARM_INS_UADD16, + ARM_INS_UADD8, + ARM_INS_UASX, + ARM_INS_UBFX, + ARM_INS_UDF, + ARM_INS_UDIV, + ARM_INS_UHADD16, + ARM_INS_UHADD8, + ARM_INS_UHASX, + ARM_INS_UHSAX, + ARM_INS_UHSUB16, + ARM_INS_UHSUB8, + ARM_INS_UMAAL, + ARM_INS_UMLAL, + ARM_INS_UMULL, + ARM_INS_UQADD16, + ARM_INS_UQADD8, + ARM_INS_UQASX, + ARM_INS_UQSAX, + ARM_INS_UQSUB16, + ARM_INS_UQSUB8, + ARM_INS_USAD8, + ARM_INS_USADA8, + ARM_INS_USAT, + ARM_INS_USAT16, + ARM_INS_USAX, + ARM_INS_USUB16, + ARM_INS_USUB8, + ARM_INS_UXTAB, + ARM_INS_UXTAB16, + ARM_INS_UXTAH, + ARM_INS_UXTB, + ARM_INS_UXTB16, + ARM_INS_UXTH, + ARM_INS_VABA, + ARM_INS_VABAL, + ARM_INS_VABD, + ARM_INS_VABDL, + ARM_INS_VABS, + ARM_INS_VACGE, + ARM_INS_VACGT, + ARM_INS_VACLE, + ARM_INS_VACLT, + ARM_INS_VADD, + ARM_INS_VADDHN, + ARM_INS_VADDL, + ARM_INS_VADDW, + ARM_INS_VAND, + ARM_INS_VBIC, + ARM_INS_VBIF, + ARM_INS_VBIT, + ARM_INS_VBSL, + ARM_INS_VCADD, + ARM_INS_VCEQ, + ARM_INS_VCGE, + ARM_INS_VCGT, + ARM_INS_VCLE, + ARM_INS_VCLS, + ARM_INS_VCLT, + ARM_INS_VCLZ, + ARM_INS_VCMLA, + ARM_INS_VCMP, + ARM_INS_VCMPE, + ARM_INS_VCNT, + ARM_INS_VCVT, + ARM_INS_VCVTA, + ARM_INS_VCVTB, + ARM_INS_VCVTM, + ARM_INS_VCVTN, + ARM_INS_VCVTP, + ARM_INS_VCVTR, + ARM_INS_VCVTT, + ARM_INS_VDIV, + ARM_INS_VDUP, + ARM_INS_VEOR, + ARM_INS_VEXT, + ARM_INS_VFMA, + ARM_INS_VFMS, + ARM_INS_VFNMA, + ARM_INS_VFNMS, + ARM_INS_VHADD, + ARM_INS_VHSUB, + ARM_INS_VINS, + ARM_INS_VJCVT, + ARM_INS_VLD1, + ARM_INS_VLD2, + ARM_INS_VLD3, + ARM_INS_VLD4, + ARM_INS_VLDMDB, + ARM_INS_VLDMIA, + ARM_INS_VLDR, + ARM_INS_VLLDM, + ARM_INS_VLSTM, + ARM_INS_VMAX, + ARM_INS_VMAXNM, + ARM_INS_VMIN, + ARM_INS_VMINNM, + ARM_INS_VMLA, + ARM_INS_VMLAL, + ARM_INS_VMLS, + ARM_INS_VMLSL, + ARM_INS_VMOV, + ARM_INS_VMOVL, + ARM_INS_VMOVN, + ARM_INS_VMOVX, + ARM_INS_VMRS, + ARM_INS_VMSR, + ARM_INS_VMUL, + ARM_INS_VMULL, + ARM_INS_VMVN, + ARM_INS_VNEG, + ARM_INS_VNMLA, + ARM_INS_VNMLS, + ARM_INS_VNMUL, + ARM_INS_VORN, + ARM_INS_VORR, + ARM_INS_VPADAL, + ARM_INS_VPADD, + ARM_INS_VPADDL, + ARM_INS_VPMAX, + ARM_INS_VPMIN, + ARM_INS_VPOP, + ARM_INS_VPUSH, + ARM_INS_VQABS, + ARM_INS_VQADD, + ARM_INS_VQDMLAL, + ARM_INS_VQDMLSL, + ARM_INS_VQDMULH, + ARM_INS_VQDMULL, + ARM_INS_VQMOVN, + ARM_INS_VQMOVUN, + ARM_INS_VQNEG, + ARM_INS_VQRDMLAH, + ARM_INS_VQRDMLSH, + ARM_INS_VQRDMULH, + ARM_INS_VQRSHL, + ARM_INS_VQRSHRN, + ARM_INS_VQRSHRUN, + ARM_INS_VQSHL, + ARM_INS_VQSHLU, + ARM_INS_VQSHRN, + ARM_INS_VQSHRUN, + ARM_INS_VQSUB, + ARM_INS_VRADDHN, + ARM_INS_VRECPE, + ARM_INS_VRECPS, + ARM_INS_VREV16, + ARM_INS_VREV32, + ARM_INS_VREV64, + ARM_INS_VRHADD, + ARM_INS_VRINTA, + ARM_INS_VRINTM, + ARM_INS_VRINTN, + ARM_INS_VRINTP, + ARM_INS_VRINTR, + ARM_INS_VRINTX, + ARM_INS_VRINTZ, + ARM_INS_VRSHL, + ARM_INS_VRSHR, + ARM_INS_VRSHRN, + ARM_INS_VRSQRTE, + ARM_INS_VRSQRTS, + ARM_INS_VRSRA, + ARM_INS_VRSUBHN, + ARM_INS_VSDOT, + ARM_INS_VSELEQ, + ARM_INS_VSELGE, + ARM_INS_VSELGT, + ARM_INS_VSELVS, + ARM_INS_VSHL, + ARM_INS_VSHLL, + ARM_INS_VSHR, + ARM_INS_VSHRN, + ARM_INS_VSLI, + ARM_INS_VSQRT, + ARM_INS_VSRA, + ARM_INS_VSRI, + ARM_INS_VST1, + ARM_INS_VST2, + ARM_INS_VST3, + ARM_INS_VST4, + ARM_INS_VSTMDB, + ARM_INS_VSTMIA, + ARM_INS_VSTR, + ARM_INS_VSUB, + ARM_INS_VSUBHN, + ARM_INS_VSUBL, + ARM_INS_VSUBW, + ARM_INS_VSWP, + ARM_INS_VTBL, + ARM_INS_VTBX, + ARM_INS_VTRN, + ARM_INS_VTST, + ARM_INS_VUDOT, + ARM_INS_VUZP, + ARM_INS_VZIP, + ARM_INS_WFE, + ARM_INS_WFI, + ARM_INS_YIELD, + + ARM_INS_ENDING, // <-- mark the end of the list of instructions +} arm_insn; + +/// Group of ARM instructions +typedef enum arm_insn_group { + ARM_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + ARM_GRP_JUMP, ///< = CS_GRP_JUMP + ARM_GRP_CALL, ///< = CS_GRP_CALL + ARM_GRP_INT = 4, ///< = CS_GRP_INT + ARM_GRP_PRIVILEGE = 6, ///< = CS_GRP_PRIVILEGE + ARM_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + // Architecture-specific groups + ARM_GRP_CRYPTO = 128, + ARM_GRP_DATABARRIER, + ARM_GRP_DIVIDE, + ARM_GRP_FPARMV8, + ARM_GRP_MULTPRO, + ARM_GRP_NEON, + ARM_GRP_T2EXTRACTPACK, + ARM_GRP_THUMB2DSP, + ARM_GRP_TRUSTZONE, + ARM_GRP_V4T, + ARM_GRP_V5T, + ARM_GRP_V5TE, + ARM_GRP_V6, + ARM_GRP_V6T2, + ARM_GRP_V7, + ARM_GRP_V8, + ARM_GRP_VFP2, + ARM_GRP_VFP3, + ARM_GRP_VFP4, + ARM_GRP_ARM, + ARM_GRP_MCLASS, + ARM_GRP_NOTMCLASS, + ARM_GRP_THUMB, + ARM_GRP_THUMB1ONLY, + ARM_GRP_THUMB2, + ARM_GRP_PREV8, + ARM_GRP_FPVMLX, + ARM_GRP_MULOPS, + ARM_GRP_CRC, + ARM_GRP_DPVFP, + ARM_GRP_V6M, + ARM_GRP_VIRTUALIZATION, + + ARM_GRP_ENDING, +} arm_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_ARM64_H +#define CAPSTONE_ARM64_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable : 4201) +#endif + +/// ARM64 shift type +typedef enum arm64_shifter { + ARM64_SFT_INVALID = 0, + ARM64_SFT_LSL = 1, + ARM64_SFT_MSL = 2, + ARM64_SFT_LSR = 3, + ARM64_SFT_ASR = 4, + ARM64_SFT_ROR = 5, +} arm64_shifter; + +/// ARM64 extender type +typedef enum arm64_extender { + ARM64_EXT_INVALID = 0, + ARM64_EXT_UXTB = 1, + ARM64_EXT_UXTH = 2, + ARM64_EXT_UXTW = 3, + ARM64_EXT_UXTX = 4, + ARM64_EXT_SXTB = 5, + ARM64_EXT_SXTH = 6, + ARM64_EXT_SXTW = 7, + ARM64_EXT_SXTX = 8, +} arm64_extender; + +/// ARM64 condition code +typedef enum arm64_cc { + ARM64_CC_INVALID = 0, + ARM64_CC_EQ = 1, ///< Equal + ARM64_CC_NE = 2, ///< Not equal: Not equal, or unordered + ARM64_CC_HS = 3, ///< Unsigned higher or same: >, ==, or unordered + ARM64_CC_LO = 4, ///< Unsigned lower or same: Less than + ARM64_CC_MI = 5, ///< Minus, negative: Less than + ARM64_CC_PL = 6, ///< Plus, positive or zero: >, ==, or unordered + ARM64_CC_VS = 7, ///< Overflow: Unordered + ARM64_CC_VC = 8, ///< No overflow: Ordered + ARM64_CC_HI = 9, ///< Unsigned higher: Greater than, or unordered + ARM64_CC_LS = 10, ///< Unsigned lower or same: Less than or equal + ARM64_CC_GE = 11, ///< Greater than or equal: Greater than or equal + ARM64_CC_LT = 12, ///< Less than: Less than, or unordered + ARM64_CC_GT = 13, ///< Signed greater than: Greater than + ARM64_CC_LE = 14, ///< Signed less than or equal: <, ==, or unordered + ARM64_CC_AL = 15, ///< Always (unconditional): Always (unconditional) + ARM64_CC_NV = 16, ///< Always (unconditional): Always (unconditional) + //< Note the NV exists purely to disassemble 0b1111. Execution is "always". +} arm64_cc; + +/// System registers +typedef enum arm64_sysreg { + // System registers for MRS + ARM64_SYSREG_INVALID = 0, + + ARM64_SYSREG_ACCDATA_EL1 = 0xC685, + ARM64_SYSREG_ACTLR_EL1 = 0xC081, + ARM64_SYSREG_ACTLR_EL2 = 0xE081, + ARM64_SYSREG_ACTLR_EL3 = 0xF081, + ARM64_SYSREG_AFSR0_EL1 = 0xC288, + ARM64_SYSREG_AFSR0_EL12 = 0xEA88, + ARM64_SYSREG_AFSR0_EL2 = 0xE288, + ARM64_SYSREG_AFSR0_EL3 = 0xF288, + ARM64_SYSREG_AFSR1_EL1 = 0xC289, + ARM64_SYSREG_AFSR1_EL12 = 0xEA89, + ARM64_SYSREG_AFSR1_EL2 = 0xE289, + ARM64_SYSREG_AFSR1_EL3 = 0xF289, + ARM64_SYSREG_AIDR_EL1 = 0xC807, + ARM64_SYSREG_AMAIR_EL1 = 0xC518, + ARM64_SYSREG_AMAIR_EL12 = 0xED18, + ARM64_SYSREG_AMAIR_EL2 = 0xE518, + ARM64_SYSREG_AMAIR_EL3 = 0xF518, + ARM64_SYSREG_AMCFGR_EL0 = 0xDE91, + ARM64_SYSREG_AMCGCR_EL0 = 0xDE92, + ARM64_SYSREG_AMCNTENCLR0_EL0 = 0xDE94, + ARM64_SYSREG_AMCNTENCLR1_EL0 = 0xDE98, + ARM64_SYSREG_AMCNTENSET0_EL0 = 0xDE95, + ARM64_SYSREG_AMCNTENSET1_EL0 = 0xDE99, + ARM64_SYSREG_AMCR_EL0 = 0xDE90, + ARM64_SYSREG_AMEVCNTR00_EL0 = 0xDEA0, + ARM64_SYSREG_AMEVCNTR01_EL0 = 0xDEA1, + ARM64_SYSREG_AMEVCNTR02_EL0 = 0xDEA2, + ARM64_SYSREG_AMEVCNTR03_EL0 = 0xDEA3, + ARM64_SYSREG_AMEVCNTR10_EL0 = 0xDEE0, + ARM64_SYSREG_AMEVCNTR110_EL0 = 0xDEEA, + ARM64_SYSREG_AMEVCNTR111_EL0 = 0xDEEB, + ARM64_SYSREG_AMEVCNTR112_EL0 = 0xDEEC, + ARM64_SYSREG_AMEVCNTR113_EL0 = 0xDEED, + ARM64_SYSREG_AMEVCNTR114_EL0 = 0xDEEE, + ARM64_SYSREG_AMEVCNTR115_EL0 = 0xDEEF, + ARM64_SYSREG_AMEVCNTR11_EL0 = 0xDEE1, + ARM64_SYSREG_AMEVCNTR12_EL0 = 0xDEE2, + ARM64_SYSREG_AMEVCNTR13_EL0 = 0xDEE3, + ARM64_SYSREG_AMEVCNTR14_EL0 = 0xDEE4, + ARM64_SYSREG_AMEVCNTR15_EL0 = 0xDEE5, + ARM64_SYSREG_AMEVCNTR16_EL0 = 0xDEE6, + ARM64_SYSREG_AMEVCNTR17_EL0 = 0xDEE7, + ARM64_SYSREG_AMEVCNTR18_EL0 = 0xDEE8, + ARM64_SYSREG_AMEVCNTR19_EL0 = 0xDEE9, + ARM64_SYSREG_AMEVCNTVOFF00_EL2 = 0xE6C0, + ARM64_SYSREG_AMEVCNTVOFF010_EL2 = 0xE6CA, + ARM64_SYSREG_AMEVCNTVOFF011_EL2 = 0xE6CB, + ARM64_SYSREG_AMEVCNTVOFF012_EL2 = 0xE6CC, + ARM64_SYSREG_AMEVCNTVOFF013_EL2 = 0xE6CD, + ARM64_SYSREG_AMEVCNTVOFF014_EL2 = 0xE6CE, + ARM64_SYSREG_AMEVCNTVOFF015_EL2 = 0xE6CF, + ARM64_SYSREG_AMEVCNTVOFF01_EL2 = 0xE6C1, + ARM64_SYSREG_AMEVCNTVOFF02_EL2 = 0xE6C2, + ARM64_SYSREG_AMEVCNTVOFF03_EL2 = 0xE6C3, + ARM64_SYSREG_AMEVCNTVOFF04_EL2 = 0xE6C4, + ARM64_SYSREG_AMEVCNTVOFF05_EL2 = 0xE6C5, + ARM64_SYSREG_AMEVCNTVOFF06_EL2 = 0xE6C6, + ARM64_SYSREG_AMEVCNTVOFF07_EL2 = 0xE6C7, + ARM64_SYSREG_AMEVCNTVOFF08_EL2 = 0xE6C8, + ARM64_SYSREG_AMEVCNTVOFF09_EL2 = 0xE6C9, + ARM64_SYSREG_AMEVCNTVOFF10_EL2 = 0xE6D0, + ARM64_SYSREG_AMEVCNTVOFF110_EL2 = 0xE6DA, + ARM64_SYSREG_AMEVCNTVOFF111_EL2 = 0xE6DB, + ARM64_SYSREG_AMEVCNTVOFF112_EL2 = 0xE6DC, + ARM64_SYSREG_AMEVCNTVOFF113_EL2 = 0xE6DD, + ARM64_SYSREG_AMEVCNTVOFF114_EL2 = 0xE6DE, + ARM64_SYSREG_AMEVCNTVOFF115_EL2 = 0xE6DF, + ARM64_SYSREG_AMEVCNTVOFF11_EL2 = 0xE6D1, + ARM64_SYSREG_AMEVCNTVOFF12_EL2 = 0xE6D2, + ARM64_SYSREG_AMEVCNTVOFF13_EL2 = 0xE6D3, + ARM64_SYSREG_AMEVCNTVOFF14_EL2 = 0xE6D4, + ARM64_SYSREG_AMEVCNTVOFF15_EL2 = 0xE6D5, + ARM64_SYSREG_AMEVCNTVOFF16_EL2 = 0xE6D6, + ARM64_SYSREG_AMEVCNTVOFF17_EL2 = 0xE6D7, + ARM64_SYSREG_AMEVCNTVOFF18_EL2 = 0xE6D8, + ARM64_SYSREG_AMEVCNTVOFF19_EL2 = 0xE6D9, + ARM64_SYSREG_AMEVTYPER00_EL0 = 0xDEB0, + ARM64_SYSREG_AMEVTYPER01_EL0 = 0xDEB1, + ARM64_SYSREG_AMEVTYPER02_EL0 = 0xDEB2, + ARM64_SYSREG_AMEVTYPER03_EL0 = 0xDEB3, + ARM64_SYSREG_AMEVTYPER10_EL0 = 0xDEF0, + ARM64_SYSREG_AMEVTYPER110_EL0 = 0xDEFA, + ARM64_SYSREG_AMEVTYPER111_EL0 = 0xDEFB, + ARM64_SYSREG_AMEVTYPER112_EL0 = 0xDEFC, + ARM64_SYSREG_AMEVTYPER113_EL0 = 0xDEFD, + ARM64_SYSREG_AMEVTYPER114_EL0 = 0xDEFE, + ARM64_SYSREG_AMEVTYPER115_EL0 = 0xDEFF, + ARM64_SYSREG_AMEVTYPER11_EL0 = 0xDEF1, + ARM64_SYSREG_AMEVTYPER12_EL0 = 0xDEF2, + ARM64_SYSREG_AMEVTYPER13_EL0 = 0xDEF3, + ARM64_SYSREG_AMEVTYPER14_EL0 = 0xDEF4, + ARM64_SYSREG_AMEVTYPER15_EL0 = 0xDEF5, + ARM64_SYSREG_AMEVTYPER16_EL0 = 0xDEF6, + ARM64_SYSREG_AMEVTYPER17_EL0 = 0xDEF7, + ARM64_SYSREG_AMEVTYPER18_EL0 = 0xDEF8, + ARM64_SYSREG_AMEVTYPER19_EL0 = 0xDEF9, + ARM64_SYSREG_AMUSERENR_EL0 = 0xDE93, + ARM64_SYSREG_APDAKEYHI_EL1 = 0xC111, + ARM64_SYSREG_APDAKEYLO_EL1 = 0xC110, + ARM64_SYSREG_APDBKEYHI_EL1 = 0xC113, + ARM64_SYSREG_APDBKEYLO_EL1 = 0xC112, + ARM64_SYSREG_APGAKEYHI_EL1 = 0xC119, + ARM64_SYSREG_APGAKEYLO_EL1 = 0xC118, + ARM64_SYSREG_APIAKEYHI_EL1 = 0xC109, + ARM64_SYSREG_APIAKEYLO_EL1 = 0xC108, + ARM64_SYSREG_APIBKEYHI_EL1 = 0xC10B, + ARM64_SYSREG_APIBKEYLO_EL1 = 0xC10A, + ARM64_SYSREG_BRBCR_EL1 = 0x8C80, + ARM64_SYSREG_BRBCR_EL12 = 0xAC80, + ARM64_SYSREG_BRBCR_EL2 = 0xA480, + ARM64_SYSREG_BRBFCR_EL1 = 0x8C81, + ARM64_SYSREG_BRBIDR0_EL1 = 0x8C90, + ARM64_SYSREG_BRBINF0_EL1 = 0x8C00, + ARM64_SYSREG_BRBINF10_EL1 = 0x8C50, + ARM64_SYSREG_BRBINF11_EL1 = 0x8C58, + ARM64_SYSREG_BRBINF12_EL1 = 0x8C60, + ARM64_SYSREG_BRBINF13_EL1 = 0x8C68, + ARM64_SYSREG_BRBINF14_EL1 = 0x8C70, + ARM64_SYSREG_BRBINF15_EL1 = 0x8C78, + ARM64_SYSREG_BRBINF16_EL1 = 0x8C04, + ARM64_SYSREG_BRBINF17_EL1 = 0x8C0C, + ARM64_SYSREG_BRBINF18_EL1 = 0x8C14, + ARM64_SYSREG_BRBINF19_EL1 = 0x8C1C, + ARM64_SYSREG_BRBINF1_EL1 = 0x8C08, + ARM64_SYSREG_BRBINF20_EL1 = 0x8C24, + ARM64_SYSREG_BRBINF21_EL1 = 0x8C2C, + ARM64_SYSREG_BRBINF22_EL1 = 0x8C34, + ARM64_SYSREG_BRBINF23_EL1 = 0x8C3C, + ARM64_SYSREG_BRBINF24_EL1 = 0x8C44, + ARM64_SYSREG_BRBINF25_EL1 = 0x8C4C, + ARM64_SYSREG_BRBINF26_EL1 = 0x8C54, + ARM64_SYSREG_BRBINF27_EL1 = 0x8C5C, + ARM64_SYSREG_BRBINF28_EL1 = 0x8C64, + ARM64_SYSREG_BRBINF29_EL1 = 0x8C6C, + ARM64_SYSREG_BRBINF2_EL1 = 0x8C10, + ARM64_SYSREG_BRBINF30_EL1 = 0x8C74, + ARM64_SYSREG_BRBINF31_EL1 = 0x8C7C, + ARM64_SYSREG_BRBINF3_EL1 = 0x8C18, + ARM64_SYSREG_BRBINF4_EL1 = 0x8C20, + ARM64_SYSREG_BRBINF5_EL1 = 0x8C28, + ARM64_SYSREG_BRBINF6_EL1 = 0x8C30, + ARM64_SYSREG_BRBINF7_EL1 = 0x8C38, + ARM64_SYSREG_BRBINF8_EL1 = 0x8C40, + ARM64_SYSREG_BRBINF9_EL1 = 0x8C48, + ARM64_SYSREG_BRBINFINJ_EL1 = 0x8C88, + ARM64_SYSREG_BRBSRC0_EL1 = 0x8C01, + ARM64_SYSREG_BRBSRC10_EL1 = 0x8C51, + ARM64_SYSREG_BRBSRC11_EL1 = 0x8C59, + ARM64_SYSREG_BRBSRC12_EL1 = 0x8C61, + ARM64_SYSREG_BRBSRC13_EL1 = 0x8C69, + ARM64_SYSREG_BRBSRC14_EL1 = 0x8C71, + ARM64_SYSREG_BRBSRC15_EL1 = 0x8C79, + ARM64_SYSREG_BRBSRC16_EL1 = 0x8C05, ARM64_SYSREG_BRBSRC17_EL1 = 0x8C0D, ARM64_SYSREG_BRBSRC18_EL1 = 0x8C15, ARM64_SYSREG_BRBSRC19_EL1 = 0x8C1D, @@ -52789,86 +79103,678 @@ typedef enum x86_insn { X86_INS_XSTORE, X86_INS_XTEST, - X86_INS_ENDING, // mark the end of the list of insn -} x86_insn; + X86_INS_ENDING, // mark the end of the list of insn +} x86_insn; + +/// Group of X86 instructions +typedef enum x86_insn_group { + X86_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + X86_GRP_JUMP, ///< = CS_GRP_JUMP + // all call instructions + X86_GRP_CALL, ///< = CS_GRP_CALL + // all return instructions + X86_GRP_RET, ///< = CS_GRP_RET + // all interrupt instructions (int+syscall) + X86_GRP_INT, ///< = CS_GRP_INT + // all interrupt return instructions + X86_GRP_IRET, ///< = CS_GRP_IRET + // all privileged instructions + X86_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE + // all relative branching instructions + X86_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + // Architecture-specific groups + X86_GRP_VM = 128, ///< all virtualization instructions (VT-x + AMD-V) + X86_GRP_3DNOW, + X86_GRP_AES, + X86_GRP_ADX, + X86_GRP_AVX, + X86_GRP_AVX2, + X86_GRP_AVX512, + X86_GRP_BMI, + X86_GRP_BMI2, + X86_GRP_CMOV, + X86_GRP_F16C, + X86_GRP_FMA, + X86_GRP_FMA4, + X86_GRP_FSGSBASE, + X86_GRP_HLE, + X86_GRP_MMX, + X86_GRP_MODE32, + X86_GRP_MODE64, + X86_GRP_RTM, + X86_GRP_SHA, + X86_GRP_SSE1, + X86_GRP_SSE2, + X86_GRP_SSE3, + X86_GRP_SSE41, + X86_GRP_SSE42, + X86_GRP_SSE4A, + X86_GRP_SSSE3, + X86_GRP_PCLMUL, + X86_GRP_XOP, + X86_GRP_CDI, + X86_GRP_ERI, + X86_GRP_TBM, + X86_GRP_16BITMODE, + X86_GRP_NOT64BITMODE, + X86_GRP_SGX, + X86_GRP_DQI, + X86_GRP_BWI, + X86_GRP_PFI, + X86_GRP_VLX, + X86_GRP_SMAP, + X86_GRP_NOVLX, + X86_GRP_FPU, + + X86_GRP_ENDING +} x86_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_XCORE_H +#define CAPSTONE_XCORE_H + +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2014-2015 */ + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +/// Operand type for instruction's operands +typedef enum xcore_op_type { + XCORE_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + XCORE_OP_REG, ///< = CS_OP_REG (Register operand). + XCORE_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + XCORE_OP_MEM, ///< = CS_OP_MEM (Memory operand). +} xcore_op_type; + +/// XCore registers +typedef enum xcore_reg { + XCORE_REG_INVALID = 0, + + XCORE_REG_CP, + XCORE_REG_DP, + XCORE_REG_LR, + XCORE_REG_SP, + XCORE_REG_R0, + XCORE_REG_R1, + XCORE_REG_R2, + XCORE_REG_R3, + XCORE_REG_R4, + XCORE_REG_R5, + XCORE_REG_R6, + XCORE_REG_R7, + XCORE_REG_R8, + XCORE_REG_R9, + XCORE_REG_R10, + XCORE_REG_R11, + + // pseudo registers + XCORE_REG_PC, ///< pc + + // internal thread registers + // see The-XMOS-XS1-Architecture(X7879A).pdf + XCORE_REG_SCP, ///< save pc + XCORE_REG_SSR, //< save status + XCORE_REG_ET, //< exception type + XCORE_REG_ED, //< exception data + XCORE_REG_SED, //< save exception data + XCORE_REG_KEP, //< kernel entry pointer + XCORE_REG_KSP, //< kernel stack pointer + XCORE_REG_ID, //< thread ID + + XCORE_REG_ENDING, // <-- mark the end of the list of registers +} xcore_reg; + +/// Instruction's operand referring to memory +/// This is associated with XCORE_OP_MEM operand type above +typedef struct xcore_op_mem { + uint8_t base; ///< base register, can be safely interpreted as + ///< a value of type `xcore_reg`, but it is only + ///< one byte wide + uint8_t index; ///< index register, same conditions apply here + int32_t disp; ///< displacement/offset value + int direct; ///< +1: forward, -1: backward +} xcore_op_mem; + +/// Instruction operand +typedef struct cs_xcore_op { + xcore_op_type type; ///< operand type + union { + xcore_reg reg; ///< register value for REG operand + int32_t imm; ///< immediate value for IMM operand + xcore_op_mem mem; ///< base/disp value for MEM operand + }; +} cs_xcore_op; + +/// Instruction structure +typedef struct cs_xcore { + /// Number of operands of this instruction, + /// or 0 when instruction has no operand. + uint8_t op_count; + cs_xcore_op operands[8]; ///< operands for this instruction. +} cs_xcore; + +/// XCore instruction +typedef enum xcore_insn { + XCORE_INS_INVALID = 0, + + XCORE_INS_ADD, + XCORE_INS_ANDNOT, + XCORE_INS_AND, + XCORE_INS_ASHR, + XCORE_INS_BAU, + XCORE_INS_BITREV, + XCORE_INS_BLA, + XCORE_INS_BLAT, + XCORE_INS_BL, + XCORE_INS_BF, + XCORE_INS_BT, + XCORE_INS_BU, + XCORE_INS_BRU, + XCORE_INS_BYTEREV, + XCORE_INS_CHKCT, + XCORE_INS_CLRE, + XCORE_INS_CLRPT, + XCORE_INS_CLRSR, + XCORE_INS_CLZ, + XCORE_INS_CRC8, + XCORE_INS_CRC32, + XCORE_INS_DCALL, + XCORE_INS_DENTSP, + XCORE_INS_DGETREG, + XCORE_INS_DIVS, + XCORE_INS_DIVU, + XCORE_INS_DRESTSP, + XCORE_INS_DRET, + XCORE_INS_ECALLF, + XCORE_INS_ECALLT, + XCORE_INS_EDU, + XCORE_INS_EEF, + XCORE_INS_EET, + XCORE_INS_EEU, + XCORE_INS_ENDIN, + XCORE_INS_ENTSP, + XCORE_INS_EQ, + XCORE_INS_EXTDP, + XCORE_INS_EXTSP, + XCORE_INS_FREER, + XCORE_INS_FREET, + XCORE_INS_GETD, + XCORE_INS_GET, + XCORE_INS_GETN, + XCORE_INS_GETR, + XCORE_INS_GETSR, + XCORE_INS_GETST, + XCORE_INS_GETTS, + XCORE_INS_INCT, + XCORE_INS_INIT, + XCORE_INS_INPW, + XCORE_INS_INSHR, + XCORE_INS_INT, + XCORE_INS_IN, + XCORE_INS_KCALL, + XCORE_INS_KENTSP, + XCORE_INS_KRESTSP, + XCORE_INS_KRET, + XCORE_INS_LADD, + XCORE_INS_LD16S, + XCORE_INS_LD8U, + XCORE_INS_LDA16, + XCORE_INS_LDAP, + XCORE_INS_LDAW, + XCORE_INS_LDC, + XCORE_INS_LDW, + XCORE_INS_LDIVU, + XCORE_INS_LMUL, + XCORE_INS_LSS, + XCORE_INS_LSUB, + XCORE_INS_LSU, + XCORE_INS_MACCS, + XCORE_INS_MACCU, + XCORE_INS_MJOIN, + XCORE_INS_MKMSK, + XCORE_INS_MSYNC, + XCORE_INS_MUL, + XCORE_INS_NEG, + XCORE_INS_NOT, + XCORE_INS_OR, + XCORE_INS_OUTCT, + XCORE_INS_OUTPW, + XCORE_INS_OUTSHR, + XCORE_INS_OUTT, + XCORE_INS_OUT, + XCORE_INS_PEEK, + XCORE_INS_REMS, + XCORE_INS_REMU, + XCORE_INS_RETSP, + XCORE_INS_SETCLK, + XCORE_INS_SET, + XCORE_INS_SETC, + XCORE_INS_SETD, + XCORE_INS_SETEV, + XCORE_INS_SETN, + XCORE_INS_SETPSC, + XCORE_INS_SETPT, + XCORE_INS_SETRDY, + XCORE_INS_SETSR, + XCORE_INS_SETTW, + XCORE_INS_SETV, + XCORE_INS_SEXT, + XCORE_INS_SHL, + XCORE_INS_SHR, + XCORE_INS_SSYNC, + XCORE_INS_ST16, + XCORE_INS_ST8, + XCORE_INS_STW, + XCORE_INS_SUB, + XCORE_INS_SYNCR, + XCORE_INS_TESTCT, + XCORE_INS_TESTLCL, + XCORE_INS_TESTWCT, + XCORE_INS_TSETMR, + XCORE_INS_START, + XCORE_INS_WAITEF, + XCORE_INS_WAITET, + XCORE_INS_WAITEU, + XCORE_INS_XOR, + XCORE_INS_ZEXT, + + XCORE_INS_ENDING, // <-- mark the end of the list of instructions +} xcore_insn; -/// Group of X86 instructions -typedef enum x86_insn_group { - X86_GRP_INVALID = 0, ///< = CS_GRP_INVALID +/// Group of XCore instructions +typedef enum xcore_insn_group { + XCORE_GRP_INVALID = 0, ///< = CS_GRP_INVALID // Generic groups // all jump instructions (conditional+direct+indirect jumps) - X86_GRP_JUMP, ///< = CS_GRP_JUMP - // all call instructions - X86_GRP_CALL, ///< = CS_GRP_CALL - // all return instructions - X86_GRP_RET, ///< = CS_GRP_RET - // all interrupt instructions (int+syscall) - X86_GRP_INT, ///< = CS_GRP_INT - // all interrupt return instructions - X86_GRP_IRET, ///< = CS_GRP_IRET - // all privileged instructions - X86_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE - // all relative branching instructions - X86_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + XCORE_GRP_JUMP, ///< = CS_GRP_JUMP - // Architecture-specific groups - X86_GRP_VM = 128, ///< all virtualization instructions (VT-x + AMD-V) - X86_GRP_3DNOW, - X86_GRP_AES, - X86_GRP_ADX, - X86_GRP_AVX, - X86_GRP_AVX2, - X86_GRP_AVX512, - X86_GRP_BMI, - X86_GRP_BMI2, - X86_GRP_CMOV, - X86_GRP_F16C, - X86_GRP_FMA, - X86_GRP_FMA4, - X86_GRP_FSGSBASE, - X86_GRP_HLE, - X86_GRP_MMX, - X86_GRP_MODE32, - X86_GRP_MODE64, - X86_GRP_RTM, - X86_GRP_SHA, - X86_GRP_SSE1, - X86_GRP_SSE2, - X86_GRP_SSE3, - X86_GRP_SSE41, - X86_GRP_SSE42, - X86_GRP_SSE4A, - X86_GRP_SSSE3, - X86_GRP_PCLMUL, - X86_GRP_XOP, - X86_GRP_CDI, - X86_GRP_ERI, - X86_GRP_TBM, - X86_GRP_16BITMODE, - X86_GRP_NOT64BITMODE, - X86_GRP_SGX, - X86_GRP_DQI, - X86_GRP_BWI, - X86_GRP_PFI, - X86_GRP_VLX, - X86_GRP_SMAP, - X86_GRP_NOVLX, - X86_GRP_FPU, + XCORE_GRP_ENDING, // <-- mark the end of the list of groups +} xcore_insn_group; - X86_GRP_ENDING -} x86_insn_group; +#ifdef __cplusplus +} +#endif + +#endif +/* Capstone Disassembly Engine */ +/* TMS320C64x Backend by Fotis Loukos 2016 */ + +#ifndef CAPSTONE_TMS320C64X_H +#define CAPSTONE_TMS320C64X_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +typedef enum tms320c64x_op_type { + TMS320C64X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + TMS320C64X_OP_REG, ///< = CS_OP_REG (Register operand). + TMS320C64X_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + TMS320C64X_OP_MEM, ///< = CS_OP_MEM (Memory operand). + TMS320C64X_OP_REGPAIR = 64, ///< Register pair for double word ops +} tms320c64x_op_type; + +typedef enum tms320c64x_mem_disp { + TMS320C64X_MEM_DISP_INVALID = 0, + TMS320C64X_MEM_DISP_CONSTANT, + TMS320C64X_MEM_DISP_REGISTER, +} tms320c64x_mem_disp; + +typedef enum tms320c64x_mem_dir { + TMS320C64X_MEM_DIR_INVALID = 0, + TMS320C64X_MEM_DIR_FW, + TMS320C64X_MEM_DIR_BW, +} tms320c64x_mem_dir; + +typedef enum tms320c64x_mem_mod { + TMS320C64X_MEM_MOD_INVALID = 0, + TMS320C64X_MEM_MOD_NO, + TMS320C64X_MEM_MOD_PRE, + TMS320C64X_MEM_MOD_POST, +} tms320c64x_mem_mod; + +typedef struct tms320c64x_op_mem { + unsigned int base; ///< base register + unsigned int disp; ///< displacement/offset value + unsigned int unit; ///< unit of base and offset register + unsigned int scaled; ///< offset scaled + unsigned int disptype; ///< displacement type + unsigned int direction; ///< direction + unsigned int modify; ///< modification +} tms320c64x_op_mem; + +typedef struct cs_tms320c64x_op { + tms320c64x_op_type type; ///< operand type + union { + unsigned int reg; ///< register value for REG operand or first register for REGPAIR operand + int32_t imm; ///< immediate value for IMM operand + tms320c64x_op_mem mem; ///< base/disp value for MEM operand + }; +} cs_tms320c64x_op; + +typedef struct cs_tms320c64x { + uint8_t op_count; + cs_tms320c64x_op operands[8]; ///< operands for this instruction. + struct { + unsigned int reg; + unsigned int zero; + } condition; + struct { + unsigned int unit; + unsigned int side; + unsigned int crosspath; + } funit; + unsigned int parallel; +} cs_tms320c64x; + +typedef enum tms320c64x_reg { + TMS320C64X_REG_INVALID = 0, + + TMS320C64X_REG_AMR, + TMS320C64X_REG_CSR, + TMS320C64X_REG_DIER, + TMS320C64X_REG_DNUM, + TMS320C64X_REG_ECR, + TMS320C64X_REG_GFPGFR, + TMS320C64X_REG_GPLYA, + TMS320C64X_REG_GPLYB, + TMS320C64X_REG_ICR, + TMS320C64X_REG_IER, + TMS320C64X_REG_IERR, + TMS320C64X_REG_ILC, + TMS320C64X_REG_IRP, + TMS320C64X_REG_ISR, + TMS320C64X_REG_ISTP, + TMS320C64X_REG_ITSR, + TMS320C64X_REG_NRP, + TMS320C64X_REG_NTSR, + TMS320C64X_REG_REP, + TMS320C64X_REG_RILC, + TMS320C64X_REG_SSR, + TMS320C64X_REG_TSCH, + TMS320C64X_REG_TSCL, + TMS320C64X_REG_TSR, + TMS320C64X_REG_A0, + TMS320C64X_REG_A1, + TMS320C64X_REG_A2, + TMS320C64X_REG_A3, + TMS320C64X_REG_A4, + TMS320C64X_REG_A5, + TMS320C64X_REG_A6, + TMS320C64X_REG_A7, + TMS320C64X_REG_A8, + TMS320C64X_REG_A9, + TMS320C64X_REG_A10, + TMS320C64X_REG_A11, + TMS320C64X_REG_A12, + TMS320C64X_REG_A13, + TMS320C64X_REG_A14, + TMS320C64X_REG_A15, + TMS320C64X_REG_A16, + TMS320C64X_REG_A17, + TMS320C64X_REG_A18, + TMS320C64X_REG_A19, + TMS320C64X_REG_A20, + TMS320C64X_REG_A21, + TMS320C64X_REG_A22, + TMS320C64X_REG_A23, + TMS320C64X_REG_A24, + TMS320C64X_REG_A25, + TMS320C64X_REG_A26, + TMS320C64X_REG_A27, + TMS320C64X_REG_A28, + TMS320C64X_REG_A29, + TMS320C64X_REG_A30, + TMS320C64X_REG_A31, + TMS320C64X_REG_B0, + TMS320C64X_REG_B1, + TMS320C64X_REG_B2, + TMS320C64X_REG_B3, + TMS320C64X_REG_B4, + TMS320C64X_REG_B5, + TMS320C64X_REG_B6, + TMS320C64X_REG_B7, + TMS320C64X_REG_B8, + TMS320C64X_REG_B9, + TMS320C64X_REG_B10, + TMS320C64X_REG_B11, + TMS320C64X_REG_B12, + TMS320C64X_REG_B13, + TMS320C64X_REG_B14, + TMS320C64X_REG_B15, + TMS320C64X_REG_B16, + TMS320C64X_REG_B17, + TMS320C64X_REG_B18, + TMS320C64X_REG_B19, + TMS320C64X_REG_B20, + TMS320C64X_REG_B21, + TMS320C64X_REG_B22, + TMS320C64X_REG_B23, + TMS320C64X_REG_B24, + TMS320C64X_REG_B25, + TMS320C64X_REG_B26, + TMS320C64X_REG_B27, + TMS320C64X_REG_B28, + TMS320C64X_REG_B29, + TMS320C64X_REG_B30, + TMS320C64X_REG_B31, + TMS320C64X_REG_PCE1, + + TMS320C64X_REG_ENDING, // <-- mark the end of the list of registers + + // Alias registers + TMS320C64X_REG_EFR = TMS320C64X_REG_ECR, + TMS320C64X_REG_IFR = TMS320C64X_REG_ISR, +} tms320c64x_reg; + +typedef enum tms320c64x_insn { + TMS320C64X_INS_INVALID = 0, + + TMS320C64X_INS_ABS, + TMS320C64X_INS_ABS2, + TMS320C64X_INS_ADD, + TMS320C64X_INS_ADD2, + TMS320C64X_INS_ADD4, + TMS320C64X_INS_ADDAB, + TMS320C64X_INS_ADDAD, + TMS320C64X_INS_ADDAH, + TMS320C64X_INS_ADDAW, + TMS320C64X_INS_ADDK, + TMS320C64X_INS_ADDKPC, + TMS320C64X_INS_ADDU, + TMS320C64X_INS_AND, + TMS320C64X_INS_ANDN, + TMS320C64X_INS_AVG2, + TMS320C64X_INS_AVGU4, + TMS320C64X_INS_B, + TMS320C64X_INS_BDEC, + TMS320C64X_INS_BITC4, + TMS320C64X_INS_BNOP, + TMS320C64X_INS_BPOS, + TMS320C64X_INS_CLR, + TMS320C64X_INS_CMPEQ, + TMS320C64X_INS_CMPEQ2, + TMS320C64X_INS_CMPEQ4, + TMS320C64X_INS_CMPGT, + TMS320C64X_INS_CMPGT2, + TMS320C64X_INS_CMPGTU4, + TMS320C64X_INS_CMPLT, + TMS320C64X_INS_CMPLTU, + TMS320C64X_INS_DEAL, + TMS320C64X_INS_DOTP2, + TMS320C64X_INS_DOTPN2, + TMS320C64X_INS_DOTPNRSU2, + TMS320C64X_INS_DOTPRSU2, + TMS320C64X_INS_DOTPSU4, + TMS320C64X_INS_DOTPU4, + TMS320C64X_INS_EXT, + TMS320C64X_INS_EXTU, + TMS320C64X_INS_GMPGTU, + TMS320C64X_INS_GMPY4, + TMS320C64X_INS_LDB, + TMS320C64X_INS_LDBU, + TMS320C64X_INS_LDDW, + TMS320C64X_INS_LDH, + TMS320C64X_INS_LDHU, + TMS320C64X_INS_LDNDW, + TMS320C64X_INS_LDNW, + TMS320C64X_INS_LDW, + TMS320C64X_INS_LMBD, + TMS320C64X_INS_MAX2, + TMS320C64X_INS_MAXU4, + TMS320C64X_INS_MIN2, + TMS320C64X_INS_MINU4, + TMS320C64X_INS_MPY, + TMS320C64X_INS_MPY2, + TMS320C64X_INS_MPYH, + TMS320C64X_INS_MPYHI, + TMS320C64X_INS_MPYHIR, + TMS320C64X_INS_MPYHL, + TMS320C64X_INS_MPYHLU, + TMS320C64X_INS_MPYHSLU, + TMS320C64X_INS_MPYHSU, + TMS320C64X_INS_MPYHU, + TMS320C64X_INS_MPYHULS, + TMS320C64X_INS_MPYHUS, + TMS320C64X_INS_MPYLH, + TMS320C64X_INS_MPYLHU, + TMS320C64X_INS_MPYLI, + TMS320C64X_INS_MPYLIR, + TMS320C64X_INS_MPYLSHU, + TMS320C64X_INS_MPYLUHS, + TMS320C64X_INS_MPYSU, + TMS320C64X_INS_MPYSU4, + TMS320C64X_INS_MPYU, + TMS320C64X_INS_MPYU4, + TMS320C64X_INS_MPYUS, + TMS320C64X_INS_MVC, + TMS320C64X_INS_MVD, + TMS320C64X_INS_MVK, + TMS320C64X_INS_MVKL, + TMS320C64X_INS_MVKLH, + TMS320C64X_INS_NOP, + TMS320C64X_INS_NORM, + TMS320C64X_INS_OR, + TMS320C64X_INS_PACK2, + TMS320C64X_INS_PACKH2, + TMS320C64X_INS_PACKH4, + TMS320C64X_INS_PACKHL2, + TMS320C64X_INS_PACKL4, + TMS320C64X_INS_PACKLH2, + TMS320C64X_INS_ROTL, + TMS320C64X_INS_SADD, + TMS320C64X_INS_SADD2, + TMS320C64X_INS_SADDU4, + TMS320C64X_INS_SADDUS2, + TMS320C64X_INS_SAT, + TMS320C64X_INS_SET, + TMS320C64X_INS_SHFL, + TMS320C64X_INS_SHL, + TMS320C64X_INS_SHLMB, + TMS320C64X_INS_SHR, + TMS320C64X_INS_SHR2, + TMS320C64X_INS_SHRMB, + TMS320C64X_INS_SHRU, + TMS320C64X_INS_SHRU2, + TMS320C64X_INS_SMPY, + TMS320C64X_INS_SMPY2, + TMS320C64X_INS_SMPYH, + TMS320C64X_INS_SMPYHL, + TMS320C64X_INS_SMPYLH, + TMS320C64X_INS_SPACK2, + TMS320C64X_INS_SPACKU4, + TMS320C64X_INS_SSHL, + TMS320C64X_INS_SSHVL, + TMS320C64X_INS_SSHVR, + TMS320C64X_INS_SSUB, + TMS320C64X_INS_STB, + TMS320C64X_INS_STDW, + TMS320C64X_INS_STH, + TMS320C64X_INS_STNDW, + TMS320C64X_INS_STNW, + TMS320C64X_INS_STW, + TMS320C64X_INS_SUB, + TMS320C64X_INS_SUB2, + TMS320C64X_INS_SUB4, + TMS320C64X_INS_SUBAB, + TMS320C64X_INS_SUBABS4, + TMS320C64X_INS_SUBAH, + TMS320C64X_INS_SUBAW, + TMS320C64X_INS_SUBC, + TMS320C64X_INS_SUBU, + TMS320C64X_INS_SWAP4, + TMS320C64X_INS_UNPKHU4, + TMS320C64X_INS_UNPKLU4, + TMS320C64X_INS_XOR, + TMS320C64X_INS_XPND2, + TMS320C64X_INS_XPND4, + // Aliases + TMS320C64X_INS_IDLE, + TMS320C64X_INS_MV, + TMS320C64X_INS_NEG, + TMS320C64X_INS_NOT, + TMS320C64X_INS_SWAP2, + TMS320C64X_INS_ZERO, + + TMS320C64X_INS_ENDING, // <-- mark the end of the list of instructions +} tms320c64x_insn; + +typedef enum tms320c64x_insn_group { + TMS320C64X_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + TMS320C64X_GRP_JUMP, ///< = CS_GRP_JUMP + + TMS320C64X_GRP_FUNIT_D = 128, + TMS320C64X_GRP_FUNIT_L, + TMS320C64X_GRP_FUNIT_M, + TMS320C64X_GRP_FUNIT_S, + TMS320C64X_GRP_FUNIT_NO, + + TMS320C64X_GRP_ENDING, // <-- mark the end of the list of groups +} tms320c64x_insn_group; + +typedef enum tms320c64x_funit { + TMS320C64X_FUNIT_INVALID = 0, + TMS320C64X_FUNIT_D, + TMS320C64X_FUNIT_L, + TMS320C64X_FUNIT_M, + TMS320C64X_FUNIT_S, + TMS320C64X_FUNIT_NO +} tms320c64x_funit; #ifdef __cplusplus } #endif #endif -#ifndef CAPSTONE_XCORE_H -#define CAPSTONE_XCORE_H + +#ifndef CAPSTONE_M680X_H +#define CAPSTONE_M680X_H /* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2014-2015 */ +/* M680X Backend by Wolfgang Schwotzer 2017 */ #ifdef __cplusplus extern "C" { @@ -52879,576 +79785,1237 @@ extern "C" { #pragma warning(disable:4201) #endif -/// Operand type for instruction's operands -typedef enum xcore_op_type { - XCORE_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - XCORE_OP_REG, ///< = CS_OP_REG (Register operand). - XCORE_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - XCORE_OP_MEM, ///< = CS_OP_MEM (Memory operand). -} xcore_op_type; +#define M680X_OPERAND_COUNT 9 -/// XCore registers -typedef enum xcore_reg { - XCORE_REG_INVALID = 0, +/// M680X registers and special registers +typedef enum m680x_reg { + M680X_REG_INVALID = 0, - XCORE_REG_CP, - XCORE_REG_DP, - XCORE_REG_LR, - XCORE_REG_SP, - XCORE_REG_R0, - XCORE_REG_R1, - XCORE_REG_R2, - XCORE_REG_R3, - XCORE_REG_R4, - XCORE_REG_R5, - XCORE_REG_R6, - XCORE_REG_R7, - XCORE_REG_R8, - XCORE_REG_R9, - XCORE_REG_R10, - XCORE_REG_R11, + M680X_REG_A, ///< M6800/1/2/3/9, HD6301/9 + M680X_REG_B, ///< M6800/1/2/3/9, HD6301/9 + M680X_REG_E, ///< HD6309 + M680X_REG_F, ///< HD6309 + M680X_REG_0, ///< HD6309 + + M680X_REG_D, ///< M6801/3/9, HD6301/9 + M680X_REG_W, ///< HD6309 + + M680X_REG_CC, ///< M6800/1/2/3/9, M6301/9 + M680X_REG_DP, ///< M6809/M6309 + M680X_REG_MD, ///< M6309 + + M680X_REG_HX, ///< M6808 + M680X_REG_H, ///< M6808 + M680X_REG_X, ///< M6800/1/2/3/9, M6301/9 + M680X_REG_Y, ///< M6809/M6309 + M680X_REG_S, ///< M6809/M6309 + M680X_REG_U, ///< M6809/M6309 + M680X_REG_V, ///< M6309 + + M680X_REG_Q, ///< M6309 + + M680X_REG_PC, ///< M6800/1/2/3/9, M6301/9 + + M680X_REG_TMP2, ///< CPU12 + M680X_REG_TMP3, ///< CPU12 + + M680X_REG_ENDING, ///< <-- mark the end of the list of registers +} m680x_reg; + +/// Operand type for instruction's operands +typedef enum m680x_op_type { + M680X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + M680X_OP_REGISTER, ///< = Register operand. + M680X_OP_IMMEDIATE, ///< = Immediate operand. + M680X_OP_INDEXED, ///< = Indexed addressing operand. + M680X_OP_EXTENDED, ///< = Extended addressing operand. + M680X_OP_DIRECT, ///< = Direct addressing operand. + M680X_OP_RELATIVE, ///< = Relative addressing operand. + M680X_OP_CONSTANT, ///< = constant operand (Displayed as number only). + ///< Used e.g. for a bit index or page number. +} m680x_op_type; - // pseudo registers - XCORE_REG_PC, ///< pc +// Supported bit values for mem.idx.offset_bits +#define M680X_OFFSET_NONE 0 +#define M680X_OFFSET_BITS_5 5 +#define M680X_OFFSET_BITS_8 8 +#define M680X_OFFSET_BITS_9 9 +#define M680X_OFFSET_BITS_16 16 - // internal thread registers - // see The-XMOS-XS1-Architecture(X7879A).pdf - XCORE_REG_SCP, ///< save pc - XCORE_REG_SSR, //< save status - XCORE_REG_ET, //< exception type - XCORE_REG_ED, //< exception data - XCORE_REG_SED, //< save exception data - XCORE_REG_KEP, //< kernel entry pointer - XCORE_REG_KSP, //< kernel stack pointer - XCORE_REG_ID, //< thread ID +// Supported bit flags for mem.idx.flags +// These flags can be combined +#define M680X_IDX_INDIRECT 1 +#define M680X_IDX_NO_COMMA 2 +#define M680X_IDX_POST_INC_DEC 4 - XCORE_REG_ENDING, // <-- mark the end of the list of registers -} xcore_reg; +/// Instruction's operand referring to indexed addressing +typedef struct m680x_op_idx { + m680x_reg base_reg; ///< base register (or M680X_REG_INVALID if + ///< irrelevant) + m680x_reg offset_reg; ///< offset register (or M680X_REG_INVALID if + ///< irrelevant) + int16_t offset; ///< 5-,8- or 16-bit offset. See also offset_bits. + uint16_t offset_addr; ///< = offset addr. if base_reg == M680X_REG_PC. + ///< calculated as offset + PC + uint8_t offset_bits; ///< offset width in bits for indexed addressing + int8_t inc_dec; ///< inc. or dec. value: + ///< 0: no inc-/decrement + ///< 1 .. 8: increment by 1 .. 8 + ///< -1 .. -8: decrement by 1 .. 8 + ///< if flag M680X_IDX_POST_INC_DEC set it is post + ///< inc-/decrement otherwise pre inc-/decrement + uint8_t flags; ///< 8-bit flags (see above) +} m680x_op_idx; -/// Instruction's operand referring to memory -/// This is associated with XCORE_OP_MEM operand type above -typedef struct xcore_op_mem { - uint8_t base; ///< base register, can be safely interpreted as - ///< a value of type `xcore_reg`, but it is only - ///< one byte wide - uint8_t index; ///< index register, same conditions apply here - int32_t disp; ///< displacement/offset value - int direct; ///< +1: forward, -1: backward -} xcore_op_mem; +/// Instruction's memory operand referring to relative addressing (Bcc/LBcc) +typedef struct m680x_op_rel { + uint16_t address; ///< The absolute address. + ///< calculated as PC + offset. PC is the first + ///< address after the instruction. + int16_t offset; ///< the offset/displacement value +} m680x_op_rel; + +/// Instruction's operand referring to extended addressing +typedef struct m680x_op_ext { + uint16_t address; ///< The absolute address + bool indirect; ///< true if extended indirect addressing +} m680x_op_ext; /// Instruction operand -typedef struct cs_xcore_op { - xcore_op_type type; ///< operand type +typedef struct cs_m680x_op { + m680x_op_type type; union { - xcore_reg reg; ///< register value for REG operand int32_t imm; ///< immediate value for IMM operand - xcore_op_mem mem; ///< base/disp value for MEM operand + m680x_reg reg; ///< register value for REG operand + m680x_op_idx idx; ///< Indexed addressing operand + m680x_op_rel rel; ///< Relative address. operand (Bcc/LBcc) + m680x_op_ext ext; ///< Extended address + uint8_t direct_addr; ///< 2016 */ +#ifndef CAPSTONE_EVM_H +#define CAPSTONE_EVM_H -#ifndef CAPSTONE_TMS320C64X_H -#define CAPSTONE_TMS320C64X_H +/* Capstone Disassembly Engine */ +/* By Nguyen Anh Quynh , 2013-2018 */ #ifdef __cplusplus extern "C" { #endif -#include #ifdef _MSC_VER #pragma warning(disable:4201) #endif -typedef enum tms320c64x_op_type { - TMS320C64X_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - TMS320C64X_OP_REG, ///< = CS_OP_REG (Register operand). - TMS320C64X_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - TMS320C64X_OP_MEM, ///< = CS_OP_MEM (Memory operand). - TMS320C64X_OP_REGPAIR = 64, ///< Register pair for double word ops -} tms320c64x_op_type; - -typedef enum tms320c64x_mem_disp { - TMS320C64X_MEM_DISP_INVALID = 0, - TMS320C64X_MEM_DISP_CONSTANT, - TMS320C64X_MEM_DISP_REGISTER, -} tms320c64x_mem_disp; - -typedef enum tms320c64x_mem_dir { - TMS320C64X_MEM_DIR_INVALID = 0, - TMS320C64X_MEM_DIR_FW, - TMS320C64X_MEM_DIR_BW, -} tms320c64x_mem_dir; - -typedef enum tms320c64x_mem_mod { - TMS320C64X_MEM_MOD_INVALID = 0, - TMS320C64X_MEM_MOD_NO, - TMS320C64X_MEM_MOD_PRE, - TMS320C64X_MEM_MOD_POST, -} tms320c64x_mem_mod; - -typedef struct tms320c64x_op_mem { - unsigned int base; ///< base register - unsigned int disp; ///< displacement/offset value - unsigned int unit; ///< unit of base and offset register - unsigned int scaled; ///< offset scaled - unsigned int disptype; ///< displacement type - unsigned int direction; ///< direction - unsigned int modify; ///< modification -} tms320c64x_op_mem; - -typedef struct cs_tms320c64x_op { - tms320c64x_op_type type; ///< operand type - union { - unsigned int reg; ///< register value for REG operand or first register for REGPAIR operand - int32_t imm; ///< immediate value for IMM operand - tms320c64x_op_mem mem; ///< base/disp value for MEM operand - }; -} cs_tms320c64x_op; - -typedef struct cs_tms320c64x { - uint8_t op_count; - cs_tms320c64x_op operands[8]; ///< operands for this instruction. - struct { - unsigned int reg; - unsigned int zero; - } condition; - struct { - unsigned int unit; - unsigned int side; - unsigned int crosspath; - } funit; - unsigned int parallel; -} cs_tms320c64x; - -typedef enum tms320c64x_reg { - TMS320C64X_REG_INVALID = 0, - - TMS320C64X_REG_AMR, - TMS320C64X_REG_CSR, - TMS320C64X_REG_DIER, - TMS320C64X_REG_DNUM, - TMS320C64X_REG_ECR, - TMS320C64X_REG_GFPGFR, - TMS320C64X_REG_GPLYA, - TMS320C64X_REG_GPLYB, - TMS320C64X_REG_ICR, - TMS320C64X_REG_IER, - TMS320C64X_REG_IERR, - TMS320C64X_REG_ILC, - TMS320C64X_REG_IRP, - TMS320C64X_REG_ISR, - TMS320C64X_REG_ISTP, - TMS320C64X_REG_ITSR, - TMS320C64X_REG_NRP, - TMS320C64X_REG_NTSR, - TMS320C64X_REG_REP, - TMS320C64X_REG_RILC, - TMS320C64X_REG_SSR, - TMS320C64X_REG_TSCH, - TMS320C64X_REG_TSCL, - TMS320C64X_REG_TSR, - TMS320C64X_REG_A0, - TMS320C64X_REG_A1, - TMS320C64X_REG_A2, - TMS320C64X_REG_A3, - TMS320C64X_REG_A4, - TMS320C64X_REG_A5, - TMS320C64X_REG_A6, - TMS320C64X_REG_A7, - TMS320C64X_REG_A8, - TMS320C64X_REG_A9, - TMS320C64X_REG_A10, - TMS320C64X_REG_A11, - TMS320C64X_REG_A12, - TMS320C64X_REG_A13, - TMS320C64X_REG_A14, - TMS320C64X_REG_A15, - TMS320C64X_REG_A16, - TMS320C64X_REG_A17, - TMS320C64X_REG_A18, - TMS320C64X_REG_A19, - TMS320C64X_REG_A20, - TMS320C64X_REG_A21, - TMS320C64X_REG_A22, - TMS320C64X_REG_A23, - TMS320C64X_REG_A24, - TMS320C64X_REG_A25, - TMS320C64X_REG_A26, - TMS320C64X_REG_A27, - TMS320C64X_REG_A28, - TMS320C64X_REG_A29, - TMS320C64X_REG_A30, - TMS320C64X_REG_A31, - TMS320C64X_REG_B0, - TMS320C64X_REG_B1, - TMS320C64X_REG_B2, - TMS320C64X_REG_B3, - TMS320C64X_REG_B4, - TMS320C64X_REG_B5, - TMS320C64X_REG_B6, - TMS320C64X_REG_B7, - TMS320C64X_REG_B8, - TMS320C64X_REG_B9, - TMS320C64X_REG_B10, - TMS320C64X_REG_B11, - TMS320C64X_REG_B12, - TMS320C64X_REG_B13, - TMS320C64X_REG_B14, - TMS320C64X_REG_B15, - TMS320C64X_REG_B16, - TMS320C64X_REG_B17, - TMS320C64X_REG_B18, - TMS320C64X_REG_B19, - TMS320C64X_REG_B20, - TMS320C64X_REG_B21, - TMS320C64X_REG_B22, - TMS320C64X_REG_B23, - TMS320C64X_REG_B24, - TMS320C64X_REG_B25, - TMS320C64X_REG_B26, - TMS320C64X_REG_B27, - TMS320C64X_REG_B28, - TMS320C64X_REG_B29, - TMS320C64X_REG_B30, - TMS320C64X_REG_B31, - TMS320C64X_REG_PCE1, - - TMS320C64X_REG_ENDING, // <-- mark the end of the list of registers - - // Alias registers - TMS320C64X_REG_EFR = TMS320C64X_REG_ECR, - TMS320C64X_REG_IFR = TMS320C64X_REG_ISR, -} tms320c64x_reg; - -typedef enum tms320c64x_insn { - TMS320C64X_INS_INVALID = 0, +/// Instruction structure +typedef struct cs_evm { + unsigned char pop; ///< number of items popped from the stack + unsigned char push; ///< number of items pushed into the stack + unsigned int fee; ///< gas fee for the instruction +} cs_evm; - TMS320C64X_INS_ABS, - TMS320C64X_INS_ABS2, - TMS320C64X_INS_ADD, - TMS320C64X_INS_ADD2, - TMS320C64X_INS_ADD4, - TMS320C64X_INS_ADDAB, - TMS320C64X_INS_ADDAD, - TMS320C64X_INS_ADDAH, - TMS320C64X_INS_ADDAW, - TMS320C64X_INS_ADDK, - TMS320C64X_INS_ADDKPC, - TMS320C64X_INS_ADDU, - TMS320C64X_INS_AND, - TMS320C64X_INS_ANDN, - TMS320C64X_INS_AVG2, - TMS320C64X_INS_AVGU4, - TMS320C64X_INS_B, - TMS320C64X_INS_BDEC, - TMS320C64X_INS_BITC4, - TMS320C64X_INS_BNOP, - TMS320C64X_INS_BPOS, - TMS320C64X_INS_CLR, - TMS320C64X_INS_CMPEQ, - TMS320C64X_INS_CMPEQ2, - TMS320C64X_INS_CMPEQ4, - TMS320C64X_INS_CMPGT, - TMS320C64X_INS_CMPGT2, - TMS320C64X_INS_CMPGTU4, - TMS320C64X_INS_CMPLT, - TMS320C64X_INS_CMPLTU, - TMS320C64X_INS_DEAL, - TMS320C64X_INS_DOTP2, - TMS320C64X_INS_DOTPN2, - TMS320C64X_INS_DOTPNRSU2, - TMS320C64X_INS_DOTPRSU2, - TMS320C64X_INS_DOTPSU4, - TMS320C64X_INS_DOTPU4, - TMS320C64X_INS_EXT, - TMS320C64X_INS_EXTU, - TMS320C64X_INS_GMPGTU, - TMS320C64X_INS_GMPY4, - TMS320C64X_INS_LDB, - TMS320C64X_INS_LDBU, - TMS320C64X_INS_LDDW, - TMS320C64X_INS_LDH, - TMS320C64X_INS_LDHU, - TMS320C64X_INS_LDNDW, - TMS320C64X_INS_LDNW, - TMS320C64X_INS_LDW, - TMS320C64X_INS_LMBD, - TMS320C64X_INS_MAX2, - TMS320C64X_INS_MAXU4, - TMS320C64X_INS_MIN2, - TMS320C64X_INS_MINU4, - TMS320C64X_INS_MPY, - TMS320C64X_INS_MPY2, - TMS320C64X_INS_MPYH, - TMS320C64X_INS_MPYHI, - TMS320C64X_INS_MPYHIR, - TMS320C64X_INS_MPYHL, - TMS320C64X_INS_MPYHLU, - TMS320C64X_INS_MPYHSLU, - TMS320C64X_INS_MPYHSU, - TMS320C64X_INS_MPYHU, - TMS320C64X_INS_MPYHULS, - TMS320C64X_INS_MPYHUS, - TMS320C64X_INS_MPYLH, - TMS320C64X_INS_MPYLHU, - TMS320C64X_INS_MPYLI, - TMS320C64X_INS_MPYLIR, - TMS320C64X_INS_MPYLSHU, - TMS320C64X_INS_MPYLUHS, - TMS320C64X_INS_MPYSU, - TMS320C64X_INS_MPYSU4, - TMS320C64X_INS_MPYU, - TMS320C64X_INS_MPYU4, - TMS320C64X_INS_MPYUS, - TMS320C64X_INS_MVC, - TMS320C64X_INS_MVD, - TMS320C64X_INS_MVK, - TMS320C64X_INS_MVKL, - TMS320C64X_INS_MVKLH, - TMS320C64X_INS_NOP, - TMS320C64X_INS_NORM, - TMS320C64X_INS_OR, - TMS320C64X_INS_PACK2, - TMS320C64X_INS_PACKH2, - TMS320C64X_INS_PACKH4, - TMS320C64X_INS_PACKHL2, - TMS320C64X_INS_PACKL4, - TMS320C64X_INS_PACKLH2, - TMS320C64X_INS_ROTL, - TMS320C64X_INS_SADD, - TMS320C64X_INS_SADD2, - TMS320C64X_INS_SADDU4, - TMS320C64X_INS_SADDUS2, - TMS320C64X_INS_SAT, - TMS320C64X_INS_SET, - TMS320C64X_INS_SHFL, - TMS320C64X_INS_SHL, - TMS320C64X_INS_SHLMB, - TMS320C64X_INS_SHR, - TMS320C64X_INS_SHR2, - TMS320C64X_INS_SHRMB, - TMS320C64X_INS_SHRU, - TMS320C64X_INS_SHRU2, - TMS320C64X_INS_SMPY, - TMS320C64X_INS_SMPY2, - TMS320C64X_INS_SMPYH, - TMS320C64X_INS_SMPYHL, - TMS320C64X_INS_SMPYLH, - TMS320C64X_INS_SPACK2, - TMS320C64X_INS_SPACKU4, - TMS320C64X_INS_SSHL, - TMS320C64X_INS_SSHVL, - TMS320C64X_INS_SSHVR, - TMS320C64X_INS_SSUB, - TMS320C64X_INS_STB, - TMS320C64X_INS_STDW, - TMS320C64X_INS_STH, - TMS320C64X_INS_STNDW, - TMS320C64X_INS_STNW, - TMS320C64X_INS_STW, - TMS320C64X_INS_SUB, - TMS320C64X_INS_SUB2, - TMS320C64X_INS_SUB4, - TMS320C64X_INS_SUBAB, - TMS320C64X_INS_SUBABS4, - TMS320C64X_INS_SUBAH, - TMS320C64X_INS_SUBAW, - TMS320C64X_INS_SUBC, - TMS320C64X_INS_SUBU, - TMS320C64X_INS_SWAP4, - TMS320C64X_INS_UNPKHU4, - TMS320C64X_INS_UNPKLU4, - TMS320C64X_INS_XOR, - TMS320C64X_INS_XPND2, - TMS320C64X_INS_XPND4, - // Aliases - TMS320C64X_INS_IDLE, - TMS320C64X_INS_MV, - TMS320C64X_INS_NEG, - TMS320C64X_INS_NOT, - TMS320C64X_INS_SWAP2, - TMS320C64X_INS_ZERO, +/// EVM instruction +typedef enum evm_insn { + EVM_INS_STOP = 0, + EVM_INS_ADD = 1, + EVM_INS_MUL = 2, + EVM_INS_SUB = 3, + EVM_INS_DIV = 4, + EVM_INS_SDIV = 5, + EVM_INS_MOD = 6, + EVM_INS_SMOD = 7, + EVM_INS_ADDMOD = 8, + EVM_INS_MULMOD = 9, + EVM_INS_EXP = 10, + EVM_INS_SIGNEXTEND = 11, + EVM_INS_LT = 16, + EVM_INS_GT = 17, + EVM_INS_SLT = 18, + EVM_INS_SGT = 19, + EVM_INS_EQ = 20, + EVM_INS_ISZERO = 21, + EVM_INS_AND = 22, + EVM_INS_OR = 23, + EVM_INS_XOR = 24, + EVM_INS_NOT = 25, + EVM_INS_BYTE = 26, + EVM_INS_SHA3 = 32, + EVM_INS_ADDRESS = 48, + EVM_INS_BALANCE = 49, + EVM_INS_ORIGIN = 50, + EVM_INS_CALLER = 51, + EVM_INS_CALLVALUE = 52, + EVM_INS_CALLDATALOAD = 53, + EVM_INS_CALLDATASIZE = 54, + EVM_INS_CALLDATACOPY = 55, + EVM_INS_CODESIZE = 56, + EVM_INS_CODECOPY = 57, + EVM_INS_GASPRICE = 58, + EVM_INS_EXTCODESIZE = 59, + EVM_INS_EXTCODECOPY = 60, + EVM_INS_RETURNDATASIZE = 61, + EVM_INS_RETURNDATACOPY = 62, + EVM_INS_BLOCKHASH = 64, + EVM_INS_COINBASE = 65, + EVM_INS_TIMESTAMP = 66, + EVM_INS_NUMBER = 67, + EVM_INS_DIFFICULTY = 68, + EVM_INS_GASLIMIT = 69, + EVM_INS_POP = 80, + EVM_INS_MLOAD = 81, + EVM_INS_MSTORE = 82, + EVM_INS_MSTORE8 = 83, + EVM_INS_SLOAD = 84, + EVM_INS_SSTORE = 85, + EVM_INS_JUMP = 86, + EVM_INS_JUMPI = 87, + EVM_INS_PC = 88, + EVM_INS_MSIZE = 89, + EVM_INS_GAS = 90, + EVM_INS_JUMPDEST = 91, + EVM_INS_PUSH1 = 96, + EVM_INS_PUSH2 = 97, + EVM_INS_PUSH3 = 98, + EVM_INS_PUSH4 = 99, + EVM_INS_PUSH5 = 100, + EVM_INS_PUSH6 = 101, + EVM_INS_PUSH7 = 102, + EVM_INS_PUSH8 = 103, + EVM_INS_PUSH9 = 104, + EVM_INS_PUSH10 = 105, + EVM_INS_PUSH11 = 106, + EVM_INS_PUSH12 = 107, + EVM_INS_PUSH13 = 108, + EVM_INS_PUSH14 = 109, + EVM_INS_PUSH15 = 110, + EVM_INS_PUSH16 = 111, + EVM_INS_PUSH17 = 112, + EVM_INS_PUSH18 = 113, + EVM_INS_PUSH19 = 114, + EVM_INS_PUSH20 = 115, + EVM_INS_PUSH21 = 116, + EVM_INS_PUSH22 = 117, + EVM_INS_PUSH23 = 118, + EVM_INS_PUSH24 = 119, + EVM_INS_PUSH25 = 120, + EVM_INS_PUSH26 = 121, + EVM_INS_PUSH27 = 122, + EVM_INS_PUSH28 = 123, + EVM_INS_PUSH29 = 124, + EVM_INS_PUSH30 = 125, + EVM_INS_PUSH31 = 126, + EVM_INS_PUSH32 = 127, + EVM_INS_DUP1 = 128, + EVM_INS_DUP2 = 129, + EVM_INS_DUP3 = 130, + EVM_INS_DUP4 = 131, + EVM_INS_DUP5 = 132, + EVM_INS_DUP6 = 133, + EVM_INS_DUP7 = 134, + EVM_INS_DUP8 = 135, + EVM_INS_DUP9 = 136, + EVM_INS_DUP10 = 137, + EVM_INS_DUP11 = 138, + EVM_INS_DUP12 = 139, + EVM_INS_DUP13 = 140, + EVM_INS_DUP14 = 141, + EVM_INS_DUP15 = 142, + EVM_INS_DUP16 = 143, + EVM_INS_SWAP1 = 144, + EVM_INS_SWAP2 = 145, + EVM_INS_SWAP3 = 146, + EVM_INS_SWAP4 = 147, + EVM_INS_SWAP5 = 148, + EVM_INS_SWAP6 = 149, + EVM_INS_SWAP7 = 150, + EVM_INS_SWAP8 = 151, + EVM_INS_SWAP9 = 152, + EVM_INS_SWAP10 = 153, + EVM_INS_SWAP11 = 154, + EVM_INS_SWAP12 = 155, + EVM_INS_SWAP13 = 156, + EVM_INS_SWAP14 = 157, + EVM_INS_SWAP15 = 158, + EVM_INS_SWAP16 = 159, + EVM_INS_LOG0 = 160, + EVM_INS_LOG1 = 161, + EVM_INS_LOG2 = 162, + EVM_INS_LOG3 = 163, + EVM_INS_LOG4 = 164, + EVM_INS_CREATE = 240, + EVM_INS_CALL = 241, + EVM_INS_CALLCODE = 242, + EVM_INS_RETURN = 243, + EVM_INS_DELEGATECALL = 244, + EVM_INS_CALLBLACKBOX = 245, + EVM_INS_STATICCALL = 250, + EVM_INS_REVERT = 253, + EVM_INS_SUICIDE = 255, - TMS320C64X_INS_ENDING, // <-- mark the end of the list of instructions -} tms320c64x_insn; + EVM_INS_INVALID = 512, + EVM_INS_ENDING, // <-- mark the end of the list of instructions +} evm_insn; -typedef enum tms320c64x_insn_group { - TMS320C64X_GRP_INVALID = 0, ///< = CS_GRP_INVALID +/// Group of EVM instructions +typedef enum evm_insn_group { + EVM_GRP_INVALID = 0, ///< = CS_GRP_INVALID - TMS320C64X_GRP_JUMP, ///< = CS_GRP_JUMP + EVM_GRP_JUMP, ///< all jump instructions - TMS320C64X_GRP_FUNIT_D = 128, - TMS320C64X_GRP_FUNIT_L, - TMS320C64X_GRP_FUNIT_M, - TMS320C64X_GRP_FUNIT_S, - TMS320C64X_GRP_FUNIT_NO, + EVM_GRP_MATH = 8, ///< math instructions + EVM_GRP_STACK_WRITE, ///< instructions write to stack + EVM_GRP_STACK_READ, ///< instructions read from stack + EVM_GRP_MEM_WRITE, ///< instructions write to memory + EVM_GRP_MEM_READ, ///< instructions read from memory + EVM_GRP_STORE_WRITE, ///< instructions write to storage + EVM_GRP_STORE_READ, ///< instructions read from storage + EVM_GRP_HALT, ///< instructions halt execution + + EVM_GRP_ENDING, ///< <-- mark the end of the list of groups +} evm_insn_group; + +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_RISCV_H +#define CAPSTONE_RISCV_H + +/* Capstone Disassembly Engine */ +/* RISC-V Backend By Rodrigo Cortes Porto & + Shawn Chang , HardenedLinux@2018 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(_MSC_VER) || !defined(_KERNEL_MODE) +#include +#endif + + +// GCC MIPS toolchain has a default macro called "mips" which breaks +// compilation +//#undef riscv + +#ifdef _MSC_VER +#pragma warning(disable:4201) +#endif + +//> Operand type for instruction's operands +typedef enum riscv_op_type { + RISCV_OP_INVALID = 0, // = CS_OP_INVALID (Uninitialized). + RISCV_OP_REG, // = CS_OP_REG (Register operand). + RISCV_OP_IMM, // = CS_OP_IMM (Immediate operand). + RISCV_OP_MEM, // = CS_OP_MEM (Memory operand). +} riscv_op_type; + +// Instruction's operand referring to memory +// This is associated with RISCV_OP_MEM operand type above +typedef struct riscv_op_mem { + unsigned int base; // base register + int64_t disp; // displacement/offset value +} riscv_op_mem; + +// Instruction operand +typedef struct cs_riscv_op { + riscv_op_type type; // operand type + union { + unsigned int reg; // register value for REG operand + int64_t imm; // immediate value for IMM operand + riscv_op_mem mem; // base/disp value for MEM operand + }; +} cs_riscv_op; + +// Instruction structure +typedef struct cs_riscv { + // Does this instruction need effective address or not. + bool need_effective_addr; + // Number of operands of this instruction, + // or 0 when instruction has no operand. + uint8_t op_count; + cs_riscv_op operands[8]; // operands for this instruction. +} cs_riscv; + +//> RISCV registers +typedef enum riscv_reg { + RISCV_REG_INVALID = 0, + //> General purpose registers + RISCV_REG_X0, // "zero" + RISCV_REG_ZERO = RISCV_REG_X0, // "zero" + RISCV_REG_X1, // "ra" + RISCV_REG_RA = RISCV_REG_X1, // "ra" + RISCV_REG_X2, // "sp" + RISCV_REG_SP = RISCV_REG_X2, // "sp" + RISCV_REG_X3, // "gp" + RISCV_REG_GP = RISCV_REG_X3, // "gp" + RISCV_REG_X4, // "tp" + RISCV_REG_TP = RISCV_REG_X4, // "tp" + RISCV_REG_X5, // "t0" + RISCV_REG_T0 = RISCV_REG_X5, // "t0" + RISCV_REG_X6, // "t1" + RISCV_REG_T1 = RISCV_REG_X6, // "t1" + RISCV_REG_X7, // "t2" + RISCV_REG_T2 = RISCV_REG_X7, // "t2" + RISCV_REG_X8, // "s0/fp" + RISCV_REG_S0 = RISCV_REG_X8, // "s0" + RISCV_REG_FP = RISCV_REG_X8, // "fp" + RISCV_REG_X9, // "s1" + RISCV_REG_S1 = RISCV_REG_X9, // "s1" + RISCV_REG_X10, // "a0" + RISCV_REG_A0 = RISCV_REG_X10, // "a0" + RISCV_REG_X11, // "a1" + RISCV_REG_A1 = RISCV_REG_X11, // "a1" + RISCV_REG_X12, // "a2" + RISCV_REG_A2 = RISCV_REG_X12, // "a2" + RISCV_REG_X13, // "a3" + RISCV_REG_A3 = RISCV_REG_X13, // "a3" + RISCV_REG_X14, // "a4" + RISCV_REG_A4 = RISCV_REG_X14, // "a4" + RISCV_REG_X15, // "a5" + RISCV_REG_A5 = RISCV_REG_X15, // "a5" + RISCV_REG_X16, // "a6" + RISCV_REG_A6 = RISCV_REG_X16, // "a6" + RISCV_REG_X17, // "a7" + RISCV_REG_A7 = RISCV_REG_X17, // "a7" + RISCV_REG_X18, // "s2" + RISCV_REG_S2 = RISCV_REG_X18, // "s2" + RISCV_REG_X19, // "s3" + RISCV_REG_S3 = RISCV_REG_X19, // "s3" + RISCV_REG_X20, // "s4" + RISCV_REG_S4 = RISCV_REG_X20, // "s4" + RISCV_REG_X21, // "s5" + RISCV_REG_S5 = RISCV_REG_X21, // "s5" + RISCV_REG_X22, // "s6" + RISCV_REG_S6 = RISCV_REG_X22, // "s6" + RISCV_REG_X23, // "s7" + RISCV_REG_S7 = RISCV_REG_X23, // "s7" + RISCV_REG_X24, // "s8" + RISCV_REG_S8 = RISCV_REG_X24, // "s8" + RISCV_REG_X25, // "s9" + RISCV_REG_S9 = RISCV_REG_X25, // "s9" + RISCV_REG_X26, // "s10" + RISCV_REG_S10 = RISCV_REG_X26, // "s10" + RISCV_REG_X27, // "s11" + RISCV_REG_S11 = RISCV_REG_X27, // "s11" + RISCV_REG_X28, // "t3" + RISCV_REG_T3 = RISCV_REG_X28, // "t3" + RISCV_REG_X29, // "t4" + RISCV_REG_T4 = RISCV_REG_X29, // "t4" + RISCV_REG_X30, // "t5" + RISCV_REG_T5 = RISCV_REG_X30, // "t5" + RISCV_REG_X31, // "t6" + RISCV_REG_T6 = RISCV_REG_X31, // "t6" + + //> Floating-point registers + RISCV_REG_F0_32, // "ft0" + RISCV_REG_F0_64, // "ft0" + RISCV_REG_F1_32, // "ft1" + RISCV_REG_F1_64, // "ft1" + RISCV_REG_F2_32, // "ft2" + RISCV_REG_F2_64, // "ft2" + RISCV_REG_F3_32, // "ft3" + RISCV_REG_F3_64, // "ft3" + RISCV_REG_F4_32, // "ft4" + RISCV_REG_F4_64, // "ft4" + RISCV_REG_F5_32, // "ft5" + RISCV_REG_F5_64, // "ft5" + RISCV_REG_F6_32, // "ft6" + RISCV_REG_F6_64, // "ft6" + RISCV_REG_F7_32, // "ft7" + RISCV_REG_F7_64, // "ft7" + RISCV_REG_F8_32, // "fs0" + RISCV_REG_F8_64, // "fs0" + RISCV_REG_F9_32, // "fs1" + RISCV_REG_F9_64, // "fs1" + RISCV_REG_F10_32, // "fa0" + RISCV_REG_F10_64, // "fa0" + RISCV_REG_F11_32, // "fa1" + RISCV_REG_F11_64, // "fa1" + RISCV_REG_F12_32, // "fa2" + RISCV_REG_F12_64, // "fa2" + RISCV_REG_F13_32, // "fa3" + RISCV_REG_F13_64, // "fa3" + RISCV_REG_F14_32, // "fa4" + RISCV_REG_F14_64, // "fa4" + RISCV_REG_F15_32, // "fa5" + RISCV_REG_F15_64, // "fa5" + RISCV_REG_F16_32, // "fa6" + RISCV_REG_F16_64, // "fa6" + RISCV_REG_F17_32, // "fa7" + RISCV_REG_F17_64, // "fa7" + RISCV_REG_F18_32, // "fs2" + RISCV_REG_F18_64, // "fs2" + RISCV_REG_F19_32, // "fs3" + RISCV_REG_F19_64, // "fs3" + RISCV_REG_F20_32, // "fs4" + RISCV_REG_F20_64, // "fs4" + RISCV_REG_F21_32, // "fs5" + RISCV_REG_F21_64, // "fs5" + RISCV_REG_F22_32, // "fs6" + RISCV_REG_F22_64, // "fs6" + RISCV_REG_F23_32, // "fs7" + RISCV_REG_F23_64, // "fs7" + RISCV_REG_F24_32, // "fs8" + RISCV_REG_F24_64, // "fs8" + RISCV_REG_F25_32, // "fs9" + RISCV_REG_F25_64, // "fs9" + RISCV_REG_F26_32, // "fs10" + RISCV_REG_F26_64, // "fs10" + RISCV_REG_F27_32, // "fs11" + RISCV_REG_F27_64, // "fs11" + RISCV_REG_F28_32, // "ft8" + RISCV_REG_F28_64, // "ft8" + RISCV_REG_F29_32, // "ft9" + RISCV_REG_F29_64, // "ft9" + RISCV_REG_F30_32, // "ft10" + RISCV_REG_F30_64, // "ft10" + RISCV_REG_F31_32, // "ft11" + RISCV_REG_F31_64, // "ft11" + + RISCV_REG_ENDING, // <-- mark the end of the list or registers +} riscv_reg; + +//> RISCV instruction +typedef enum riscv_insn { + RISCV_INS_INVALID = 0, + + RISCV_INS_ADD, + RISCV_INS_ADDI, + RISCV_INS_ADDIW, + RISCV_INS_ADDW, + RISCV_INS_AMOADD_D, + RISCV_INS_AMOADD_D_AQ, + RISCV_INS_AMOADD_D_AQ_RL, + RISCV_INS_AMOADD_D_RL, + RISCV_INS_AMOADD_W, + RISCV_INS_AMOADD_W_AQ, + RISCV_INS_AMOADD_W_AQ_RL, + RISCV_INS_AMOADD_W_RL, + RISCV_INS_AMOAND_D, + RISCV_INS_AMOAND_D_AQ, + RISCV_INS_AMOAND_D_AQ_RL, + RISCV_INS_AMOAND_D_RL, + RISCV_INS_AMOAND_W, + RISCV_INS_AMOAND_W_AQ, + RISCV_INS_AMOAND_W_AQ_RL, + RISCV_INS_AMOAND_W_RL, + RISCV_INS_AMOMAXU_D, + RISCV_INS_AMOMAXU_D_AQ, + RISCV_INS_AMOMAXU_D_AQ_RL, + RISCV_INS_AMOMAXU_D_RL, + RISCV_INS_AMOMAXU_W, + RISCV_INS_AMOMAXU_W_AQ, + RISCV_INS_AMOMAXU_W_AQ_RL, + RISCV_INS_AMOMAXU_W_RL, + RISCV_INS_AMOMAX_D, + RISCV_INS_AMOMAX_D_AQ, + RISCV_INS_AMOMAX_D_AQ_RL, + RISCV_INS_AMOMAX_D_RL, + RISCV_INS_AMOMAX_W, + RISCV_INS_AMOMAX_W_AQ, + RISCV_INS_AMOMAX_W_AQ_RL, + RISCV_INS_AMOMAX_W_RL, + RISCV_INS_AMOMINU_D, + RISCV_INS_AMOMINU_D_AQ, + RISCV_INS_AMOMINU_D_AQ_RL, + RISCV_INS_AMOMINU_D_RL, + RISCV_INS_AMOMINU_W, + RISCV_INS_AMOMINU_W_AQ, + RISCV_INS_AMOMINU_W_AQ_RL, + RISCV_INS_AMOMINU_W_RL, + RISCV_INS_AMOMIN_D, + RISCV_INS_AMOMIN_D_AQ, + RISCV_INS_AMOMIN_D_AQ_RL, + RISCV_INS_AMOMIN_D_RL, + RISCV_INS_AMOMIN_W, + RISCV_INS_AMOMIN_W_AQ, + RISCV_INS_AMOMIN_W_AQ_RL, + RISCV_INS_AMOMIN_W_RL, + RISCV_INS_AMOOR_D, + RISCV_INS_AMOOR_D_AQ, + RISCV_INS_AMOOR_D_AQ_RL, + RISCV_INS_AMOOR_D_RL, + RISCV_INS_AMOOR_W, + RISCV_INS_AMOOR_W_AQ, + RISCV_INS_AMOOR_W_AQ_RL, + RISCV_INS_AMOOR_W_RL, + RISCV_INS_AMOSWAP_D, + RISCV_INS_AMOSWAP_D_AQ, + RISCV_INS_AMOSWAP_D_AQ_RL, + RISCV_INS_AMOSWAP_D_RL, + RISCV_INS_AMOSWAP_W, + RISCV_INS_AMOSWAP_W_AQ, + RISCV_INS_AMOSWAP_W_AQ_RL, + RISCV_INS_AMOSWAP_W_RL, + RISCV_INS_AMOXOR_D, + RISCV_INS_AMOXOR_D_AQ, + RISCV_INS_AMOXOR_D_AQ_RL, + RISCV_INS_AMOXOR_D_RL, + RISCV_INS_AMOXOR_W, + RISCV_INS_AMOXOR_W_AQ, + RISCV_INS_AMOXOR_W_AQ_RL, + RISCV_INS_AMOXOR_W_RL, + RISCV_INS_AND, + RISCV_INS_ANDI, + RISCV_INS_AUIPC, + RISCV_INS_BEQ, + RISCV_INS_BGE, + RISCV_INS_BGEU, + RISCV_INS_BLT, + RISCV_INS_BLTU, + RISCV_INS_BNE, + RISCV_INS_CSRRC, + RISCV_INS_CSRRCI, + RISCV_INS_CSRRS, + RISCV_INS_CSRRSI, + RISCV_INS_CSRRW, + RISCV_INS_CSRRWI, + RISCV_INS_C_ADD, + RISCV_INS_C_ADDI, + RISCV_INS_C_ADDI16SP, + RISCV_INS_C_ADDI4SPN, + RISCV_INS_C_ADDIW, + RISCV_INS_C_ADDW, + RISCV_INS_C_AND, + RISCV_INS_C_ANDI, + RISCV_INS_C_BEQZ, + RISCV_INS_C_BNEZ, + RISCV_INS_C_EBREAK, + RISCV_INS_C_FLD, + RISCV_INS_C_FLDSP, + RISCV_INS_C_FLW, + RISCV_INS_C_FLWSP, + RISCV_INS_C_FSD, + RISCV_INS_C_FSDSP, + RISCV_INS_C_FSW, + RISCV_INS_C_FSWSP, + RISCV_INS_C_J, + RISCV_INS_C_JAL, + RISCV_INS_C_JALR, + RISCV_INS_C_JR, + RISCV_INS_C_LD, + RISCV_INS_C_LDSP, + RISCV_INS_C_LI, + RISCV_INS_C_LUI, + RISCV_INS_C_LW, + RISCV_INS_C_LWSP, + RISCV_INS_C_MV, + RISCV_INS_C_NOP, + RISCV_INS_C_OR, + RISCV_INS_C_SD, + RISCV_INS_C_SDSP, + RISCV_INS_C_SLLI, + RISCV_INS_C_SRAI, + RISCV_INS_C_SRLI, + RISCV_INS_C_SUB, + RISCV_INS_C_SUBW, + RISCV_INS_C_SW, + RISCV_INS_C_SWSP, + RISCV_INS_C_UNIMP, + RISCV_INS_C_XOR, + RISCV_INS_DIV, + RISCV_INS_DIVU, + RISCV_INS_DIVUW, + RISCV_INS_DIVW, + RISCV_INS_EBREAK, + RISCV_INS_ECALL, + RISCV_INS_FADD_D, + RISCV_INS_FADD_S, + RISCV_INS_FCLASS_D, + RISCV_INS_FCLASS_S, + RISCV_INS_FCVT_D_L, + RISCV_INS_FCVT_D_LU, + RISCV_INS_FCVT_D_S, + RISCV_INS_FCVT_D_W, + RISCV_INS_FCVT_D_WU, + RISCV_INS_FCVT_LU_D, + RISCV_INS_FCVT_LU_S, + RISCV_INS_FCVT_L_D, + RISCV_INS_FCVT_L_S, + RISCV_INS_FCVT_S_D, + RISCV_INS_FCVT_S_L, + RISCV_INS_FCVT_S_LU, + RISCV_INS_FCVT_S_W, + RISCV_INS_FCVT_S_WU, + RISCV_INS_FCVT_WU_D, + RISCV_INS_FCVT_WU_S, + RISCV_INS_FCVT_W_D, + RISCV_INS_FCVT_W_S, + RISCV_INS_FDIV_D, + RISCV_INS_FDIV_S, + RISCV_INS_FENCE, + RISCV_INS_FENCE_I, + RISCV_INS_FENCE_TSO, + RISCV_INS_FEQ_D, + RISCV_INS_FEQ_S, + RISCV_INS_FLD, + RISCV_INS_FLE_D, + RISCV_INS_FLE_S, + RISCV_INS_FLT_D, + RISCV_INS_FLT_S, + RISCV_INS_FLW, + RISCV_INS_FMADD_D, + RISCV_INS_FMADD_S, + RISCV_INS_FMAX_D, + RISCV_INS_FMAX_S, + RISCV_INS_FMIN_D, + RISCV_INS_FMIN_S, + RISCV_INS_FMSUB_D, + RISCV_INS_FMSUB_S, + RISCV_INS_FMUL_D, + RISCV_INS_FMUL_S, + RISCV_INS_FMV_D_X, + RISCV_INS_FMV_W_X, + RISCV_INS_FMV_X_D, + RISCV_INS_FMV_X_W, + RISCV_INS_FNMADD_D, + RISCV_INS_FNMADD_S, + RISCV_INS_FNMSUB_D, + RISCV_INS_FNMSUB_S, + RISCV_INS_FSD, + RISCV_INS_FSGNJN_D, + RISCV_INS_FSGNJN_S, + RISCV_INS_FSGNJX_D, + RISCV_INS_FSGNJX_S, + RISCV_INS_FSGNJ_D, + RISCV_INS_FSGNJ_S, + RISCV_INS_FSQRT_D, + RISCV_INS_FSQRT_S, + RISCV_INS_FSUB_D, + RISCV_INS_FSUB_S, + RISCV_INS_FSW, + RISCV_INS_JAL, + RISCV_INS_JALR, + RISCV_INS_LB, + RISCV_INS_LBU, + RISCV_INS_LD, + RISCV_INS_LH, + RISCV_INS_LHU, + RISCV_INS_LR_D, + RISCV_INS_LR_D_AQ, + RISCV_INS_LR_D_AQ_RL, + RISCV_INS_LR_D_RL, + RISCV_INS_LR_W, + RISCV_INS_LR_W_AQ, + RISCV_INS_LR_W_AQ_RL, + RISCV_INS_LR_W_RL, + RISCV_INS_LUI, + RISCV_INS_LW, + RISCV_INS_LWU, + RISCV_INS_MRET, + RISCV_INS_MUL, + RISCV_INS_MULH, + RISCV_INS_MULHSU, + RISCV_INS_MULHU, + RISCV_INS_MULW, + RISCV_INS_OR, + RISCV_INS_ORI, + RISCV_INS_REM, + RISCV_INS_REMU, + RISCV_INS_REMUW, + RISCV_INS_REMW, + RISCV_INS_SB, + RISCV_INS_SC_D, + RISCV_INS_SC_D_AQ, + RISCV_INS_SC_D_AQ_RL, + RISCV_INS_SC_D_RL, + RISCV_INS_SC_W, + RISCV_INS_SC_W_AQ, + RISCV_INS_SC_W_AQ_RL, + RISCV_INS_SC_W_RL, + RISCV_INS_SD, + RISCV_INS_SFENCE_VMA, + RISCV_INS_SH, + RISCV_INS_SLL, + RISCV_INS_SLLI, + RISCV_INS_SLLIW, + RISCV_INS_SLLW, + RISCV_INS_SLT, + RISCV_INS_SLTI, + RISCV_INS_SLTIU, + RISCV_INS_SLTU, + RISCV_INS_SRA, + RISCV_INS_SRAI, + RISCV_INS_SRAIW, + RISCV_INS_SRAW, + RISCV_INS_SRET, + RISCV_INS_SRL, + RISCV_INS_SRLI, + RISCV_INS_SRLIW, + RISCV_INS_SRLW, + RISCV_INS_SUB, + RISCV_INS_SUBW, + RISCV_INS_SW, + RISCV_INS_UNIMP, + RISCV_INS_URET, + RISCV_INS_WFI, + RISCV_INS_XOR, + RISCV_INS_XORI, + + RISCV_INS_ENDING, +} riscv_insn; - TMS320C64X_GRP_ENDING, // <-- mark the end of the list of groups -} tms320c64x_insn_group; +//> Group of RISCV instructions +typedef enum riscv_insn_group { + RISCV_GRP_INVALID = 0, ///< = CS_GRP_INVALID -typedef enum tms320c64x_funit { - TMS320C64X_FUNIT_INVALID = 0, - TMS320C64X_FUNIT_D, - TMS320C64X_FUNIT_L, - TMS320C64X_FUNIT_M, - TMS320C64X_FUNIT_S, - TMS320C64X_FUNIT_NO -} tms320c64x_funit; + // Generic groups + // all jump instructions (conditional+direct+indirect jumps) + RISCV_GRP_JUMP, ///< = CS_GRP_JUMP + // all call instructions + RISCV_GRP_CALL, ///< = CS_GRP_CALL + // all return instructions + RISCV_GRP_RET, ///< = CS_GRP_RET + // all interrupt instructions (int+syscall) + RISCV_GRP_INT, ///< = CS_GRP_INT + // all interrupt return instructions + RISCV_GRP_IRET, ///< = CS_GRP_IRET + // all privileged instructions + RISCV_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE + // all relative branching instructions + RISCV_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + // Architecture-specific groups + RISCV_GRP_ISRV32 = 128, + RISCV_GRP_ISRV64, + RISCV_GRP_HASSTDEXTA, + RISCV_GRP_HASSTDEXTC, + RISCV_GRP_HASSTDEXTD, + RISCV_GRP_HASSTDEXTF, + RISCV_GRP_HASSTDEXTM, + /* + RISCV_GRP_ISRVA, + RISCV_GRP_ISRVC, + RISCV_GRP_ISRVD, + RISCV_GRP_ISRVCD, + RISCV_GRP_ISRVF, + RISCV_GRP_ISRV32C, + RISCV_GRP_ISRV32CF, + RISCV_GRP_ISRVM, + RISCV_GRP_ISRV64A, + RISCV_GRP_ISRV64C, + RISCV_GRP_ISRV64D, + RISCV_GRP_ISRV64F, + RISCV_GRP_ISRV64M, + */ + RISCV_GRP_ENDING, +} riscv_insn_group; #ifdef __cplusplus } @@ -53456,11 +81023,11 @@ typedef enum tms320c64x_funit { #endif -#ifndef CAPSTONE_M680X_H -#define CAPSTONE_M680X_H - /* Capstone Disassembly Engine */ -/* M680X Backend by Wolfgang Schwotzer 2017 */ +/* By Spike , xwings 2019 */ + +#ifndef CAPSTONE_WASM_H +#define CAPSTONE_WASM_H #ifdef __cplusplus extern "C" { @@ -53471,532 +81038,448 @@ extern "C" { #pragma warning(disable:4201) #endif -#define M680X_OPERAND_COUNT 9 +typedef enum wasm_op_type { + WASM_OP_INVALID = 0, + WASM_OP_NONE, + WASM_OP_INT7, + WASM_OP_VARUINT32, + WASM_OP_VARUINT64, + WASM_OP_UINT32, + WASM_OP_UINT64, + WASM_OP_IMM, + WASM_OP_BRTABLE, +} wasm_op_type; -/// M680X registers and special registers -typedef enum m680x_reg { - M680X_REG_INVALID = 0, +typedef struct cs_wasm_brtable { + uint32_t length; + uint64_t address; + uint32_t default_target; +} cs_wasm_brtable; - M680X_REG_A, ///< M6800/1/2/3/9, HD6301/9 - M680X_REG_B, ///< M6800/1/2/3/9, HD6301/9 - M680X_REG_E, ///< HD6309 - M680X_REG_F, ///< HD6309 - M680X_REG_0, ///< HD6309 +typedef struct cs_wasm_op { + wasm_op_type type; + uint32_t size; + union { + int8_t int7; + uint32_t varuint32; + uint64_t varuint64; + uint32_t uint32; + uint64_t uint64; + uint32_t immediate[2]; + cs_wasm_brtable brtable; + }; +} cs_wasm_op; - M680X_REG_D, ///< M6801/3/9, HD6301/9 - M680X_REG_W, ///< HD6309 +/// Instruction structure +typedef struct cs_wasm { + uint8_t op_count; + cs_wasm_op operands[2]; +} cs_wasm; - M680X_REG_CC, ///< M6800/1/2/3/9, M6301/9 - M680X_REG_DP, ///< M6809/M6309 - M680X_REG_MD, ///< M6309 +/// WASM instruction +typedef enum wasm_insn { + WASM_INS_UNREACHABLE = 0x0, + WASM_INS_NOP = 0x1, + WASM_INS_BLOCK = 0x2, + WASM_INS_LOOP = 0x3, + WASM_INS_IF = 0x4, + WASM_INS_ELSE = 0x5, + WASM_INS_END = 0xb, + WASM_INS_BR = 0xc, + WASM_INS_BR_IF = 0xd, + WASM_INS_BR_TABLE = 0xe, + WASM_INS_RETURN = 0xf, + WASM_INS_CALL = 0x10, + WASM_INS_CALL_INDIRECT = 0x11, + WASM_INS_DROP = 0x1a, + WASM_INS_SELECT = 0x1b, + WASM_INS_GET_LOCAL = 0x20, + WASM_INS_SET_LOCAL = 0x21, + WASM_INS_TEE_LOCAL = 0x22, + WASM_INS_GET_GLOBAL = 0x23, + WASM_INS_SET_GLOBAL = 0x24, + WASM_INS_I32_LOAD = 0x28, + WASM_INS_I64_LOAD = 0x29, + WASM_INS_F32_LOAD = 0x2a, + WASM_INS_F64_LOAD = 0x2b, + WASM_INS_I32_LOAD8_S = 0x2c, + WASM_INS_I32_LOAD8_U = 0x2d, + WASM_INS_I32_LOAD16_S = 0x2e, + WASM_INS_I32_LOAD16_U = 0x2f, + WASM_INS_I64_LOAD8_S = 0x30, + WASM_INS_I64_LOAD8_U = 0x31, + WASM_INS_I64_LOAD16_S = 0x32, + WASM_INS_I64_LOAD16_U = 0x33, + WASM_INS_I64_LOAD32_S = 0x34, + WASM_INS_I64_LOAD32_U = 0x35, + WASM_INS_I32_STORE = 0x36, + WASM_INS_I64_STORE = 0x37, + WASM_INS_F32_STORE = 0x38, + WASM_INS_F64_STORE = 0x39, + WASM_INS_I32_STORE8 = 0x3a, + WASM_INS_I32_STORE16 = 0x3b, + WASM_INS_I64_STORE8 = 0x3c, + WASM_INS_I64_STORE16 = 0x3d, + WASM_INS_I64_STORE32 = 0x3e, + WASM_INS_CURRENT_MEMORY = 0x3f, + WASM_INS_GROW_MEMORY = 0x40, + WASM_INS_I32_CONST = 0x41, + WASM_INS_I64_CONST = 0x42, + WASM_INS_F32_CONST = 0x43, + WASM_INS_F64_CONST = 0x44, + WASM_INS_I32_EQZ = 0x45, + WASM_INS_I32_EQ = 0x46, + WASM_INS_I32_NE = 0x47, + WASM_INS_I32_LT_S = 0x48, + WASM_INS_I32_LT_U = 0x49, + WASM_INS_I32_GT_S = 0x4a, + WASM_INS_I32_GT_U = 0x4b, + WASM_INS_I32_LE_S = 0x4c, + WASM_INS_I32_LE_U = 0x4d, + WASM_INS_I32_GE_S = 0x4e, + WASM_INS_I32_GE_U = 0x4f, + WASM_INS_I64_EQZ = 0x50, + WASM_INS_I64_EQ = 0x51, + WASM_INS_I64_NE = 0x52, + WASM_INS_I64_LT_S = 0x53, + WASM_INS_I64_LT_U = 0x54, + WASN_INS_I64_GT_S = 0x55, + WASM_INS_I64_GT_U = 0x56, + WASM_INS_I64_LE_S = 0x57, + WASM_INS_I64_LE_U = 0x58, + WASM_INS_I64_GE_S = 0x59, + WASM_INS_I64_GE_U = 0x5a, + WASM_INS_F32_EQ = 0x5b, + WASM_INS_F32_NE = 0x5c, + WASM_INS_F32_LT = 0x5d, + WASM_INS_F32_GT = 0x5e, + WASM_INS_F32_LE = 0x5f, + WASM_INS_F32_GE = 0x60, + WASM_INS_F64_EQ = 0x61, + WASM_INS_F64_NE = 0x62, + WASM_INS_F64_LT = 0x63, + WASM_INS_F64_GT = 0x64, + WASM_INS_F64_LE = 0x65, + WASM_INS_F64_GE = 0x66, + WASM_INS_I32_CLZ = 0x67, + WASM_INS_I32_CTZ = 0x68, + WASM_INS_I32_POPCNT = 0x69, + WASM_INS_I32_ADD = 0x6a, + WASM_INS_I32_SUB = 0x6b, + WASM_INS_I32_MUL = 0x6c, + WASM_INS_I32_DIV_S = 0x6d, + WASM_INS_I32_DIV_U = 0x6e, + WASM_INS_I32_REM_S = 0x6f, + WASM_INS_I32_REM_U = 0x70, + WASM_INS_I32_AND = 0x71, + WASM_INS_I32_OR = 0x72, + WASM_INS_I32_XOR = 0x73, + WASM_INS_I32_SHL = 0x74, + WASM_INS_I32_SHR_S = 0x75, + WASM_INS_I32_SHR_U = 0x76, + WASM_INS_I32_ROTL = 0x77, + WASM_INS_I32_ROTR = 0x78, + WASM_INS_I64_CLZ = 0x79, + WASM_INS_I64_CTZ = 0x7a, + WASM_INS_I64_POPCNT = 0x7b, + WASM_INS_I64_ADD = 0x7c, + WASM_INS_I64_SUB = 0x7d, + WASM_INS_I64_MUL = 0x7e, + WASM_INS_I64_DIV_S = 0x7f, + WASM_INS_I64_DIV_U = 0x80, + WASM_INS_I64_REM_S = 0x81, + WASM_INS_I64_REM_U = 0x82, + WASM_INS_I64_AND = 0x83, + WASM_INS_I64_OR = 0x84, + WASM_INS_I64_XOR = 0x85, + WASM_INS_I64_SHL = 0x86, + WASM_INS_I64_SHR_S = 0x87, + WASM_INS_I64_SHR_U = 0x88, + WASM_INS_I64_ROTL = 0x89, + WASM_INS_I64_ROTR = 0x8a, + WASM_INS_F32_ABS = 0x8b, + WASM_INS_F32_NEG = 0x8c, + WASM_INS_F32_CEIL = 0x8d, + WASM_INS_F32_FLOOR = 0x8e, + WASM_INS_F32_TRUNC = 0x8f, + WASM_INS_F32_NEAREST = 0x90, + WASM_INS_F32_SQRT = 0x91, + WASM_INS_F32_ADD = 0x92, + WASM_INS_F32_SUB = 0x93, + WASM_INS_F32_MUL = 0x94, + WASM_INS_F32_DIV = 0x95, + WASM_INS_F32_MIN = 0x96, + WASM_INS_F32_MAX = 0x97, + WASM_INS_F32_COPYSIGN = 0x98, + WASM_INS_F64_ABS = 0x99, + WASM_INS_F64_NEG = 0x9a, + WASM_INS_F64_CEIL = 0x9b, + WASM_INS_F64_FLOOR = 0x9c, + WASM_INS_F64_TRUNC = 0x9d, + WASM_INS_F64_NEAREST = 0x9e, + WASM_INS_F64_SQRT = 0x9f, + WASM_INS_F64_ADD = 0xa0, + WASM_INS_F64_SUB = 0xa1, + WASM_INS_F64_MUL = 0xa2, + WASM_INS_F64_DIV = 0xa3, + WASM_INS_F64_MIN = 0xa4, + WASM_INS_F64_MAX = 0xa5, + WASM_INS_F64_COPYSIGN = 0xa6, + WASM_INS_I32_WARP_I64 = 0xa7, + WASP_INS_I32_TRUNC_S_F32 = 0xa8, + WASM_INS_I32_TRUNC_U_F32 = 0xa9, + WASM_INS_I32_TRUNC_S_F64 = 0xaa, + WASM_INS_I32_TRUNC_U_F64 = 0xab, + WASM_INS_I64_EXTEND_S_I32 = 0xac, + WASM_INS_I64_EXTEND_U_I32 = 0xad, + WASM_INS_I64_TRUNC_S_F32 = 0xae, + WASM_INS_I64_TRUNC_U_F32 = 0xaf, + WASM_INS_I64_TRUNC_S_F64 = 0xb0, + WASM_INS_I64_TRUNC_U_F64 = 0xb1, + WASM_INS_F32_CONVERT_S_I32 = 0xb2, + WASM_INS_F32_CONVERT_U_I32 = 0xb3, + WASM_INS_F32_CONVERT_S_I64 = 0xb4, + WASM_INS_F32_CONVERT_U_I64 = 0xb5, + WASM_INS_F32_DEMOTE_F64 = 0xb6, + WASM_INS_F64_CONVERT_S_I32 = 0xb7, + WASM_INS_F64_CONVERT_U_I32 = 0xb8, + WASM_INS_F64_CONVERT_S_I64 = 0xb9, + WASM_INS_F64_CONVERT_U_I64 = 0xba, + WASM_INS_F64_PROMOTE_F32 = 0xbb, + WASM_INS_I32_REINTERPRET_F32 = 0xbc, + WASM_INS_I64_REINTERPRET_F64 = 0xbd, + WASM_INS_F32_REINTERPRET_I32 = 0xbe, + WASM_INS_F64_REINTERPRET_I64 = 0xbf, + WASM_INS_INVALID = 512, + WASM_INS_ENDING, +} wasm_insn; - M680X_REG_HX, ///< M6808 - M680X_REG_H, ///< M6808 - M680X_REG_X, ///< M6800/1/2/3/9, M6301/9 - M680X_REG_Y, ///< M6809/M6309 - M680X_REG_S, ///< M6809/M6309 - M680X_REG_U, ///< M6809/M6309 - M680X_REG_V, ///< M6309 +/// Group of WASM instructions +typedef enum wasm_insn_group { + WASM_GRP_INVALID = 0, ///< = CS_GRP_INVALID - M680X_REG_Q, ///< M6309 + WASM_GRP_NUMBERIC = 8, + WASM_GRP_PARAMETRIC, + WASM_GRP_VARIABLE, + WASM_GRP_MEMORY, + WASM_GRP_CONTROL, - M680X_REG_PC, ///< M6800/1/2/3/9, M6301/9 + WASM_GRP_ENDING, ///< <-- mark the end of the list of groups +} wasm_insn_group; - M680X_REG_TMP2, ///< CPU12 - M680X_REG_TMP3, ///< CPU12 +#ifdef __cplusplus +} +#endif + +#endif +#ifndef CAPSTONE_MOS65XX_H +#define CAPSTONE_MOS65XX_H + +/* Capstone Disassembly Engine */ +/* By Sebastian Macke , 2013-2018 */ +/* BPF Backend by david942j , 2019 */ + +#ifndef CAPSTONE_BPF_H +#define CAPSTONE_BPF_H #ifdef __cplusplus extern "C" { @@ -54007,4355 +81490,5396 @@ extern "C" { #pragma warning(disable:4201) #endif +/// Operand type for instruction's operands +typedef enum bpf_op_type { + BPF_OP_INVALID = 0, + + BPF_OP_REG, + BPF_OP_IMM, + BPF_OP_OFF, + BPF_OP_MEM, + BPF_OP_MMEM, ///< M[k] in cBPF + BPF_OP_MSH, ///< corresponds to cBPF's BPF_MSH mode + BPF_OP_EXT, ///< cBPF's extension (not eBPF) +} bpf_op_type; + +/// BPF registers +typedef enum bpf_reg { + BPF_REG_INVALID = 0, + + ///< cBPF + BPF_REG_A, + BPF_REG_X, + + ///< eBPF + BPF_REG_R0, + BPF_REG_R1, + BPF_REG_R2, + BPF_REG_R3, + BPF_REG_R4, + BPF_REG_R5, + BPF_REG_R6, + BPF_REG_R7, + BPF_REG_R8, + BPF_REG_R9, + BPF_REG_R10, + + BPF_REG_ENDING, +} bpf_reg; + +/// Instruction's operand referring to memory +/// This is associated with BPF_OP_MEM operand type above +typedef struct bpf_op_mem { + bpf_reg base; ///< base register + uint32_t disp; ///< offset value +} bpf_op_mem; + +typedef enum bpf_ext_type { + BPF_EXT_INVALID = 0, + + BPF_EXT_LEN, +} bpf_ext_type; + +/// Instruction operand +typedef struct cs_bpf_op { + bpf_op_type type; + union { + uint8_t reg; ///< register value for REG operand + uint64_t imm; ///< immediate value IMM operand + uint32_t off; ///< offset value, used in jump & call + bpf_op_mem mem; ///< base/disp value for MEM operand + /* cBPF only */ + uint32_t mmem; ///< M[k] in cBPF + uint32_t msh; ///< corresponds to cBPF's BPF_MSH mode + uint32_t ext; ///< cBPF's extension (not eBPF) + }; + + /// How is this operand accessed? (READ, WRITE or READ|WRITE) + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; +} cs_bpf_op; + /// Instruction structure -typedef struct cs_evm { - unsigned char pop; ///< number of items popped from the stack - unsigned char push; ///< number of items pushed into the stack - unsigned int fee; ///< gas fee for the instruction -} cs_evm; +typedef struct cs_bpf { + uint8_t op_count; + cs_bpf_op operands[4]; +} cs_bpf; -/// EVM instruction -typedef enum evm_insn { - EVM_INS_STOP = 0, - EVM_INS_ADD = 1, - EVM_INS_MUL = 2, - EVM_INS_SUB = 3, - EVM_INS_DIV = 4, - EVM_INS_SDIV = 5, - EVM_INS_MOD = 6, - EVM_INS_SMOD = 7, - EVM_INS_ADDMOD = 8, - EVM_INS_MULMOD = 9, - EVM_INS_EXP = 10, - EVM_INS_SIGNEXTEND = 11, - EVM_INS_LT = 16, - EVM_INS_GT = 17, - EVM_INS_SLT = 18, - EVM_INS_SGT = 19, - EVM_INS_EQ = 20, - EVM_INS_ISZERO = 21, - EVM_INS_AND = 22, - EVM_INS_OR = 23, - EVM_INS_XOR = 24, - EVM_INS_NOT = 25, - EVM_INS_BYTE = 26, - EVM_INS_SHA3 = 32, - EVM_INS_ADDRESS = 48, - EVM_INS_BALANCE = 49, - EVM_INS_ORIGIN = 50, - EVM_INS_CALLER = 51, - EVM_INS_CALLVALUE = 52, - EVM_INS_CALLDATALOAD = 53, - EVM_INS_CALLDATASIZE = 54, - EVM_INS_CALLDATACOPY = 55, - EVM_INS_CODESIZE = 56, - EVM_INS_CODECOPY = 57, - EVM_INS_GASPRICE = 58, - EVM_INS_EXTCODESIZE = 59, - EVM_INS_EXTCODECOPY = 60, - EVM_INS_RETURNDATASIZE = 61, - EVM_INS_RETURNDATACOPY = 62, - EVM_INS_BLOCKHASH = 64, - EVM_INS_COINBASE = 65, - EVM_INS_TIMESTAMP = 66, - EVM_INS_NUMBER = 67, - EVM_INS_DIFFICULTY = 68, - EVM_INS_GASLIMIT = 69, - EVM_INS_POP = 80, - EVM_INS_MLOAD = 81, - EVM_INS_MSTORE = 82, - EVM_INS_MSTORE8 = 83, - EVM_INS_SLOAD = 84, - EVM_INS_SSTORE = 85, - EVM_INS_JUMP = 86, - EVM_INS_JUMPI = 87, - EVM_INS_PC = 88, - EVM_INS_MSIZE = 89, - EVM_INS_GAS = 90, - EVM_INS_JUMPDEST = 91, - EVM_INS_PUSH1 = 96, - EVM_INS_PUSH2 = 97, - EVM_INS_PUSH3 = 98, - EVM_INS_PUSH4 = 99, - EVM_INS_PUSH5 = 100, - EVM_INS_PUSH6 = 101, - EVM_INS_PUSH7 = 102, - EVM_INS_PUSH8 = 103, - EVM_INS_PUSH9 = 104, - EVM_INS_PUSH10 = 105, - EVM_INS_PUSH11 = 106, - EVM_INS_PUSH12 = 107, - EVM_INS_PUSH13 = 108, - EVM_INS_PUSH14 = 109, - EVM_INS_PUSH15 = 110, - EVM_INS_PUSH16 = 111, - EVM_INS_PUSH17 = 112, - EVM_INS_PUSH18 = 113, - EVM_INS_PUSH19 = 114, - EVM_INS_PUSH20 = 115, - EVM_INS_PUSH21 = 116, - EVM_INS_PUSH22 = 117, - EVM_INS_PUSH23 = 118, - EVM_INS_PUSH24 = 119, - EVM_INS_PUSH25 = 120, - EVM_INS_PUSH26 = 121, - EVM_INS_PUSH27 = 122, - EVM_INS_PUSH28 = 123, - EVM_INS_PUSH29 = 124, - EVM_INS_PUSH30 = 125, - EVM_INS_PUSH31 = 126, - EVM_INS_PUSH32 = 127, - EVM_INS_DUP1 = 128, - EVM_INS_DUP2 = 129, - EVM_INS_DUP3 = 130, - EVM_INS_DUP4 = 131, - EVM_INS_DUP5 = 132, - EVM_INS_DUP6 = 133, - EVM_INS_DUP7 = 134, - EVM_INS_DUP8 = 135, - EVM_INS_DUP9 = 136, - EVM_INS_DUP10 = 137, - EVM_INS_DUP11 = 138, - EVM_INS_DUP12 = 139, - EVM_INS_DUP13 = 140, - EVM_INS_DUP14 = 141, - EVM_INS_DUP15 = 142, - EVM_INS_DUP16 = 143, - EVM_INS_SWAP1 = 144, - EVM_INS_SWAP2 = 145, - EVM_INS_SWAP3 = 146, - EVM_INS_SWAP4 = 147, - EVM_INS_SWAP5 = 148, - EVM_INS_SWAP6 = 149, - EVM_INS_SWAP7 = 150, - EVM_INS_SWAP8 = 151, - EVM_INS_SWAP9 = 152, - EVM_INS_SWAP10 = 153, - EVM_INS_SWAP11 = 154, - EVM_INS_SWAP12 = 155, - EVM_INS_SWAP13 = 156, - EVM_INS_SWAP14 = 157, - EVM_INS_SWAP15 = 158, - EVM_INS_SWAP16 = 159, - EVM_INS_LOG0 = 160, - EVM_INS_LOG1 = 161, - EVM_INS_LOG2 = 162, - EVM_INS_LOG3 = 163, - EVM_INS_LOG4 = 164, - EVM_INS_CREATE = 240, - EVM_INS_CALL = 241, - EVM_INS_CALLCODE = 242, - EVM_INS_RETURN = 243, - EVM_INS_DELEGATECALL = 244, - EVM_INS_CALLBLACKBOX = 245, - EVM_INS_STATICCALL = 250, - EVM_INS_REVERT = 253, - EVM_INS_SUICIDE = 255, +/// BPF instruction +typedef enum bpf_insn { + BPF_INS_INVALID = 0, - EVM_INS_INVALID = 512, - EVM_INS_ENDING, // <-- mark the end of the list of instructions -} evm_insn; + ///< ALU + BPF_INS_ADD, + BPF_INS_SUB, + BPF_INS_MUL, + BPF_INS_DIV, + BPF_INS_OR, + BPF_INS_AND, + BPF_INS_LSH, + BPF_INS_RSH, + BPF_INS_NEG, + BPF_INS_MOD, + BPF_INS_XOR, + BPF_INS_MOV, ///< eBPF only + BPF_INS_ARSH, ///< eBPF only -/// Group of EVM instructions -typedef enum evm_insn_group { - EVM_GRP_INVALID = 0, ///< = CS_GRP_INVALID + ///< ALU64, eBPF only + BPF_INS_ADD64, + BPF_INS_SUB64, + BPF_INS_MUL64, + BPF_INS_DIV64, + BPF_INS_OR64, + BPF_INS_AND64, + BPF_INS_LSH64, + BPF_INS_RSH64, + BPF_INS_NEG64, + BPF_INS_MOD64, + BPF_INS_XOR64, + BPF_INS_MOV64, + BPF_INS_ARSH64, - EVM_GRP_JUMP, ///< all jump instructions + ///< Byteswap, eBPF only + BPF_INS_LE16, + BPF_INS_LE32, + BPF_INS_LE64, + BPF_INS_BE16, + BPF_INS_BE32, + BPF_INS_BE64, - EVM_GRP_MATH = 8, ///< math instructions - EVM_GRP_STACK_WRITE, ///< instructions write to stack - EVM_GRP_STACK_READ, ///< instructions read from stack - EVM_GRP_MEM_WRITE, ///< instructions write to memory - EVM_GRP_MEM_READ, ///< instructions read from memory - EVM_GRP_STORE_WRITE, ///< instructions write to storage - EVM_GRP_STORE_READ, ///< instructions read from storage - EVM_GRP_HALT, ///< instructions halt execution + ///< Load + BPF_INS_LDW, ///< eBPF only + BPF_INS_LDH, + BPF_INS_LDB, + BPF_INS_LDDW, ///< eBPF only: load 64-bit imm + BPF_INS_LDXW, ///< eBPF only + BPF_INS_LDXH, ///< eBPF only + BPF_INS_LDXB, ///< eBPF only + BPF_INS_LDXDW, ///< eBPF only - EVM_GRP_ENDING, ///< <-- mark the end of the list of groups -} evm_insn_group; + ///< Store + BPF_INS_STW, ///< eBPF only + BPF_INS_STH, ///< eBPF only + BPF_INS_STB, ///< eBPF only + BPF_INS_STDW, ///< eBPF only + BPF_INS_STXW, ///< eBPF only + BPF_INS_STXH, ///< eBPF only + BPF_INS_STXB, ///< eBPF only + BPF_INS_STXDW, ///< eBPF only + BPF_INS_XADDW, ///< eBPF only + BPF_INS_XADDDW, ///< eBPF only + + ///< Jump + BPF_INS_JMP, + BPF_INS_JEQ, + BPF_INS_JGT, + BPF_INS_JGE, + BPF_INS_JSET, + BPF_INS_JNE, ///< eBPF only + BPF_INS_JSGT, ///< eBPF only + BPF_INS_JSGE, ///< eBPF only + BPF_INS_CALL, ///< eBPF only + BPF_INS_CALLX, ///< eBPF only + BPF_INS_EXIT, ///< eBPF only + BPF_INS_JLT, ///< eBPF only + BPF_INS_JLE, ///< eBPF only + BPF_INS_JSLT, ///< eBPF only + BPF_INS_JSLE, ///< eBPF only + + ///< Return, cBPF only + BPF_INS_RET, + + ///< Misc, cBPF only + BPF_INS_TAX, + BPF_INS_TXA, + + BPF_INS_ENDING, + + // alias instructions + BPF_INS_LD = BPF_INS_LDW, ///< cBPF only + BPF_INS_LDX = BPF_INS_LDXW, ///< cBPF only + BPF_INS_ST = BPF_INS_STW, ///< cBPF only + BPF_INS_STX = BPF_INS_STXW, ///< cBPF only +} bpf_insn; + +/// Group of BPF instructions +typedef enum bpf_insn_group { + BPF_GRP_INVALID = 0, ///< = CS_GRP_INVALID + + BPF_GRP_LOAD, + BPF_GRP_STORE, + BPF_GRP_ALU, + BPF_GRP_JUMP, + BPF_GRP_CALL, ///< eBPF only + BPF_GRP_RETURN, + BPF_GRP_MISC, ///< cBPF only + + BPF_GRP_ENDING, +} bpf_insn_group; #ifdef __cplusplus } #endif #endif -#ifndef CAPSTONE_RISCV_H -#define CAPSTONE_RISCV_H +#ifndef CAPSTONE_SH_H +#define CAPSTONE_SH_H /* Capstone Disassembly Engine */ -/* RISC-V Backend By Rodrigo Cortes Porto & - Shawn Chang , HardenedLinux@2018 */ +/* By Yoshinori Sato, 2022 */ #ifdef __cplusplus extern "C" { #endif -#if !defined(_MSC_VER) || !defined(_KERNEL_MODE) -#include -#endif - - -// GCC MIPS toolchain has a default macro called "mips" which breaks -// compilation -//#undef riscv #ifdef _MSC_VER #pragma warning(disable:4201) #endif -//> Operand type for instruction's operands -typedef enum riscv_op_type { - RISCV_OP_INVALID = 0, // = CS_OP_INVALID (Uninitialized). - RISCV_OP_REG, // = CS_OP_REG (Register operand). - RISCV_OP_IMM, // = CS_OP_IMM (Immediate operand). - RISCV_OP_MEM, // = CS_OP_MEM (Memory operand). -} riscv_op_type; +/// SH registers and special registers +typedef enum { + SH_REG_INVALID = 0, + + SH_REG_R0, + SH_REG_R1, + SH_REG_R2, + SH_REG_R3, + SH_REG_R4, + SH_REG_R5, + SH_REG_R6, + SH_REG_R7, + + SH_REG_R8, + SH_REG_R9, + SH_REG_R10, + SH_REG_R11, + SH_REG_R12, + SH_REG_R13, + SH_REG_R14, + SH_REG_R15, + + SH_REG_R0_BANK, + SH_REG_R1_BANK, + SH_REG_R2_BANK, + SH_REG_R3_BANK, + SH_REG_R4_BANK, + SH_REG_R5_BANK, + SH_REG_R6_BANK, + SH_REG_R7_BANK, + + SH_REG_FR0, + SH_REG_FR1, + SH_REG_FR2, + SH_REG_FR3, + SH_REG_FR4, + SH_REG_FR5, + SH_REG_FR6, + SH_REG_FR7, + SH_REG_FR8, + SH_REG_FR9, + SH_REG_FR10, + SH_REG_FR11, + SH_REG_FR12, + SH_REG_FR13, + SH_REG_FR14, + SH_REG_FR15, + + SH_REG_DR0, + SH_REG_DR2, + SH_REG_DR4, + SH_REG_DR6, + SH_REG_DR8, + SH_REG_DR10, + SH_REG_DR12, + SH_REG_DR14, + + SH_REG_XD0, + SH_REG_XD2, + SH_REG_XD4, + SH_REG_XD6, + SH_REG_XD8, + SH_REG_XD10, + SH_REG_XD12, + SH_REG_XD14, + + SH_REG_XF0, + SH_REG_XF1, + SH_REG_XF2, + SH_REG_XF3, + SH_REG_XF4, + SH_REG_XF5, + SH_REG_XF6, + SH_REG_XF7, + SH_REG_XF8, + SH_REG_XF9, + SH_REG_XF10, + SH_REG_XF11, + SH_REG_XF12, + SH_REG_XF13, + SH_REG_XF14, + SH_REG_XF15, + + SH_REG_FV0, + SH_REG_FV4, + SH_REG_FV8, + SH_REG_FV12, + + SH_REG_XMATRX, + + SH_REG_PC, + SH_REG_PR, + SH_REG_MACH, + SH_REG_MACL, + + SH_REG_SR, + SH_REG_GBR, + SH_REG_SSR, + SH_REG_SPC, + SH_REG_SGR, + SH_REG_DBR, + SH_REG_VBR, + SH_REG_TBR, + SH_REG_RS, + SH_REG_RE, + SH_REG_MOD, + + SH_REG_FPUL, + SH_REG_FPSCR, + + SH_REG_DSP_X0, + SH_REG_DSP_X1, + SH_REG_DSP_Y0, + SH_REG_DSP_Y1, + SH_REG_DSP_A0, + SH_REG_DSP_A1, + SH_REG_DSP_A0G, + SH_REG_DSP_A1G, + SH_REG_DSP_M0, + SH_REG_DSP_M1, + SH_REG_DSP_DSR, + + SH_REG_DSP_RSV0, + SH_REG_DSP_RSV1, + SH_REG_DSP_RSV2, + SH_REG_DSP_RSV3, + SH_REG_DSP_RSV4, + SH_REG_DSP_RSV5, + SH_REG_DSP_RSV6, + SH_REG_DSP_RSV7, + SH_REG_DSP_RSV8, + SH_REG_DSP_RSV9, + SH_REG_DSP_RSVA, + SH_REG_DSP_RSVB, + SH_REG_DSP_RSVC, + SH_REG_DSP_RSVD, + SH_REG_DSP_RSVE, + SH_REG_DSP_RSVF, -// Instruction's operand referring to memory -// This is associated with RISCV_OP_MEM operand type above -typedef struct riscv_op_mem { - unsigned int base; // base register - int64_t disp; // displacement/offset value -} riscv_op_mem; + SH_REG_ENDING, // <-- mark the end of the list of registers +} sh_reg; -// Instruction operand -typedef struct cs_riscv_op { - riscv_op_type type; // operand type - union { - unsigned int reg; // register value for REG operand - int64_t imm; // immediate value for IMM operand - riscv_op_mem mem; // base/disp value for MEM operand - }; -} cs_riscv_op; +typedef enum { + SH_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). + SH_OP_REG, ///< = CS_OP_REG (Register operand). + SH_OP_IMM, ///< = CS_OP_IMM (Immediate operand). + SH_OP_MEM, ///< = CS_OP_MEM (Memory operand). +} sh_op_type; -// Instruction structure -typedef struct cs_riscv { - // Does this instruction need effective address or not. - bool need_effective_addr; - // Number of operands of this instruction, - // or 0 when instruction has no operand. - uint8_t op_count; - cs_riscv_op operands[8]; // operands for this instruction. -} cs_riscv; +typedef enum { + SH_OP_MEM_INVALID = 0, /// <= Invalid + SH_OP_MEM_REG_IND, /// <= Register indirect + SH_OP_MEM_REG_POST, /// <= Register post increment + SH_OP_MEM_REG_PRE, /// <= Register pre decrement + SH_OP_MEM_REG_DISP, /// <= displacement + SH_OP_MEM_REG_R0, /// <= R0 indexed + SH_OP_MEM_GBR_DISP, /// <= GBR based displacement + SH_OP_MEM_GBR_R0, /// <= GBR based R0 indexed + SH_OP_MEM_PCR, /// <= PC relative + SH_OP_MEM_TBR_DISP, /// <= TBR based displaysment +} sh_op_mem_type; -//> RISCV registers -typedef enum riscv_reg { - RISCV_REG_INVALID = 0, - //> General purpose registers - RISCV_REG_X0, // "zero" - RISCV_REG_ZERO = RISCV_REG_X0, // "zero" - RISCV_REG_X1, // "ra" - RISCV_REG_RA = RISCV_REG_X1, // "ra" - RISCV_REG_X2, // "sp" - RISCV_REG_SP = RISCV_REG_X2, // "sp" - RISCV_REG_X3, // "gp" - RISCV_REG_GP = RISCV_REG_X3, // "gp" - RISCV_REG_X4, // "tp" - RISCV_REG_TP = RISCV_REG_X4, // "tp" - RISCV_REG_X5, // "t0" - RISCV_REG_T0 = RISCV_REG_X5, // "t0" - RISCV_REG_X6, // "t1" - RISCV_REG_T1 = RISCV_REG_X6, // "t1" - RISCV_REG_X7, // "t2" - RISCV_REG_T2 = RISCV_REG_X7, // "t2" - RISCV_REG_X8, // "s0/fp" - RISCV_REG_S0 = RISCV_REG_X8, // "s0" - RISCV_REG_FP = RISCV_REG_X8, // "fp" - RISCV_REG_X9, // "s1" - RISCV_REG_S1 = RISCV_REG_X9, // "s1" - RISCV_REG_X10, // "a0" - RISCV_REG_A0 = RISCV_REG_X10, // "a0" - RISCV_REG_X11, // "a1" - RISCV_REG_A1 = RISCV_REG_X11, // "a1" - RISCV_REG_X12, // "a2" - RISCV_REG_A2 = RISCV_REG_X12, // "a2" - RISCV_REG_X13, // "a3" - RISCV_REG_A3 = RISCV_REG_X13, // "a3" - RISCV_REG_X14, // "a4" - RISCV_REG_A4 = RISCV_REG_X14, // "a4" - RISCV_REG_X15, // "a5" - RISCV_REG_A5 = RISCV_REG_X15, // "a5" - RISCV_REG_X16, // "a6" - RISCV_REG_A6 = RISCV_REG_X16, // "a6" - RISCV_REG_X17, // "a7" - RISCV_REG_A7 = RISCV_REG_X17, // "a7" - RISCV_REG_X18, // "s2" - RISCV_REG_S2 = RISCV_REG_X18, // "s2" - RISCV_REG_X19, // "s3" - RISCV_REG_S3 = RISCV_REG_X19, // "s3" - RISCV_REG_X20, // "s4" - RISCV_REG_S4 = RISCV_REG_X20, // "s4" - RISCV_REG_X21, // "s5" - RISCV_REG_S5 = RISCV_REG_X21, // "s5" - RISCV_REG_X22, // "s6" - RISCV_REG_S6 = RISCV_REG_X22, // "s6" - RISCV_REG_X23, // "s7" - RISCV_REG_S7 = RISCV_REG_X23, // "s7" - RISCV_REG_X24, // "s8" - RISCV_REG_S8 = RISCV_REG_X24, // "s8" - RISCV_REG_X25, // "s9" - RISCV_REG_S9 = RISCV_REG_X25, // "s9" - RISCV_REG_X26, // "s10" - RISCV_REG_S10 = RISCV_REG_X26, // "s10" - RISCV_REG_X27, // "s11" - RISCV_REG_S11 = RISCV_REG_X27, // "s11" - RISCV_REG_X28, // "t3" - RISCV_REG_T3 = RISCV_REG_X28, // "t3" - RISCV_REG_X29, // "t4" - RISCV_REG_T4 = RISCV_REG_X29, // "t4" - RISCV_REG_X30, // "t5" - RISCV_REG_T5 = RISCV_REG_X30, // "t5" - RISCV_REG_X31, // "t6" - RISCV_REG_T6 = RISCV_REG_X31, // "t6" - - //> Floating-point registers - RISCV_REG_F0_32, // "ft0" - RISCV_REG_F0_64, // "ft0" - RISCV_REG_F1_32, // "ft1" - RISCV_REG_F1_64, // "ft1" - RISCV_REG_F2_32, // "ft2" - RISCV_REG_F2_64, // "ft2" - RISCV_REG_F3_32, // "ft3" - RISCV_REG_F3_64, // "ft3" - RISCV_REG_F4_32, // "ft4" - RISCV_REG_F4_64, // "ft4" - RISCV_REG_F5_32, // "ft5" - RISCV_REG_F5_64, // "ft5" - RISCV_REG_F6_32, // "ft6" - RISCV_REG_F6_64, // "ft6" - RISCV_REG_F7_32, // "ft7" - RISCV_REG_F7_64, // "ft7" - RISCV_REG_F8_32, // "fs0" - RISCV_REG_F8_64, // "fs0" - RISCV_REG_F9_32, // "fs1" - RISCV_REG_F9_64, // "fs1" - RISCV_REG_F10_32, // "fa0" - RISCV_REG_F10_64, // "fa0" - RISCV_REG_F11_32, // "fa1" - RISCV_REG_F11_64, // "fa1" - RISCV_REG_F12_32, // "fa2" - RISCV_REG_F12_64, // "fa2" - RISCV_REG_F13_32, // "fa3" - RISCV_REG_F13_64, // "fa3" - RISCV_REG_F14_32, // "fa4" - RISCV_REG_F14_64, // "fa4" - RISCV_REG_F15_32, // "fa5" - RISCV_REG_F15_64, // "fa5" - RISCV_REG_F16_32, // "fa6" - RISCV_REG_F16_64, // "fa6" - RISCV_REG_F17_32, // "fa7" - RISCV_REG_F17_64, // "fa7" - RISCV_REG_F18_32, // "fs2" - RISCV_REG_F18_64, // "fs2" - RISCV_REG_F19_32, // "fs3" - RISCV_REG_F19_64, // "fs3" - RISCV_REG_F20_32, // "fs4" - RISCV_REG_F20_64, // "fs4" - RISCV_REG_F21_32, // "fs5" - RISCV_REG_F21_64, // "fs5" - RISCV_REG_F22_32, // "fs6" - RISCV_REG_F22_64, // "fs6" - RISCV_REG_F23_32, // "fs7" - RISCV_REG_F23_64, // "fs7" - RISCV_REG_F24_32, // "fs8" - RISCV_REG_F24_64, // "fs8" - RISCV_REG_F25_32, // "fs9" - RISCV_REG_F25_64, // "fs9" - RISCV_REG_F26_32, // "fs10" - RISCV_REG_F26_64, // "fs10" - RISCV_REG_F27_32, // "fs11" - RISCV_REG_F27_64, // "fs11" - RISCV_REG_F28_32, // "ft8" - RISCV_REG_F28_64, // "ft8" - RISCV_REG_F29_32, // "ft9" - RISCV_REG_F29_64, // "ft9" - RISCV_REG_F30_32, // "ft10" - RISCV_REG_F30_64, // "ft10" - RISCV_REG_F31_32, // "ft11" - RISCV_REG_F31_64, // "ft11" - - RISCV_REG_ENDING, // <-- mark the end of the list or registers -} riscv_reg; +typedef struct sh_op_mem { + sh_op_mem_type address; /// <= memory address + sh_reg reg; /// <= base register + uint32_t disp; /// <= displacement +} sh_op_mem; -//> RISCV instruction -typedef enum riscv_insn { - RISCV_INS_INVALID = 0, +// SH-DSP instcutions define +typedef enum sh_dsp_insn_type { + SH_INS_DSP_INVALID, + SH_INS_DSP_DOUBLE, + SH_INS_DSP_SINGLE, + SH_INS_DSP_PARALLEL, +} sh_dsp_insn_type; - RISCV_INS_ADD, - RISCV_INS_ADDI, - RISCV_INS_ADDIW, - RISCV_INS_ADDW, - RISCV_INS_AMOADD_D, - RISCV_INS_AMOADD_D_AQ, - RISCV_INS_AMOADD_D_AQ_RL, - RISCV_INS_AMOADD_D_RL, - RISCV_INS_AMOADD_W, - RISCV_INS_AMOADD_W_AQ, - RISCV_INS_AMOADD_W_AQ_RL, - RISCV_INS_AMOADD_W_RL, - RISCV_INS_AMOAND_D, - RISCV_INS_AMOAND_D_AQ, - RISCV_INS_AMOAND_D_AQ_RL, - RISCV_INS_AMOAND_D_RL, - RISCV_INS_AMOAND_W, - RISCV_INS_AMOAND_W_AQ, - RISCV_INS_AMOAND_W_AQ_RL, - RISCV_INS_AMOAND_W_RL, - RISCV_INS_AMOMAXU_D, - RISCV_INS_AMOMAXU_D_AQ, - RISCV_INS_AMOMAXU_D_AQ_RL, - RISCV_INS_AMOMAXU_D_RL, - RISCV_INS_AMOMAXU_W, - RISCV_INS_AMOMAXU_W_AQ, - RISCV_INS_AMOMAXU_W_AQ_RL, - RISCV_INS_AMOMAXU_W_RL, - RISCV_INS_AMOMAX_D, - RISCV_INS_AMOMAX_D_AQ, - RISCV_INS_AMOMAX_D_AQ_RL, - RISCV_INS_AMOMAX_D_RL, - RISCV_INS_AMOMAX_W, - RISCV_INS_AMOMAX_W_AQ, - RISCV_INS_AMOMAX_W_AQ_RL, - RISCV_INS_AMOMAX_W_RL, - RISCV_INS_AMOMINU_D, - RISCV_INS_AMOMINU_D_AQ, - RISCV_INS_AMOMINU_D_AQ_RL, - RISCV_INS_AMOMINU_D_RL, - RISCV_INS_AMOMINU_W, - RISCV_INS_AMOMINU_W_AQ, - RISCV_INS_AMOMINU_W_AQ_RL, - RISCV_INS_AMOMINU_W_RL, - RISCV_INS_AMOMIN_D, - RISCV_INS_AMOMIN_D_AQ, - RISCV_INS_AMOMIN_D_AQ_RL, - RISCV_INS_AMOMIN_D_RL, - RISCV_INS_AMOMIN_W, - RISCV_INS_AMOMIN_W_AQ, - RISCV_INS_AMOMIN_W_AQ_RL, - RISCV_INS_AMOMIN_W_RL, - RISCV_INS_AMOOR_D, - RISCV_INS_AMOOR_D_AQ, - RISCV_INS_AMOOR_D_AQ_RL, - RISCV_INS_AMOOR_D_RL, - RISCV_INS_AMOOR_W, - RISCV_INS_AMOOR_W_AQ, - RISCV_INS_AMOOR_W_AQ_RL, - RISCV_INS_AMOOR_W_RL, - RISCV_INS_AMOSWAP_D, - RISCV_INS_AMOSWAP_D_AQ, - RISCV_INS_AMOSWAP_D_AQ_RL, - RISCV_INS_AMOSWAP_D_RL, - RISCV_INS_AMOSWAP_W, - RISCV_INS_AMOSWAP_W_AQ, - RISCV_INS_AMOSWAP_W_AQ_RL, - RISCV_INS_AMOSWAP_W_RL, - RISCV_INS_AMOXOR_D, - RISCV_INS_AMOXOR_D_AQ, - RISCV_INS_AMOXOR_D_AQ_RL, - RISCV_INS_AMOXOR_D_RL, - RISCV_INS_AMOXOR_W, - RISCV_INS_AMOXOR_W_AQ, - RISCV_INS_AMOXOR_W_AQ_RL, - RISCV_INS_AMOXOR_W_RL, - RISCV_INS_AND, - RISCV_INS_ANDI, - RISCV_INS_AUIPC, - RISCV_INS_BEQ, - RISCV_INS_BGE, - RISCV_INS_BGEU, - RISCV_INS_BLT, - RISCV_INS_BLTU, - RISCV_INS_BNE, - RISCV_INS_CSRRC, - RISCV_INS_CSRRCI, - RISCV_INS_CSRRS, - RISCV_INS_CSRRSI, - RISCV_INS_CSRRW, - RISCV_INS_CSRRWI, - RISCV_INS_C_ADD, - RISCV_INS_C_ADDI, - RISCV_INS_C_ADDI16SP, - RISCV_INS_C_ADDI4SPN, - RISCV_INS_C_ADDIW, - RISCV_INS_C_ADDW, - RISCV_INS_C_AND, - RISCV_INS_C_ANDI, - RISCV_INS_C_BEQZ, - RISCV_INS_C_BNEZ, - RISCV_INS_C_EBREAK, - RISCV_INS_C_FLD, - RISCV_INS_C_FLDSP, - RISCV_INS_C_FLW, - RISCV_INS_C_FLWSP, - RISCV_INS_C_FSD, - RISCV_INS_C_FSDSP, - RISCV_INS_C_FSW, - RISCV_INS_C_FSWSP, - RISCV_INS_C_J, - RISCV_INS_C_JAL, - RISCV_INS_C_JALR, - RISCV_INS_C_JR, - RISCV_INS_C_LD, - RISCV_INS_C_LDSP, - RISCV_INS_C_LI, - RISCV_INS_C_LUI, - RISCV_INS_C_LW, - RISCV_INS_C_LWSP, - RISCV_INS_C_MV, - RISCV_INS_C_NOP, - RISCV_INS_C_OR, - RISCV_INS_C_SD, - RISCV_INS_C_SDSP, - RISCV_INS_C_SLLI, - RISCV_INS_C_SRAI, - RISCV_INS_C_SRLI, - RISCV_INS_C_SUB, - RISCV_INS_C_SUBW, - RISCV_INS_C_SW, - RISCV_INS_C_SWSP, - RISCV_INS_C_UNIMP, - RISCV_INS_C_XOR, - RISCV_INS_DIV, - RISCV_INS_DIVU, - RISCV_INS_DIVUW, - RISCV_INS_DIVW, - RISCV_INS_EBREAK, - RISCV_INS_ECALL, - RISCV_INS_FADD_D, - RISCV_INS_FADD_S, - RISCV_INS_FCLASS_D, - RISCV_INS_FCLASS_S, - RISCV_INS_FCVT_D_L, - RISCV_INS_FCVT_D_LU, - RISCV_INS_FCVT_D_S, - RISCV_INS_FCVT_D_W, - RISCV_INS_FCVT_D_WU, - RISCV_INS_FCVT_LU_D, - RISCV_INS_FCVT_LU_S, - RISCV_INS_FCVT_L_D, - RISCV_INS_FCVT_L_S, - RISCV_INS_FCVT_S_D, - RISCV_INS_FCVT_S_L, - RISCV_INS_FCVT_S_LU, - RISCV_INS_FCVT_S_W, - RISCV_INS_FCVT_S_WU, - RISCV_INS_FCVT_WU_D, - RISCV_INS_FCVT_WU_S, - RISCV_INS_FCVT_W_D, - RISCV_INS_FCVT_W_S, - RISCV_INS_FDIV_D, - RISCV_INS_FDIV_S, - RISCV_INS_FENCE, - RISCV_INS_FENCE_I, - RISCV_INS_FENCE_TSO, - RISCV_INS_FEQ_D, - RISCV_INS_FEQ_S, - RISCV_INS_FLD, - RISCV_INS_FLE_D, - RISCV_INS_FLE_S, - RISCV_INS_FLT_D, - RISCV_INS_FLT_S, - RISCV_INS_FLW, - RISCV_INS_FMADD_D, - RISCV_INS_FMADD_S, - RISCV_INS_FMAX_D, - RISCV_INS_FMAX_S, - RISCV_INS_FMIN_D, - RISCV_INS_FMIN_S, - RISCV_INS_FMSUB_D, - RISCV_INS_FMSUB_S, - RISCV_INS_FMUL_D, - RISCV_INS_FMUL_S, - RISCV_INS_FMV_D_X, - RISCV_INS_FMV_W_X, - RISCV_INS_FMV_X_D, - RISCV_INS_FMV_X_W, - RISCV_INS_FNMADD_D, - RISCV_INS_FNMADD_S, - RISCV_INS_FNMSUB_D, - RISCV_INS_FNMSUB_S, - RISCV_INS_FSD, - RISCV_INS_FSGNJN_D, - RISCV_INS_FSGNJN_S, - RISCV_INS_FSGNJX_D, - RISCV_INS_FSGNJX_S, - RISCV_INS_FSGNJ_D, - RISCV_INS_FSGNJ_S, - RISCV_INS_FSQRT_D, - RISCV_INS_FSQRT_S, - RISCV_INS_FSUB_D, - RISCV_INS_FSUB_S, - RISCV_INS_FSW, - RISCV_INS_JAL, - RISCV_INS_JALR, - RISCV_INS_LB, - RISCV_INS_LBU, - RISCV_INS_LD, - RISCV_INS_LH, - RISCV_INS_LHU, - RISCV_INS_LR_D, - RISCV_INS_LR_D_AQ, - RISCV_INS_LR_D_AQ_RL, - RISCV_INS_LR_D_RL, - RISCV_INS_LR_W, - RISCV_INS_LR_W_AQ, - RISCV_INS_LR_W_AQ_RL, - RISCV_INS_LR_W_RL, - RISCV_INS_LUI, - RISCV_INS_LW, - RISCV_INS_LWU, - RISCV_INS_MRET, - RISCV_INS_MUL, - RISCV_INS_MULH, - RISCV_INS_MULHSU, - RISCV_INS_MULHU, - RISCV_INS_MULW, - RISCV_INS_OR, - RISCV_INS_ORI, - RISCV_INS_REM, - RISCV_INS_REMU, - RISCV_INS_REMUW, - RISCV_INS_REMW, - RISCV_INS_SB, - RISCV_INS_SC_D, - RISCV_INS_SC_D_AQ, - RISCV_INS_SC_D_AQ_RL, - RISCV_INS_SC_D_RL, - RISCV_INS_SC_W, - RISCV_INS_SC_W_AQ, - RISCV_INS_SC_W_AQ_RL, - RISCV_INS_SC_W_RL, - RISCV_INS_SD, - RISCV_INS_SFENCE_VMA, - RISCV_INS_SH, - RISCV_INS_SLL, - RISCV_INS_SLLI, - RISCV_INS_SLLIW, - RISCV_INS_SLLW, - RISCV_INS_SLT, - RISCV_INS_SLTI, - RISCV_INS_SLTIU, - RISCV_INS_SLTU, - RISCV_INS_SRA, - RISCV_INS_SRAI, - RISCV_INS_SRAIW, - RISCV_INS_SRAW, - RISCV_INS_SRET, - RISCV_INS_SRL, - RISCV_INS_SRLI, - RISCV_INS_SRLIW, - RISCV_INS_SRLW, - RISCV_INS_SUB, - RISCV_INS_SUBW, - RISCV_INS_SW, - RISCV_INS_UNIMP, - RISCV_INS_URET, - RISCV_INS_WFI, - RISCV_INS_XOR, - RISCV_INS_XORI, +typedef enum sh_dsp_insn { + SH_INS_DSP_NOP = 1, + SH_INS_DSP_MOV, + SH_INS_DSP_PSHL, + SH_INS_DSP_PSHA, + SH_INS_DSP_PMULS, + SH_INS_DSP_PCLR_PMULS, + SH_INS_DSP_PSUB_PMULS, + SH_INS_DSP_PADD_PMULS, + SH_INS_DSP_PSUBC, + SH_INS_DSP_PADDC, + SH_INS_DSP_PCMP, + SH_INS_DSP_PABS, + SH_INS_DSP_PRND, + SH_INS_DSP_PSUB, + SH_INS_DSP_PSUBr, + SH_INS_DSP_PADD, + SH_INS_DSP_PAND, + SH_INS_DSP_PXOR, + SH_INS_DSP_POR, + SH_INS_DSP_PDEC, + SH_INS_DSP_PINC, + SH_INS_DSP_PCLR, + SH_INS_DSP_PDMSB, + SH_INS_DSP_PNEG, + SH_INS_DSP_PCOPY, + SH_INS_DSP_PSTS, + SH_INS_DSP_PLDS, + SH_INS_DSP_PSWAP, + SH_INS_DSP_PWAD, + SH_INS_DSP_PWSB, +} sh_dsp_insn; + +typedef enum sh_dsp_operand { + SH_OP_DSP_INVALID, + SH_OP_DSP_REG_PRE, + SH_OP_DSP_REG_IND, + SH_OP_DSP_REG_POST, + SH_OP_DSP_REG_INDEX, + SH_OP_DSP_REG, + SH_OP_DSP_IMM, - RISCV_INS_ENDING, -} riscv_insn; +} sh_dsp_operand; -//> Group of RISCV instructions -typedef enum riscv_insn_group { - RISCV_GRP_INVALID = 0, ///< = CS_GRP_INVALID +typedef enum sh_dsp_cc { + SH_DSP_CC_INVALID, + SH_DSP_CC_NONE, + SH_DSP_CC_DCT, + SH_DSP_CC_DCF, +} sh_dsp_cc; - // Generic groups - // all jump instructions (conditional+direct+indirect jumps) - RISCV_GRP_JUMP, ///< = CS_GRP_JUMP - // all call instructions - RISCV_GRP_CALL, ///< = CS_GRP_CALL - // all return instructions - RISCV_GRP_RET, ///< = CS_GRP_RET - // all interrupt instructions (int+syscall) - RISCV_GRP_INT, ///< = CS_GRP_INT - // all interrupt return instructions - RISCV_GRP_IRET, ///< = CS_GRP_IRET - // all privileged instructions - RISCV_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE - // all relative branching instructions - RISCV_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE - - // Architecture-specific groups - RISCV_GRP_ISRV32 = 128, - RISCV_GRP_ISRV64, - RISCV_GRP_HASSTDEXTA, - RISCV_GRP_HASSTDEXTC, - RISCV_GRP_HASSTDEXTD, - RISCV_GRP_HASSTDEXTF, - RISCV_GRP_HASSTDEXTM, - /* - RISCV_GRP_ISRVA, - RISCV_GRP_ISRVC, - RISCV_GRP_ISRVD, - RISCV_GRP_ISRVCD, - RISCV_GRP_ISRVF, - RISCV_GRP_ISRV32C, - RISCV_GRP_ISRV32CF, - RISCV_GRP_ISRVM, - RISCV_GRP_ISRV64A, - RISCV_GRP_ISRV64C, - RISCV_GRP_ISRV64D, - RISCV_GRP_ISRV64F, - RISCV_GRP_ISRV64M, - */ - RISCV_GRP_ENDING, -} riscv_insn_group; +typedef struct sh_op_dsp { + sh_dsp_insn insn; + sh_dsp_operand operand[2]; + sh_reg r[6]; + sh_dsp_cc cc; + uint8_t imm; + int size; +} sh_op_dsp; + +/// Instruction operand +typedef struct cs_sh_op { + sh_op_type type; + union { + uint64_t imm; ///< immediate value for IMM operand + sh_reg reg; ///< register value for REG operand + sh_op_mem mem; ///< data when operand is targeting memory + sh_op_dsp dsp; ///< dsp instruction + }; +} cs_sh_op; + +/// SH instruction +typedef enum sh_insn { + SH_INS_INVALID, + SH_INS_ADD_r, + SH_INS_ADD, + SH_INS_ADDC, + SH_INS_ADDV, + SH_INS_AND, + SH_INS_BAND, + SH_INS_BANDNOT, + SH_INS_BCLR, + SH_INS_BF, + SH_INS_BF_S, + SH_INS_BLD, + SH_INS_BLDNOT, + SH_INS_BOR, + SH_INS_BORNOT, + SH_INS_BRA, + SH_INS_BRAF, + SH_INS_BSET, + SH_INS_BSR, + SH_INS_BSRF, + SH_INS_BST, + SH_INS_BT, + SH_INS_BT_S, + SH_INS_BXOR, + SH_INS_CLIPS, + SH_INS_CLIPU, + SH_INS_CLRDMXY, + SH_INS_CLRMAC, + SH_INS_CLRS, + SH_INS_CLRT, + SH_INS_CMP_EQ, + SH_INS_CMP_GE, + SH_INS_CMP_GT, + SH_INS_CMP_HI, + SH_INS_CMP_HS, + SH_INS_CMP_PL, + SH_INS_CMP_PZ, + SH_INS_CMP_STR, + SH_INS_DIV0S, + SH_INS_DIV0U, + SH_INS_DIV1, + SH_INS_DIVS, + SH_INS_DIVU, + SH_INS_DMULS_L, + SH_INS_DMULU_L, + SH_INS_DT, + SH_INS_EXTS_B, + SH_INS_EXTS_W, + SH_INS_EXTU_B, + SH_INS_EXTU_W, + SH_INS_FABS, + SH_INS_FADD, + SH_INS_FCMP_EQ, + SH_INS_FCMP_GT, + SH_INS_FCNVDS, + SH_INS_FCNVSD, + SH_INS_FDIV, + SH_INS_FIPR, + SH_INS_FLDI0, + SH_INS_FLDI1, + SH_INS_FLDS, + SH_INS_FLOAT, + SH_INS_FMAC, + SH_INS_FMOV, + SH_INS_FMUL, + SH_INS_FNEG, + SH_INS_FPCHG, + SH_INS_FRCHG, + SH_INS_FSCA, + SH_INS_FSCHG, + SH_INS_FSQRT, + SH_INS_FSRRA, + SH_INS_FSTS, + SH_INS_FSUB, + SH_INS_FTRC, + SH_INS_FTRV, + SH_INS_ICBI, + SH_INS_JMP, + SH_INS_JSR, + SH_INS_JSR_N, + SH_INS_LDBANK, + SH_INS_LDC, + SH_INS_LDRC, + SH_INS_LDRE, + SH_INS_LDRS, + SH_INS_LDS, + SH_INS_LDTLB, + SH_INS_MAC_L, + SH_INS_MAC_W, + SH_INS_MOV, + SH_INS_MOVA, + SH_INS_MOVCA, + SH_INS_MOVCO, + SH_INS_MOVI20, + SH_INS_MOVI20S, + SH_INS_MOVLI, + SH_INS_MOVML, + SH_INS_MOVMU, + SH_INS_MOVRT, + SH_INS_MOVT, + SH_INS_MOVU, + SH_INS_MOVUA, + SH_INS_MUL_L, + SH_INS_MULR, + SH_INS_MULS_W, + SH_INS_MULU_W, + SH_INS_NEG, + SH_INS_NEGC, + SH_INS_NOP, + SH_INS_NOT, + SH_INS_NOTT, + SH_INS_OCBI, + SH_INS_OCBP, + SH_INS_OCBWB, + SH_INS_OR, + SH_INS_PREF, + SH_INS_PREFI, + SH_INS_RESBANK, + SH_INS_ROTCL, + SH_INS_ROTCR, + SH_INS_ROTL, + SH_INS_ROTR, + SH_INS_RTE, + SH_INS_RTS, + SH_INS_RTS_N, + SH_INS_RTV_N, + SH_INS_SETDMX, + SH_INS_SETDMY, + SH_INS_SETRC, + SH_INS_SETS, + SH_INS_SETT, + SH_INS_SHAD, + SH_INS_SHAL, + SH_INS_SHAR, + SH_INS_SHLD, + SH_INS_SHLL, + SH_INS_SHLL16, + SH_INS_SHLL2, + SH_INS_SHLL8, + SH_INS_SHLR, + SH_INS_SHLR16, + SH_INS_SHLR2, + SH_INS_SHLR8, + SH_INS_SLEEP, + SH_INS_STBANK, + SH_INS_STC, + SH_INS_STS, + SH_INS_SUB, + SH_INS_SUBC, + SH_INS_SUBV, + SH_INS_SWAP_B, + SH_INS_SWAP_W, + SH_INS_SYNCO, + SH_INS_TAS, + SH_INS_TRAPA, + SH_INS_TST, + SH_INS_XOR, + SH_INS_XTRCT, + SH_INS_DSP, + SH_INS_ENDING, // <-- mark the end of the list of instructions +} sh_insn; + +/// Instruction structure +typedef struct cs_sh { + sh_insn insn; + uint8_t size; + uint8_t op_count; + cs_sh_op operands[3]; +} cs_sh; + +/// Group of SH instructions +typedef enum sh_insn_group { + SH_GRP_INVALID = 0, ///< CS_GRUP_INVALID + SH_GRP_JUMP, ///< = CS_GRP_JUMP + SH_GRP_CALL, ///< = CS_GRP_CALL + SH_GRP_INT, ///< = CS_GRP_INT + SH_GRP_RET, ///< = CS_GRP_RET + SH_GRP_IRET, ///< = CS_GRP_IRET + SH_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE + SH_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + + SH_GRP_SH1, + SH_GRP_SH2, + SH_GRP_SH2E, + SH_GRP_SH2DSP, + SH_GRP_SH2A, + SH_GRP_SH2AFPU, + SH_GRP_SH3, + SH_GRP_SH3DSP, + SH_GRP_SH4, + SH_GRP_SH4A, + + SH_GRP_ENDING,// <-- mark the end of the list of groups +} sh_insn_group; #ifdef __cplusplus } #endif #endif +#ifndef CAPSTONE_TRICORE_H +#define CAPSTONE_TRICORE_H /* Capstone Disassembly Engine */ -/* By Spike , xwings 2019 */ - -#ifndef CAPSTONE_WASM_H -#define CAPSTONE_WASM_H +/* By Nguyen Anh Quynh , 2014 */ #ifdef __cplusplus extern "C" { #endif +#if !defined(_MSC_VER) || !defined(_KERNEL_MODE) +#include +#endif + #ifdef _MSC_VER -#pragma warning(disable:4201) +#pragma warning(disable : 4201) #endif -typedef enum wasm_op_type { - WASM_OP_INVALID = 0, - WASM_OP_NONE, - WASM_OP_INT7, - WASM_OP_VARUINT32, - WASM_OP_VARUINT64, - WASM_OP_UINT32, - WASM_OP_UINT64, - WASM_OP_IMM, - WASM_OP_BRTABLE, -} wasm_op_type; +/// Operand type for instruction's operands +typedef enum tricore_op_type { + TRICORE_OP_INVALID = CS_OP_INVALID, ///< CS_OP_INVALID (Uninitialized). + TRICORE_OP_REG = CS_OP_REG, ///< CS_OP_REG (Register operand). + TRICORE_OP_IMM = CS_OP_IMM, ///< CS_OP_IMM (Immediate operand). + TRICORE_OP_MEM = CS_OP_MEM, ///< CS_OP_MEM (Memory operand). +} tricore_op_type; -typedef struct cs_wasm_brtable { - uint32_t length; - uint64_t address; - uint32_t default_target; -} cs_wasm_brtable; +/// Instruction's operand referring to memory +/// This is associated with TRICORE_OP_MEM operand type above +typedef struct tricore_op_mem { + uint8_t base; ///< base register + int32_t disp; ///< displacement/offset value +} tricore_op_mem; -typedef struct cs_wasm_op { - wasm_op_type type; - uint32_t size; +/// Instruction operand +typedef struct cs_tricore_op { + tricore_op_type type; ///< operand type union { - int8_t int7; - uint32_t varuint32; - uint64_t varuint64; - uint32_t uint32; - uint64_t uint64; - uint32_t immediate[2]; - cs_wasm_brtable brtable; + unsigned int reg; ///< register value for REG operand + int32_t imm; ///< immediate value for IMM operand + tricore_op_mem mem; ///< base/disp value for MEM operand }; -} cs_wasm_op; + /// This field is combined of cs_ac_type. + /// NOTE: this field is irrelevant if engine is compiled in DIET mode. + uint8_t access; ///< How is this operand accessed? (READ, WRITE or READ|WRITE) +} cs_tricore_op; + +#define TRICORE_OP_COUNT 8 + +/// Instruction structure +typedef struct cs_tricore { + uint8_t op_count; ///< number of operands of this instruction. + cs_tricore_op + operands[TRICORE_OP_COUNT]; ///< operands for this instruction. + /// TODO: Mark the modified flags register in td files and regenerate inc files + bool update_flags; ///< whether the flags register is updated. +} cs_tricore; + +/// TriCore registers +typedef enum tricore_reg { + // generate content begin + // clang-format off + + TRICORE_REG_INVALID = 0, + TRICORE_REG_FCX = 1, + TRICORE_REG_PC = 2, + TRICORE_REG_PCXI = 3, + TRICORE_REG_PSW = 4, + TRICORE_REG_A0 = 5, + TRICORE_REG_A1 = 6, + TRICORE_REG_A2 = 7, + TRICORE_REG_A3 = 8, + TRICORE_REG_A4 = 9, + TRICORE_REG_A5 = 10, + TRICORE_REG_A6 = 11, + TRICORE_REG_A7 = 12, + TRICORE_REG_A8 = 13, + TRICORE_REG_A9 = 14, + TRICORE_REG_A10 = 15, + TRICORE_REG_A11 = 16, + TRICORE_REG_A12 = 17, + TRICORE_REG_A13 = 18, + TRICORE_REG_A14 = 19, + TRICORE_REG_A15 = 20, + TRICORE_REG_D0 = 21, + TRICORE_REG_D1 = 22, + TRICORE_REG_D2 = 23, + TRICORE_REG_D3 = 24, + TRICORE_REG_D4 = 25, + TRICORE_REG_D5 = 26, + TRICORE_REG_D6 = 27, + TRICORE_REG_D7 = 28, + TRICORE_REG_D8 = 29, + TRICORE_REG_D9 = 30, + TRICORE_REG_D10 = 31, + TRICORE_REG_D11 = 32, + TRICORE_REG_D12 = 33, + TRICORE_REG_D13 = 34, + TRICORE_REG_D14 = 35, + TRICORE_REG_D15 = 36, + TRICORE_REG_E0 = 37, + TRICORE_REG_E2 = 38, + TRICORE_REG_E4 = 39, + TRICORE_REG_E6 = 40, + TRICORE_REG_E8 = 41, + TRICORE_REG_E10 = 42, + TRICORE_REG_E12 = 43, + TRICORE_REG_E14 = 44, + TRICORE_REG_P0 = 45, + TRICORE_REG_P2 = 46, + TRICORE_REG_P4 = 47, + TRICORE_REG_P6 = 48, + TRICORE_REG_P8 = 49, + TRICORE_REG_P10 = 50, + TRICORE_REG_P12 = 51, + TRICORE_REG_P14 = 52, + TRICORE_REG_A0_A1 = 53, + TRICORE_REG_A2_A3 = 54, + TRICORE_REG_A4_A5 = 55, + TRICORE_REG_A6_A7 = 56, + TRICORE_REG_A8_A9 = 57, + TRICORE_REG_A10_A11 = 58, + TRICORE_REG_A12_A13 = 59, + TRICORE_REG_A14_A15 = 60, + TRICORE_REG_ENDING, // 61 + + // clang-format on + // generate content end +} tricore_reg; + +/// TriCore instruction +typedef enum tricore_insn { + TRICORE_INS_INVALID = 0, + // generate content begin + // clang-format off + + TRICORE_INS_XOR_T, + TRICORE_INS_ABSDIFS_B, + TRICORE_INS_ABSDIFS_H, + TRICORE_INS_ABSDIFS, + TRICORE_INS_ABSDIF_B, + TRICORE_INS_ABSDIF_H, + TRICORE_INS_ABSDIF, + TRICORE_INS_ABSS_B, + TRICORE_INS_ABSS_H, + TRICORE_INS_ABSS, + TRICORE_INS_ABS_B, + TRICORE_INS_ABS_H, + TRICORE_INS_ABS, + TRICORE_INS_ADDC, + TRICORE_INS_ADDIH_A, + TRICORE_INS_ADDIH, + TRICORE_INS_ADDI, + TRICORE_INS_ADDSC_AT, + TRICORE_INS_ADDSC_A, + TRICORE_INS_ADDS_BU, + TRICORE_INS_ADDS_B, + TRICORE_INS_ADDS_H, + TRICORE_INS_ADDS_HU, + TRICORE_INS_ADDS_U, + TRICORE_INS_ADDS, + TRICORE_INS_ADDX, + TRICORE_INS_ADD_A, + TRICORE_INS_ADD_B, + TRICORE_INS_ADD_F, + TRICORE_INS_ADD_H, + TRICORE_INS_ADD, + TRICORE_INS_ANDN_T, + TRICORE_INS_ANDN, + TRICORE_INS_AND_ANDN_T, + TRICORE_INS_AND_AND_T, + TRICORE_INS_AND_EQ, + TRICORE_INS_AND_GE_U, + TRICORE_INS_AND_GE, + TRICORE_INS_AND_LT_U, + TRICORE_INS_AND_LT, + TRICORE_INS_AND_NE, + TRICORE_INS_AND_NOR_T, + TRICORE_INS_AND_OR_T, + TRICORE_INS_AND_T, + TRICORE_INS_AND, + TRICORE_INS_BISR, + TRICORE_INS_BMERGE, + TRICORE_INS_BSPLIT, + TRICORE_INS_CACHEA_I, + TRICORE_INS_CACHEA_WI, + TRICORE_INS_CACHEA_W, + TRICORE_INS_CACHEI_I, + TRICORE_INS_CACHEI_WI, + TRICORE_INS_CACHEI_W, + TRICORE_INS_CADDN_A, + TRICORE_INS_CADDN, + TRICORE_INS_CADD_A, + TRICORE_INS_CADD, + TRICORE_INS_CALLA, + TRICORE_INS_CALLI, + TRICORE_INS_CALL, + TRICORE_INS_CLO_B, + TRICORE_INS_CLO_H, + TRICORE_INS_CLO, + TRICORE_INS_CLS_B, + TRICORE_INS_CLS_H, + TRICORE_INS_CLS, + TRICORE_INS_CLZ_B, + TRICORE_INS_CLZ_H, + TRICORE_INS_CLZ, + TRICORE_INS_CMOVN, + TRICORE_INS_CMOV, + TRICORE_INS_CMPSWAP_W, + TRICORE_INS_CMP_F, + TRICORE_INS_CRC32B_W, + TRICORE_INS_CRC32L_W, + TRICORE_INS_CRC32_B, + TRICORE_INS_CRCN, + TRICORE_INS_CSUBN_A, + TRICORE_INS_CSUBN, + TRICORE_INS_CSUB_A, + TRICORE_INS_CSUB, + TRICORE_INS_DEBUG, + TRICORE_INS_DEXTR, + TRICORE_INS_DIFSC_A, + TRICORE_INS_DISABLE, + TRICORE_INS_DIV_F, + TRICORE_INS_DIV_U, + TRICORE_INS_DIV, + TRICORE_INS_DSYNC, + TRICORE_INS_DVADJ, + TRICORE_INS_DVINIT_BU, + TRICORE_INS_DVINIT_B, + TRICORE_INS_DVINIT_HU, + TRICORE_INS_DVINIT_H, + TRICORE_INS_DVINIT_U, + TRICORE_INS_DVINIT, + TRICORE_INS_DVSTEP_U, + TRICORE_INS_DVSTEP, + TRICORE_INS_ENABLE, + TRICORE_INS_EQANY_B, + TRICORE_INS_EQANY_H, + TRICORE_INS_EQZ_A, + TRICORE_INS_EQ_A, + TRICORE_INS_EQ_B, + TRICORE_INS_EQ_H, + TRICORE_INS_EQ_W, + TRICORE_INS_EQ, + TRICORE_INS_EXTR_U, + TRICORE_INS_EXTR, + TRICORE_INS_FCALLA, + TRICORE_INS_FCALLI, + TRICORE_INS_FCALL, + TRICORE_INS_FRET, + TRICORE_INS_FTOHP, + TRICORE_INS_FTOIZ, + TRICORE_INS_FTOI, + TRICORE_INS_FTOQ31Z, + TRICORE_INS_FTOQ31, + TRICORE_INS_FTOUZ, + TRICORE_INS_FTOU, + TRICORE_INS_GE_A, + TRICORE_INS_GE_U, + TRICORE_INS_GE, + TRICORE_INS_HPTOF, + TRICORE_INS_IMASK, + TRICORE_INS_INSERT, + TRICORE_INS_INSN_T, + TRICORE_INS_INS_T, + TRICORE_INS_ISYNC, + TRICORE_INS_ITOF, + TRICORE_INS_IXMAX_U, + TRICORE_INS_IXMAX, + TRICORE_INS_IXMIN_U, + TRICORE_INS_IXMIN, + TRICORE_INS_JA, + TRICORE_INS_JEQ_A, + TRICORE_INS_JEQ, + TRICORE_INS_JGEZ, + TRICORE_INS_JGE_U, + TRICORE_INS_JGE, + TRICORE_INS_JGTZ, + TRICORE_INS_JI, + TRICORE_INS_JLA, + TRICORE_INS_JLEZ, + TRICORE_INS_JLI, + TRICORE_INS_JLTZ, + TRICORE_INS_JLT_U, + TRICORE_INS_JLT, + TRICORE_INS_JL, + TRICORE_INS_JNED, + TRICORE_INS_JNEI, + TRICORE_INS_JNE_A, + TRICORE_INS_JNE, + TRICORE_INS_JNZ_A, + TRICORE_INS_JNZ_T, + TRICORE_INS_JNZ, + TRICORE_INS_JZ_A, + TRICORE_INS_JZ_T, + TRICORE_INS_JZ, + TRICORE_INS_J, + TRICORE_INS_LDLCX, + TRICORE_INS_LDMST, + TRICORE_INS_LDUCX, + TRICORE_INS_LD_A, + TRICORE_INS_LD_BU, + TRICORE_INS_LD_B, + TRICORE_INS_LD_DA, + TRICORE_INS_LD_D, + TRICORE_INS_LD_HU, + TRICORE_INS_LD_H, + TRICORE_INS_LD_Q, + TRICORE_INS_LD_W, + TRICORE_INS_LEA, + TRICORE_INS_LHA, + TRICORE_INS_LOOPU, + TRICORE_INS_LOOP, + TRICORE_INS_LT_A, + TRICORE_INS_LT_B, + TRICORE_INS_LT_BU, + TRICORE_INS_LT_H, + TRICORE_INS_LT_HU, + TRICORE_INS_LT_U, + TRICORE_INS_LT_W, + TRICORE_INS_LT_WU, + TRICORE_INS_LT, + TRICORE_INS_MADDMS_H, + TRICORE_INS_MADDMS_U, + TRICORE_INS_MADDMS, + TRICORE_INS_MADDM_H, + TRICORE_INS_MADDM_Q, + TRICORE_INS_MADDM_U, + TRICORE_INS_MADDM, + TRICORE_INS_MADDRS_H, + TRICORE_INS_MADDRS_Q, + TRICORE_INS_MADDR_H, + TRICORE_INS_MADDR_Q, + TRICORE_INS_MADDSUMS_H, + TRICORE_INS_MADDSUM_H, + TRICORE_INS_MADDSURS_H, + TRICORE_INS_MADDSUR_H, + TRICORE_INS_MADDSUS_H, + TRICORE_INS_MADDSU_H, + TRICORE_INS_MADDS_H, + TRICORE_INS_MADDS_Q, + TRICORE_INS_MADDS_U, + TRICORE_INS_MADDS, + TRICORE_INS_MADD_F, + TRICORE_INS_MADD_H, + TRICORE_INS_MADD_Q, + TRICORE_INS_MADD_U, + TRICORE_INS_MADD, + TRICORE_INS_MAX_B, + TRICORE_INS_MAX_BU, + TRICORE_INS_MAX_H, + TRICORE_INS_MAX_HU, + TRICORE_INS_MAX_U, + TRICORE_INS_MAX, + TRICORE_INS_MFCR, + TRICORE_INS_MIN_B, + TRICORE_INS_MIN_BU, + TRICORE_INS_MIN_H, + TRICORE_INS_MIN_HU, + TRICORE_INS_MIN_U, + TRICORE_INS_MIN, + TRICORE_INS_MOVH_A, + TRICORE_INS_MOVH, + TRICORE_INS_MOVZ_A, + TRICORE_INS_MOV_AA, + TRICORE_INS_MOV_A, + TRICORE_INS_MOV_D, + TRICORE_INS_MOV_U, + TRICORE_INS_MOV, + TRICORE_INS_MSUBADMS_H, + TRICORE_INS_MSUBADM_H, + TRICORE_INS_MSUBADRS_H, + TRICORE_INS_MSUBADR_H, + TRICORE_INS_MSUBADS_H, + TRICORE_INS_MSUBAD_H, + TRICORE_INS_MSUBMS_H, + TRICORE_INS_MSUBMS_U, + TRICORE_INS_MSUBMS, + TRICORE_INS_MSUBM_H, + TRICORE_INS_MSUBM_Q, + TRICORE_INS_MSUBM_U, + TRICORE_INS_MSUBM, + TRICORE_INS_MSUBRS_H, + TRICORE_INS_MSUBRS_Q, + TRICORE_INS_MSUBR_H, + TRICORE_INS_MSUBR_Q, + TRICORE_INS_MSUBS_H, + TRICORE_INS_MSUBS_Q, + TRICORE_INS_MSUBS_U, + TRICORE_INS_MSUBS, + TRICORE_INS_MSUB_F, + TRICORE_INS_MSUB_H, + TRICORE_INS_MSUB_Q, + TRICORE_INS_MSUB_U, + TRICORE_INS_MSUB, + TRICORE_INS_MTCR, + TRICORE_INS_MULMS_H, + TRICORE_INS_MULM_H, + TRICORE_INS_MULM_U, + TRICORE_INS_MULM, + TRICORE_INS_MULR_H, + TRICORE_INS_MULR_Q, + TRICORE_INS_MULS_U, + TRICORE_INS_MULS, + TRICORE_INS_MUL_F, + TRICORE_INS_MUL_H, + TRICORE_INS_MUL_Q, + TRICORE_INS_MUL_U, + TRICORE_INS_MUL, + TRICORE_INS_NAND_T, + TRICORE_INS_NAND, + TRICORE_INS_NEZ_A, + TRICORE_INS_NE_A, + TRICORE_INS_NE, + TRICORE_INS_NOP, + TRICORE_INS_NOR_T, + TRICORE_INS_NOR, + TRICORE_INS_NOT, + TRICORE_INS_ORN_T, + TRICORE_INS_ORN, + TRICORE_INS_OR_ANDN_T, + TRICORE_INS_OR_AND_T, + TRICORE_INS_OR_EQ, + TRICORE_INS_OR_GE_U, + TRICORE_INS_OR_GE, + TRICORE_INS_OR_LT_U, + TRICORE_INS_OR_LT, + TRICORE_INS_OR_NE, + TRICORE_INS_OR_NOR_T, + TRICORE_INS_OR_OR_T, + TRICORE_INS_OR_T, + TRICORE_INS_OR, + TRICORE_INS_PACK, + TRICORE_INS_PARITY, + TRICORE_INS_POPCNT_W, + TRICORE_INS_Q31TOF, + TRICORE_INS_QSEED_F, + TRICORE_INS_RESTORE, + TRICORE_INS_RET, + TRICORE_INS_RFE, + TRICORE_INS_RFM, + TRICORE_INS_RSLCX, + TRICORE_INS_RSTV, + TRICORE_INS_RSUBS_U, + TRICORE_INS_RSUBS, + TRICORE_INS_RSUB, + TRICORE_INS_SAT_BU, + TRICORE_INS_SAT_B, + TRICORE_INS_SAT_HU, + TRICORE_INS_SAT_H, + TRICORE_INS_SELN_A, + TRICORE_INS_SELN, + TRICORE_INS_SEL_A, + TRICORE_INS_SEL, + TRICORE_INS_SHAS, + TRICORE_INS_SHA_B, + TRICORE_INS_SHA_H, + TRICORE_INS_SHA, + TRICORE_INS_SHUFFLE, + TRICORE_INS_SH_ANDN_T, + TRICORE_INS_SH_AND_T, + TRICORE_INS_SH_B, + TRICORE_INS_SH_EQ, + TRICORE_INS_SH_GE_U, + TRICORE_INS_SH_GE, + TRICORE_INS_SH_H, + TRICORE_INS_SH_LT_U, + TRICORE_INS_SH_LT, + TRICORE_INS_SH_NAND_T, + TRICORE_INS_SH_NE, + TRICORE_INS_SH_NOR_T, + TRICORE_INS_SH_ORN_T, + TRICORE_INS_SH_OR_T, + TRICORE_INS_SH_XNOR_T, + TRICORE_INS_SH_XOR_T, + TRICORE_INS_SH, + TRICORE_INS_STLCX, + TRICORE_INS_STUCX, + TRICORE_INS_ST_A, + TRICORE_INS_ST_B, + TRICORE_INS_ST_DA, + TRICORE_INS_ST_D, + TRICORE_INS_ST_H, + TRICORE_INS_ST_Q, + TRICORE_INS_ST_T, + TRICORE_INS_ST_W, + TRICORE_INS_SUBC, + TRICORE_INS_SUBSC_A, + TRICORE_INS_SUBS_BU, + TRICORE_INS_SUBS_B, + TRICORE_INS_SUBS_HU, + TRICORE_INS_SUBS_H, + TRICORE_INS_SUBS_U, + TRICORE_INS_SUBS, + TRICORE_INS_SUBX, + TRICORE_INS_SUB_A, + TRICORE_INS_SUB_B, + TRICORE_INS_SUB_F, + TRICORE_INS_SUB_H, + TRICORE_INS_SUB, + TRICORE_INS_SVLCX, + TRICORE_INS_SWAPMSK_W, + TRICORE_INS_SWAP_A, + TRICORE_INS_SWAP_W, + TRICORE_INS_SYSCALL, + TRICORE_INS_TLBDEMAP, + TRICORE_INS_TLBFLUSH_A, + TRICORE_INS_TLBFLUSH_B, + TRICORE_INS_TLBMAP, + TRICORE_INS_TLBPROBE_A, + TRICORE_INS_TLBPROBE_I, + TRICORE_INS_TRAPSV, + TRICORE_INS_TRAPV, + TRICORE_INS_UNPACK, + TRICORE_INS_UPDFL, + TRICORE_INS_UTOF, + TRICORE_INS_WAIT, + TRICORE_INS_XNOR_T, + TRICORE_INS_XNOR, + TRICORE_INS_XOR_EQ, + TRICORE_INS_XOR_GE_U, + TRICORE_INS_XOR_GE, + TRICORE_INS_XOR_LT_U, + TRICORE_INS_XOR_LT, + TRICORE_INS_XOR_NE, + TRICORE_INS_XOR, -/// Instruction structure -typedef struct cs_wasm { - uint8_t op_count; - cs_wasm_op operands[2]; -} cs_wasm; + // clang-format on + // generate content end + TRICORE_INS_ENDING, // <-- mark the end of the list of instructions +} tricore_insn; -/// WASM instruction -typedef enum wasm_insn { - WASM_INS_UNREACHABLE = 0x0, - WASM_INS_NOP = 0x1, - WASM_INS_BLOCK = 0x2, - WASM_INS_LOOP = 0x3, - WASM_INS_IF = 0x4, - WASM_INS_ELSE = 0x5, - WASM_INS_END = 0xb, - WASM_INS_BR = 0xc, - WASM_INS_BR_IF = 0xd, - WASM_INS_BR_TABLE = 0xe, - WASM_INS_RETURN = 0xf, - WASM_INS_CALL = 0x10, - WASM_INS_CALL_INDIRECT = 0x11, - WASM_INS_DROP = 0x1a, - WASM_INS_SELECT = 0x1b, - WASM_INS_GET_LOCAL = 0x20, - WASM_INS_SET_LOCAL = 0x21, - WASM_INS_TEE_LOCAL = 0x22, - WASM_INS_GET_GLOBAL = 0x23, - WASM_INS_SET_GLOBAL = 0x24, - WASM_INS_I32_LOAD = 0x28, - WASM_INS_I64_LOAD = 0x29, - WASM_INS_F32_LOAD = 0x2a, - WASM_INS_F64_LOAD = 0x2b, - WASM_INS_I32_LOAD8_S = 0x2c, - WASM_INS_I32_LOAD8_U = 0x2d, - WASM_INS_I32_LOAD16_S = 0x2e, - WASM_INS_I32_LOAD16_U = 0x2f, - WASM_INS_I64_LOAD8_S = 0x30, - WASM_INS_I64_LOAD8_U = 0x31, - WASM_INS_I64_LOAD16_S = 0x32, - WASM_INS_I64_LOAD16_U = 0x33, - WASM_INS_I64_LOAD32_S = 0x34, - WASM_INS_I64_LOAD32_U = 0x35, - WASM_INS_I32_STORE = 0x36, - WASM_INS_I64_STORE = 0x37, - WASM_INS_F32_STORE = 0x38, - WASM_INS_F64_STORE = 0x39, - WASM_INS_I32_STORE8 = 0x3a, - WASM_INS_I32_STORE16 = 0x3b, - WASM_INS_I64_STORE8 = 0x3c, - WASM_INS_I64_STORE16 = 0x3d, - WASM_INS_I64_STORE32 = 0x3e, - WASM_INS_CURRENT_MEMORY = 0x3f, - WASM_INS_GROW_MEMORY = 0x40, - WASM_INS_I32_CONST = 0x41, - WASM_INS_I64_CONST = 0x42, - WASM_INS_F32_CONST = 0x43, - WASM_INS_F64_CONST = 0x44, - WASM_INS_I32_EQZ = 0x45, - WASM_INS_I32_EQ = 0x46, - WASM_INS_I32_NE = 0x47, - WASM_INS_I32_LT_S = 0x48, - WASM_INS_I32_LT_U = 0x49, - WASM_INS_I32_GT_S = 0x4a, - WASM_INS_I32_GT_U = 0x4b, - WASM_INS_I32_LE_S = 0x4c, - WASM_INS_I32_LE_U = 0x4d, - WASM_INS_I32_GE_S = 0x4e, - WASM_INS_I32_GE_U = 0x4f, - WASM_INS_I64_EQZ = 0x50, - WASM_INS_I64_EQ = 0x51, - WASM_INS_I64_NE = 0x52, - WASM_INS_I64_LT_S = 0x53, - WASM_INS_I64_LT_U = 0x54, - WASN_INS_I64_GT_S = 0x55, - WASM_INS_I64_GT_U = 0x56, - WASM_INS_I64_LE_S = 0x57, - WASM_INS_I64_LE_U = 0x58, - WASM_INS_I64_GE_S = 0x59, - WASM_INS_I64_GE_U = 0x5a, - WASM_INS_F32_EQ = 0x5b, - WASM_INS_F32_NE = 0x5c, - WASM_INS_F32_LT = 0x5d, - WASM_INS_F32_GT = 0x5e, - WASM_INS_F32_LE = 0x5f, - WASM_INS_F32_GE = 0x60, - WASM_INS_F64_EQ = 0x61, - WASM_INS_F64_NE = 0x62, - WASM_INS_F64_LT = 0x63, - WASM_INS_F64_GT = 0x64, - WASM_INS_F64_LE = 0x65, - WASM_INS_F64_GE = 0x66, - WASM_INS_I32_CLZ = 0x67, - WASM_INS_I32_CTZ = 0x68, - WASM_INS_I32_POPCNT = 0x69, - WASM_INS_I32_ADD = 0x6a, - WASM_INS_I32_SUB = 0x6b, - WASM_INS_I32_MUL = 0x6c, - WASM_INS_I32_DIV_S = 0x6d, - WASM_INS_I32_DIV_U = 0x6e, - WASM_INS_I32_REM_S = 0x6f, - WASM_INS_I32_REM_U = 0x70, - WASM_INS_I32_AND = 0x71, - WASM_INS_I32_OR = 0x72, - WASM_INS_I32_XOR = 0x73, - WASM_INS_I32_SHL = 0x74, - WASM_INS_I32_SHR_S = 0x75, - WASM_INS_I32_SHR_U = 0x76, - WASM_INS_I32_ROTL = 0x77, - WASM_INS_I32_ROTR = 0x78, - WASM_INS_I64_CLZ = 0x79, - WASM_INS_I64_CTZ = 0x7a, - WASM_INS_I64_POPCNT = 0x7b, - WASM_INS_I64_ADD = 0x7c, - WASM_INS_I64_SUB = 0x7d, - WASM_INS_I64_MUL = 0x7e, - WASM_INS_I64_DIV_S = 0x7f, - WASM_INS_I64_DIV_U = 0x80, - WASM_INS_I64_REM_S = 0x81, - WASM_INS_I64_REM_U = 0x82, - WASM_INS_I64_AND = 0x83, - WASM_INS_I64_OR = 0x84, - WASM_INS_I64_XOR = 0x85, - WASM_INS_I64_SHL = 0x86, - WASM_INS_I64_SHR_S = 0x87, - WASM_INS_I64_SHR_U = 0x88, - WASM_INS_I64_ROTL = 0x89, - WASM_INS_I64_ROTR = 0x8a, - WASM_INS_F32_ABS = 0x8b, - WASM_INS_F32_NEG = 0x8c, - WASM_INS_F32_CEIL = 0x8d, - WASM_INS_F32_FLOOR = 0x8e, - WASM_INS_F32_TRUNC = 0x8f, - WASM_INS_F32_NEAREST = 0x90, - WASM_INS_F32_SQRT = 0x91, - WASM_INS_F32_ADD = 0x92, - WASM_INS_F32_SUB = 0x93, - WASM_INS_F32_MUL = 0x94, - WASM_INS_F32_DIV = 0x95, - WASM_INS_F32_MIN = 0x96, - WASM_INS_F32_MAX = 0x97, - WASM_INS_F32_COPYSIGN = 0x98, - WASM_INS_F64_ABS = 0x99, - WASM_INS_F64_NEG = 0x9a, - WASM_INS_F64_CEIL = 0x9b, - WASM_INS_F64_FLOOR = 0x9c, - WASM_INS_F64_TRUNC = 0x9d, - WASM_INS_F64_NEAREST = 0x9e, - WASM_INS_F64_SQRT = 0x9f, - WASM_INS_F64_ADD = 0xa0, - WASM_INS_F64_SUB = 0xa1, - WASM_INS_F64_MUL = 0xa2, - WASM_INS_F64_DIV = 0xa3, - WASM_INS_F64_MIN = 0xa4, - WASM_INS_F64_MAX = 0xa5, - WASM_INS_F64_COPYSIGN = 0xa6, - WASM_INS_I32_WARP_I64 = 0xa7, - WASP_INS_I32_TRUNC_S_F32 = 0xa8, - WASM_INS_I32_TRUNC_U_F32 = 0xa9, - WASM_INS_I32_TRUNC_S_F64 = 0xaa, - WASM_INS_I32_TRUNC_U_F64 = 0xab, - WASM_INS_I64_EXTEND_S_I32 = 0xac, - WASM_INS_I64_EXTEND_U_I32 = 0xad, - WASM_INS_I64_TRUNC_S_F32 = 0xae, - WASM_INS_I64_TRUNC_U_F32 = 0xaf, - WASM_INS_I64_TRUNC_S_F64 = 0xb0, - WASM_INS_I64_TRUNC_U_F64 = 0xb1, - WASM_INS_F32_CONVERT_S_I32 = 0xb2, - WASM_INS_F32_CONVERT_U_I32 = 0xb3, - WASM_INS_F32_CONVERT_S_I64 = 0xb4, - WASM_INS_F32_CONVERT_U_I64 = 0xb5, - WASM_INS_F32_DEMOTE_F64 = 0xb6, - WASM_INS_F64_CONVERT_S_I32 = 0xb7, - WASM_INS_F64_CONVERT_U_I32 = 0xb8, - WASM_INS_F64_CONVERT_S_I64 = 0xb9, - WASM_INS_F64_CONVERT_U_I64 = 0xba, - WASM_INS_F64_PROMOTE_F32 = 0xbb, - WASM_INS_I32_REINTERPRET_F32 = 0xbc, - WASM_INS_I64_REINTERPRET_F64 = 0xbd, - WASM_INS_F32_REINTERPRET_I32 = 0xbe, - WASM_INS_F64_REINTERPRET_I64 = 0xbf, - WASM_INS_INVALID = 512, - WASM_INS_ENDING, -} wasm_insn; +/// Group of TriCore instructions +typedef enum tricore_insn_group { + TRICORE_GRP_INVALID, ///< = CS_GRP_INVALID + /// Generic groups + TRICORE_GRP_CALL, ///< = CS_GRP_CALL + TRICORE_GRP_JUMP, ///< = CS_GRP_JUMP + TRICORE_GRP_ENDING, ///< mark the end of the list of groups +} tricore_insn_group; -/// Group of WASM instructions -typedef enum wasm_insn_group { - WASM_GRP_INVALID = 0, ///< = CS_GRP_INVALID +typedef enum tricore_feature_t { + TRICORE_FEATURE_INVALID = 0, + // generate content begin + // clang-format off - WASM_GRP_NUMBERIC = 8, - WASM_GRP_PARAMETRIC, - WASM_GRP_VARIABLE, - WASM_GRP_MEMORY, - WASM_GRP_CONTROL, + TRICORE_FEATURE_HasV110 = 128, + TRICORE_FEATURE_HasV120_UP, + TRICORE_FEATURE_HasV130_UP, + TRICORE_FEATURE_HasV161, + TRICORE_FEATURE_HasV160_UP, + TRICORE_FEATURE_HasV131_UP, + TRICORE_FEATURE_HasV161_UP, + TRICORE_FEATURE_HasV162, + TRICORE_FEATURE_HasV162_UP, - WASM_GRP_ENDING, ///< <-- mark the end of the list of groups -} wasm_insn_group; + // clang-format on + // generate content end + TRICORE_FEATURE_ENDING, ///< mark the end of the list of features +} tricore_feature; #ifdef __cplusplus } #endif #endif -#ifndef CAPSTONE_MOS65XX_H -#define CAPSTONE_MOS65XX_H -/* Capstone Disassembly Engine */ -/* By Sebastian Macke , 2019 */ + /// Pointer to cs_detail. + /// NOTE: detail pointer is only valid when both requirements below are met: + /// (1) CS_OP_DETAIL = CS_OPT_ON + /// (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON) + /// + /// NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer + /// is not NULL, its content is still irrelevant. + cs_detail *detail; +} cs_insn; -#ifndef CAPSTONE_BPF_H -#define CAPSTONE_BPF_H -#ifdef __cplusplus -extern "C" { -#endif +/// Calculate the offset of a disassembled instruction in its buffer, given its position +/// in its array of disassembled insn +/// NOTE: this macro works with position (>=1), not index +#define CS_INSN_OFFSET(insns, post) (insns[post - 1].address - insns[0].address) -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif +/// All type of errors encountered by Capstone API. +/// These are values returned by cs_errno() +typedef enum cs_err { + CS_ERR_OK = 0, ///< No error: everything was fine + CS_ERR_MEM, ///< Out-Of-Memory error: cs_open(), cs_disasm(), cs_disasm_iter() + CS_ERR_ARCH, ///< Unsupported architecture: cs_open() + CS_ERR_HANDLE, ///< Invalid handle: cs_op_count(), cs_op_index() + CS_ERR_CSH, ///< Invalid csh argument: cs_close(), cs_errno(), cs_option() + CS_ERR_MODE, ///< Invalid/unsupported mode: cs_open() + CS_ERR_OPTION, ///< Invalid/unsupported option: cs_option() + CS_ERR_DETAIL, ///< Information is unavailable because detail option is OFF + CS_ERR_MEMSETUP, ///< Dynamic memory management uninitialized (see CS_OPT_MEM) + CS_ERR_VERSION, ///< Unsupported version (bindings) + CS_ERR_DIET, ///< Access irrelevant data in "diet" engine + CS_ERR_SKIPDATA, ///< Access irrelevant data for "data" instruction in SKIPDATA mode + CS_ERR_X86_ATT, ///< X86 AT&T syntax is unsupported (opt-out at compile time) + CS_ERR_X86_INTEL, ///< X86 Intel syntax is unsupported (opt-out at compile time) + CS_ERR_X86_MASM, ///< X86 Masm syntax is unsupported (opt-out at compile time) +} cs_err; -/// Operand type for instruction's operands -typedef enum bpf_op_type { - BPF_OP_INVALID = 0, +/** + Return combined API version & major and minor version numbers. - BPF_OP_REG, - BPF_OP_IMM, - BPF_OP_OFF, - BPF_OP_MEM, - BPF_OP_MMEM, ///< M[k] in cBPF - BPF_OP_MSH, ///< corresponds to cBPF's BPF_MSH mode - BPF_OP_EXT, ///< cBPF's extension (not eBPF) -} bpf_op_type; + @major: major number of API version + @minor: minor number of API version -/// BPF registers -typedef enum bpf_reg { - BPF_REG_INVALID = 0, + @return hexical number as (major << 8 | minor), which encodes both + major & minor versions. + NOTE: This returned value can be compared with version number made + with macro CS_MAKE_VERSION - ///< cBPF - BPF_REG_A, - BPF_REG_X, + For example, second API version would return 1 in @major, and 1 in @minor + The return value would be 0x0101 - ///< eBPF - BPF_REG_R0, - BPF_REG_R1, - BPF_REG_R2, - BPF_REG_R3, - BPF_REG_R4, - BPF_REG_R5, - BPF_REG_R6, - BPF_REG_R7, - BPF_REG_R8, - BPF_REG_R9, - BPF_REG_R10, + NOTE: if you only care about returned value, but not major and minor values, + set both @major & @minor arguments to NULL. +*/ +CAPSTONE_EXPORT +unsigned int CAPSTONE_API cs_version(int *major, int *minor); - BPF_REG_ENDING, -} bpf_reg; +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_arm(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_arm64(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_mips(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_x86(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_ppc(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_sparc(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_sysz(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_xcore(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_m68k(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_tms320c64x(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_m680x(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_evm(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_mos65xx(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_wasm(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_bpf(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_riscv(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_sh(void); +CAPSTONE_EXPORT +void CAPSTONE_API cs_arch_register_tricore(void); -/// Instruction's operand referring to memory -/// This is associated with BPF_OP_MEM operand type above -typedef struct bpf_op_mem { - bpf_reg base; ///< base register - uint32_t disp; ///< offset value -} bpf_op_mem; +/** + This API can be used to either ask for archs supported by this library, + or check to see if the library was compile with 'diet' option (or called + in 'diet' mode). -typedef enum bpf_ext_type { - BPF_EXT_INVALID = 0, + To check if a particular arch is supported by this library, set @query to + arch mode (CS_ARCH_* value). + To verify if this library supports all the archs, use CS_ARCH_ALL. - BPF_EXT_LEN, -} bpf_ext_type; + To check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET. -/// Instruction operand -typedef struct cs_bpf_op { - bpf_op_type type; - union { - uint8_t reg; ///< register value for REG operand - uint64_t imm; ///< immediate value IMM operand - uint32_t off; ///< offset value, used in jump & call - bpf_op_mem mem; ///< base/disp value for MEM operand - /* cBPF only */ - uint32_t mmem; ///< M[k] in cBPF - uint32_t msh; ///< corresponds to cBPF's BPF_MSH mode - uint32_t ext; ///< cBPF's extension (not eBPF) - }; + @return True if this library supports the given arch, or in 'diet' mode. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_support(int query); + +/** + Initialize CS handle: this must be done before any usage of CS. + + @arch: architecture type (CS_ARCH_*) + @mode: hardware mode. This is combined of CS_MODE_* + @handle: pointer to handle, which will be updated at return time + + @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum + for detailed error). +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle); + +/** + Close CS handle: MUST do to release the handle when it is not used anymore. + NOTE: this must be only called when there is no longer usage of Capstone, + not even access to cs_insn array. The reason is the this API releases some + cached memory, thus access to any Capstone API after cs_close() might crash + your application. + + In fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0). + + @handle: pointer to a handle returned by cs_open() + + @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum + for detailed error). +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_close(csh *handle); + +/** + Set option for disassembling engine at runtime + + @handle: handle returned by cs_open() + @type: type of option to be set + @value: option value corresponding with @type + + @return: CS_ERR_OK on success, or other value on failure. + Refer to cs_err enum for detailed error. + + NOTE: in the case of CS_OPT_MEM, handle's value can be anything, + so that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called + even before cs_open() +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_option(csh handle, cs_opt_type type, size_t value); + +/** + Report the last error number when some API function fail. + Like glibc's errno, cs_errno might not retain its old value once accessed. + + @handle: handle returned by cs_open() + + @return: error code of cs_err enum type (CS_ERR_*, see above) +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_errno(csh handle); + + +/** + Return a string describing given error code. + + @code: error code (see CS_ERR_* above) + + @return: returns a pointer to a string that describes the error code + passed in the argument @code +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_strerror(cs_err code); + +/** + Disassemble binary code, given the code buffer, size, address and number + of instructions to be decoded. + This API dynamically allocate memory to contain disassembled instruction. + Resulting instructions will be put into @*insn + + NOTE 1: this API will automatically determine memory needed to contain + output disassembled instructions in @insn. - /// How is this operand accessed? (READ, WRITE or READ|WRITE) - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; -} cs_bpf_op; + NOTE 2: caller must free the allocated memory itself to avoid memory leaking. -/// Instruction structure -typedef struct cs_bpf { - uint8_t op_count; - cs_bpf_op operands[4]; -} cs_bpf; + NOTE 3: for system with scarce memory to be dynamically allocated such as + OS kernel or firmware, the API cs_disasm_iter() might be a better choice than + cs_disasm(). The reason is that with cs_disasm(), based on limited available + memory, we have to calculate in advance how many instructions to be disassembled, + which complicates things. This is especially troublesome for the case @count=0, + when cs_disasm() runs uncontrollably (until either end of input buffer, or + when it encounters an invalid instruction). + + @handle: handle returned by cs_open() + @code: buffer containing raw binary code to be disassembled. + @code_size: size of the above code buffer. + @address: address of the first instruction in given raw code buffer. + @insn: array of instructions filled in by this API. + NOTE: @insn will be allocated by this function, and should be freed + with cs_free() API. + @count: number of instructions to be disassembled, or 0 to get all of them -/// BPF instruction -typedef enum bpf_insn { - BPF_INS_INVALID = 0, + @return: the number of successfully disassembled instructions, + or 0 if this function failed to disassemble the given code - ///< ALU - BPF_INS_ADD, - BPF_INS_SUB, - BPF_INS_MUL, - BPF_INS_DIV, - BPF_INS_OR, - BPF_INS_AND, - BPF_INS_LSH, - BPF_INS_RSH, - BPF_INS_NEG, - BPF_INS_MOD, - BPF_INS_XOR, - BPF_INS_MOV, ///< eBPF only - BPF_INS_ARSH, ///< eBPF only + On failure, call cs_errno() for error code. +*/ +CAPSTONE_EXPORT +size_t CAPSTONE_API cs_disasm(csh handle, + const uint8_t *code, size_t code_size, + uint64_t address, + size_t count, + cs_insn **insn); - ///< ALU64, eBPF only - BPF_INS_ADD64, - BPF_INS_SUB64, - BPF_INS_MUL64, - BPF_INS_DIV64, - BPF_INS_OR64, - BPF_INS_AND64, - BPF_INS_LSH64, - BPF_INS_RSH64, - BPF_INS_NEG64, - BPF_INS_MOD64, - BPF_INS_XOR64, - BPF_INS_MOV64, - BPF_INS_ARSH64, +/** + Free memory allocated by cs_malloc() or cs_disasm() (argument @insn) - ///< Byteswap, eBPF only - BPF_INS_LE16, - BPF_INS_LE32, - BPF_INS_LE64, - BPF_INS_BE16, - BPF_INS_BE32, - BPF_INS_BE64, + @insn: pointer returned by @insn argument in cs_disasm() or cs_malloc() + @count: number of cs_insn structures returned by cs_disasm(), or 1 + to free memory allocated by cs_malloc(). +*/ +CAPSTONE_EXPORT +void CAPSTONE_API cs_free(cs_insn *insn, size_t count); - ///< Load - BPF_INS_LDW, ///< eBPF only - BPF_INS_LDH, - BPF_INS_LDB, - BPF_INS_LDDW, ///< eBPF only: load 64-bit imm - BPF_INS_LDXW, ///< eBPF only - BPF_INS_LDXH, ///< eBPF only - BPF_INS_LDXB, ///< eBPF only - BPF_INS_LDXDW, ///< eBPF only - ///< Store - BPF_INS_STW, ///< eBPF only - BPF_INS_STH, ///< eBPF only - BPF_INS_STB, ///< eBPF only - BPF_INS_STDW, ///< eBPF only - BPF_INS_STXW, ///< eBPF only - BPF_INS_STXH, ///< eBPF only - BPF_INS_STXB, ///< eBPF only - BPF_INS_STXDW, ///< eBPF only - BPF_INS_XADDW, ///< eBPF only - BPF_INS_XADDDW, ///< eBPF only +/** + Allocate memory for 1 instruction to be used by cs_disasm_iter(). - ///< Jump - BPF_INS_JMP, - BPF_INS_JEQ, - BPF_INS_JGT, - BPF_INS_JGE, - BPF_INS_JSET, - BPF_INS_JNE, ///< eBPF only - BPF_INS_JSGT, ///< eBPF only - BPF_INS_JSGE, ///< eBPF only - BPF_INS_CALL, ///< eBPF only - BPF_INS_CALLX, ///< eBPF only - BPF_INS_EXIT, ///< eBPF only - BPF_INS_JLT, ///< eBPF only - BPF_INS_JLE, ///< eBPF only - BPF_INS_JSLT, ///< eBPF only - BPF_INS_JSLE, ///< eBPF only + @handle: handle returned by cs_open() - ///< Return, cBPF only - BPF_INS_RET, + NOTE: when no longer in use, you can reclaim the memory allocated for + this instruction with cs_free(insn, 1) +*/ +CAPSTONE_EXPORT +cs_insn * CAPSTONE_API cs_malloc(csh handle); - ///< Misc, cBPF only - BPF_INS_TAX, - BPF_INS_TXA, +/** + Fast API to disassemble binary code, given the code buffer, size, address + and number of instructions to be decoded. + This API puts the resulting instruction into a given cache in @insn. + See tests/test_iter.c for sample code demonstrating this API. - BPF_INS_ENDING, + NOTE 1: this API will update @code, @size & @address to point to the next + instruction in the input buffer. Therefore, it is convenient to use + cs_disasm_iter() inside a loop to quickly iterate all the instructions. + While decoding one instruction at a time can also be achieved with + cs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30% + faster on random input. - // alias instructions - BPF_INS_LD = BPF_INS_LDW, ///< cBPF only - BPF_INS_LDX = BPF_INS_LDXW, ///< cBPF only - BPF_INS_ST = BPF_INS_STW, ///< cBPF only - BPF_INS_STX = BPF_INS_STXW, ///< cBPF only -} bpf_insn; + NOTE 2: the cache in @insn can be created with cs_malloc() API. -/// Group of BPF instructions -typedef enum bpf_insn_group { - BPF_GRP_INVALID = 0, ///< = CS_GRP_INVALID + NOTE 3: for system with scarce memory to be dynamically allocated such as + OS kernel or firmware, this API is recommended over cs_disasm(), which + allocates memory based on the number of instructions to be disassembled. + The reason is that with cs_disasm(), based on limited available memory, + we have to calculate in advance how many instructions to be disassembled, + which complicates things. This is especially troublesome for the case + @count=0, when cs_disasm() runs uncontrollably (until either end of input + buffer, or when it encounters an invalid instruction). + + @handle: handle returned by cs_open() + @code: buffer containing raw binary code to be disassembled + @size: size of above code + @address: address of the first insn in given raw code buffer + @insn: pointer to instruction to be filled in by this API. - BPF_GRP_LOAD, - BPF_GRP_STORE, - BPF_GRP_ALU, - BPF_GRP_JUMP, - BPF_GRP_CALL, ///< eBPF only - BPF_GRP_RETURN, - BPF_GRP_MISC, ///< cBPF only + @return: true if this API successfully decode 1 instruction, + or false otherwise. - BPF_GRP_ENDING, -} bpf_insn_group; + On failure, call cs_errno() for error code. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_disasm_iter(csh handle, + const uint8_t **code, size_t *size, + uint64_t *address, cs_insn *insn); -#ifdef __cplusplus -} -#endif +/** + Return friendly name of register in a string. + Find the instruction id from header file of corresponding architecture (arm.h for ARM, + x86.h for X86, ...) -#endif -#ifndef CAPSTONE_SH_H -#define CAPSTONE_SH_H + WARN: when in 'diet' mode, this API is irrelevant because engine does not + store register name. -/* Capstone Disassembly Engine */ -/* By Yoshinori Sato, 2022 */ + @handle: handle returned by cs_open() + @reg_id: register id -#ifdef __cplusplus -extern "C" { -#endif + @return: string name of the register, or NULL if @reg_id is invalid. +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_reg_name(csh handle, unsigned int reg_id); +/** + Return friendly name of an instruction in a string. + Find the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) -#ifdef _MSC_VER -#pragma warning(disable:4201) -#endif + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + store instruction name. -/// SH registers and special registers -typedef enum { - SH_REG_INVALID = 0, + @handle: handle returned by cs_open() + @insn_id: instruction id - SH_REG_R0, - SH_REG_R1, - SH_REG_R2, - SH_REG_R3, - SH_REG_R4, - SH_REG_R5, - SH_REG_R6, - SH_REG_R7, + @return: string name of the instruction, or NULL if @insn_id is invalid. +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_insn_name(csh handle, unsigned int insn_id); - SH_REG_R8, - SH_REG_R9, - SH_REG_R10, - SH_REG_R11, - SH_REG_R12, - SH_REG_R13, - SH_REG_R14, - SH_REG_R15, +/** + Return friendly name of a group id (that an instruction can belong to) + Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - SH_REG_R0_BANK, - SH_REG_R1_BANK, - SH_REG_R2_BANK, - SH_REG_R3_BANK, - SH_REG_R4_BANK, - SH_REG_R5_BANK, - SH_REG_R6_BANK, - SH_REG_R7_BANK, + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + store group name. - SH_REG_FR0, - SH_REG_FR1, - SH_REG_FR2, - SH_REG_FR3, - SH_REG_FR4, - SH_REG_FR5, - SH_REG_FR6, - SH_REG_FR7, - SH_REG_FR8, - SH_REG_FR9, - SH_REG_FR10, - SH_REG_FR11, - SH_REG_FR12, - SH_REG_FR13, - SH_REG_FR14, - SH_REG_FR15, + @handle: handle returned by cs_open() + @group_id: group id - SH_REG_DR0, - SH_REG_DR2, - SH_REG_DR4, - SH_REG_DR6, - SH_REG_DR8, - SH_REG_DR10, - SH_REG_DR12, - SH_REG_DR14, + @return: string name of the group, or NULL if @group_id is invalid. +*/ +CAPSTONE_EXPORT +const char * CAPSTONE_API cs_group_name(csh handle, unsigned int group_id); - SH_REG_XD0, - SH_REG_XD2, - SH_REG_XD4, - SH_REG_XD6, - SH_REG_XD8, - SH_REG_XD10, - SH_REG_XD12, - SH_REG_XD14, +/** + Check if a disassembled instruction belong to a particular group. + Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + Internally, this simply verifies if @group_id matches any member of insn->groups array. - SH_REG_XF0, - SH_REG_XF1, - SH_REG_XF2, - SH_REG_XF3, - SH_REG_XF4, - SH_REG_XF5, - SH_REG_XF6, - SH_REG_XF7, - SH_REG_XF8, - SH_REG_XF9, - SH_REG_XF10, - SH_REG_XF11, - SH_REG_XF12, - SH_REG_XF13, - SH_REG_XF14, - SH_REG_XF15, + NOTE: this API is only valid when detail option is ON (which is OFF by default). - SH_REG_FV0, - SH_REG_FV4, - SH_REG_FV8, - SH_REG_FV12, + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + update @groups array. - SH_REG_XMATRX, + @handle: handle returned by cs_open() + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @group_id: group that you want to check if this instruction belong to. - SH_REG_PC, - SH_REG_PR, - SH_REG_MACH, - SH_REG_MACL, + @return: true if this instruction indeed belongs to the given group, or false otherwise. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_insn_group(csh handle, const cs_insn *insn, unsigned int group_id); - SH_REG_SR, - SH_REG_GBR, - SH_REG_SSR, - SH_REG_SPC, - SH_REG_SGR, - SH_REG_DBR, - SH_REG_VBR, - SH_REG_TBR, - SH_REG_RS, - SH_REG_RE, - SH_REG_MOD, +/** + Check if a disassembled instruction IMPLICITLY used a particular register. + Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + Internally, this simply verifies if @reg_id matches any member of insn->regs_read array. - SH_REG_FPUL, - SH_REG_FPSCR, + NOTE: this API is only valid when detail option is ON (which is OFF by default) - SH_REG_DSP_X0, - SH_REG_DSP_X1, - SH_REG_DSP_Y0, - SH_REG_DSP_Y1, - SH_REG_DSP_A0, - SH_REG_DSP_A1, - SH_REG_DSP_A0G, - SH_REG_DSP_A1G, - SH_REG_DSP_M0, - SH_REG_DSP_M1, - SH_REG_DSP_DSR, + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + update @regs_read array. - SH_REG_DSP_RSV0, - SH_REG_DSP_RSV1, - SH_REG_DSP_RSV2, - SH_REG_DSP_RSV3, - SH_REG_DSP_RSV4, - SH_REG_DSP_RSV5, - SH_REG_DSP_RSV6, - SH_REG_DSP_RSV7, - SH_REG_DSP_RSV8, - SH_REG_DSP_RSV9, - SH_REG_DSP_RSVA, - SH_REG_DSP_RSVB, - SH_REG_DSP_RSVC, - SH_REG_DSP_RSVD, - SH_REG_DSP_RSVE, - SH_REG_DSP_RSVF, + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @reg_id: register that you want to check if this instruction used it. - SH_REG_ENDING, // <-- mark the end of the list of registers -} sh_reg; + @return: true if this instruction indeed implicitly used the given register, or false otherwise. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_reg_read(csh handle, const cs_insn *insn, unsigned int reg_id); -typedef enum { - SH_OP_INVALID = 0, ///< = CS_OP_INVALID (Uninitialized). - SH_OP_REG, ///< = CS_OP_REG (Register operand). - SH_OP_IMM, ///< = CS_OP_IMM (Immediate operand). - SH_OP_MEM, ///< = CS_OP_MEM (Memory operand). -} sh_op_type; +/** + Check if a disassembled instruction IMPLICITLY modified a particular register. + Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) + Internally, this simply verifies if @reg_id matches any member of insn->regs_write array. -typedef enum { - SH_OP_MEM_INVALID = 0, /// <= Invalid - SH_OP_MEM_REG_IND, /// <= Register indirect - SH_OP_MEM_REG_POST, /// <= Register post increment - SH_OP_MEM_REG_PRE, /// <= Register pre decrement - SH_OP_MEM_REG_DISP, /// <= displacement - SH_OP_MEM_REG_R0, /// <= R0 indexed - SH_OP_MEM_GBR_DISP, /// <= GBR based displacement - SH_OP_MEM_GBR_R0, /// <= GBR based R0 indexed - SH_OP_MEM_PCR, /// <= PC relative - SH_OP_MEM_TBR_DISP, /// <= TBR based displaysment -} sh_op_mem_type; + NOTE: this API is only valid when detail option is ON (which is OFF by default) -typedef struct sh_op_mem { - sh_op_mem_type address; /// <= memory address - sh_reg reg; /// <= base register - uint32_t disp; /// <= displacement -} sh_op_mem; + WARN: when in 'diet' mode, this API is irrelevant because the engine does not + update @regs_write array. -// SH-DSP instcutions define -typedef enum sh_dsp_insn_type { - SH_INS_DSP_INVALID, - SH_INS_DSP_DOUBLE, - SH_INS_DSP_SINGLE, - SH_INS_DSP_PARALLEL, -} sh_dsp_insn_type; + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @reg_id: register that you want to check if this instruction modified it. -typedef enum sh_dsp_insn { - SH_INS_DSP_NOP = 1, - SH_INS_DSP_MOV, - SH_INS_DSP_PSHL, - SH_INS_DSP_PSHA, - SH_INS_DSP_PMULS, - SH_INS_DSP_PCLR_PMULS, - SH_INS_DSP_PSUB_PMULS, - SH_INS_DSP_PADD_PMULS, - SH_INS_DSP_PSUBC, - SH_INS_DSP_PADDC, - SH_INS_DSP_PCMP, - SH_INS_DSP_PABS, - SH_INS_DSP_PRND, - SH_INS_DSP_PSUB, - SH_INS_DSP_PSUBr, - SH_INS_DSP_PADD, - SH_INS_DSP_PAND, - SH_INS_DSP_PXOR, - SH_INS_DSP_POR, - SH_INS_DSP_PDEC, - SH_INS_DSP_PINC, - SH_INS_DSP_PCLR, - SH_INS_DSP_PDMSB, - SH_INS_DSP_PNEG, - SH_INS_DSP_PCOPY, - SH_INS_DSP_PSTS, - SH_INS_DSP_PLDS, - SH_INS_DSP_PSWAP, - SH_INS_DSP_PWAD, - SH_INS_DSP_PWSB, -} sh_dsp_insn; + @return: true if this instruction indeed implicitly modified the given register, or false otherwise. +*/ +CAPSTONE_EXPORT +bool CAPSTONE_API cs_reg_write(csh handle, const cs_insn *insn, unsigned int reg_id); -typedef enum sh_dsp_operand { - SH_OP_DSP_INVALID, - SH_OP_DSP_REG_PRE, - SH_OP_DSP_REG_IND, - SH_OP_DSP_REG_POST, - SH_OP_DSP_REG_INDEX, - SH_OP_DSP_REG, - SH_OP_DSP_IMM, - -} sh_dsp_operand; +/** + Count the number of operands of a given type. + Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) -typedef enum sh_dsp_cc { - SH_DSP_CC_INVALID, - SH_DSP_CC_NONE, - SH_DSP_CC_DCT, - SH_DSP_CC_DCF, -} sh_dsp_cc; + NOTE: this API is only valid when detail option is ON (which is OFF by default) -typedef struct sh_op_dsp { - sh_dsp_insn insn; - sh_dsp_operand operand[2]; - sh_reg r[6]; - sh_dsp_cc cc; - uint8_t imm; - int size; -} sh_op_dsp; - -/// Instruction operand -typedef struct cs_sh_op { - sh_op_type type; - union { - uint64_t imm; ///< immediate value for IMM operand - sh_reg reg; ///< register value for REG operand - sh_op_mem mem; ///< data when operand is targeting memory - sh_op_dsp dsp; ///< dsp instruction - }; -} cs_sh_op; + @handle: handle returned by cs_open() + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @op_type: Operand type to be found. + + @return: number of operands of given type @op_type in instruction @insn, + or -1 on failure. +*/ +CAPSTONE_EXPORT +int CAPSTONE_API cs_op_count(csh handle, const cs_insn *insn, unsigned int op_type); + +/** + Retrieve the position of operand of given type in .operands[] array. + Later, the operand can be accessed using the returned position. + Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) -/// SH instruction -typedef enum sh_insn { - SH_INS_INVALID, - SH_INS_ADD_r, - SH_INS_ADD, - SH_INS_ADDC, - SH_INS_ADDV, - SH_INS_AND, - SH_INS_BAND, - SH_INS_BANDNOT, - SH_INS_BCLR, - SH_INS_BF, - SH_INS_BF_S, - SH_INS_BLD, - SH_INS_BLDNOT, - SH_INS_BOR, - SH_INS_BORNOT, - SH_INS_BRA, - SH_INS_BRAF, - SH_INS_BSET, - SH_INS_BSR, - SH_INS_BSRF, - SH_INS_BST, - SH_INS_BT, - SH_INS_BT_S, - SH_INS_BXOR, - SH_INS_CLIPS, - SH_INS_CLIPU, - SH_INS_CLRDMXY, - SH_INS_CLRMAC, - SH_INS_CLRS, - SH_INS_CLRT, - SH_INS_CMP_EQ, - SH_INS_CMP_GE, - SH_INS_CMP_GT, - SH_INS_CMP_HI, - SH_INS_CMP_HS, - SH_INS_CMP_PL, - SH_INS_CMP_PZ, - SH_INS_CMP_STR, - SH_INS_DIV0S, - SH_INS_DIV0U, - SH_INS_DIV1, - SH_INS_DIVS, - SH_INS_DIVU, - SH_INS_DMULS_L, - SH_INS_DMULU_L, - SH_INS_DT, - SH_INS_EXTS_B, - SH_INS_EXTS_W, - SH_INS_EXTU_B, - SH_INS_EXTU_W, - SH_INS_FABS, - SH_INS_FADD, - SH_INS_FCMP_EQ, - SH_INS_FCMP_GT, - SH_INS_FCNVDS, - SH_INS_FCNVSD, - SH_INS_FDIV, - SH_INS_FIPR, - SH_INS_FLDI0, - SH_INS_FLDI1, - SH_INS_FLDS, - SH_INS_FLOAT, - SH_INS_FMAC, - SH_INS_FMOV, - SH_INS_FMUL, - SH_INS_FNEG, - SH_INS_FPCHG, - SH_INS_FRCHG, - SH_INS_FSCA, - SH_INS_FSCHG, - SH_INS_FSQRT, - SH_INS_FSRRA, - SH_INS_FSTS, - SH_INS_FSUB, - SH_INS_FTRC, - SH_INS_FTRV, - SH_INS_ICBI, - SH_INS_JMP, - SH_INS_JSR, - SH_INS_JSR_N, - SH_INS_LDBANK, - SH_INS_LDC, - SH_INS_LDRC, - SH_INS_LDRE, - SH_INS_LDRS, - SH_INS_LDS, - SH_INS_LDTLB, - SH_INS_MAC_L, - SH_INS_MAC_W, - SH_INS_MOV, - SH_INS_MOVA, - SH_INS_MOVCA, - SH_INS_MOVCO, - SH_INS_MOVI20, - SH_INS_MOVI20S, - SH_INS_MOVLI, - SH_INS_MOVML, - SH_INS_MOVMU, - SH_INS_MOVRT, - SH_INS_MOVT, - SH_INS_MOVU, - SH_INS_MOVUA, - SH_INS_MUL_L, - SH_INS_MULR, - SH_INS_MULS_W, - SH_INS_MULU_W, - SH_INS_NEG, - SH_INS_NEGC, - SH_INS_NOP, - SH_INS_NOT, - SH_INS_NOTT, - SH_INS_OCBI, - SH_INS_OCBP, - SH_INS_OCBWB, - SH_INS_OR, - SH_INS_PREF, - SH_INS_PREFI, - SH_INS_RESBANK, - SH_INS_ROTCL, - SH_INS_ROTCR, - SH_INS_ROTL, - SH_INS_ROTR, - SH_INS_RTE, - SH_INS_RTS, - SH_INS_RTS_N, - SH_INS_RTV_N, - SH_INS_SETDMX, - SH_INS_SETDMY, - SH_INS_SETRC, - SH_INS_SETS, - SH_INS_SETT, - SH_INS_SHAD, - SH_INS_SHAL, - SH_INS_SHAR, - SH_INS_SHLD, - SH_INS_SHLL, - SH_INS_SHLL16, - SH_INS_SHLL2, - SH_INS_SHLL8, - SH_INS_SHLR, - SH_INS_SHLR16, - SH_INS_SHLR2, - SH_INS_SHLR8, - SH_INS_SLEEP, - SH_INS_STBANK, - SH_INS_STC, - SH_INS_STS, - SH_INS_SUB, - SH_INS_SUBC, - SH_INS_SUBV, - SH_INS_SWAP_B, - SH_INS_SWAP_W, - SH_INS_SYNCO, - SH_INS_TAS, - SH_INS_TRAPA, - SH_INS_TST, - SH_INS_XOR, - SH_INS_XTRCT, - SH_INS_DSP, - SH_INS_ENDING, // <-- mark the end of the list of instructions -} sh_insn; + NOTE: this API is only valid when detail option is ON (which is OFF by default) -/// Instruction structure -typedef struct cs_sh { - sh_insn insn; - uint8_t size; - uint8_t op_count; - cs_sh_op operands[3]; -} cs_sh; + @handle: handle returned by cs_open() + @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() + @op_type: Operand type to be found. + @position: position of the operand to be found. This must be in the range + [1, cs_op_count(handle, insn, op_type)] -/// Group of SH instructions -typedef enum sh_insn_group { - SH_GRP_INVALID = 0, ///< CS_GRUP_INVALID - SH_GRP_JUMP, ///< = CS_GRP_JUMP - SH_GRP_CALL, ///< = CS_GRP_CALL - SH_GRP_INT, ///< = CS_GRP_INT - SH_GRP_RET, ///< = CS_GRP_RET - SH_GRP_IRET, ///< = CS_GRP_IRET - SH_GRP_PRIVILEGE, ///< = CS_GRP_PRIVILEGE - SH_GRP_BRANCH_RELATIVE, ///< = CS_GRP_BRANCH_RELATIVE + @return: index of operand of given type @op_type in .operands[] array + in instruction @insn, or -1 on failure. +*/ +CAPSTONE_EXPORT +int CAPSTONE_API cs_op_index(csh handle, const cs_insn *insn, unsigned int op_type, + unsigned int position); - SH_GRP_SH1, - SH_GRP_SH2, - SH_GRP_SH2E, - SH_GRP_SH2DSP, - SH_GRP_SH2A, - SH_GRP_SH2AFPU, - SH_GRP_SH3, - SH_GRP_SH3DSP, - SH_GRP_SH4, - SH_GRP_SH4A, - - SH_GRP_ENDING,// <-- mark the end of the list of groups -} sh_insn_group; +/// Type of array to keep the list of registers +typedef uint16_t cs_regs[64]; + +/** + Retrieve all the registers accessed by an instruction, either explicitly or + implicitly. + + WARN: when in 'diet' mode, this API is irrelevant because engine does not + store registers. + + @handle: handle returned by cs_open() + @insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter() + @regs_read: on return, this array contains all registers read by instruction. + @regs_read_count: number of registers kept inside @regs_read array. + @regs_write: on return, this array contains all registers written by instruction. + @regs_write_count: number of registers kept inside @regs_write array. + + @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum + for detailed error). +*/ +CAPSTONE_EXPORT +cs_err CAPSTONE_API cs_regs_access(csh handle, const cs_insn *insn, + cs_regs regs_read, uint8_t *regs_read_count, + cs_regs regs_write, uint8_t *regs_write_count); #ifdef __cplusplus } #endif #endif -#ifndef CAPSTONE_TRICORE_H -#define CAPSTONE_TRICORE_H +/* + * Copyright (C) 2009-2022 Ole André Vadla Ravnås + * Copyright (C) 2023 Fabian Freyer + * Copyright (C) 2024 Yannis Juglaret + * + * Licence: wxWindows Library Licence, Version 3.1 + */ -/* Capstone Disassembly Engine */ -/* By Nguyen Anh Quynh , 2014 */ +#ifndef __GUM_X86_WRITER_H__ +#define __GUM_X86_WRITER_H__ -#ifdef __cplusplus -extern "C" { -#endif -#if !defined(_MSC_VER) || !defined(_KERNEL_MODE) -#include -#endif +G_BEGIN_DECLS -#ifdef _MSC_VER -#pragma warning(disable : 4201) -#endif +typedef struct _GumX86Writer GumX86Writer; +typedef guint GumX86Reg; +typedef guint GumX86PtrTarget; -/// Operand type for instruction's operands -typedef enum tricore_op_type { - TRICORE_OP_INVALID = CS_OP_INVALID, ///< CS_OP_INVALID (Uninitialized). - TRICORE_OP_REG = CS_OP_REG, ///< CS_OP_REG (Register operand). - TRICORE_OP_IMM = CS_OP_IMM, ///< CS_OP_IMM (Immediate operand). - TRICORE_OP_MEM = CS_OP_MEM, ///< CS_OP_MEM (Memory operand). -} tricore_op_type; +struct _GumX86Writer +{ + volatile gint ref_count; + gboolean flush_on_destroy; -/// Instruction's operand referring to memory -/// This is associated with TRICORE_OP_MEM operand type above -typedef struct tricore_op_mem { - uint8_t base; ///< base register - int32_t disp; ///< displacement/offset value -} tricore_op_mem; + GumCpuType target_cpu; + GumAbiType target_abi; + GumCpuFeatures cpu_features; -/// Instruction operand -typedef struct cs_tricore_op { - tricore_op_type type; ///< operand type - union { - unsigned int reg; ///< register value for REG operand - int32_t imm; ///< immediate value for IMM operand - tricore_op_mem mem; ///< base/disp value for MEM operand - }; - /// This field is combined of cs_ac_type. - /// NOTE: this field is irrelevant if engine is compiled in DIET mode. - uint8_t access; ///< How is this operand accessed? (READ, WRITE or READ|WRITE) -} cs_tricore_op; + guint8 * base; + guint8 * code; + GumAddress pc; -#define TRICORE_OP_COUNT 8 + GumMetalHashTable * label_defs; + GumMetalArray label_refs; +}; -/// Instruction structure -typedef struct cs_tricore { - uint8_t op_count; ///< number of operands of this instruction. - cs_tricore_op - operands[TRICORE_OP_COUNT]; ///< operands for this instruction. - /// TODO: Mark the modified flags register in td files and regenerate inc files - bool update_flags; ///< whether the flags register is updated. -} cs_tricore; +enum _GumX86Reg +{ + /* 32-bit */ + GUM_X86_EAX = 0, + GUM_X86_ECX, + GUM_X86_EDX, + GUM_X86_EBX, + GUM_X86_ESP, + GUM_X86_EBP, + GUM_X86_ESI, + GUM_X86_EDI, -/// TriCore registers -typedef enum tricore_reg { - // generate content begin - // clang-format off + GUM_X86_R8D, + GUM_X86_R9D, + GUM_X86_R10D, + GUM_X86_R11D, + GUM_X86_R12D, + GUM_X86_R13D, + GUM_X86_R14D, + GUM_X86_R15D, + + GUM_X86_EIP, + + /* 64-bit */ + GUM_X86_RAX, + GUM_X86_RCX, + GUM_X86_RDX, + GUM_X86_RBX, + GUM_X86_RSP, + GUM_X86_RBP, + GUM_X86_RSI, + GUM_X86_RDI, + + GUM_X86_R8, + GUM_X86_R9, + GUM_X86_R10, + GUM_X86_R11, + GUM_X86_R12, + GUM_X86_R13, + GUM_X86_R14, + GUM_X86_R15, + + GUM_X86_RIP, + + /* Meta */ + GUM_X86_XAX, + GUM_X86_XCX, + GUM_X86_XDX, + GUM_X86_XBX, + GUM_X86_XSP, + GUM_X86_XBP, + GUM_X86_XSI, + GUM_X86_XDI, + + GUM_X86_XIP, + + GUM_X86_NONE +}; + +enum _GumX86PtrTarget +{ + GUM_X86_PTR_BYTE, + GUM_X86_PTR_DWORD, + GUM_X86_PTR_QWORD +}; + +GUM_API GumX86Writer * gum_x86_writer_new (gpointer code_address); +GUM_API GumX86Writer * gum_x86_writer_ref (GumX86Writer * writer); +GUM_API void gum_x86_writer_unref (GumX86Writer * writer); + +GUM_API void gum_x86_writer_init (GumX86Writer * writer, + gpointer code_address); +GUM_API void gum_x86_writer_clear (GumX86Writer * writer); + +GUM_API void gum_x86_writer_reset (GumX86Writer * writer, + gpointer code_address); +GUM_API void gum_x86_writer_set_target_cpu (GumX86Writer * self, + GumCpuType cpu_type); +GUM_API void gum_x86_writer_set_target_abi (GumX86Writer * self, + GumAbiType abi_type); + +GUM_API gpointer gum_x86_writer_cur (GumX86Writer * self); +GUM_API guint gum_x86_writer_offset (GumX86Writer * self); + +GUM_API gboolean gum_x86_writer_flush (GumX86Writer * self); + +GUM_API GumX86Reg gum_x86_writer_get_cpu_register_for_nth_argument ( + GumX86Writer * self, guint n); + +GUM_API gboolean gum_x86_writer_put_label (GumX86Writer * self, + gconstpointer id); + +GUM_API gboolean gum_x86_writer_can_branch_directly_between (GumAddress from, + GumAddress to); +GUM_API gboolean gum_x86_writer_put_call_address_with_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_address_with_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumAddress func, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + gssize offset, guint n_args, ...); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + gssize offset, guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + gssize offset, guint n_args, ...); +GUM_API gboolean + gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments_array ( + GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, + gssize offset, guint n_args, const GumArgument * args); +GUM_API gboolean gum_x86_writer_put_call_address (GumX86Writer * self, + GumAddress address); +GUM_API gboolean gum_x86_writer_put_call_reg (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr (GumX86Writer * self, + GumX86Reg reg, gssize offset); +GUM_API gboolean gum_x86_writer_put_call_indirect (GumX86Writer * self, + GumAddress addr); +GUM_API gboolean gum_x86_writer_put_call_indirect_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API void gum_x86_writer_put_call_near_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API void gum_x86_writer_put_leave (GumX86Writer * self); +GUM_API void gum_x86_writer_put_ret (GumX86Writer * self); +GUM_API void gum_x86_writer_put_ret_imm (GumX86Writer * self, + guint16 imm_value); +GUM_API gboolean gum_x86_writer_put_jmp_address (GumX86Writer * self, + GumAddress address); +GUM_API void gum_x86_writer_put_jmp_short_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API void gum_x86_writer_put_jmp_near_label (GumX86Writer * self, + gconstpointer label_id); +GUM_API gboolean gum_x86_writer_put_jmp_reg (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_jmp_reg_ptr (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_jmp_reg_offset_ptr (GumX86Writer * self, + GumX86Reg reg, gssize offset); +GUM_API gboolean gum_x86_writer_put_jmp_near_ptr (GumX86Writer * self, + GumAddress address); +GUM_API gboolean gum_x86_writer_put_jcc_short (GumX86Writer * self, + x86_insn instruction_id, gconstpointer target, GumBranchHint hint); +GUM_API gboolean gum_x86_writer_put_jcc_near (GumX86Writer * self, + x86_insn instruction_id, gconstpointer target, GumBranchHint hint); +GUM_API void gum_x86_writer_put_jcc_short_label (GumX86Writer * self, + x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); +GUM_API void gum_x86_writer_put_jcc_near_label (GumX86Writer * self, + x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); + +GUM_API gboolean gum_x86_writer_put_add_reg_imm (GumX86Writer * self, + GumX86Reg reg, gssize imm_value); +GUM_API gboolean gum_x86_writer_put_add_reg_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_add_reg_near_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumAddress src_address); +GUM_API gboolean gum_x86_writer_put_sub_reg_imm (GumX86Writer * self, + GumX86Reg reg, gssize imm_value); +GUM_API gboolean gum_x86_writer_put_sub_reg_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_sub_reg_near_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumAddress src_address); +GUM_API gboolean gum_x86_writer_put_inc_reg (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_dec_reg (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_inc_reg_ptr (GumX86Writer * self, + GumX86PtrTarget target, GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_dec_reg_ptr (GumX86Writer * self, + GumX86PtrTarget target, GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_lock_xadd_reg_ptr_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_lock_cmpxchg_reg_ptr_reg ( + GumX86Writer * self, GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_lock_inc_imm32_ptr (GumX86Writer * self, + gpointer target); +GUM_API gboolean gum_x86_writer_put_lock_dec_imm32_ptr (GumX86Writer * self, + gpointer target); + +GUM_API gboolean gum_x86_writer_put_and_reg_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_and_reg_u32 (GumX86Writer * self, + GumX86Reg reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_shl_reg_u8 (GumX86Writer * self, + GumX86Reg reg, guint8 imm_value); +GUM_API gboolean gum_x86_writer_put_shr_reg_u8 (GumX86Writer * self, + GumX86Reg reg, guint8 imm_value); +GUM_API gboolean gum_x86_writer_put_xor_reg_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); - TRICORE_REG_INVALID = 0, - TRICORE_REG_FCX = 1, - TRICORE_REG_PC = 2, - TRICORE_REG_PCXI = 3, - TRICORE_REG_PSW = 4, - TRICORE_REG_A0 = 5, - TRICORE_REG_A1 = 6, - TRICORE_REG_A2 = 7, - TRICORE_REG_A3 = 8, - TRICORE_REG_A4 = 9, - TRICORE_REG_A5 = 10, - TRICORE_REG_A6 = 11, - TRICORE_REG_A7 = 12, - TRICORE_REG_A8 = 13, - TRICORE_REG_A9 = 14, - TRICORE_REG_A10 = 15, - TRICORE_REG_A11 = 16, - TRICORE_REG_A12 = 17, - TRICORE_REG_A13 = 18, - TRICORE_REG_A14 = 19, - TRICORE_REG_A15 = 20, - TRICORE_REG_D0 = 21, - TRICORE_REG_D1 = 22, - TRICORE_REG_D2 = 23, - TRICORE_REG_D3 = 24, - TRICORE_REG_D4 = 25, - TRICORE_REG_D5 = 26, - TRICORE_REG_D6 = 27, - TRICORE_REG_D7 = 28, - TRICORE_REG_D8 = 29, - TRICORE_REG_D9 = 30, - TRICORE_REG_D10 = 31, - TRICORE_REG_D11 = 32, - TRICORE_REG_D12 = 33, - TRICORE_REG_D13 = 34, - TRICORE_REG_D14 = 35, - TRICORE_REG_D15 = 36, - TRICORE_REG_E0 = 37, - TRICORE_REG_E2 = 38, - TRICORE_REG_E4 = 39, - TRICORE_REG_E6 = 40, - TRICORE_REG_E8 = 41, - TRICORE_REG_E10 = 42, - TRICORE_REG_E12 = 43, - TRICORE_REG_E14 = 44, - TRICORE_REG_P0 = 45, - TRICORE_REG_P2 = 46, - TRICORE_REG_P4 = 47, - TRICORE_REG_P6 = 48, - TRICORE_REG_P8 = 49, - TRICORE_REG_P10 = 50, - TRICORE_REG_P12 = 51, - TRICORE_REG_P14 = 52, - TRICORE_REG_A0_A1 = 53, - TRICORE_REG_A2_A3 = 54, - TRICORE_REG_A4_A5 = 55, - TRICORE_REG_A6_A7 = 56, - TRICORE_REG_A8_A9 = 57, - TRICORE_REG_A10_A11 = 58, - TRICORE_REG_A12_A13 = 59, - TRICORE_REG_A14_A15 = 60, - TRICORE_REG_ENDING, // 61 +GUM_API gboolean gum_x86_writer_put_mov_reg_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_u32 (GumX86Writer * self, + GumX86Reg dst_reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_mov_reg_u64 (GumX86Writer * self, + GumX86Reg dst_reg, guint64 imm_value); +GUM_API void gum_x86_writer_put_mov_reg_address (GumX86Writer * self, + GumX86Reg dst_reg, GumAddress address); +GUM_API void gum_x86_writer_put_mov_reg_ptr_u32 (GumX86Writer * self, + GumX86Reg dst_reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_u32 (GumX86Writer * self, + GumX86Reg dst_reg, gssize dst_offset, guint32 imm_value); +GUM_API void gum_x86_writer_put_mov_reg_ptr_reg (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_reg (GumX86Writer * self, + GumX86Reg dst_reg, gssize dst_offset, GumX86Reg src_reg); +GUM_API void gum_x86_writer_put_mov_reg_reg_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_reg_offset_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg, gssize src_offset); +GUM_API gboolean gum_x86_writer_put_mov_reg_base_index_scale_offset_ptr ( + GumX86Writer * self, GumX86Reg dst_reg, GumX86Reg base_reg, + GumX86Reg index_reg, guint8 scale, gssize offset); - // clang-format on - // generate content end -} tricore_reg; +GUM_API gboolean gum_x86_writer_put_mov_reg_near_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumAddress src_address); +GUM_API gboolean gum_x86_writer_put_mov_near_ptr_reg (GumX86Writer * self, + GumAddress dst_address, GumX86Reg src_reg); -/// TriCore instruction -typedef enum tricore_insn { - TRICORE_INS_INVALID = 0, - // generate content begin - // clang-format off +GUM_API gboolean gum_x86_writer_put_mov_fs_u32_ptr_reg (GumX86Writer * self, + guint32 fs_offset, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_fs_u32_ptr (GumX86Writer * self, + GumX86Reg dst_reg, guint32 fs_offset); +GUM_API void gum_x86_writer_put_mov_fs_reg_ptr_reg (GumX86Writer * self, + GumX86Reg fs_offset, GumX86Reg src_reg); +GUM_API void gum_x86_writer_put_mov_reg_fs_reg_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg fs_offset); +GUM_API gboolean gum_x86_writer_put_mov_gs_u32_ptr_reg (GumX86Writer * self, + guint32 fs_offset, GumX86Reg src_reg); +GUM_API gboolean gum_x86_writer_put_mov_reg_gs_u32_ptr (GumX86Writer * self, + GumX86Reg dst_reg, guint32 fs_offset); +GUM_API void gum_x86_writer_put_mov_gs_reg_ptr_reg (GumX86Writer * self, + GumX86Reg gs_offset, GumX86Reg src_reg); +GUM_API void gum_x86_writer_put_mov_reg_gs_reg_ptr (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg gs_offset); - TRICORE_INS_XOR_T, - TRICORE_INS_ABSDIFS_B, - TRICORE_INS_ABSDIFS_H, - TRICORE_INS_ABSDIFS, - TRICORE_INS_ABSDIF_B, - TRICORE_INS_ABSDIF_H, - TRICORE_INS_ABSDIF, - TRICORE_INS_ABSS_B, - TRICORE_INS_ABSS_H, - TRICORE_INS_ABSS, - TRICORE_INS_ABS_B, - TRICORE_INS_ABS_H, - TRICORE_INS_ABS, - TRICORE_INS_ADDC, - TRICORE_INS_ADDIH_A, - TRICORE_INS_ADDIH, - TRICORE_INS_ADDI, - TRICORE_INS_ADDSC_AT, - TRICORE_INS_ADDSC_A, - TRICORE_INS_ADDS_BU, - TRICORE_INS_ADDS_B, - TRICORE_INS_ADDS_H, - TRICORE_INS_ADDS_HU, - TRICORE_INS_ADDS_U, - TRICORE_INS_ADDS, - TRICORE_INS_ADDX, - TRICORE_INS_ADD_A, - TRICORE_INS_ADD_B, - TRICORE_INS_ADD_F, - TRICORE_INS_ADD_H, - TRICORE_INS_ADD, - TRICORE_INS_ANDN_T, - TRICORE_INS_ANDN, - TRICORE_INS_AND_ANDN_T, - TRICORE_INS_AND_AND_T, - TRICORE_INS_AND_EQ, - TRICORE_INS_AND_GE_U, - TRICORE_INS_AND_GE, - TRICORE_INS_AND_LT_U, - TRICORE_INS_AND_LT, - TRICORE_INS_AND_NE, - TRICORE_INS_AND_NOR_T, - TRICORE_INS_AND_OR_T, - TRICORE_INS_AND_T, - TRICORE_INS_AND, - TRICORE_INS_BISR, - TRICORE_INS_BMERGE, - TRICORE_INS_BSPLIT, - TRICORE_INS_CACHEA_I, - TRICORE_INS_CACHEA_WI, - TRICORE_INS_CACHEA_W, - TRICORE_INS_CACHEI_I, - TRICORE_INS_CACHEI_WI, - TRICORE_INS_CACHEI_W, - TRICORE_INS_CADDN_A, - TRICORE_INS_CADDN, - TRICORE_INS_CADD_A, - TRICORE_INS_CADD, - TRICORE_INS_CALLA, - TRICORE_INS_CALLI, - TRICORE_INS_CALL, - TRICORE_INS_CLO_B, - TRICORE_INS_CLO_H, - TRICORE_INS_CLO, - TRICORE_INS_CLS_B, - TRICORE_INS_CLS_H, - TRICORE_INS_CLS, - TRICORE_INS_CLZ_B, - TRICORE_INS_CLZ_H, - TRICORE_INS_CLZ, - TRICORE_INS_CMOVN, - TRICORE_INS_CMOV, - TRICORE_INS_CMPSWAP_W, - TRICORE_INS_CMP_F, - TRICORE_INS_CRC32B_W, - TRICORE_INS_CRC32L_W, - TRICORE_INS_CRC32_B, - TRICORE_INS_CRCN, - TRICORE_INS_CSUBN_A, - TRICORE_INS_CSUBN, - TRICORE_INS_CSUB_A, - TRICORE_INS_CSUB, - TRICORE_INS_DEBUG, - TRICORE_INS_DEXTR, - TRICORE_INS_DIFSC_A, - TRICORE_INS_DISABLE, - TRICORE_INS_DIV_F, - TRICORE_INS_DIV_U, - TRICORE_INS_DIV, - TRICORE_INS_DSYNC, - TRICORE_INS_DVADJ, - TRICORE_INS_DVINIT_BU, - TRICORE_INS_DVINIT_B, - TRICORE_INS_DVINIT_HU, - TRICORE_INS_DVINIT_H, - TRICORE_INS_DVINIT_U, - TRICORE_INS_DVINIT, - TRICORE_INS_DVSTEP_U, - TRICORE_INS_DVSTEP, - TRICORE_INS_ENABLE, - TRICORE_INS_EQANY_B, - TRICORE_INS_EQANY_H, - TRICORE_INS_EQZ_A, - TRICORE_INS_EQ_A, - TRICORE_INS_EQ_B, - TRICORE_INS_EQ_H, - TRICORE_INS_EQ_W, - TRICORE_INS_EQ, - TRICORE_INS_EXTR_U, - TRICORE_INS_EXTR, - TRICORE_INS_FCALLA, - TRICORE_INS_FCALLI, - TRICORE_INS_FCALL, - TRICORE_INS_FRET, - TRICORE_INS_FTOHP, - TRICORE_INS_FTOIZ, - TRICORE_INS_FTOI, - TRICORE_INS_FTOQ31Z, - TRICORE_INS_FTOQ31, - TRICORE_INS_FTOUZ, - TRICORE_INS_FTOU, - TRICORE_INS_GE_A, - TRICORE_INS_GE_U, - TRICORE_INS_GE, - TRICORE_INS_HPTOF, - TRICORE_INS_IMASK, - TRICORE_INS_INSERT, - TRICORE_INS_INSN_T, - TRICORE_INS_INS_T, - TRICORE_INS_ISYNC, - TRICORE_INS_ITOF, - TRICORE_INS_IXMAX_U, - TRICORE_INS_IXMAX, - TRICORE_INS_IXMIN_U, - TRICORE_INS_IXMIN, - TRICORE_INS_JA, - TRICORE_INS_JEQ_A, - TRICORE_INS_JEQ, - TRICORE_INS_JGEZ, - TRICORE_INS_JGE_U, - TRICORE_INS_JGE, - TRICORE_INS_JGTZ, - TRICORE_INS_JI, - TRICORE_INS_JLA, - TRICORE_INS_JLEZ, - TRICORE_INS_JLI, - TRICORE_INS_JLTZ, - TRICORE_INS_JLT_U, - TRICORE_INS_JLT, - TRICORE_INS_JL, - TRICORE_INS_JNED, - TRICORE_INS_JNEI, - TRICORE_INS_JNE_A, - TRICORE_INS_JNE, - TRICORE_INS_JNZ_A, - TRICORE_INS_JNZ_T, - TRICORE_INS_JNZ, - TRICORE_INS_JZ_A, - TRICORE_INS_JZ_T, - TRICORE_INS_JZ, - TRICORE_INS_J, - TRICORE_INS_LDLCX, - TRICORE_INS_LDMST, - TRICORE_INS_LDUCX, - TRICORE_INS_LD_A, - TRICORE_INS_LD_BU, - TRICORE_INS_LD_B, - TRICORE_INS_LD_DA, - TRICORE_INS_LD_D, - TRICORE_INS_LD_HU, - TRICORE_INS_LD_H, - TRICORE_INS_LD_Q, - TRICORE_INS_LD_W, - TRICORE_INS_LEA, - TRICORE_INS_LHA, - TRICORE_INS_LOOPU, - TRICORE_INS_LOOP, - TRICORE_INS_LT_A, - TRICORE_INS_LT_B, - TRICORE_INS_LT_BU, - TRICORE_INS_LT_H, - TRICORE_INS_LT_HU, - TRICORE_INS_LT_U, - TRICORE_INS_LT_W, - TRICORE_INS_LT_WU, - TRICORE_INS_LT, - TRICORE_INS_MADDMS_H, - TRICORE_INS_MADDMS_U, - TRICORE_INS_MADDMS, - TRICORE_INS_MADDM_H, - TRICORE_INS_MADDM_Q, - TRICORE_INS_MADDM_U, - TRICORE_INS_MADDM, - TRICORE_INS_MADDRS_H, - TRICORE_INS_MADDRS_Q, - TRICORE_INS_MADDR_H, - TRICORE_INS_MADDR_Q, - TRICORE_INS_MADDSUMS_H, - TRICORE_INS_MADDSUM_H, - TRICORE_INS_MADDSURS_H, - TRICORE_INS_MADDSUR_H, - TRICORE_INS_MADDSUS_H, - TRICORE_INS_MADDSU_H, - TRICORE_INS_MADDS_H, - TRICORE_INS_MADDS_Q, - TRICORE_INS_MADDS_U, - TRICORE_INS_MADDS, - TRICORE_INS_MADD_F, - TRICORE_INS_MADD_H, - TRICORE_INS_MADD_Q, - TRICORE_INS_MADD_U, - TRICORE_INS_MADD, - TRICORE_INS_MAX_B, - TRICORE_INS_MAX_BU, - TRICORE_INS_MAX_H, - TRICORE_INS_MAX_HU, - TRICORE_INS_MAX_U, - TRICORE_INS_MAX, - TRICORE_INS_MFCR, - TRICORE_INS_MIN_B, - TRICORE_INS_MIN_BU, - TRICORE_INS_MIN_H, - TRICORE_INS_MIN_HU, - TRICORE_INS_MIN_U, - TRICORE_INS_MIN, - TRICORE_INS_MOVH_A, - TRICORE_INS_MOVH, - TRICORE_INS_MOVZ_A, - TRICORE_INS_MOV_AA, - TRICORE_INS_MOV_A, - TRICORE_INS_MOV_D, - TRICORE_INS_MOV_U, - TRICORE_INS_MOV, - TRICORE_INS_MSUBADMS_H, - TRICORE_INS_MSUBADM_H, - TRICORE_INS_MSUBADRS_H, - TRICORE_INS_MSUBADR_H, - TRICORE_INS_MSUBADS_H, - TRICORE_INS_MSUBAD_H, - TRICORE_INS_MSUBMS_H, - TRICORE_INS_MSUBMS_U, - TRICORE_INS_MSUBMS, - TRICORE_INS_MSUBM_H, - TRICORE_INS_MSUBM_Q, - TRICORE_INS_MSUBM_U, - TRICORE_INS_MSUBM, - TRICORE_INS_MSUBRS_H, - TRICORE_INS_MSUBRS_Q, - TRICORE_INS_MSUBR_H, - TRICORE_INS_MSUBR_Q, - TRICORE_INS_MSUBS_H, - TRICORE_INS_MSUBS_Q, - TRICORE_INS_MSUBS_U, - TRICORE_INS_MSUBS, - TRICORE_INS_MSUB_F, - TRICORE_INS_MSUB_H, - TRICORE_INS_MSUB_Q, - TRICORE_INS_MSUB_U, - TRICORE_INS_MSUB, - TRICORE_INS_MTCR, - TRICORE_INS_MULMS_H, - TRICORE_INS_MULM_H, - TRICORE_INS_MULM_U, - TRICORE_INS_MULM, - TRICORE_INS_MULR_H, - TRICORE_INS_MULR_Q, - TRICORE_INS_MULS_U, - TRICORE_INS_MULS, - TRICORE_INS_MUL_F, - TRICORE_INS_MUL_H, - TRICORE_INS_MUL_Q, - TRICORE_INS_MUL_U, - TRICORE_INS_MUL, - TRICORE_INS_NAND_T, - TRICORE_INS_NAND, - TRICORE_INS_NEZ_A, - TRICORE_INS_NE_A, - TRICORE_INS_NE, - TRICORE_INS_NOP, - TRICORE_INS_NOR_T, - TRICORE_INS_NOR, - TRICORE_INS_NOT, - TRICORE_INS_ORN_T, - TRICORE_INS_ORN, - TRICORE_INS_OR_ANDN_T, - TRICORE_INS_OR_AND_T, - TRICORE_INS_OR_EQ, - TRICORE_INS_OR_GE_U, - TRICORE_INS_OR_GE, - TRICORE_INS_OR_LT_U, - TRICORE_INS_OR_LT, - TRICORE_INS_OR_NE, - TRICORE_INS_OR_NOR_T, - TRICORE_INS_OR_OR_T, - TRICORE_INS_OR_T, - TRICORE_INS_OR, - TRICORE_INS_PACK, - TRICORE_INS_PARITY, - TRICORE_INS_POPCNT_W, - TRICORE_INS_Q31TOF, - TRICORE_INS_QSEED_F, - TRICORE_INS_RESTORE, - TRICORE_INS_RET, - TRICORE_INS_RFE, - TRICORE_INS_RFM, - TRICORE_INS_RSLCX, - TRICORE_INS_RSTV, - TRICORE_INS_RSUBS_U, - TRICORE_INS_RSUBS, - TRICORE_INS_RSUB, - TRICORE_INS_SAT_BU, - TRICORE_INS_SAT_B, - TRICORE_INS_SAT_HU, - TRICORE_INS_SAT_H, - TRICORE_INS_SELN_A, - TRICORE_INS_SELN, - TRICORE_INS_SEL_A, - TRICORE_INS_SEL, - TRICORE_INS_SHAS, - TRICORE_INS_SHA_B, - TRICORE_INS_SHA_H, - TRICORE_INS_SHA, - TRICORE_INS_SHUFFLE, - TRICORE_INS_SH_ANDN_T, - TRICORE_INS_SH_AND_T, - TRICORE_INS_SH_B, - TRICORE_INS_SH_EQ, - TRICORE_INS_SH_GE_U, - TRICORE_INS_SH_GE, - TRICORE_INS_SH_H, - TRICORE_INS_SH_LT_U, - TRICORE_INS_SH_LT, - TRICORE_INS_SH_NAND_T, - TRICORE_INS_SH_NE, - TRICORE_INS_SH_NOR_T, - TRICORE_INS_SH_ORN_T, - TRICORE_INS_SH_OR_T, - TRICORE_INS_SH_XNOR_T, - TRICORE_INS_SH_XOR_T, - TRICORE_INS_SH, - TRICORE_INS_STLCX, - TRICORE_INS_STUCX, - TRICORE_INS_ST_A, - TRICORE_INS_ST_B, - TRICORE_INS_ST_DA, - TRICORE_INS_ST_D, - TRICORE_INS_ST_H, - TRICORE_INS_ST_Q, - TRICORE_INS_ST_T, - TRICORE_INS_ST_W, - TRICORE_INS_SUBC, - TRICORE_INS_SUBSC_A, - TRICORE_INS_SUBS_BU, - TRICORE_INS_SUBS_B, - TRICORE_INS_SUBS_HU, - TRICORE_INS_SUBS_H, - TRICORE_INS_SUBS_U, - TRICORE_INS_SUBS, - TRICORE_INS_SUBX, - TRICORE_INS_SUB_A, - TRICORE_INS_SUB_B, - TRICORE_INS_SUB_F, - TRICORE_INS_SUB_H, - TRICORE_INS_SUB, - TRICORE_INS_SVLCX, - TRICORE_INS_SWAPMSK_W, - TRICORE_INS_SWAP_A, - TRICORE_INS_SWAP_W, - TRICORE_INS_SYSCALL, - TRICORE_INS_TLBDEMAP, - TRICORE_INS_TLBFLUSH_A, - TRICORE_INS_TLBFLUSH_B, - TRICORE_INS_TLBMAP, - TRICORE_INS_TLBPROBE_A, - TRICORE_INS_TLBPROBE_I, - TRICORE_INS_TRAPSV, - TRICORE_INS_TRAPV, - TRICORE_INS_UNPACK, - TRICORE_INS_UPDFL, - TRICORE_INS_UTOF, - TRICORE_INS_WAIT, - TRICORE_INS_XNOR_T, - TRICORE_INS_XNOR, - TRICORE_INS_XOR_EQ, - TRICORE_INS_XOR_GE_U, - TRICORE_INS_XOR_GE, - TRICORE_INS_XOR_LT_U, - TRICORE_INS_XOR_LT, - TRICORE_INS_XOR_NE, - TRICORE_INS_XOR, +GUM_API void gum_x86_writer_put_movq_xmm0_esp_offset_ptr (GumX86Writer * self, + gint8 offset); +GUM_API void gum_x86_writer_put_movq_eax_offset_ptr_xmm0 (GumX86Writer * self, + gint8 offset); +GUM_API void gum_x86_writer_put_movdqu_xmm0_esp_offset_ptr (GumX86Writer * self, + gint8 offset); +GUM_API void gum_x86_writer_put_movdqu_eax_offset_ptr_xmm0 (GumX86Writer * self, + gint8 offset); - // clang-format on - // generate content end - TRICORE_INS_ENDING, // <-- mark the end of the list of instructions -} tricore_insn; +GUM_API gboolean gum_x86_writer_put_lea_reg_reg_offset (GumX86Writer * self, + GumX86Reg dst_reg, GumX86Reg src_reg, gssize src_offset); -/// Group of TriCore instructions -typedef enum tricore_insn_group { - TRICORE_GRP_INVALID, ///< = CS_GRP_INVALID - /// Generic groups - TRICORE_GRP_CALL, ///< = CS_GRP_CALL - TRICORE_GRP_JUMP, ///< = CS_GRP_JUMP - TRICORE_GRP_ENDING, ///< mark the end of the list of groups -} tricore_insn_group; +GUM_API gboolean gum_x86_writer_put_xchg_reg_reg_ptr (GumX86Writer * self, + GumX86Reg left_reg, GumX86Reg right_reg); -typedef enum tricore_feature_t { - TRICORE_FEATURE_INVALID = 0, - // generate content begin - // clang-format off +GUM_API void gum_x86_writer_put_push_u32 (GumX86Writer * self, + guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_push_near_ptr (GumX86Writer * self, + GumAddress address); +GUM_API gboolean gum_x86_writer_put_push_reg (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_pop_reg (GumX86Writer * self, + GumX86Reg reg); +GUM_API void gum_x86_writer_put_push_imm_ptr (GumX86Writer * self, + gconstpointer imm_ptr); +GUM_API void gum_x86_writer_put_pushax (GumX86Writer * self); +GUM_API void gum_x86_writer_put_popax (GumX86Writer * self); +GUM_API void gum_x86_writer_put_pushfx (GumX86Writer * self); +GUM_API void gum_x86_writer_put_popfx (GumX86Writer * self); +GUM_API void gum_x86_writer_put_sahf (GumX86Writer * self); +GUM_API void gum_x86_writer_put_lahf (GumX86Writer * self); - TRICORE_FEATURE_HasV110 = 128, - TRICORE_FEATURE_HasV120_UP, - TRICORE_FEATURE_HasV130_UP, - TRICORE_FEATURE_HasV161, - TRICORE_FEATURE_HasV160_UP, - TRICORE_FEATURE_HasV131_UP, - TRICORE_FEATURE_HasV161_UP, - TRICORE_FEATURE_HasV162, - TRICORE_FEATURE_HasV162_UP, +GUM_API gboolean gum_x86_writer_put_test_reg_reg (GumX86Writer * self, + GumX86Reg reg_a, GumX86Reg reg_b); +GUM_API gboolean gum_x86_writer_put_test_reg_u32 (GumX86Writer * self, + GumX86Reg reg, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_cmp_reg_i32 (GumX86Writer * self, + GumX86Reg reg, gint32 imm_value); +GUM_API gboolean gum_x86_writer_put_cmp_reg_offset_ptr_reg (GumX86Writer * self, + GumX86Reg reg_a, gssize offset, GumX86Reg reg_b); +GUM_API void gum_x86_writer_put_cmp_imm_ptr_imm_u32 (GumX86Writer * self, + gconstpointer imm_ptr, guint32 imm_value); +GUM_API gboolean gum_x86_writer_put_cmp_reg_reg (GumX86Writer * self, + GumX86Reg reg_a, GumX86Reg reg_b); +GUM_API void gum_x86_writer_put_clc (GumX86Writer * self); +GUM_API void gum_x86_writer_put_stc (GumX86Writer * self); +GUM_API void gum_x86_writer_put_cld (GumX86Writer * self); +GUM_API void gum_x86_writer_put_std (GumX86Writer * self); - // clang-format on - // generate content end - TRICORE_FEATURE_ENDING, ///< mark the end of the list of features -} tricore_feature; +GUM_API void gum_x86_writer_put_cpuid (GumX86Writer * self); +GUM_API void gum_x86_writer_put_lfence (GumX86Writer * self); +GUM_API void gum_x86_writer_put_rdtsc (GumX86Writer * self); +GUM_API void gum_x86_writer_put_pause (GumX86Writer * self); +GUM_API void gum_x86_writer_put_nop (GumX86Writer * self); +GUM_API void gum_x86_writer_put_breakpoint (GumX86Writer * self); +GUM_API void gum_x86_writer_put_padding (GumX86Writer * self, guint n); +GUM_API void gum_x86_writer_put_nop_padding (GumX86Writer * self, guint n); -#ifdef __cplusplus -} -#endif +GUM_API gboolean gum_x86_writer_put_fxsave_reg_ptr (GumX86Writer * self, + GumX86Reg reg); +GUM_API gboolean gum_x86_writer_put_fxrstor_reg_ptr (GumX86Writer * self, + GumX86Reg reg); + +GUM_API void gum_x86_writer_put_u8 (GumX86Writer * self, guint8 value); +GUM_API void gum_x86_writer_put_s8 (GumX86Writer * self, gint8 value); +GUM_API void gum_x86_writer_put_bytes (GumX86Writer * self, const guint8 * data, + guint n); + +G_END_DECLS #endif +/* + * Copyright (C) 2010-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ -#define MAX_IMPL_W_REGS 20 -#define MAX_IMPL_R_REGS 20 -#define MAX_NUM_GROUPS 8 +#ifndef __GUM_ARM_WRITER_H__ +#define __GUM_ARM_WRITER_H__ -/// NOTE: All information in cs_detail is only available when CS_OPT_DETAIL = CS_OPT_ON -/// Initialized as memset(., 0, offsetof(cs_detail, ARCH)+sizeof(cs_ARCH)) -/// by ARCH_getInstruction in arch/ARCH/ARCHDisassembler.c -/// if cs_detail changes, in particular if a field is added after the union, -/// then update arch/ARCH/ARCHDisassembler.c accordingly -typedef struct cs_detail { - uint16_t regs_read - [MAX_IMPL_R_REGS]; ///< list of implicit registers read by this insn - uint8_t regs_read_count; ///< number of implicit registers read by this insn - uint16_t regs_write - [MAX_IMPL_W_REGS]; ///< list of implicit registers modified by this insn - uint8_t regs_write_count; ///< number of implicit registers modified by this insn +#define GUM_ARM_B_MAX_DISTANCE 0x01fffffc - uint8_t groups[MAX_NUM_GROUPS]; ///< list of group this instruction belong to - uint8_t groups_count; ///< number of groups this insn belongs to +G_BEGIN_DECLS - bool writeback; ///< Instruction has writeback operands. +typedef struct _GumArmWriter GumArmWriter; - /// Architecture-specific instruction info - union { - cs_x86 x86; ///< X86 architecture, including 16-bit, 32-bit & 64-bit mode - cs_arm64 arm64; ///< ARM64 architecture (aka AArch64) - cs_arm arm; ///< ARM architecture (including Thumb/Thumb2) - cs_m68k m68k; ///< M68K architecture - cs_mips mips; ///< MIPS architecture - cs_ppc ppc; ///< PowerPC architecture - cs_sparc sparc; ///< Sparc architecture - cs_sysz sysz; ///< SystemZ architecture - cs_xcore xcore; ///< XCore architecture - cs_tms320c64x tms320c64x; ///< TMS320C64x architecture - cs_m680x m680x; ///< M680X architecture - cs_evm evm; ///< Ethereum architecture - cs_mos65xx mos65xx; ///< MOS65XX architecture (including MOS6502) - cs_wasm wasm; ///< Web Assembly architecture - cs_bpf bpf; ///< Berkeley Packet Filter architecture (including eBPF) - cs_riscv riscv; ///< RISCV architecture - cs_sh sh; ///< SH architecture - cs_tricore tricore; ///< TriCore architecture - }; -} cs_detail; +struct _GumArmWriter +{ + volatile gint ref_count; + gboolean flush_on_destroy; -/// Detail information of disassembled instruction -typedef struct cs_insn { - /// Instruction ID (basically a numeric ID for the instruction mnemonic) - /// Find the instruction id in the '[ARCH]_insn' enum in the header file - /// of corresponding architecture, such as 'arm_insn' in arm.h for ARM, - /// 'x86_insn' in x86.h for X86, etc... - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - /// NOTE: in Skipdata mode, "data" instruction has 0 for this id field. - unsigned int id; + GumOS target_os; + GumCpuFeatures cpu_features; - /// Address (EIP) of this instruction - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - uint64_t address; + guint32 * base; + guint32 * code; + GumAddress pc; - /// Size of this instruction - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - uint16_t size; + GumMetalHashTable * label_defs; + GumMetalArray label_refs; + GumMetalArray literal_refs; + const guint32 * earliest_literal_insn; +}; - /// Machine bytes of this instruction, with number of bytes indicated by @size above - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - uint8_t bytes[24]; +GUM_API GumArmWriter * gum_arm_writer_new (gpointer code_address); +GUM_API GumArmWriter * gum_arm_writer_ref (GumArmWriter * writer); +GUM_API void gum_arm_writer_unref (GumArmWriter * writer); - /// Ascii text of instruction mnemonic - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - char mnemonic[CS_MNEMONIC_SIZE]; +GUM_API void gum_arm_writer_init (GumArmWriter * writer, gpointer code_address); +GUM_API void gum_arm_writer_clear (GumArmWriter * writer); - /// Ascii text of instruction operands - /// This information is available even when CS_OPT_DETAIL = CS_OPT_OFF - char op_str[160]; +GUM_API void gum_arm_writer_reset (GumArmWriter * writer, + gpointer code_address); +GUM_API void gum_arm_writer_set_target_os (GumArmWriter * self, GumOS os); - /// Pointer to cs_detail. - /// NOTE: detail pointer is only valid when both requirements below are met: - /// (1) CS_OP_DETAIL = CS_OPT_ON - /// (2) Engine is not in Skipdata mode (CS_OP_SKIPDATA option set to CS_OPT_ON) - /// - /// NOTE 2: when in Skipdata mode, or when detail mode is OFF, even if this pointer - /// is not NULL, its content is still irrelevant. - cs_detail *detail; -} cs_insn; +GUM_API gpointer gum_arm_writer_cur (GumArmWriter * self); +GUM_API guint gum_arm_writer_offset (GumArmWriter * self); +GUM_API void gum_arm_writer_skip (GumArmWriter * self, guint n_bytes); +GUM_API gboolean gum_arm_writer_flush (GumArmWriter * self); -/// Calculate the offset of a disassembled instruction in its buffer, given its position -/// in its array of disassembled insn -/// NOTE: this macro works with position (>=1), not index -#define CS_INSN_OFFSET(insns, post) (insns[post - 1].address - insns[0].address) +GUM_API gboolean gum_arm_writer_put_label (GumArmWriter * self, + gconstpointer id); +GUM_API void gum_arm_writer_put_call_address_with_arguments ( + GumArmWriter * self, GumAddress func, guint n_args, ...); +GUM_API void gum_arm_writer_put_call_address_with_arguments_array ( + GumArmWriter * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_arm_writer_put_call_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_call_reg_with_arguments (GumArmWriter * self, + arm_reg reg, guint n_args, ...); +GUM_API void gum_arm_writer_put_call_reg_with_arguments_array ( + GumArmWriter * self, arm_reg reg, guint n_args, const GumArgument * args); -/// All type of errors encountered by Capstone API. -/// These are values returned by cs_errno() -typedef enum cs_err { - CS_ERR_OK = 0, ///< No error: everything was fine - CS_ERR_MEM, ///< Out-Of-Memory error: cs_open(), cs_disasm(), cs_disasm_iter() - CS_ERR_ARCH, ///< Unsupported architecture: cs_open() - CS_ERR_HANDLE, ///< Invalid handle: cs_op_count(), cs_op_index() - CS_ERR_CSH, ///< Invalid csh argument: cs_close(), cs_errno(), cs_option() - CS_ERR_MODE, ///< Invalid/unsupported mode: cs_open() - CS_ERR_OPTION, ///< Invalid/unsupported option: cs_option() - CS_ERR_DETAIL, ///< Information is unavailable because detail option is OFF - CS_ERR_MEMSETUP, ///< Dynamic memory management uninitialized (see CS_OPT_MEM) - CS_ERR_VERSION, ///< Unsupported version (bindings) - CS_ERR_DIET, ///< Access irrelevant data in "diet" engine - CS_ERR_SKIPDATA, ///< Access irrelevant data for "data" instruction in SKIPDATA mode - CS_ERR_X86_ATT, ///< X86 AT&T syntax is unsupported (opt-out at compile time) - CS_ERR_X86_INTEL, ///< X86 Intel syntax is unsupported (opt-out at compile time) - CS_ERR_X86_MASM, ///< X86 Masm syntax is unsupported (opt-out at compile time) -} cs_err; +GUM_API void gum_arm_writer_put_branch_address (GumArmWriter * self, + GumAddress address); -/** - Return combined API version & major and minor version numbers. +GUM_API gboolean gum_arm_writer_can_branch_directly_between ( + GumArmWriter * self, GumAddress from, GumAddress to); +GUM_API gboolean gum_arm_writer_put_b_imm (GumArmWriter * self, + GumAddress target); +GUM_API gboolean gum_arm_writer_put_b_cond_imm (GumArmWriter * self, + arm_cc cc, GumAddress target); +GUM_API void gum_arm_writer_put_b_label (GumArmWriter * self, + gconstpointer label_id); +GUM_API void gum_arm_writer_put_b_cond_label (GumArmWriter * self, + arm_cc cc, gconstpointer label_id); +GUM_API gboolean gum_arm_writer_put_bl_imm (GumArmWriter * self, + GumAddress target); +GUM_API gboolean gum_arm_writer_put_blx_imm (GumArmWriter * self, + GumAddress target); +GUM_API void gum_arm_writer_put_bl_label (GumArmWriter * self, + gconstpointer label_id); +GUM_API void gum_arm_writer_put_bx_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_bl_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_blx_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_ret (GumArmWriter * self); - @major: major number of API version - @minor: minor number of API version +GUM_API void gum_arm_writer_put_push_regs (GumArmWriter * self, guint n, ...); +GUM_API void gum_arm_writer_put_pop_regs (GumArmWriter * self, guint n, ...); +GUM_API gboolean gum_arm_writer_put_vpush_range (GumArmWriter * self, + arm_reg first_reg, arm_reg last_reg); +GUM_API gboolean gum_arm_writer_put_vpop_range (GumArmWriter * self, + arm_reg first_reg, arm_reg last_reg); - @return hexical number as (major << 8 | minor), which encodes both - major & minor versions. - NOTE: This returned value can be compared with version number made - with macro CS_MAKE_VERSION +GUM_API gboolean gum_arm_writer_put_ldr_reg_address (GumArmWriter * self, + arm_reg reg, GumAddress address); +GUM_API gboolean gum_arm_writer_put_ldr_reg_u32 (GumArmWriter * self, + arm_reg reg, guint32 val); +GUM_API gboolean gum_arm_writer_put_ldr_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API gboolean gum_arm_writer_put_ldr_reg_reg_offset (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, gssize src_offset); +GUM_API gboolean gum_arm_writer_put_ldr_cond_reg_reg_offset ( + GumArmWriter * self, arm_cc cc, arm_reg dst_reg, arm_reg src_reg, + gssize src_offset); +GUM_API void gum_arm_writer_put_ldmia_reg_mask (GumArmWriter * self, + arm_reg reg, guint16 mask); +GUM_API void gum_arm_writer_put_ldmia_reg_mask_wb (GumArmWriter * self, + arm_reg reg, guint16 mask); +GUM_API gboolean gum_arm_writer_put_str_reg_reg (GumArmWriter * self, + arm_reg src_reg, arm_reg dst_reg); +GUM_API gboolean gum_arm_writer_put_str_reg_reg_offset (GumArmWriter * self, + arm_reg src_reg, arm_reg dst_reg, gssize dst_offset); +GUM_API gboolean gum_arm_writer_put_str_cond_reg_reg_offset ( + GumArmWriter * self, arm_cc cc, arm_reg src_reg, + arm_reg dst_reg, gssize dst_offset); +GUM_API void gum_arm_writer_put_mov_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_arm_writer_put_mov_reg_reg_shift (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, arm_shifter shift, + guint16 shift_value); +GUM_API void gum_arm_writer_put_mov_reg_cpsr (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_mov_cpsr_reg (GumArmWriter * self, arm_reg reg); +GUM_API void gum_arm_writer_put_add_reg_u16 (GumArmWriter * self, + arm_reg dst_reg, guint16 val); +GUM_API void gum_arm_writer_put_add_reg_u32 (GumArmWriter * self, + arm_reg dst_reg, guint32 val); +GUM_API void gum_arm_writer_put_add_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_add_reg_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); +GUM_API void gum_arm_writer_put_add_reg_reg_reg_shift (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2, arm_shifter shift, + guint16 shift_value); +GUM_API void gum_arm_writer_put_sub_reg_u16 (GumArmWriter * self, + arm_reg dst_reg, guint16 val); +GUM_API void gum_arm_writer_put_sub_reg_u32 (GumArmWriter * self, + arm_reg dst_reg, guint32 val); +GUM_API void gum_arm_writer_put_sub_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_sub_reg_reg_reg (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); +GUM_API void gum_arm_writer_put_rsb_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_ands_reg_reg_imm (GumArmWriter * self, + arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); +GUM_API void gum_arm_writer_put_cmp_reg_imm (GumArmWriter * self, + arm_reg dst_reg, guint32 imm_val); - For example, second API version would return 1 in @major, and 1 in @minor - The return value would be 0x0101 +GUM_API void gum_arm_writer_put_nop (GumArmWriter * self); +GUM_API void gum_arm_writer_put_breakpoint (GumArmWriter * self); +GUM_API void gum_arm_writer_put_brk_imm (GumArmWriter * self, + guint16 imm); - NOTE: if you only care about returned value, but not major and minor values, - set both @major & @minor arguments to NULL. -*/ -CAPSTONE_EXPORT -unsigned int CAPSTONE_API cs_version(int *major, int *minor); +GUM_API void gum_arm_writer_put_instruction (GumArmWriter * self, guint32 insn); +GUM_API gboolean gum_arm_writer_put_bytes (GumArmWriter * self, + const guint8 * data, guint n); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_arm(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_arm64(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_mips(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_x86(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_ppc(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_sparc(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_sysz(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_xcore(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_m68k(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_tms320c64x(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_m680x(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_evm(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_mos65xx(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_wasm(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_bpf(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_riscv(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_sh(void); -CAPSTONE_EXPORT -void CAPSTONE_API cs_arch_register_tricore(void); +G_END_DECLS -/** - This API can be used to either ask for archs supported by this library, - or check to see if the library was compile with 'diet' option (or called - in 'diet' mode). +#endif +/* + * Copyright (C) 2010-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ - To check if a particular arch is supported by this library, set @query to - arch mode (CS_ARCH_* value). - To verify if this library supports all the archs, use CS_ARCH_ALL. +#ifndef __GUM_THUMB_WRITER_H__ +#define __GUM_THUMB_WRITER_H__ - To check if this library is in 'diet' mode, set @query to CS_SUPPORT_DIET. - @return True if this library supports the given arch, or in 'diet' mode. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_support(int query); +#define GUM_THUMB_B_MAX_DISTANCE 0x00fffffe + +G_BEGIN_DECLS + +typedef struct _GumThumbWriter GumThumbWriter; + +struct _GumThumbWriter +{ + volatile gint ref_count; + gboolean flush_on_destroy; + + GumOS target_os; + + guint16 * base; + guint16 * code; + GumAddress pc; + + GumMetalHashTable * label_defs; + GumMetalArray label_refs; + GumMetalArray literal_refs; + const guint16 * earliest_literal_insn; +}; + +GUM_API GumThumbWriter * gum_thumb_writer_new (gpointer code_address); +GUM_API GumThumbWriter * gum_thumb_writer_ref (GumThumbWriter * writer); +GUM_API void gum_thumb_writer_unref (GumThumbWriter * writer); + +GUM_API void gum_thumb_writer_init (GumThumbWriter * writer, + gpointer code_address); +GUM_API void gum_thumb_writer_clear (GumThumbWriter * writer); + +GUM_API void gum_thumb_writer_reset (GumThumbWriter * writer, + gpointer code_address); +GUM_API void gum_thumb_writer_set_target_os (GumThumbWriter * self, GumOS os); + +GUM_API gpointer gum_thumb_writer_cur (GumThumbWriter * self); +GUM_API guint gum_thumb_writer_offset (GumThumbWriter * self); +GUM_API void gum_thumb_writer_skip (GumThumbWriter * self, guint n_bytes); + +GUM_API gboolean gum_thumb_writer_flush (GumThumbWriter * self); + +GUM_API gboolean gum_thumb_writer_put_label (GumThumbWriter * self, + gconstpointer id); +GUM_API gboolean gum_thumb_writer_commit_label (GumThumbWriter * self, + gconstpointer id); + +GUM_API void gum_thumb_writer_put_call_address_with_arguments ( + GumThumbWriter * self, GumAddress func, guint n_args, ...); +GUM_API void gum_thumb_writer_put_call_address_with_arguments_array ( + GumThumbWriter * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_thumb_writer_put_call_reg_with_arguments ( + GumThumbWriter * self, arm_reg reg, guint n_args, ...); +GUM_API void gum_thumb_writer_put_call_reg_with_arguments_array ( + GumThumbWriter * self, arm_reg reg, guint n_args, const GumArgument * args); + +GUM_API void gum_thumb_writer_put_branch_address (GumThumbWriter * self, + GumAddress address); + +GUM_API gboolean gum_thumb_writer_can_branch_directly_between ( + GumThumbWriter * self, GumAddress from, GumAddress to); +GUM_API void gum_thumb_writer_put_b_imm (GumThumbWriter * self, + GumAddress target); +GUM_API void gum_thumb_writer_put_b_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_b_label_wide (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_bx_reg (GumThumbWriter * self, arm_reg reg); +GUM_API void gum_thumb_writer_put_bl_imm (GumThumbWriter * self, + GumAddress target); +GUM_API void gum_thumb_writer_put_bl_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_blx_imm (GumThumbWriter * self, + GumAddress target); +GUM_API void gum_thumb_writer_put_blx_reg (GumThumbWriter * self, arm_reg reg); +GUM_API void gum_thumb_writer_put_cmp_reg_imm (GumThumbWriter * self, + arm_reg reg, guint8 imm_value); +GUM_API void gum_thumb_writer_put_beq_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_bne_label (GumThumbWriter * self, + gconstpointer label_id); +GUM_API void gum_thumb_writer_put_b_cond_label (GumThumbWriter * self, + arm_cc cc, gconstpointer label_id); +GUM_API void gum_thumb_writer_put_b_cond_label_wide (GumThumbWriter * self, + arm_cc cc, gconstpointer label_id); +GUM_API void gum_thumb_writer_put_cbz_reg_label (GumThumbWriter * self, + arm_reg reg, gconstpointer label_id); +GUM_API void gum_thumb_writer_put_cbnz_reg_label (GumThumbWriter * self, + arm_reg reg, gconstpointer label_id); + +GUM_API gboolean gum_thumb_writer_put_push_regs (GumThumbWriter * self, + guint n_regs, arm_reg first_reg, ...); +GUM_API gboolean gum_thumb_writer_put_push_regs_array (GumThumbWriter * self, + guint n_regs, const arm_reg * regs); +GUM_API gboolean gum_thumb_writer_put_pop_regs (GumThumbWriter * self, + guint n_regs, arm_reg first_reg, ...); +GUM_API gboolean gum_thumb_writer_put_pop_regs_array (GumThumbWriter * self, + guint n_regs, const arm_reg * regs); +GUM_API gboolean gum_thumb_writer_put_vpush_range (GumThumbWriter * self, + arm_reg first_reg, arm_reg last_reg); +GUM_API gboolean gum_thumb_writer_put_vpop_range (GumThumbWriter * self, + arm_reg first_reg, arm_reg last_reg); +GUM_API gboolean gum_thumb_writer_put_ldr_reg_address (GumThumbWriter * self, + arm_reg reg, GumAddress address); +GUM_API gboolean gum_thumb_writer_put_ldr_reg_u32 (GumThumbWriter * self, + arm_reg reg, guint32 val); +GUM_API void gum_thumb_writer_put_ldr_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API gboolean gum_thumb_writer_put_ldr_reg_reg_offset (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg, gsize src_offset); +GUM_API void gum_thumb_writer_put_ldrb_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +void gum_thumb_writer_put_ldrh_reg_reg (GumThumbWriter * self, arm_reg dst_reg, + arm_reg src_reg); +GUM_API gboolean gum_thumb_writer_put_vldr_reg_reg_offset ( + GumThumbWriter * self, arm_reg dst_reg, arm_reg src_reg, gssize src_offset); +GUM_API void gum_thumb_writer_put_ldmia_reg_mask (GumThumbWriter * self, + arm_reg reg, guint16 mask); +GUM_API void gum_thumb_writer_put_str_reg_reg (GumThumbWriter * self, + arm_reg src_reg, arm_reg dst_reg); +GUM_API gboolean gum_thumb_writer_put_str_reg_reg_offset (GumThumbWriter * self, + arm_reg src_reg, arm_reg dst_reg, gsize dst_offset); +GUM_API void gum_thumb_writer_put_mov_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_thumb_writer_put_mov_reg_u8 (GumThumbWriter * self, + arm_reg dst_reg, guint8 imm_value); +GUM_API void gum_thumb_writer_put_mov_reg_cpsr (GumThumbWriter * self, + arm_reg reg); +GUM_API void gum_thumb_writer_put_mov_cpsr_reg (GumThumbWriter * self, + arm_reg reg); +GUM_API gboolean gum_thumb_writer_put_add_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, gssize imm_value); +GUM_API void gum_thumb_writer_put_add_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_thumb_writer_put_add_reg_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); +GUM_API gboolean gum_thumb_writer_put_add_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_sub_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, gssize imm_value); +GUM_API void gum_thumb_writer_put_sub_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg src_reg); +GUM_API void gum_thumb_writer_put_sub_reg_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); +GUM_API gboolean gum_thumb_writer_put_sub_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_and_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_or_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, gssize right_value); +GUM_API gboolean gum_thumb_writer_put_lsl_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, guint8 right_value); +GUM_API gboolean gum_thumb_writer_put_lsls_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, guint8 right_value); +GUM_API gboolean gum_thumb_writer_put_lsrs_reg_reg_imm (GumThumbWriter * self, + arm_reg dst_reg, arm_reg left_reg, guint8 right_value); +GUM_API gboolean gum_thumb_writer_put_mrs_reg_reg (GumThumbWriter * self, + arm_reg dst_reg, arm_sysreg src_reg); +GUM_API gboolean gum_thumb_writer_put_msr_reg_reg (GumThumbWriter * self, + arm_sysreg dst_reg, arm_reg src_reg); -/** - Initialize CS handle: this must be done before any usage of CS. +GUM_API void gum_thumb_writer_put_nop (GumThumbWriter * self); +GUM_API void gum_thumb_writer_put_bkpt_imm (GumThumbWriter * self, guint8 imm); +GUM_API void gum_thumb_writer_put_breakpoint (GumThumbWriter * self); - @arch: architecture type (CS_ARCH_*) - @mode: hardware mode. This is combined of CS_MODE_* - @handle: pointer to handle, which will be updated at return time +GUM_API void gum_thumb_writer_put_instruction (GumThumbWriter * self, + guint16 insn); +GUM_API void gum_thumb_writer_put_instruction_wide (GumThumbWriter * self, + guint16 upper, guint16 lower); +GUM_API gboolean gum_thumb_writer_put_bytes (GumThumbWriter * self, + const guint8 * data, guint n); - @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum - for detailed error). -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_open(cs_arch arch, cs_mode mode, csh *handle); +G_END_DECLS -/** - Close CS handle: MUST do to release the handle when it is not used anymore. - NOTE: this must be only called when there is no longer usage of Capstone, - not even access to cs_insn array. The reason is the this API releases some - cached memory, thus access to any Capstone API after cs_close() might crash - your application. +#endif +/* + * Copyright (C) 2014-2023 Ole André Vadla Ravnås + * Copyright (C) 2017 Antonio Ken Iannillo + * Copyright (C) 2023 Håvard Sørbø + * Copyright (C) 2023 Fabian Freyer + * + * Licence: wxWindows Library Licence, Version 3.1 + */ - In fact,this API invalidate @handle by ZERO out its value (i.e *handle = 0). +#ifndef __GUM_ARM64_WRITER_H__ +#define __GUM_ARM64_WRITER_H__ - @handle: pointer to a handle returned by cs_open() - @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum - for detailed error). -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_close(csh *handle); +#define GUM_ARM64_ADRP_MAX_DISTANCE 0xfffff000 +#define GUM_ARM64_B_MAX_DISTANCE 0x07fffffc -/** - Set option for disassembling engine at runtime +#define GUM_ARM64_SYSREG(op0, op1, crn, crm, op2) \ + ( \ + (((op0 == 2) ? 0 : 1) << 14) | \ + (op1 << 11) | \ + (crn << 7) | \ + (crm << 3) | \ + op2 \ + ) +#define GUM_ARM64_SYSREG_TPIDRRO_EL0 GUM_ARM64_SYSREG (3, 3, 13, 0, 3) - @handle: handle returned by cs_open() - @type: type of option to be set - @value: option value corresponding with @type +G_BEGIN_DECLS - @return: CS_ERR_OK on success, or other value on failure. - Refer to cs_err enum for detailed error. +typedef struct _GumArm64Writer GumArm64Writer; +typedef guint GumArm64IndexMode; - NOTE: in the case of CS_OPT_MEM, handle's value can be anything, - so that cs_option(handle, CS_OPT_MEM, value) can (i.e must) be called - even before cs_open() -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_option(csh handle, cs_opt_type type, size_t value); +struct _GumArm64Writer +{ + volatile gint ref_count; + gboolean flush_on_destroy; -/** - Report the last error number when some API function fail. - Like glibc's errno, cs_errno might not retain its old value once accessed. + GumOS target_os; + GumPtrauthSupport ptrauth_support; + GumAddress (* sign) (GumAddress value); - @handle: handle returned by cs_open() + guint32 * base; + guint32 * code; + GumAddress pc; - @return: error code of cs_err enum type (CS_ERR_*, see above) -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_errno(csh handle); + GumMetalHashTable * label_defs; + GumMetalArray label_refs; + GumMetalArray literal_refs; + const guint32 * earliest_literal_insn; +}; +enum _GumArm64IndexMode +{ + GUM_INDEX_POST_ADJUST = 1, + GUM_INDEX_SIGNED_OFFSET = 2, + GUM_INDEX_PRE_ADJUST = 3, +}; -/** - Return a string describing given error code. +GUM_API GumArm64Writer * gum_arm64_writer_new (gpointer code_address); +GUM_API GumArm64Writer * gum_arm64_writer_ref (GumArm64Writer * writer); +GUM_API void gum_arm64_writer_unref (GumArm64Writer * writer); - @code: error code (see CS_ERR_* above) +GUM_API void gum_arm64_writer_init (GumArm64Writer * writer, + gpointer code_address); +GUM_API void gum_arm64_writer_clear (GumArm64Writer * writer); - @return: returns a pointer to a string that describes the error code - passed in the argument @code -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_strerror(cs_err code); +GUM_API void gum_arm64_writer_reset (GumArm64Writer * writer, + gpointer code_address); -/** - Disassemble binary code, given the code buffer, size, address and number - of instructions to be decoded. - This API dynamically allocate memory to contain disassembled instruction. - Resulting instructions will be put into @*insn +GUM_API gpointer gum_arm64_writer_cur (GumArm64Writer * self); +GUM_API guint gum_arm64_writer_offset (GumArm64Writer * self); +GUM_API void gum_arm64_writer_skip (GumArm64Writer * self, guint n_bytes); - NOTE 1: this API will automatically determine memory needed to contain - output disassembled instructions in @insn. +GUM_API gboolean gum_arm64_writer_flush (GumArm64Writer * self); - NOTE 2: caller must free the allocated memory itself to avoid memory leaking. +GUM_API gboolean gum_arm64_writer_put_label (GumArm64Writer * self, + gconstpointer id); - NOTE 3: for system with scarce memory to be dynamically allocated such as - OS kernel or firmware, the API cs_disasm_iter() might be a better choice than - cs_disasm(). The reason is that with cs_disasm(), based on limited available - memory, we have to calculate in advance how many instructions to be disassembled, - which complicates things. This is especially troublesome for the case @count=0, - when cs_disasm() runs uncontrollably (until either end of input buffer, or - when it encounters an invalid instruction). - - @handle: handle returned by cs_open() - @code: buffer containing raw binary code to be disassembled. - @code_size: size of the above code buffer. - @address: address of the first instruction in given raw code buffer. - @insn: array of instructions filled in by this API. - NOTE: @insn will be allocated by this function, and should be freed - with cs_free() API. - @count: number of instructions to be disassembled, or 0 to get all of them +GUM_API void gum_arm64_writer_put_call_address_with_arguments ( + GumArm64Writer * self, GumAddress func, guint n_args, ...); +GUM_API void gum_arm64_writer_put_call_address_with_arguments_array ( + GumArm64Writer * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_arm64_writer_put_call_reg_with_arguments ( + GumArm64Writer * self, arm64_reg reg, guint n_args, ...); +GUM_API void gum_arm64_writer_put_call_reg_with_arguments_array ( + GumArm64Writer * self, arm64_reg reg, guint n_args, + const GumArgument * args); - @return: the number of successfully disassembled instructions, - or 0 if this function failed to disassemble the given code +GUM_API void gum_arm64_writer_put_branch_address (GumArm64Writer * self, + GumAddress address); - On failure, call cs_errno() for error code. -*/ -CAPSTONE_EXPORT -size_t CAPSTONE_API cs_disasm(csh handle, - const uint8_t *code, size_t code_size, - uint64_t address, - size_t count, - cs_insn **insn); +GUM_API gboolean gum_arm64_writer_can_branch_directly_between ( + GumArm64Writer * self, GumAddress from, GumAddress to); +GUM_API gboolean gum_arm64_writer_put_b_imm (GumArm64Writer * self, + GumAddress address); +GUM_API void gum_arm64_writer_put_b_label (GumArm64Writer * self, + gconstpointer label_id); +GUM_API void gum_arm64_writer_put_b_cond_label (GumArm64Writer * self, + arm64_cc cc, gconstpointer label_id); +GUM_API gboolean gum_arm64_writer_put_bl_imm (GumArm64Writer * self, + GumAddress address); +GUM_API void gum_arm64_writer_put_bl_label (GumArm64Writer * self, + gconstpointer label_id); +GUM_API gboolean gum_arm64_writer_put_br_reg (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_br_reg_no_auth (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_blr_reg (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_blr_reg_no_auth (GumArm64Writer * self, + arm64_reg reg); +GUM_API void gum_arm64_writer_put_ret (GumArm64Writer * self); +GUM_API gboolean gum_arm64_writer_put_ret_reg (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_cbz_reg_imm (GumArm64Writer * self, + arm64_reg reg, GumAddress target); +GUM_API gboolean gum_arm64_writer_put_cbnz_reg_imm (GumArm64Writer * self, + arm64_reg reg, GumAddress target); +GUM_API void gum_arm64_writer_put_cbz_reg_label (GumArm64Writer * self, + arm64_reg reg, gconstpointer label_id); +GUM_API void gum_arm64_writer_put_cbnz_reg_label (GumArm64Writer * self, + arm64_reg reg, gconstpointer label_id); +GUM_API gboolean gum_arm64_writer_put_tbz_reg_imm_imm (GumArm64Writer * self, + arm64_reg reg, guint bit, GumAddress target); +GUM_API gboolean gum_arm64_writer_put_tbnz_reg_imm_imm (GumArm64Writer * self, + arm64_reg reg, guint bit, GumAddress target); +GUM_API void gum_arm64_writer_put_tbz_reg_imm_label (GumArm64Writer * self, + arm64_reg reg, guint bit, gconstpointer label_id); +GUM_API void gum_arm64_writer_put_tbnz_reg_imm_label (GumArm64Writer * self, + arm64_reg reg, guint bit, gconstpointer label_id); -/** - Free memory allocated by cs_malloc() or cs_disasm() (argument @insn) +GUM_API gboolean gum_arm64_writer_put_push_reg_reg (GumArm64Writer * self, + arm64_reg reg_a, arm64_reg reg_b); +GUM_API gboolean gum_arm64_writer_put_pop_reg_reg (GumArm64Writer * self, + arm64_reg reg_a, arm64_reg reg_b); +GUM_API void gum_arm64_writer_put_push_all_x_registers (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_pop_all_x_registers (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_push_all_q_registers (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_pop_all_q_registers (GumArm64Writer * self); - @insn: pointer returned by @insn argument in cs_disasm() or cs_malloc() - @count: number of cs_insn structures returned by cs_disasm(), or 1 - to free memory allocated by cs_malloc(). -*/ -CAPSTONE_EXPORT -void CAPSTONE_API cs_free(cs_insn *insn, size_t count); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_address (GumArm64Writer * self, + arm64_reg reg, GumAddress address); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_u32 (GumArm64Writer * self, + arm64_reg reg, guint32 val); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_u64 (GumArm64Writer * self, + arm64_reg reg, guint64 val); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_u32_ptr (GumArm64Writer * self, + arm64_reg reg, GumAddress src_address); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_u64_ptr (GumArm64Writer * self, + arm64_reg reg, GumAddress src_address); +GUM_API guint gum_arm64_writer_put_ldr_reg_ref (GumArm64Writer * self, + arm64_reg reg); +GUM_API void gum_arm64_writer_put_ldr_reg_value (GumArm64Writer * self, + guint ref, GumAddress value); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg_offset (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg, gsize src_offset); +GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg_offset_mode ( + GumArm64Writer * self, arm64_reg dst_reg, arm64_reg src_reg, + gssize src_offset, GumArm64IndexMode mode); +GUM_API gboolean gum_arm64_writer_put_ldrsw_reg_reg_offset ( + GumArm64Writer * self, arm64_reg dst_reg, arm64_reg src_reg, + gsize src_offset); +GUM_API gboolean gum_arm64_writer_put_adrp_reg_address (GumArm64Writer * self, + arm64_reg reg, GumAddress address); +GUM_API gboolean gum_arm64_writer_put_str_reg_reg (GumArm64Writer * self, + arm64_reg src_reg, arm64_reg dst_reg); +GUM_API gboolean gum_arm64_writer_put_str_reg_reg_offset (GumArm64Writer * self, + arm64_reg src_reg, arm64_reg dst_reg, gsize dst_offset); +GUM_API gboolean gum_arm64_writer_put_str_reg_reg_offset_mode ( + GumArm64Writer * self, arm64_reg src_reg, arm64_reg dst_reg, + gssize dst_offset, GumArm64IndexMode mode); +GUM_API gboolean gum_arm64_writer_put_ldp_reg_reg_reg_offset ( + GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_src, + gssize src_offset, GumArm64IndexMode mode); +GUM_API gboolean gum_arm64_writer_put_stp_reg_reg_reg_offset ( + GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_dst, + gssize dst_offset, GumArm64IndexMode mode); +GUM_API gboolean gum_arm64_writer_put_mov_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg); +GUM_API void gum_arm64_writer_put_mov_reg_nzcv (GumArm64Writer * self, + arm64_reg reg); +GUM_API void gum_arm64_writer_put_mov_nzcv_reg (GumArm64Writer * self, + arm64_reg reg); +GUM_API gboolean gum_arm64_writer_put_uxtw_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg); +GUM_API gboolean gum_arm64_writer_put_add_reg_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); +GUM_API gboolean gum_arm64_writer_put_add_reg_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); +GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); +GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); +GUM_API gboolean gum_arm64_writer_put_and_reg_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, guint64 right_value); +GUM_API gboolean gum_arm64_writer_put_eor_reg_reg_reg (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); +GUM_API gboolean gum_arm64_writer_put_ubfm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg, guint8 imms, guint8 immr); +GUM_API gboolean gum_arm64_writer_put_lsl_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg, guint8 shift); +GUM_API gboolean gum_arm64_writer_put_lsr_reg_imm (GumArm64Writer * self, + arm64_reg dst_reg, arm64_reg src_reg, guint8 shift); +GUM_API gboolean gum_arm64_writer_put_tst_reg_imm (GumArm64Writer * self, + arm64_reg reg, guint64 imm_value); +GUM_API gboolean gum_arm64_writer_put_cmp_reg_reg (GumArm64Writer * self, + arm64_reg reg_a, arm64_reg reg_b); +GUM_API gboolean gum_arm64_writer_put_xpaci_reg (GumArm64Writer * self, + arm64_reg reg); -/** - Allocate memory for 1 instruction to be used by cs_disasm_iter(). +GUM_API void gum_arm64_writer_put_nop (GumArm64Writer * self); +GUM_API void gum_arm64_writer_put_brk_imm (GumArm64Writer * self, guint16 imm); +GUM_API gboolean gum_arm64_writer_put_mrs (GumArm64Writer * self, + arm64_reg dst_reg, guint16 system_reg); - @handle: handle returned by cs_open() +GUM_API void gum_arm64_writer_put_instruction (GumArm64Writer * self, + guint32 insn); +GUM_API gboolean gum_arm64_writer_put_bytes (GumArm64Writer * self, + const guint8 * data, guint n); - NOTE: when no longer in use, you can reclaim the memory allocated for - this instruction with cs_free(insn, 1) -*/ -CAPSTONE_EXPORT -cs_insn * CAPSTONE_API cs_malloc(csh handle); +GUM_API GumAddress gum_arm64_writer_sign (GumArm64Writer * self, + GumAddress value); -/** - Fast API to disassemble binary code, given the code buffer, size, address - and number of instructions to be decoded. - This API puts the resulting instruction into a given cache in @insn. - See tests/test_iter.c for sample code demonstrating this API. +G_END_DECLS - NOTE 1: this API will update @code, @size & @address to point to the next - instruction in the input buffer. Therefore, it is convenient to use - cs_disasm_iter() inside a loop to quickly iterate all the instructions. - While decoding one instruction at a time can also be achieved with - cs_disasm(count=1), some benchmarks shown that cs_disasm_iter() can be 30% - faster on random input. +#endif +/* + * Copyright (C) 2014-2022 Ole André Vadla Ravnås + * Copyright (C) 2019 Jon Wilson + * + * Licence: wxWindows Library Licence, Version 3.1 + */ - NOTE 2: the cache in @insn can be created with cs_malloc() API. +#ifndef __GUM_MIPS_WRITER_H__ +#define __GUM_MIPS_WRITER_H__ - NOTE 3: for system with scarce memory to be dynamically allocated such as - OS kernel or firmware, this API is recommended over cs_disasm(), which - allocates memory based on the number of instructions to be disassembled. - The reason is that with cs_disasm(), based on limited available memory, - we have to calculate in advance how many instructions to be disassembled, - which complicates things. This is especially troublesome for the case - @count=0, when cs_disasm() runs uncontrollably (until either end of input - buffer, or when it encounters an invalid instruction). - - @handle: handle returned by cs_open() - @code: buffer containing raw binary code to be disassembled - @size: size of above code - @address: address of the first insn in given raw code buffer - @insn: pointer to instruction to be filled in by this API. - @return: true if this API successfully decode 1 instruction, - or false otherwise. +#define GUM_MIPS_J_MAX_DISTANCE (1 << 28) - On failure, call cs_errno() for error code. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_disasm_iter(csh handle, - const uint8_t **code, size_t *size, - uint64_t *address, cs_insn *insn); +G_BEGIN_DECLS -/** - Return friendly name of register in a string. - Find the instruction id from header file of corresponding architecture (arm.h for ARM, - x86.h for X86, ...) +typedef struct _GumMipsWriter GumMipsWriter; - WARN: when in 'diet' mode, this API is irrelevant because engine does not - store register name. +struct _GumMipsWriter +{ + volatile gint ref_count; + gboolean flush_on_destroy; - @handle: handle returned by cs_open() - @reg_id: register id + guint32 * base; + guint32 * code; + GumAddress pc; - @return: string name of the register, or NULL if @reg_id is invalid. -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_reg_name(csh handle, unsigned int reg_id); + GumMetalHashTable * label_defs; + GumMetalArray label_refs; +}; -/** - Return friendly name of an instruction in a string. - Find the instruction id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) +GUM_API GumMipsWriter * gum_mips_writer_new (gpointer code_address); +GUM_API GumMipsWriter * gum_mips_writer_ref (GumMipsWriter * writer); +GUM_API void gum_mips_writer_unref (GumMipsWriter * writer); - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - store instruction name. +GUM_API void gum_mips_writer_init (GumMipsWriter * writer, + gpointer code_address); +GUM_API void gum_mips_writer_clear (GumMipsWriter * writer); - @handle: handle returned by cs_open() - @insn_id: instruction id +GUM_API void gum_mips_writer_reset (GumMipsWriter * writer, + gpointer code_address); - @return: string name of the instruction, or NULL if @insn_id is invalid. -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_insn_name(csh handle, unsigned int insn_id); +GUM_API gpointer gum_mips_writer_cur (GumMipsWriter * self); +GUM_API guint gum_mips_writer_offset (GumMipsWriter * self); +GUM_API void gum_mips_writer_skip (GumMipsWriter * self, guint n_bytes); -/** - Return friendly name of a group id (that an instruction can belong to) - Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) +GUM_API gboolean gum_mips_writer_flush (GumMipsWriter * self); - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - store group name. +GUM_API gboolean gum_mips_writer_put_label (GumMipsWriter * self, + gconstpointer id); - @handle: handle returned by cs_open() - @group_id: group id +GUM_API void gum_mips_writer_put_call_address_with_arguments ( + GumMipsWriter * self, GumAddress func, guint n_args, ...); +GUM_API void gum_mips_writer_put_call_address_with_arguments_array ( + GumMipsWriter * self, GumAddress func, guint n_args, + const GumArgument * args); +GUM_API void gum_mips_writer_put_call_reg_with_arguments (GumMipsWriter * self, + mips_reg reg, guint n_args, ...); +GUM_API void gum_mips_writer_put_call_reg_with_arguments_array ( + GumMipsWriter * self, mips_reg reg, guint n_args, const GumArgument * args); - @return: string name of the group, or NULL if @group_id is invalid. -*/ -CAPSTONE_EXPORT -const char * CAPSTONE_API cs_group_name(csh handle, unsigned int group_id); +GUM_API gboolean gum_mips_writer_can_branch_directly_between (GumAddress from, + GumAddress to); +GUM_API gboolean gum_mips_writer_put_j_address (GumMipsWriter * self, + GumAddress address); +GUM_API gboolean gum_mips_writer_put_j_address_without_nop ( + GumMipsWriter * self, GumAddress address); +GUM_API void gum_mips_writer_put_j_label (GumMipsWriter * self, + gconstpointer label_id); +GUM_API void gum_mips_writer_put_jr_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_jal_address (GumMipsWriter * self, + guint32 address); +GUM_API void gum_mips_writer_put_jalr_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_b_offset (GumMipsWriter * self, gint32 offset); +GUM_API void gum_mips_writer_put_beq_reg_reg_label (GumMipsWriter * self, + mips_reg right_reg, mips_reg left_reg, gconstpointer label_id); +GUM_API void gum_mips_writer_put_ret (GumMipsWriter * self); -/** - Check if a disassembled instruction belong to a particular group. - Find the group id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - Internally, this simply verifies if @group_id matches any member of insn->groups array. +GUM_API void gum_mips_writer_put_la_reg_address (GumMipsWriter * self, + mips_reg reg, GumAddress address); +GUM_API void gum_mips_writer_put_lui_reg_imm (GumMipsWriter * self, + mips_reg reg, guint imm); +GUM_API void gum_mips_writer_put_dsll_reg_reg (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg, guint amount); +GUM_API void gum_mips_writer_put_ori_reg_reg_imm (GumMipsWriter * self, + mips_reg rt, mips_reg rs, guint imm); +GUM_API void gum_mips_writer_put_ld_reg_reg_offset (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg, gsize src_offset); +GUM_API void gum_mips_writer_put_lw_reg_reg_offset (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg, gsize src_offset); +GUM_API void gum_mips_writer_put_sw_reg_reg_offset (GumMipsWriter * self, + mips_reg src_reg, mips_reg dst_reg, gsize dst_offset); +GUM_API void gum_mips_writer_put_move_reg_reg (GumMipsWriter * self, + mips_reg dst_reg, mips_reg src_reg); +GUM_API void gum_mips_writer_put_addu_reg_reg_reg (GumMipsWriter * self, + mips_reg dst_reg, mips_reg left_reg, mips_reg right_reg); +GUM_API void gum_mips_writer_put_addi_reg_reg_imm (GumMipsWriter * self, + mips_reg dst_reg, mips_reg left_reg, gint32 imm); +GUM_API void gum_mips_writer_put_addi_reg_imm (GumMipsWriter * self, + mips_reg dst_reg, gint32 imm); +GUM_API void gum_mips_writer_put_sub_reg_reg_imm (GumMipsWriter * self, + mips_reg dst_reg, mips_reg left_reg, gint32 imm); - NOTE: this API is only valid when detail option is ON (which is OFF by default). +GUM_API void gum_mips_writer_put_push_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_pop_reg (GumMipsWriter * self, mips_reg reg); - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - update @groups array. +GUM_API void gum_mips_writer_put_mfhi_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_mflo_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_mthi_reg (GumMipsWriter * self, mips_reg reg); +GUM_API void gum_mips_writer_put_mtlo_reg (GumMipsWriter * self, mips_reg reg); - @handle: handle returned by cs_open() - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @group_id: group that you want to check if this instruction belong to. +GUM_API void gum_mips_writer_put_nop (GumMipsWriter * self); +GUM_API void gum_mips_writer_put_break (GumMipsWriter * self); - @return: true if this instruction indeed belongs to the given group, or false otherwise. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_insn_group(csh handle, const cs_insn *insn, unsigned int group_id); +GUM_API void gum_mips_writer_put_prologue_trampoline (GumMipsWriter * self, + mips_reg reg, GumAddress address); -/** - Check if a disassembled instruction IMPLICITLY used a particular register. - Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - Internally, this simply verifies if @reg_id matches any member of insn->regs_read array. +GUM_API void gum_mips_writer_put_instruction (GumMipsWriter * self, + guint32 insn); +GUM_API gboolean gum_mips_writer_put_bytes (GumMipsWriter * self, + const guint8 * data, guint n); - NOTE: this API is only valid when detail option is ON (which is OFF by default) +G_END_DECLS - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - update @regs_read array. +#endif - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @reg_id: register that you want to check if this instruction used it. +G_BEGIN_DECLS - @return: true if this instruction indeed implicitly used the given register, or false otherwise. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_reg_read(csh handle, const cs_insn *insn, unsigned int reg_id); +#define GUM_TYPE_STALKER (gum_stalker_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumStalker, gum_stalker, GUM, STALKER, GObject) -/** - Check if a disassembled instruction IMPLICITLY modified a particular register. - Find the register id from header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) - Internally, this simply verifies if @reg_id matches any member of insn->regs_write array. +#define GUM_TYPE_STALKER_TRANSFORMER (gum_stalker_transformer_get_type ()) +GUM_DECLARE_INTERFACE (GumStalkerTransformer, gum_stalker_transformer, GUM, + STALKER_TRANSFORMER, GObject) - NOTE: this API is only valid when detail option is ON (which is OFF by default) +#define GUM_TYPE_DEFAULT_STALKER_TRANSFORMER \ + (gum_default_stalker_transformer_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumDefaultStalkerTransformer, + gum_default_stalker_transformer, + GUM, DEFAULT_STALKER_TRANSFORMER, + GObject) - WARN: when in 'diet' mode, this API is irrelevant because the engine does not - update @regs_write array. +#define GUM_TYPE_CALLBACK_STALKER_TRANSFORMER \ + (gum_callback_stalker_transformer_get_type ()) +GUM_DECLARE_FINAL_TYPE (GumCallbackStalkerTransformer, + gum_callback_stalker_transformer, + GUM, CALLBACK_STALKER_TRANSFORMER, + GObject) - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @reg_id: register that you want to check if this instruction modified it. +#define GUM_TYPE_STALKER_OBSERVER (gum_stalker_observer_get_type ()) +GUM_DECLARE_INTERFACE (GumStalkerObserver, gum_stalker_observer, GUM, + STALKER_OBSERVER, GObject) - @return: true if this instruction indeed implicitly modified the given register, or false otherwise. -*/ -CAPSTONE_EXPORT -bool CAPSTONE_API cs_reg_write(csh handle, const cs_insn *insn, unsigned int reg_id); +typedef struct _GumStalkerIterator GumStalkerIterator; +typedef struct _GumStalkerOutput GumStalkerOutput; +typedef struct _GumBackpatch GumBackpatch; +typedef struct _GumBackpatchInstruction GumBackpatchInstruction; +typedef void (* GumStalkerIncrementFunc) (GumStalkerObserver * self); +typedef void (* GumStalkerNotifyBackpatchFunc) (GumStalkerObserver * self, + const GumBackpatch * backpatch, gsize size); +typedef void (* GumStalkerSwitchCallbackFunc) (GumStalkerObserver * self, + gpointer from_address, gpointer start_address, gpointer from_insn, + gpointer * target); +typedef union _GumStalkerWriter GumStalkerWriter; +typedef void (* GumStalkerTransformerCallback) (GumStalkerIterator * iterator, + GumStalkerOutput * output, gpointer user_data); +typedef void (* GumStalkerCallout) (GumCpuContext * cpu_context, + gpointer user_data); -/** - Count the number of operands of a given type. - Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) +typedef guint GumProbeId; +typedef struct _GumCallDetails GumCallDetails; +typedef void (* GumCallProbeCallback) (GumCallDetails * details, + gpointer user_data); +typedef void (* GumStalkerRunOnThreadFunc) (const GumCpuContext * cpu_context, + gpointer user_data); - NOTE: this API is only valid when detail option is ON (which is OFF by default) +#ifndef GUM_DIET - @handle: handle returned by cs_open() - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @op_type: Operand type to be found. +struct _GumStalkerTransformerInterface +{ + GTypeInterface parent; - @return: number of operands of given type @op_type in instruction @insn, - or -1 on failure. -*/ -CAPSTONE_EXPORT -int CAPSTONE_API cs_op_count(csh handle, const cs_insn *insn, unsigned int op_type); + void (* transform_block) (GumStalkerTransformer * self, + GumStalkerIterator * iterator, GumStalkerOutput * output); +}; -/** - Retrieve the position of operand of given type in .operands[] array. - Later, the operand can be accessed using the returned position. - Find the operand type in header file of corresponding architecture (arm.h for ARM, x86.h for X86, ...) +struct _GumStalkerObserverInterface +{ + GTypeInterface parent; - NOTE: this API is only valid when detail option is ON (which is OFF by default) + /* Common */ + GumStalkerIncrementFunc increment_total; - @handle: handle returned by cs_open() - @insn: disassembled instruction structure received from cs_disasm() or cs_disasm_iter() - @op_type: Operand type to be found. - @position: position of the operand to be found. This must be in the range - [1, cs_op_count(handle, insn, op_type)] + GumStalkerIncrementFunc increment_call_imm; + GumStalkerIncrementFunc increment_call_reg; - @return: index of operand of given type @op_type in .operands[] array - in instruction @insn, or -1 on failure. -*/ -CAPSTONE_EXPORT -int CAPSTONE_API cs_op_index(csh handle, const cs_insn *insn, unsigned int op_type, - unsigned int position); + /* x86 only */ + GumStalkerIncrementFunc increment_call_mem; -/// Type of array to keep the list of registers -typedef uint16_t cs_regs[64]; + /* Arm64 only */ + GumStalkerIncrementFunc increment_excluded_call_reg; -/** - Retrieve all the registers accessed by an instruction, either explicitly or - implicitly. + /* x86 only */ + GumStalkerIncrementFunc increment_ret_slow_path; - WARN: when in 'diet' mode, this API is irrelevant because engine does not - store registers. + /* Arm64 only */ + GumStalkerIncrementFunc increment_ret; - @handle: handle returned by cs_open() - @insn: disassembled instruction structure returned from cs_disasm() or cs_disasm_iter() - @regs_read: on return, this array contains all registers read by instruction. - @regs_read_count: number of registers kept inside @regs_read array. - @regs_write: on return, this array contains all registers written by instruction. - @regs_write_count: number of registers kept inside @regs_write array. + /* Common */ + GumStalkerIncrementFunc increment_post_call_invoke; + GumStalkerIncrementFunc increment_excluded_call_imm; - @return CS_ERR_OK on success, or other value on failure (refer to cs_err enum - for detailed error). -*/ -CAPSTONE_EXPORT -cs_err CAPSTONE_API cs_regs_access(csh handle, const cs_insn *insn, - cs_regs regs_read, uint8_t *regs_read_count, - cs_regs regs_write, uint8_t *regs_write_count); + /* Common */ + GumStalkerIncrementFunc increment_jmp_imm; + GumStalkerIncrementFunc increment_jmp_reg; -#ifdef __cplusplus -} -#endif + /* x86 only */ + GumStalkerIncrementFunc increment_jmp_mem; + GumStalkerIncrementFunc increment_jmp_cond_imm; + GumStalkerIncrementFunc increment_jmp_cond_mem; + GumStalkerIncrementFunc increment_jmp_cond_reg; + GumStalkerIncrementFunc increment_jmp_cond_jcxz; -#endif -/* - * Copyright (C) 2009-2022 Ole André Vadla Ravnås - * Copyright (C) 2023 Fabian Freyer - * Copyright (C) 2024 Yannis Juglaret - * - * Licence: wxWindows Library Licence, Version 3.1 - */ + /* Arm64 only */ + GumStalkerIncrementFunc increment_jmp_cond_cc; + GumStalkerIncrementFunc increment_jmp_cond_cbz; + GumStalkerIncrementFunc increment_jmp_cond_cbnz; + GumStalkerIncrementFunc increment_jmp_cond_tbz; + GumStalkerIncrementFunc increment_jmp_cond_tbnz; -#ifndef __GUM_X86_WRITER_H__ -#define __GUM_X86_WRITER_H__ + /* Common */ + GumStalkerIncrementFunc increment_jmp_continuation; + /* x86 only */ + GumStalkerIncrementFunc increment_sysenter_slow_path; + GumStalkerNotifyBackpatchFunc notify_backpatch; -G_BEGIN_DECLS + GumStalkerSwitchCallbackFunc switch_callback; +}; -typedef struct _GumX86Writer GumX86Writer; -typedef guint GumX86Reg; -typedef guint GumX86PtrTarget; +#endif -struct _GumX86Writer +union _GumStalkerWriter { - volatile gint ref_count; - gboolean flush_on_destroy; - - GumCpuType target_cpu; - GumAbiType target_abi; - GumCpuFeatures cpu_features; - - guint8 * base; - guint8 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; + gpointer instance; + GumX86Writer * x86; + GumArmWriter * arm; + GumThumbWriter * thumb; + GumArm64Writer * arm64; + GumMipsWriter * mips; }; -enum _GumX86Reg +struct _GumStalkerOutput { - /* 32-bit */ - GUM_X86_EAX = 0, - GUM_X86_ECX, - GUM_X86_EDX, - GUM_X86_EBX, - GUM_X86_ESP, - GUM_X86_EBP, - GUM_X86_ESI, - GUM_X86_EDI, - - GUM_X86_R8D, - GUM_X86_R9D, - GUM_X86_R10D, - GUM_X86_R11D, - GUM_X86_R12D, - GUM_X86_R13D, - GUM_X86_R14D, - GUM_X86_R15D, + GumStalkerWriter writer; + GumInstructionEncoding encoding; +}; - GUM_X86_EIP, +struct _GumCallDetails +{ + gpointer target_address; + gpointer return_address; + gpointer stack_data; + GumCpuContext * cpu_context; +}; - /* 64-bit */ - GUM_X86_RAX, - GUM_X86_RCX, - GUM_X86_RDX, - GUM_X86_RBX, - GUM_X86_RSP, - GUM_X86_RBP, - GUM_X86_RSI, - GUM_X86_RDI, +GUM_API gboolean gum_stalker_is_supported (void); - GUM_X86_R8, - GUM_X86_R9, - GUM_X86_R10, - GUM_X86_R11, - GUM_X86_R12, - GUM_X86_R13, - GUM_X86_R14, - GUM_X86_R15, +GUM_API void gum_stalker_activate_experimental_unwind_support (void); - GUM_X86_RIP, +GUM_API GumStalker * gum_stalker_new (void); - /* Meta */ - GUM_X86_XAX, - GUM_X86_XCX, - GUM_X86_XDX, - GUM_X86_XBX, - GUM_X86_XSP, - GUM_X86_XBP, - GUM_X86_XSI, - GUM_X86_XDI, +GUM_API void gum_stalker_exclude (GumStalker * self, + const GumMemoryRange * range); - GUM_X86_XIP, +GUM_API gint gum_stalker_get_trust_threshold (GumStalker * self); +GUM_API void gum_stalker_set_trust_threshold (GumStalker * self, + gint trust_threshold); - GUM_X86_NONE -}; +GUM_API void gum_stalker_flush (GumStalker * self); +GUM_API void gum_stalker_stop (GumStalker * self); +GUM_API gboolean gum_stalker_garbage_collect (GumStalker * self); -enum _GumX86PtrTarget -{ - GUM_X86_PTR_BYTE, - GUM_X86_PTR_DWORD, - GUM_X86_PTR_QWORD -}; +GUM_API void gum_stalker_follow_me (GumStalker * self, + GumStalkerTransformer * transformer, GumEventSink * sink); +GUM_API void gum_stalker_unfollow_me (GumStalker * self); +GUM_API gboolean gum_stalker_is_following_me (GumStalker * self); -GUM_API GumX86Writer * gum_x86_writer_new (gpointer code_address); -GUM_API GumX86Writer * gum_x86_writer_ref (GumX86Writer * writer); -GUM_API void gum_x86_writer_unref (GumX86Writer * writer); +GUM_API void gum_stalker_follow (GumStalker * self, GumThreadId thread_id, + GumStalkerTransformer * transformer, GumEventSink * sink); +GUM_API void gum_stalker_unfollow (GumStalker * self, GumThreadId thread_id); -GUM_API void gum_x86_writer_init (GumX86Writer * writer, - gpointer code_address); -GUM_API void gum_x86_writer_clear (GumX86Writer * writer); +GUM_API void gum_stalker_activate (GumStalker * self, gconstpointer target); +GUM_API void gum_stalker_deactivate (GumStalker * self); -GUM_API void gum_x86_writer_reset (GumX86Writer * writer, - gpointer code_address); -GUM_API void gum_x86_writer_set_target_cpu (GumX86Writer * self, - GumCpuType cpu_type); -GUM_API void gum_x86_writer_set_target_abi (GumX86Writer * self, - GumAbiType abi_type); +GUM_API void gum_stalker_set_observer (GumStalker * self, + GumStalkerObserver * observer); -GUM_API gpointer gum_x86_writer_cur (GumX86Writer * self); -GUM_API guint gum_x86_writer_offset (GumX86Writer * self); +GUM_API void gum_stalker_prefetch (GumStalker * self, gconstpointer address, + gint recycle_count); +GUM_API void gum_stalker_prefetch_backpatch (GumStalker * self, + const GumBackpatch * notification); +GUM_API void gum_stalker_recompile (GumStalker * self, gconstpointer address); -GUM_API gboolean gum_x86_writer_flush (GumX86Writer * self); +GUM_API gpointer gum_stalker_backpatch_get_from ( + const GumBackpatch * backpatch); +GUM_API gpointer gum_stalker_backpatch_get_to ( + const GumBackpatch * backpatch); -GUM_API GumX86Reg gum_x86_writer_get_cpu_register_for_nth_argument ( - GumX86Writer * self, guint n); +GUM_API void gum_stalker_invalidate (GumStalker * self, gconstpointer address); +GUM_API void gum_stalker_invalidate_for_thread (GumStalker * self, + GumThreadId thread_id, gconstpointer address); -GUM_API gboolean gum_x86_writer_put_label (GumX86Writer * self, - gconstpointer id); +GUM_API GumProbeId gum_stalker_add_call_probe (GumStalker * self, + gpointer target_address, GumCallProbeCallback callback, gpointer data, + GDestroyNotify notify); +GUM_API void gum_stalker_remove_call_probe (GumStalker * self, + GumProbeId id); -GUM_API gboolean gum_x86_writer_can_branch_directly_between (GumAddress from, - GumAddress to); -GUM_API gboolean gum_x86_writer_put_call_address_with_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_address_with_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_address_with_aligned_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumAddress func, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_reg_with_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_reg_with_aligned_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - gssize offset, guint n_args, ...); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - gssize offset, guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - gssize offset, guint n_args, ...); -GUM_API gboolean - gum_x86_writer_put_call_reg_offset_ptr_with_aligned_arguments_array ( - GumX86Writer * self, GumCallingConvention conv, GumX86Reg reg, - gssize offset, guint n_args, const GumArgument * args); -GUM_API gboolean gum_x86_writer_put_call_address (GumX86Writer * self, - GumAddress address); -GUM_API gboolean gum_x86_writer_put_call_reg (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_call_reg_offset_ptr (GumX86Writer * self, - GumX86Reg reg, gssize offset); -GUM_API gboolean gum_x86_writer_put_call_indirect (GumX86Writer * self, - GumAddress addr); -GUM_API gboolean gum_x86_writer_put_call_indirect_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API void gum_x86_writer_put_call_near_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API void gum_x86_writer_put_leave (GumX86Writer * self); -GUM_API void gum_x86_writer_put_ret (GumX86Writer * self); -GUM_API void gum_x86_writer_put_ret_imm (GumX86Writer * self, - guint16 imm_value); -GUM_API gboolean gum_x86_writer_put_jmp_address (GumX86Writer * self, - GumAddress address); -GUM_API void gum_x86_writer_put_jmp_short_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API void gum_x86_writer_put_jmp_near_label (GumX86Writer * self, - gconstpointer label_id); -GUM_API gboolean gum_x86_writer_put_jmp_reg (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_jmp_reg_ptr (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_jmp_reg_offset_ptr (GumX86Writer * self, - GumX86Reg reg, gssize offset); -GUM_API gboolean gum_x86_writer_put_jmp_near_ptr (GumX86Writer * self, - GumAddress address); -GUM_API gboolean gum_x86_writer_put_jcc_short (GumX86Writer * self, - x86_insn instruction_id, gconstpointer target, GumBranchHint hint); -GUM_API gboolean gum_x86_writer_put_jcc_near (GumX86Writer * self, - x86_insn instruction_id, gconstpointer target, GumBranchHint hint); -GUM_API void gum_x86_writer_put_jcc_short_label (GumX86Writer * self, - x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); -GUM_API void gum_x86_writer_put_jcc_near_label (GumX86Writer * self, - x86_insn instruction_id, gconstpointer label_id, GumBranchHint hint); +GUM_API gboolean gum_stalker_run_on_thread (GumStalker * self, + GumThreadId thread_id, GumStalkerRunOnThreadFunc func, gpointer data, + GDestroyNotify data_destroy); +GUM_API gboolean gum_stalker_run_on_thread_sync (GumStalker * self, + GumThreadId thread_id, GumStalkerRunOnThreadFunc func, gpointer data); -GUM_API gboolean gum_x86_writer_put_add_reg_imm (GumX86Writer * self, - GumX86Reg reg, gssize imm_value); -GUM_API gboolean gum_x86_writer_put_add_reg_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_add_reg_near_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumAddress src_address); -GUM_API gboolean gum_x86_writer_put_sub_reg_imm (GumX86Writer * self, - GumX86Reg reg, gssize imm_value); -GUM_API gboolean gum_x86_writer_put_sub_reg_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_sub_reg_near_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumAddress src_address); -GUM_API gboolean gum_x86_writer_put_inc_reg (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_dec_reg (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_inc_reg_ptr (GumX86Writer * self, - GumX86PtrTarget target, GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_dec_reg_ptr (GumX86Writer * self, - GumX86PtrTarget target, GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_lock_xadd_reg_ptr_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_lock_cmpxchg_reg_ptr_reg ( - GumX86Writer * self, GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_lock_inc_imm32_ptr (GumX86Writer * self, - gpointer target); -GUM_API gboolean gum_x86_writer_put_lock_dec_imm32_ptr (GumX86Writer * self, - gpointer target); +GUM_API GumStalkerTransformer * gum_stalker_transformer_make_default (void); +GUM_API GumStalkerTransformer * gum_stalker_transformer_make_from_callback ( + GumStalkerTransformerCallback callback, gpointer data, + GDestroyNotify data_destroy); -GUM_API gboolean gum_x86_writer_put_and_reg_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_and_reg_u32 (GumX86Writer * self, - GumX86Reg reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_shl_reg_u8 (GumX86Writer * self, - GumX86Reg reg, guint8 imm_value); -GUM_API gboolean gum_x86_writer_put_shr_reg_u8 (GumX86Writer * self, - GumX86Reg reg, guint8 imm_value); -GUM_API gboolean gum_x86_writer_put_xor_reg_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); +GUM_API void gum_stalker_transformer_transform_block ( + GumStalkerTransformer * self, GumStalkerIterator * iterator, + GumStalkerOutput * output); -GUM_API gboolean gum_x86_writer_put_mov_reg_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_u32 (GumX86Writer * self, - GumX86Reg dst_reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_mov_reg_u64 (GumX86Writer * self, - GumX86Reg dst_reg, guint64 imm_value); -GUM_API void gum_x86_writer_put_mov_reg_address (GumX86Writer * self, - GumX86Reg dst_reg, GumAddress address); -GUM_API void gum_x86_writer_put_mov_reg_ptr_u32 (GumX86Writer * self, - GumX86Reg dst_reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_u32 (GumX86Writer * self, - GumX86Reg dst_reg, gssize dst_offset, guint32 imm_value); -GUM_API void gum_x86_writer_put_mov_reg_ptr_reg (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_offset_ptr_reg (GumX86Writer * self, - GumX86Reg dst_reg, gssize dst_offset, GumX86Reg src_reg); -GUM_API void gum_x86_writer_put_mov_reg_reg_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_reg_offset_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg, gssize src_offset); -GUM_API gboolean gum_x86_writer_put_mov_reg_base_index_scale_offset_ptr ( - GumX86Writer * self, GumX86Reg dst_reg, GumX86Reg base_reg, - GumX86Reg index_reg, guint8 scale, gssize offset); +GUM_API gboolean gum_stalker_iterator_next (GumStalkerIterator * self, + const cs_insn ** insn); +GUM_API void gum_stalker_iterator_keep (GumStalkerIterator * self); +GUM_API GumMemoryAccess gum_stalker_iterator_get_memory_access ( + GumStalkerIterator * self); +GUM_API void gum_stalker_iterator_put_callout (GumStalkerIterator * self, + GumStalkerCallout callout, gpointer data, GDestroyNotify data_destroy); +GUM_API void gum_stalker_iterator_put_chaining_return ( + GumStalkerIterator * self); +GUM_API csh gum_stalker_iterator_get_capstone (GumStalkerIterator * self); -GUM_API gboolean gum_x86_writer_put_mov_reg_near_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumAddress src_address); -GUM_API gboolean gum_x86_writer_put_mov_near_ptr_reg (GumX86Writer * self, - GumAddress dst_address, GumX86Reg src_reg); +#define GUM_DECLARE_OBSERVER_INCREMENT(name) \ + GUM_API void gum_stalker_observer_increment_##name ( \ + GumStalkerObserver * observer); -GUM_API gboolean gum_x86_writer_put_mov_fs_u32_ptr_reg (GumX86Writer * self, - guint32 fs_offset, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_fs_u32_ptr (GumX86Writer * self, - GumX86Reg dst_reg, guint32 fs_offset); -GUM_API void gum_x86_writer_put_mov_fs_reg_ptr_reg (GumX86Writer * self, - GumX86Reg fs_offset, GumX86Reg src_reg); -GUM_API void gum_x86_writer_put_mov_reg_fs_reg_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg fs_offset); -GUM_API gboolean gum_x86_writer_put_mov_gs_u32_ptr_reg (GumX86Writer * self, - guint32 fs_offset, GumX86Reg src_reg); -GUM_API gboolean gum_x86_writer_put_mov_reg_gs_u32_ptr (GumX86Writer * self, - GumX86Reg dst_reg, guint32 fs_offset); -GUM_API void gum_x86_writer_put_mov_gs_reg_ptr_reg (GumX86Writer * self, - GumX86Reg gs_offset, GumX86Reg src_reg); -GUM_API void gum_x86_writer_put_mov_reg_gs_reg_ptr (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg gs_offset); +GUM_DECLARE_OBSERVER_INCREMENT (total) -GUM_API void gum_x86_writer_put_movq_xmm0_esp_offset_ptr (GumX86Writer * self, - gint8 offset); -GUM_API void gum_x86_writer_put_movq_eax_offset_ptr_xmm0 (GumX86Writer * self, - gint8 offset); -GUM_API void gum_x86_writer_put_movdqu_xmm0_esp_offset_ptr (GumX86Writer * self, - gint8 offset); -GUM_API void gum_x86_writer_put_movdqu_eax_offset_ptr_xmm0 (GumX86Writer * self, - gint8 offset); +GUM_DECLARE_OBSERVER_INCREMENT (call_imm) +GUM_DECLARE_OBSERVER_INCREMENT (call_reg) -GUM_API gboolean gum_x86_writer_put_lea_reg_reg_offset (GumX86Writer * self, - GumX86Reg dst_reg, GumX86Reg src_reg, gssize src_offset); +GUM_DECLARE_OBSERVER_INCREMENT (call_mem) -GUM_API gboolean gum_x86_writer_put_xchg_reg_reg_ptr (GumX86Writer * self, - GumX86Reg left_reg, GumX86Reg right_reg); +GUM_DECLARE_OBSERVER_INCREMENT (excluded_call_reg) -GUM_API void gum_x86_writer_put_push_u32 (GumX86Writer * self, - guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_push_near_ptr (GumX86Writer * self, - GumAddress address); -GUM_API gboolean gum_x86_writer_put_push_reg (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_pop_reg (GumX86Writer * self, - GumX86Reg reg); -GUM_API void gum_x86_writer_put_push_imm_ptr (GumX86Writer * self, - gconstpointer imm_ptr); -GUM_API void gum_x86_writer_put_pushax (GumX86Writer * self); -GUM_API void gum_x86_writer_put_popax (GumX86Writer * self); -GUM_API void gum_x86_writer_put_pushfx (GumX86Writer * self); -GUM_API void gum_x86_writer_put_popfx (GumX86Writer * self); -GUM_API void gum_x86_writer_put_sahf (GumX86Writer * self); -GUM_API void gum_x86_writer_put_lahf (GumX86Writer * self); +GUM_DECLARE_OBSERVER_INCREMENT (ret_slow_path) -GUM_API gboolean gum_x86_writer_put_test_reg_reg (GumX86Writer * self, - GumX86Reg reg_a, GumX86Reg reg_b); -GUM_API gboolean gum_x86_writer_put_test_reg_u32 (GumX86Writer * self, - GumX86Reg reg, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_cmp_reg_i32 (GumX86Writer * self, - GumX86Reg reg, gint32 imm_value); -GUM_API gboolean gum_x86_writer_put_cmp_reg_offset_ptr_reg (GumX86Writer * self, - GumX86Reg reg_a, gssize offset, GumX86Reg reg_b); -GUM_API void gum_x86_writer_put_cmp_imm_ptr_imm_u32 (GumX86Writer * self, - gconstpointer imm_ptr, guint32 imm_value); -GUM_API gboolean gum_x86_writer_put_cmp_reg_reg (GumX86Writer * self, - GumX86Reg reg_a, GumX86Reg reg_b); -GUM_API void gum_x86_writer_put_clc (GumX86Writer * self); -GUM_API void gum_x86_writer_put_stc (GumX86Writer * self); -GUM_API void gum_x86_writer_put_cld (GumX86Writer * self); -GUM_API void gum_x86_writer_put_std (GumX86Writer * self); +GUM_DECLARE_OBSERVER_INCREMENT (ret) -GUM_API void gum_x86_writer_put_cpuid (GumX86Writer * self); -GUM_API void gum_x86_writer_put_lfence (GumX86Writer * self); -GUM_API void gum_x86_writer_put_rdtsc (GumX86Writer * self); -GUM_API void gum_x86_writer_put_pause (GumX86Writer * self); -GUM_API void gum_x86_writer_put_nop (GumX86Writer * self); -GUM_API void gum_x86_writer_put_breakpoint (GumX86Writer * self); -GUM_API void gum_x86_writer_put_padding (GumX86Writer * self, guint n); -GUM_API void gum_x86_writer_put_nop_padding (GumX86Writer * self, guint n); +GUM_DECLARE_OBSERVER_INCREMENT (post_call_invoke) +GUM_DECLARE_OBSERVER_INCREMENT (excluded_call_imm) -GUM_API gboolean gum_x86_writer_put_fxsave_reg_ptr (GumX86Writer * self, - GumX86Reg reg); -GUM_API gboolean gum_x86_writer_put_fxrstor_reg_ptr (GumX86Writer * self, - GumX86Reg reg); +GUM_DECLARE_OBSERVER_INCREMENT (jmp_imm) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_reg) -GUM_API void gum_x86_writer_put_u8 (GumX86Writer * self, guint8 value); -GUM_API void gum_x86_writer_put_s8 (GumX86Writer * self, gint8 value); -GUM_API void gum_x86_writer_put_bytes (GumX86Writer * self, const guint8 * data, - guint n); +GUM_DECLARE_OBSERVER_INCREMENT (jmp_mem) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_imm) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_mem) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_reg) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_jcxz) + +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_cc) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_cbz) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_cbnz) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_tbz) +GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_tbnz) + +GUM_DECLARE_OBSERVER_INCREMENT (jmp_continuation) + +GUM_DECLARE_OBSERVER_INCREMENT (sysenter_slow_path) + +GUM_API void gum_stalker_observer_notify_backpatch ( + GumStalkerObserver * observer, const GumBackpatch * backpatch, gsize size); + +GUM_API void gum_stalker_observer_switch_callback ( + GumStalkerObserver * observer, gpointer from_address, + gpointer start_address, gpointer from_insn, gpointer * target); G_END_DECLS #endif /* - * Copyright (C) 2010-2022 Ole André Vadla Ravnås + * Copyright (C) 2008-2010 Ole André Vadla Ravnås + * Copyright (C) 2008 Christian Berentsen + * Copyright (C) 2020 Matt Oh * * Licence: wxWindows Library Licence, Version 3.1 */ -#ifndef __GUM_ARM_WRITER_H__ -#define __GUM_ARM_WRITER_H__ - - -#define GUM_ARM_B_MAX_DISTANCE 0x01fffffc +#ifndef __GUM_SYMBOL_UTIL_H__ +#define __GUM_SYMBOL_UTIL_H__ -G_BEGIN_DECLS -typedef struct _GumArmWriter GumArmWriter; +typedef struct _GumDebugSymbolDetails GumDebugSymbolDetails; -struct _GumArmWriter +struct _GumDebugSymbolDetails { - volatile gint ref_count; - gboolean flush_on_destroy; - - GumOS target_os; - GumCpuFeatures cpu_features; - - guint32 * base; - guint32 * code; - GumAddress pc; - - GumMetalHashTable * label_defs; - GumMetalArray label_refs; - GumMetalArray literal_refs; - const guint32 * earliest_literal_insn; + GumAddress address; + gchar module_name[GUM_MAX_PATH + 1]; + gchar symbol_name[GUM_MAX_SYMBOL_NAME + 1]; + gchar file_name[GUM_MAX_PATH + 1]; + guint line_number; + guint column; }; -GUM_API GumArmWriter * gum_arm_writer_new (gpointer code_address); -GUM_API GumArmWriter * gum_arm_writer_ref (GumArmWriter * writer); -GUM_API void gum_arm_writer_unref (GumArmWriter * writer); - -GUM_API void gum_arm_writer_init (GumArmWriter * writer, gpointer code_address); -GUM_API void gum_arm_writer_clear (GumArmWriter * writer); - -GUM_API void gum_arm_writer_reset (GumArmWriter * writer, - gpointer code_address); -GUM_API void gum_arm_writer_set_target_os (GumArmWriter * self, GumOS os); - -GUM_API gpointer gum_arm_writer_cur (GumArmWriter * self); -GUM_API guint gum_arm_writer_offset (GumArmWriter * self); -GUM_API void gum_arm_writer_skip (GumArmWriter * self, guint n_bytes); - -GUM_API gboolean gum_arm_writer_flush (GumArmWriter * self); +G_BEGIN_DECLS -GUM_API gboolean gum_arm_writer_put_label (GumArmWriter * self, - gconstpointer id); +GUM_API gboolean gum_symbol_details_from_address (gpointer address, + GumDebugSymbolDetails * details); +GUM_API gchar * gum_symbol_name_from_address (gpointer address); -GUM_API void gum_arm_writer_put_call_address_with_arguments ( - GumArmWriter * self, GumAddress func, guint n_args, ...); -GUM_API void gum_arm_writer_put_call_address_with_arguments_array ( - GumArmWriter * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_arm_writer_put_call_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_call_reg_with_arguments (GumArmWriter * self, - arm_reg reg, guint n_args, ...); -GUM_API void gum_arm_writer_put_call_reg_with_arguments_array ( - GumArmWriter * self, arm_reg reg, guint n_args, const GumArgument * args); +GUM_API gpointer gum_find_function (const gchar * name); +GUM_API GArray * gum_find_functions_named (const gchar * name); +GUM_API GArray * gum_find_functions_matching (const gchar * str); +GUM_API gboolean gum_load_symbols (const gchar * path); -GUM_API void gum_arm_writer_put_branch_address (GumArmWriter * self, - GumAddress address); +G_END_DECLS -GUM_API gboolean gum_arm_writer_can_branch_directly_between ( - GumArmWriter * self, GumAddress from, GumAddress to); -GUM_API gboolean gum_arm_writer_put_b_imm (GumArmWriter * self, - GumAddress target); -GUM_API gboolean gum_arm_writer_put_b_cond_imm (GumArmWriter * self, - arm_cc cc, GumAddress target); -GUM_API void gum_arm_writer_put_b_label (GumArmWriter * self, - gconstpointer label_id); -GUM_API void gum_arm_writer_put_b_cond_label (GumArmWriter * self, - arm_cc cc, gconstpointer label_id); -GUM_API gboolean gum_arm_writer_put_bl_imm (GumArmWriter * self, - GumAddress target); -GUM_API gboolean gum_arm_writer_put_blx_imm (GumArmWriter * self, - GumAddress target); -GUM_API void gum_arm_writer_put_bl_label (GumArmWriter * self, - gconstpointer label_id); -GUM_API void gum_arm_writer_put_bx_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_bl_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_blx_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_ret (GumArmWriter * self); +#endif +/* + * Copyright (C) 2010-2014 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ -GUM_API void gum_arm_writer_put_push_regs (GumArmWriter * self, guint n, ...); -GUM_API void gum_arm_writer_put_pop_regs (GumArmWriter * self, guint n, ...); -GUM_API gboolean gum_arm_writer_put_vpush_range (GumArmWriter * self, - arm_reg first_reg, arm_reg last_reg); -GUM_API gboolean gum_arm_writer_put_vpop_range (GumArmWriter * self, - arm_reg first_reg, arm_reg last_reg); +#ifndef __GUM_SYS_INTERNALS_H__ +#define __GUM_SYS_INTERNALS_H__ -GUM_API gboolean gum_arm_writer_put_ldr_reg_address (GumArmWriter * self, - arm_reg reg, GumAddress address); -GUM_API gboolean gum_arm_writer_put_ldr_reg_u32 (GumArmWriter * self, - arm_reg reg, guint32 val); -GUM_API gboolean gum_arm_writer_put_ldr_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API gboolean gum_arm_writer_put_ldr_reg_reg_offset (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, gssize src_offset); -GUM_API gboolean gum_arm_writer_put_ldr_cond_reg_reg_offset ( - GumArmWriter * self, arm_cc cc, arm_reg dst_reg, arm_reg src_reg, - gssize src_offset); -GUM_API void gum_arm_writer_put_ldmia_reg_mask (GumArmWriter * self, - arm_reg reg, guint16 mask); -GUM_API void gum_arm_writer_put_ldmia_reg_mask_wb (GumArmWriter * self, - arm_reg reg, guint16 mask); -GUM_API gboolean gum_arm_writer_put_str_reg_reg (GumArmWriter * self, - arm_reg src_reg, arm_reg dst_reg); -GUM_API gboolean gum_arm_writer_put_str_reg_reg_offset (GumArmWriter * self, - arm_reg src_reg, arm_reg dst_reg, gssize dst_offset); -GUM_API gboolean gum_arm_writer_put_str_cond_reg_reg_offset ( - GumArmWriter * self, arm_cc cc, arm_reg src_reg, - arm_reg dst_reg, gssize dst_offset); -GUM_API void gum_arm_writer_put_mov_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_arm_writer_put_mov_reg_reg_shift (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, arm_shifter shift, - guint16 shift_value); -GUM_API void gum_arm_writer_put_mov_reg_cpsr (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_mov_cpsr_reg (GumArmWriter * self, arm_reg reg); -GUM_API void gum_arm_writer_put_add_reg_u16 (GumArmWriter * self, - arm_reg dst_reg, guint16 val); -GUM_API void gum_arm_writer_put_add_reg_u32 (GumArmWriter * self, - arm_reg dst_reg, guint32 val); -GUM_API void gum_arm_writer_put_add_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_add_reg_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); -GUM_API void gum_arm_writer_put_add_reg_reg_reg_shift (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2, arm_shifter shift, - guint16 shift_value); -GUM_API void gum_arm_writer_put_sub_reg_u16 (GumArmWriter * self, - arm_reg dst_reg, guint16 val); -GUM_API void gum_arm_writer_put_sub_reg_u32 (GumArmWriter * self, - arm_reg dst_reg, guint32 val); -GUM_API void gum_arm_writer_put_sub_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_sub_reg_reg_reg (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg1, arm_reg src_reg2); -GUM_API void gum_arm_writer_put_rsb_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_ands_reg_reg_imm (GumArmWriter * self, - arm_reg dst_reg, arm_reg src_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_cmp_reg_imm (GumArmWriter * self, - arm_reg dst_reg, guint32 imm_val); -GUM_API void gum_arm_writer_put_nop (GumArmWriter * self); -GUM_API void gum_arm_writer_put_breakpoint (GumArmWriter * self); -GUM_API void gum_arm_writer_put_brk_imm (GumArmWriter * self, - guint16 imm); +#ifdef G_OS_WIN32 -GUM_API void gum_arm_writer_put_instruction (GumArmWriter * self, guint32 insn); -GUM_API gboolean gum_arm_writer_put_bytes (GumArmWriter * self, - const guint8 * data, guint n); +# if GLIB_SIZEOF_VOID_P == 4 +# define GUM_TEB_OFFSET_SELF 0x0018 +# define GUM_TEB_OFFSET_TID 0x0024 +# else +# define GUM_TEB_OFFSET_SELF 0x0030 +# define GUM_TEB_OFFSET_TID 0x0048 +# endif -G_END_DECLS +#endif #endif /* - * Copyright (C) 2010-2022 Ole André Vadla Ravnås + * Copyright (C) 2010-2017 Ole André Vadla Ravnås * * Licence: wxWindows Library Licence, Version 3.1 */ -#ifndef __GUM_THUMB_WRITER_H__ -#define __GUM_THUMB_WRITER_H__ - +#ifndef __GUM_TLS_H__ +#define __GUM_TLS_H__ -#define GUM_THUMB_B_MAX_DISTANCE 0x00fffffe G_BEGIN_DECLS -typedef struct _GumThumbWriter GumThumbWriter; +typedef gsize GumTlsKey; -struct _GumThumbWriter -{ - volatile gint ref_count; - gboolean flush_on_destroy; +GUM_API GumTlsKey gum_tls_key_new (void); +GUM_API void gum_tls_key_free (GumTlsKey key); - GumOS target_os; +GUM_API gpointer gum_tls_key_get_value (GumTlsKey key); +GUM_API void gum_tls_key_set_value (GumTlsKey key, gpointer value); - guint16 * base; - guint16 * code; - GumAddress pc; +G_END_DECLS - GumMetalHashTable * label_defs; - GumMetalArray label_refs; - GumMetalArray literal_refs; - const guint16 * earliest_literal_insn; -}; +#endif -GUM_API GumThumbWriter * gum_thumb_writer_new (gpointer code_address); -GUM_API GumThumbWriter * gum_thumb_writer_ref (GumThumbWriter * writer); -GUM_API void gum_thumb_writer_unref (GumThumbWriter * writer); +G_BEGIN_DECLS -GUM_API void gum_thumb_writer_init (GumThumbWriter * writer, - gpointer code_address); -GUM_API void gum_thumb_writer_clear (GumThumbWriter * writer); +GUM_API void gum_init (void); +GUM_API void gum_shutdown (void); +GUM_API void gum_deinit (void); -GUM_API void gum_thumb_writer_reset (GumThumbWriter * writer, - gpointer code_address); -GUM_API void gum_thumb_writer_set_target_os (GumThumbWriter * self, GumOS os); +GUM_API void gum_init_embedded (void); +GUM_API void gum_deinit_embedded (void); -GUM_API gpointer gum_thumb_writer_cur (GumThumbWriter * self); -GUM_API guint gum_thumb_writer_offset (GumThumbWriter * self); -GUM_API void gum_thumb_writer_skip (GumThumbWriter * self, guint n_bytes); +GUM_API void gum_prepare_to_fork (void); +GUM_API void gum_recover_from_fork_in_parent (void); +GUM_API void gum_recover_from_fork_in_child (void); -GUM_API gboolean gum_thumb_writer_flush (GumThumbWriter * self); +G_END_DECLS -GUM_API gboolean gum_thumb_writer_put_label (GumThumbWriter * self, - gconstpointer id); -GUM_API gboolean gum_thumb_writer_commit_label (GumThumbWriter * self, - gconstpointer id); +#endif +/* json-glib.h: Main header + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ -GUM_API void gum_thumb_writer_put_call_address_with_arguments ( - GumThumbWriter * self, GumAddress func, guint n_args, ...); -GUM_API void gum_thumb_writer_put_call_address_with_arguments_array ( - GumThumbWriter * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_thumb_writer_put_call_reg_with_arguments ( - GumThumbWriter * self, arm_reg reg, guint n_args, ...); -GUM_API void gum_thumb_writer_put_call_reg_with_arguments_array ( - GumThumbWriter * self, arm_reg reg, guint n_args, const GumArgument * args); +#ifndef __JSON_GLIB_H__ +#define __JSON_GLIB_H__ -GUM_API void gum_thumb_writer_put_branch_address (GumThumbWriter * self, - GumAddress address); +#define __JSON_GLIB_INSIDE__ -GUM_API gboolean gum_thumb_writer_can_branch_directly_between ( - GumThumbWriter * self, GumAddress from, GumAddress to); -GUM_API void gum_thumb_writer_put_b_imm (GumThumbWriter * self, - GumAddress target); -GUM_API void gum_thumb_writer_put_b_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_b_label_wide (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_bx_reg (GumThumbWriter * self, arm_reg reg); -GUM_API void gum_thumb_writer_put_bl_imm (GumThumbWriter * self, - GumAddress target); -GUM_API void gum_thumb_writer_put_bl_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_blx_imm (GumThumbWriter * self, - GumAddress target); -GUM_API void gum_thumb_writer_put_blx_reg (GumThumbWriter * self, arm_reg reg); -GUM_API void gum_thumb_writer_put_cmp_reg_imm (GumThumbWriter * self, - arm_reg reg, guint8 imm_value); -GUM_API void gum_thumb_writer_put_beq_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_bne_label (GumThumbWriter * self, - gconstpointer label_id); -GUM_API void gum_thumb_writer_put_b_cond_label (GumThumbWriter * self, - arm_cc cc, gconstpointer label_id); -GUM_API void gum_thumb_writer_put_b_cond_label_wide (GumThumbWriter * self, - arm_cc cc, gconstpointer label_id); -GUM_API void gum_thumb_writer_put_cbz_reg_label (GumThumbWriter * self, - arm_reg reg, gconstpointer label_id); -GUM_API void gum_thumb_writer_put_cbnz_reg_label (GumThumbWriter * self, - arm_reg reg, gconstpointer label_id); +/* json-types.h - JSON data types + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ -GUM_API gboolean gum_thumb_writer_put_push_regs (GumThumbWriter * self, - guint n_regs, arm_reg first_reg, ...); -GUM_API gboolean gum_thumb_writer_put_push_regs_array (GumThumbWriter * self, - guint n_regs, const arm_reg * regs); -GUM_API gboolean gum_thumb_writer_put_pop_regs (GumThumbWriter * self, - guint n_regs, arm_reg first_reg, ...); -GUM_API gboolean gum_thumb_writer_put_pop_regs_array (GumThumbWriter * self, - guint n_regs, const arm_reg * regs); -GUM_API gboolean gum_thumb_writer_put_vpush_range (GumThumbWriter * self, - arm_reg first_reg, arm_reg last_reg); -GUM_API gboolean gum_thumb_writer_put_vpop_range (GumThumbWriter * self, - arm_reg first_reg, arm_reg last_reg); -GUM_API gboolean gum_thumb_writer_put_ldr_reg_address (GumThumbWriter * self, - arm_reg reg, GumAddress address); -GUM_API gboolean gum_thumb_writer_put_ldr_reg_u32 (GumThumbWriter * self, - arm_reg reg, guint32 val); -GUM_API void gum_thumb_writer_put_ldr_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API gboolean gum_thumb_writer_put_ldr_reg_reg_offset (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg, gsize src_offset); -GUM_API void gum_thumb_writer_put_ldrb_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -void gum_thumb_writer_put_ldrh_reg_reg (GumThumbWriter * self, arm_reg dst_reg, - arm_reg src_reg); -GUM_API gboolean gum_thumb_writer_put_vldr_reg_reg_offset ( - GumThumbWriter * self, arm_reg dst_reg, arm_reg src_reg, gssize src_offset); -GUM_API void gum_thumb_writer_put_ldmia_reg_mask (GumThumbWriter * self, - arm_reg reg, guint16 mask); -GUM_API void gum_thumb_writer_put_str_reg_reg (GumThumbWriter * self, - arm_reg src_reg, arm_reg dst_reg); -GUM_API gboolean gum_thumb_writer_put_str_reg_reg_offset (GumThumbWriter * self, - arm_reg src_reg, arm_reg dst_reg, gsize dst_offset); -GUM_API void gum_thumb_writer_put_mov_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_thumb_writer_put_mov_reg_u8 (GumThumbWriter * self, - arm_reg dst_reg, guint8 imm_value); -GUM_API void gum_thumb_writer_put_mov_reg_cpsr (GumThumbWriter * self, - arm_reg reg); -GUM_API void gum_thumb_writer_put_mov_cpsr_reg (GumThumbWriter * self, - arm_reg reg); -GUM_API gboolean gum_thumb_writer_put_add_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, gssize imm_value); -GUM_API void gum_thumb_writer_put_add_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_thumb_writer_put_add_reg_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); -GUM_API gboolean gum_thumb_writer_put_add_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_sub_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, gssize imm_value); -GUM_API void gum_thumb_writer_put_sub_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg src_reg); -GUM_API void gum_thumb_writer_put_sub_reg_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, arm_reg right_reg); -GUM_API gboolean gum_thumb_writer_put_sub_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_and_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_or_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, gssize right_value); -GUM_API gboolean gum_thumb_writer_put_lsl_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, guint8 right_value); -GUM_API gboolean gum_thumb_writer_put_lsls_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, guint8 right_value); -GUM_API gboolean gum_thumb_writer_put_lsrs_reg_reg_imm (GumThumbWriter * self, - arm_reg dst_reg, arm_reg left_reg, guint8 right_value); -GUM_API gboolean gum_thumb_writer_put_mrs_reg_reg (GumThumbWriter * self, - arm_reg dst_reg, arm_sysreg src_reg); -GUM_API gboolean gum_thumb_writer_put_msr_reg_reg (GumThumbWriter * self, - arm_sysreg dst_reg, arm_reg src_reg); +#ifndef __JSON_TYPES_H__ +#define __JSON_TYPES_H__ + +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif + +/* json-version-macros.h - JSON-GLib symbol versioning macros + * + * This file is part of JSON-GLib + * Copyright © 2014 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ -GUM_API void gum_thumb_writer_put_nop (GumThumbWriter * self); -GUM_API void gum_thumb_writer_put_bkpt_imm (GumThumbWriter * self, guint8 imm); -GUM_API void gum_thumb_writer_put_breakpoint (GumThumbWriter * self); +#ifndef __JSON_VERSION_MACROS_H__ +#define __JSON_VERSION_MACROS_H__ -GUM_API void gum_thumb_writer_put_instruction (GumThumbWriter * self, - guint16 insn); -GUM_API void gum_thumb_writer_put_instruction_wide (GumThumbWriter * self, - guint16 upper, guint16 lower); -GUM_API gboolean gum_thumb_writer_put_bytes (GumThumbWriter * self, - const guint8 * data, guint n); +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif -G_END_DECLS +/* json-version.h - JSON-GLib versioning information + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ + +#ifndef __JSON_VERSION_H__ +#define __JSON_VERSION_H__ +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." #endif -/* - * Copyright (C) 2014-2023 Ole André Vadla Ravnås - * Copyright (C) 2017 Antonio Ken Iannillo - * Copyright (C) 2023 Håvard Sørbø - * Copyright (C) 2023 Fabian Freyer + +/** + * JSON_MAJOR_VERSION: * - * Licence: wxWindows Library Licence, Version 3.1 + * Json major version component (e.g. 1 if `JSON_VERSION` is "1.2.3") */ +#define JSON_MAJOR_VERSION (1) -#ifndef __GUM_ARM64_WRITER_H__ -#define __GUM_ARM64_WRITER_H__ +/** + * JSON_MINOR_VERSION: + * + * Json minor version component (e.g. 2 if `JSON_VERSION` is "1.2.3") + */ +#define JSON_MINOR_VERSION (7) +/** + * JSON_MICRO_VERSION: + * + * Json micro version component (e.g. 3 if `JSON_VERSION` is "1.2.3") + */ +#define JSON_MICRO_VERSION (1) -#define GUM_ARM64_ADRP_MAX_DISTANCE 0xfffff000 -#define GUM_ARM64_B_MAX_DISTANCE 0x07fffffc +/** + * JSON_VERSION + * + * The version of JSON-GLib. + */ +#define JSON_VERSION (1.7.1) -#define GUM_ARM64_SYSREG(op0, op1, crn, crm, op2) \ - ( \ - (((op0 == 2) ? 0 : 1) << 14) | \ - (op1 << 11) | \ - (crn << 7) | \ - (crm << 3) | \ - op2 \ - ) -#define GUM_ARM64_SYSREG_TPIDRRO_EL0 GUM_ARM64_SYSREG (3, 3, 13, 0, 3) +/** + * JSON_VERSION_S: + * + * The version of JSON-GLib, encoded as a string, useful for printing and + * concatenation. + */ +#define JSON_VERSION_S "1.7.1" -G_BEGIN_DECLS +/** + * JSON_ENCODE_VERSION: + * @major: (type int): the major version to encode + * @minor: (type int): the minor version to encode + * @micro: (type int): the micro version to encode + * + * Encodes a JSON-GLib version in an hexadecimal number, useful for + * integer comparisons. + */ +#define JSON_ENCODE_VERSION(major,minor,micro) \ + ((major) << 24 | (minor) << 16 | (micro) << 8) -typedef struct _GumArm64Writer GumArm64Writer; -typedef guint GumArm64IndexMode; +/** + * JSON_VERSION_HEX: + * + * The version of JSON-GLib, encoded as an hexadecimal number, useful for + * integer comparisons. + */ +#define JSON_VERSION_HEX \ + (JSON_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION, JSON_MICRO_VERSION)) -struct _GumArm64Writer -{ - volatile gint ref_count; - gboolean flush_on_destroy; +/** + * JSON_CHECK_VERSION: + * @major: required major version + * @minor: required minor version + * @micro: required micro version + * + * Compile-time version checking. Evaluates to `TRUE` if the version + * of JSON-GLib is greater than the required one. + */ +#define JSON_CHECK_VERSION(major,minor,micro) \ + (JSON_MAJOR_VERSION > (major) || \ + (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION > (minor)) || \ + (JSON_MAJOR_VERSION == (major) && JSON_MINOR_VERSION == (minor) && \ + JSON_MICRO_VERSION >= (micro))) - GumOS target_os; - GumPtrauthSupport ptrauth_support; - GumAddress (* sign) (GumAddress value); +#endif /* __JSON_VERSION_H__ */ - guint32 * base; - guint32 * code; - GumAddress pc; +#ifndef _JSON_EXTERN +#define _JSON_EXTERN extern +#endif - GumMetalHashTable * label_defs; - GumMetalArray label_refs; - GumMetalArray literal_refs; - const guint32 * earliest_literal_insn; -}; +#ifdef JSON_DISABLE_DEPRECATION_WARNINGS +#define JSON_DEPRECATED _JSON_EXTERN +#define JSON_DEPRECATED_FOR(f) _JSON_EXTERN +#define JSON_UNAVAILABLE(maj,min) _JSON_EXTERN +#else +#define JSON_DEPRECATED G_DEPRECATED _JSON_EXTERN +#define JSON_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _JSON_EXTERN +#define JSON_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _JSON_EXTERN +#endif -enum _GumArm64IndexMode -{ - GUM_INDEX_POST_ADJUST = 1, - GUM_INDEX_SIGNED_OFFSET = 2, - GUM_INDEX_PRE_ADJUST = 3, -}; +/* XXX: Each new cycle should add a new version symbol here */ +/** + * JSON_VERSION_1_0: + * + * The encoded representation of JSON-GLib version "1.0". + * + * Since: 1.0 + */ +#define JSON_VERSION_1_0 (G_ENCODE_VERSION (1, 0)) -GUM_API GumArm64Writer * gum_arm64_writer_new (gpointer code_address); -GUM_API GumArm64Writer * gum_arm64_writer_ref (GumArm64Writer * writer); -GUM_API void gum_arm64_writer_unref (GumArm64Writer * writer); +/** + * JSON_VERSION_1_2: + * + * The encoded representation of JSON-GLib version "1.2". + * + * Since: 1.2 + */ +#define JSON_VERSION_1_2 (G_ENCODE_VERSION (1, 2)) -GUM_API void gum_arm64_writer_init (GumArm64Writer * writer, - gpointer code_address); -GUM_API void gum_arm64_writer_clear (GumArm64Writer * writer); +/** + * JSON_VERSION_1_4: + * + * The encoded representation of JSON-GLib version "1.4". + * + * Since: 1.4 + */ +#define JSON_VERSION_1_4 (G_ENCODE_VERSION (1, 4)) -GUM_API void gum_arm64_writer_reset (GumArm64Writer * writer, - gpointer code_address); +/** + * JSON_VERSION_1_6: + * + * The encoded representation of JSON-GLib version "1.6". + * + * Since: 1.6 + */ +#define JSON_VERSION_1_6 (G_ENCODE_VERSION (1, 6)) -GUM_API gpointer gum_arm64_writer_cur (GumArm64Writer * self); -GUM_API guint gum_arm64_writer_offset (GumArm64Writer * self); -GUM_API void gum_arm64_writer_skip (GumArm64Writer * self, guint n_bytes); +/** + * JSON_VERSION_1_8: + * + * The encoded representation of JSON-GLib version "1.8". + * + * Since: 1.8 + */ +#define JSON_VERSION_1_8 (G_ENCODE_VERSION (1, 8)) -GUM_API gboolean gum_arm64_writer_flush (GumArm64Writer * self); +/* evaluates to the current stable version; for development cycles, + * this means the next stable target + */ +#if (JSON_MINOR_VERSION == 99) +#define JSON_VERSION_CUR_STABLE (G_ENCODE_VERSION (JSON_MAJOR_VERSION + 1, 0)) +#elif (JSON_MINOR_VERSION % 2) +#define JSON_VERSION_CUR_STABLE (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION + 1)) +#else +#define JSON_VERSION_CUR_STABLE (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION)) +#endif -GUM_API gboolean gum_arm64_writer_put_label (GumArm64Writer * self, - gconstpointer id); +/* evaluates to the previous stable version */ +#if (JSON_MINOR_VERSION == 99) +#define JSON_VERSION_PREV_STABLE (G_ENCODE_VERSION (JSON_MAJOR_VERSION + 1, 0)) +#elif (JSON_MINOR_VERSION % 2) +#define JSON_VERSION_PREV_STABLE (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION - 1)) +#else +#define JSON_VERSION_PREV_STABLE (G_ENCODE_VERSION (JSON_MAJOR_VERSION, JSON_MINOR_VERSION - 2)) +#endif -GUM_API void gum_arm64_writer_put_call_address_with_arguments ( - GumArm64Writer * self, GumAddress func, guint n_args, ...); -GUM_API void gum_arm64_writer_put_call_address_with_arguments_array ( - GumArm64Writer * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_arm64_writer_put_call_reg_with_arguments ( - GumArm64Writer * self, arm64_reg reg, guint n_args, ...); -GUM_API void gum_arm64_writer_put_call_reg_with_arguments_array ( - GumArm64Writer * self, arm64_reg reg, guint n_args, - const GumArgument * args); +/** + * JSON_VERSION_MIN_REQUIRED: + * + * A macro that should be defined by the user prior to including + * the `json-glib/json-glib.h` header. + * + * The definition should be one of the predefined JSON-GLib version + * macros: `JSON_VERSION_1_0`, `JSON_VERSION_1_2`, ... + * + * This macro defines the lower bound for the JSON-GLib API to use. + * + * If a function has been deprecated in a newer version of JSON-GLib, + * it is possible to use this symbol to avoid the compiler warnings + * without disabling warning for every deprecated function. + * + * Since: 1.0 + */ +#ifndef JSON_VERSION_MIN_REQUIRED +# define JSON_VERSION_MIN_REQUIRED (JSON_VERSION_CUR_STABLE) +#endif -GUM_API void gum_arm64_writer_put_branch_address (GumArm64Writer * self, - GumAddress address); +/** + * JSON_VERSION_MAX_ALLOWED: + * + * A macro that should be defined by the user prior to including + * the `json-glib/json-glib.h` header. -GUM_API gboolean gum_arm64_writer_can_branch_directly_between ( - GumArm64Writer * self, GumAddress from, GumAddress to); -GUM_API gboolean gum_arm64_writer_put_b_imm (GumArm64Writer * self, - GumAddress address); -GUM_API void gum_arm64_writer_put_b_label (GumArm64Writer * self, - gconstpointer label_id); -GUM_API void gum_arm64_writer_put_b_cond_label (GumArm64Writer * self, - arm64_cc cc, gconstpointer label_id); -GUM_API gboolean gum_arm64_writer_put_bl_imm (GumArm64Writer * self, - GumAddress address); -GUM_API void gum_arm64_writer_put_bl_label (GumArm64Writer * self, - gconstpointer label_id); -GUM_API gboolean gum_arm64_writer_put_br_reg (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_br_reg_no_auth (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_blr_reg (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_blr_reg_no_auth (GumArm64Writer * self, - arm64_reg reg); -GUM_API void gum_arm64_writer_put_ret (GumArm64Writer * self); -GUM_API gboolean gum_arm64_writer_put_ret_reg (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_cbz_reg_imm (GumArm64Writer * self, - arm64_reg reg, GumAddress target); -GUM_API gboolean gum_arm64_writer_put_cbnz_reg_imm (GumArm64Writer * self, - arm64_reg reg, GumAddress target); -GUM_API void gum_arm64_writer_put_cbz_reg_label (GumArm64Writer * self, - arm64_reg reg, gconstpointer label_id); -GUM_API void gum_arm64_writer_put_cbnz_reg_label (GumArm64Writer * self, - arm64_reg reg, gconstpointer label_id); -GUM_API gboolean gum_arm64_writer_put_tbz_reg_imm_imm (GumArm64Writer * self, - arm64_reg reg, guint bit, GumAddress target); -GUM_API gboolean gum_arm64_writer_put_tbnz_reg_imm_imm (GumArm64Writer * self, - arm64_reg reg, guint bit, GumAddress target); -GUM_API void gum_arm64_writer_put_tbz_reg_imm_label (GumArm64Writer * self, - arm64_reg reg, guint bit, gconstpointer label_id); -GUM_API void gum_arm64_writer_put_tbnz_reg_imm_label (GumArm64Writer * self, - arm64_reg reg, guint bit, gconstpointer label_id); + * The definition should be one of the predefined JSON-GLib version + * macros: `JSON_VERSION_1_0`, `JSON_VERSION_1_2`, ... + * + * This macro defines the upper bound for the JSON API-GLib to use. + * + * If a function has been introduced in a newer version of JSON-GLib, + * it is possible to use this symbol to get compiler warnings when + * trying to use that function. + * + * Since: 1.0 + */ +#ifndef JSON_VERSION_MAX_ALLOWED +# if JSON_VERSION_MIN_REQUIRED > JSON_VERSION_PREV_STABLE +# define JSON_VERSION_MAX_ALLOWED (JSON_VERSION_MIN_REQUIRED) +# else +# define JSON_VERSION_MAX_ALLOWED (JSON_VERSION_CUR_STABLE) +# endif +#endif -GUM_API gboolean gum_arm64_writer_put_push_reg_reg (GumArm64Writer * self, - arm64_reg reg_a, arm64_reg reg_b); -GUM_API gboolean gum_arm64_writer_put_pop_reg_reg (GumArm64Writer * self, - arm64_reg reg_a, arm64_reg reg_b); -GUM_API void gum_arm64_writer_put_push_all_x_registers (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_pop_all_x_registers (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_push_all_q_registers (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_pop_all_q_registers (GumArm64Writer * self); +/* sanity checks */ +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_MIN_REQUIRED +#error "JSON_VERSION_MAX_ALLOWED must be >= JSON_VERSION_MIN_REQUIRED" +#endif +#if JSON_VERSION_MIN_REQUIRED < JSON_VERSION_1_0 +#error "JSON_VERSION_MIN_REQUIRED must be >= JSON_VERSION_1_0" +#endif -GUM_API gboolean gum_arm64_writer_put_ldr_reg_address (GumArm64Writer * self, - arm64_reg reg, GumAddress address); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_u32 (GumArm64Writer * self, - arm64_reg reg, guint32 val); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_u64 (GumArm64Writer * self, - arm64_reg reg, guint64 val); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_u32_ptr (GumArm64Writer * self, - arm64_reg reg, GumAddress src_address); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_u64_ptr (GumArm64Writer * self, - arm64_reg reg, GumAddress src_address); -GUM_API guint gum_arm64_writer_put_ldr_reg_ref (GumArm64Writer * self, - arm64_reg reg); -GUM_API void gum_arm64_writer_put_ldr_reg_value (GumArm64Writer * self, - guint ref, GumAddress value); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg_offset (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg, gsize src_offset); -GUM_API gboolean gum_arm64_writer_put_ldr_reg_reg_offset_mode ( - GumArm64Writer * self, arm64_reg dst_reg, arm64_reg src_reg, - gssize src_offset, GumArm64IndexMode mode); -GUM_API gboolean gum_arm64_writer_put_ldrsw_reg_reg_offset ( - GumArm64Writer * self, arm64_reg dst_reg, arm64_reg src_reg, - gsize src_offset); -GUM_API gboolean gum_arm64_writer_put_adrp_reg_address (GumArm64Writer * self, - arm64_reg reg, GumAddress address); -GUM_API gboolean gum_arm64_writer_put_str_reg_reg (GumArm64Writer * self, - arm64_reg src_reg, arm64_reg dst_reg); -GUM_API gboolean gum_arm64_writer_put_str_reg_reg_offset (GumArm64Writer * self, - arm64_reg src_reg, arm64_reg dst_reg, gsize dst_offset); -GUM_API gboolean gum_arm64_writer_put_str_reg_reg_offset_mode ( - GumArm64Writer * self, arm64_reg src_reg, arm64_reg dst_reg, - gssize dst_offset, GumArm64IndexMode mode); -GUM_API gboolean gum_arm64_writer_put_ldp_reg_reg_reg_offset ( - GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_src, - gssize src_offset, GumArm64IndexMode mode); -GUM_API gboolean gum_arm64_writer_put_stp_reg_reg_reg_offset ( - GumArm64Writer * self, arm64_reg reg_a, arm64_reg reg_b, arm64_reg reg_dst, - gssize dst_offset, GumArm64IndexMode mode); -GUM_API gboolean gum_arm64_writer_put_mov_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg); -GUM_API void gum_arm64_writer_put_mov_reg_nzcv (GumArm64Writer * self, - arm64_reg reg); -GUM_API void gum_arm64_writer_put_mov_nzcv_reg (GumArm64Writer * self, - arm64_reg reg); -GUM_API gboolean gum_arm64_writer_put_uxtw_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg); -GUM_API gboolean gum_arm64_writer_put_add_reg_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); -GUM_API gboolean gum_arm64_writer_put_add_reg_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); -GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, gsize right_value); -GUM_API gboolean gum_arm64_writer_put_sub_reg_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); -GUM_API gboolean gum_arm64_writer_put_and_reg_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, guint64 right_value); -GUM_API gboolean gum_arm64_writer_put_eor_reg_reg_reg (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg left_reg, arm64_reg right_reg); -GUM_API gboolean gum_arm64_writer_put_ubfm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg, guint8 imms, guint8 immr); -GUM_API gboolean gum_arm64_writer_put_lsl_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg, guint8 shift); -GUM_API gboolean gum_arm64_writer_put_lsr_reg_imm (GumArm64Writer * self, - arm64_reg dst_reg, arm64_reg src_reg, guint8 shift); -GUM_API gboolean gum_arm64_writer_put_tst_reg_imm (GumArm64Writer * self, - arm64_reg reg, guint64 imm_value); -GUM_API gboolean gum_arm64_writer_put_cmp_reg_reg (GumArm64Writer * self, - arm64_reg reg_a, arm64_reg reg_b); +/* XXX: Every new stable minor release should add a set of macros here */ -GUM_API gboolean gum_arm64_writer_put_xpaci_reg (GumArm64Writer * self, - arm64_reg reg); +/* 1.0 */ +#if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_0 +# define JSON_DEPRECATED_IN_1_0 JSON_DEPRECATED +# define JSON_DEPRECATED_IN_1_0_FOR(f) JSON_DEPRECATED_FOR(f) +#else +# define JSON_DEPRECATED_IN_1_0 _JSON_EXTERN +# define JSON_DEPRECATED_IN_1_0_FOR(f) _JSON_EXTERN +#endif -GUM_API void gum_arm64_writer_put_nop (GumArm64Writer * self); -GUM_API void gum_arm64_writer_put_brk_imm (GumArm64Writer * self, guint16 imm); -GUM_API gboolean gum_arm64_writer_put_mrs (GumArm64Writer * self, - arm64_reg dst_reg, guint16 system_reg); +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_0 +# define JSON_AVAILABLE_IN_1_0 JSON_UNAVAILABLE(1, 0) +#else +# define JSON_AVAILABLE_IN_1_0 _JSON_EXTERN +#endif -GUM_API void gum_arm64_writer_put_instruction (GumArm64Writer * self, - guint32 insn); -GUM_API gboolean gum_arm64_writer_put_bytes (GumArm64Writer * self, - const guint8 * data, guint n); +/* 1.2 */ +#if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_2 +# define JSON_DEPRECATED_IN_1_2 JSON_DEPRECATED +# define JSON_DEPRECATED_IN_1_2_FOR(f) JSON_DEPRECATED_FOR(f) +#else +# define JSON_DEPRECATED_IN_1_2 _JSON_EXTERN +# define JSON_DEPRECATED_IN_1_2_FOR(f) _JSON_EXTERN +#endif -GUM_API GumAddress gum_arm64_writer_sign (GumArm64Writer * self, - GumAddress value); +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_2 +# define JSON_AVAILABLE_IN_1_2 JSON_UNAVAILABLE(1, 2) +#else +# define JSON_AVAILABLE_IN_1_2 _JSON_EXTERN +#endif -G_END_DECLS +/* 1.4 */ +#if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_4 +# define JSON_DEPRECATED_IN_1_4 JSON_DEPRECATED +# define JSON_DEPRECATED_IN_1_4_FOR(f) JSON_DEPRECATED_FOR(f) +#else +# define JSON_DEPRECATED_IN_1_4 _JSON_EXTERN +# define JSON_DEPRECATED_IN_1_4_FOR(f) _JSON_EXTERN +#endif + +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_4 +# define JSON_AVAILABLE_IN_1_4 JSON_UNAVAILABLE(1, 4) +#else +# define JSON_AVAILABLE_IN_1_4 _JSON_EXTERN +#endif + +/* 1.6 */ +#if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_6 +# define JSON_DEPRECATED_IN_1_6 JSON_DEPRECATED +# define JSON_DEPRECATED_IN_1_6_FOR(f) JSON_DEPRECATED_FOR(f) +#else +# define JSON_DEPRECATED_IN_1_6 _JSON_EXTERN +# define JSON_DEPRECATED_IN_1_6_FOR(f) _JSON_EXTERN +#endif + +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_6 +# define JSON_AVAILABLE_IN_1_6 JSON_UNAVAILABLE(1, 6) +#else +# define JSON_AVAILABLE_IN_1_6 _JSON_EXTERN +#endif + +/* 1.8 */ +#if JSON_VERSION_MIN_REQUIRED >= JSON_VERSION_1_8 +# define JSON_DEPRECATED_IN_1_8 JSON_DEPRECATED +# define JSON_DEPRECATED_IN_1_8_FOR(f) JSON_DEPRECATED_FOR(f) +#else +# define JSON_DEPRECATED_IN_1_8 _JSON_EXTERN +# define JSON_DEPRECATED_IN_1_8_FOR(f) _JSON_EXTERN +#endif +#if JSON_VERSION_MAX_ALLOWED < JSON_VERSION_1_8 +# define JSON_AVAILABLE_IN_1_8 JSON_UNAVAILABLE(1, 8) +#else +# define JSON_AVAILABLE_IN_1_8 _JSON_EXTERN #endif + +#endif /* __JSON_VERSION_MACROS_H__ */ + +G_BEGIN_DECLS + +/** + * JSON_NODE_TYPE: + * @node: (type Json.Node): the [struct@Json.Node] to check + * + * Evaluates to the [enum@Json.NodeType] value contained by the node. + */ +#define JSON_NODE_TYPE(node) (json_node_get_node_type ((node))) + +/** + * JSON_NODE_HOLDS: + * @node: (type Json.Node): the [struct@Json.Node] to check + * @t: (type Json.NodeType): the desired [enum@Json.NodeType] + * + * Evaluates to `TRUE` if the node holds the given type. + * + * Since: 0.10 + */ +#define JSON_NODE_HOLDS(node,t) (json_node_get_node_type ((node)) == (t)) + +/** + * JSON_NODE_HOLDS_VALUE: + * @node: (type Json.Node): the [struct@Json.Node] to check + * + * Evaluates to `TRUE` if the node holds a scalar value. + * + * Since: 0.10 + */ +#define JSON_NODE_HOLDS_VALUE(node) (JSON_NODE_HOLDS ((node), JSON_NODE_VALUE)) + +/** + * JSON_NODE_HOLDS_OBJECT: + * @node: (type Json.Node): the [struct@Json.Node] to check + * + * Evaluates to `TRUE` if the node holds a JSON object. + * + * Since: 0.10 + */ +#define JSON_NODE_HOLDS_OBJECT(node) (JSON_NODE_HOLDS ((node), JSON_NODE_OBJECT)) + +/** + * JSON_NODE_HOLDS_ARRAY: + * @node: (type Json.Node): the [struct@Json.Node] to check + * + * Evaluates to `TRUE` if the node holds a JSON array. + * + * Since: 0.10 + */ +#define JSON_NODE_HOLDS_ARRAY(node) (JSON_NODE_HOLDS ((node), JSON_NODE_ARRAY)) + +/** + * JSON_NODE_HOLDS_NULL: + * @node: (type Json.Node): the [struct@Json.Node] to check + * + * Evaluates to `TRUE` if the node holds `null`. + * + * Since: 0.10 + */ +#define JSON_NODE_HOLDS_NULL(node) (JSON_NODE_HOLDS ((node), JSON_NODE_NULL)) + +#define JSON_TYPE_NODE (json_node_get_type ()) +#define JSON_TYPE_OBJECT (json_object_get_type ()) +#define JSON_TYPE_ARRAY (json_array_get_type ()) + +typedef struct _JsonNode JsonNode; +typedef struct _JsonObject JsonObject; +typedef struct _JsonArray JsonArray; + +/** + * JsonNodeType: + * @JSON_NODE_OBJECT: The node contains a JSON object + * @JSON_NODE_ARRAY: The node contains a JSON array + * @JSON_NODE_VALUE: The node contains a fundamental type + * @JSON_NODE_NULL: Special type, for nodes containing null + * + * Indicates the content of a node. + */ +typedef enum { + JSON_NODE_OBJECT, + JSON_NODE_ARRAY, + JSON_NODE_VALUE, + JSON_NODE_NULL +} JsonNodeType; + +/** + * JsonObjectForeach: + * @object: the iterated JSON object + * @member_name: the name of the member + * @member_node: the value of the member + * @user_data: data passed to the function + * + * The function to be passed to [method@Json.Object.foreach_member]. + * + * You should not add or remove members to and from @object within + * this function. + * + * It is safe to change the value of @member_node. + * + * Since: 0.8 + */ +typedef void (* JsonObjectForeach) (JsonObject *object, + const gchar *member_name, + JsonNode *member_node, + gpointer user_data); + +/** + * JsonArrayForeach: + * @array: the iterated JSON array + * @index_: the index of the element + * @element_node: the value of the element at the given @index_ + * @user_data: data passed to the function + * + * The function to be passed to [method@Json.Array.foreach_element]. + * + * You should not add or remove elements to and from @array within + * this function. + * + * It is safe to change the value of @element_node. + * + * Since: 0.8 + */ +typedef void (* JsonArrayForeach) (JsonArray *array, + guint index_, + JsonNode *element_node, + gpointer user_data); + /* - * Copyright (C) 2014-2022 Ole André Vadla Ravnås - * Copyright (C) 2019 Jon Wilson + * JsonNode + */ + +JSON_AVAILABLE_IN_1_0 +GType json_node_get_type (void) G_GNUC_CONST; +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_new (JsonNodeType type); + +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_alloc (void); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init (JsonNode *node, + JsonNodeType type); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_object (JsonNode *node, + JsonObject *object); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_array (JsonNode *node, + JsonArray *array); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_int (JsonNode *node, + gint64 value); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_double (JsonNode *node, + gdouble value); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_boolean (JsonNode *node, + gboolean value); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_string (JsonNode *node, + const char *value); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_init_null (JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_copy (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_free (JsonNode *node); + +JSON_AVAILABLE_IN_1_2 +JsonNode * json_node_ref (JsonNode *node); +JSON_AVAILABLE_IN_1_2 +void json_node_unref (JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +JsonNodeType json_node_get_node_type (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +GType json_node_get_value_type (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_set_parent (JsonNode *node, + JsonNode *parent); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_node_get_parent (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +const gchar * json_node_type_name (JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +void json_node_set_object (JsonNode *node, + JsonObject *object); +JSON_AVAILABLE_IN_1_0 +void json_node_take_object (JsonNode *node, + JsonObject *object); +JSON_AVAILABLE_IN_1_0 +JsonObject * json_node_get_object (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +JsonObject * json_node_dup_object (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_set_array (JsonNode *node, + JsonArray *array); +JSON_AVAILABLE_IN_1_0 +void json_node_take_array (JsonNode *node, + JsonArray *array); +JSON_AVAILABLE_IN_1_0 +JsonArray * json_node_get_array (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +JsonArray * json_node_dup_array (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_set_value (JsonNode *node, + const GValue *value); +JSON_AVAILABLE_IN_1_0 +void json_node_get_value (JsonNode *node, + GValue *value); +JSON_AVAILABLE_IN_1_0 +void json_node_set_string (JsonNode *node, + const gchar *value); +JSON_AVAILABLE_IN_1_0 +const gchar * json_node_get_string (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +gchar * json_node_dup_string (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_set_int (JsonNode *node, + gint64 value); +JSON_AVAILABLE_IN_1_0 +gint64 json_node_get_int (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_set_double (JsonNode *node, + gdouble value); +JSON_AVAILABLE_IN_1_0 +gdouble json_node_get_double (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_node_set_boolean (JsonNode *node, + gboolean value); +JSON_AVAILABLE_IN_1_0 +gboolean json_node_get_boolean (JsonNode *node); +JSON_AVAILABLE_IN_1_0 +gboolean json_node_is_null (JsonNode *node); + +JSON_AVAILABLE_IN_1_2 +void json_node_seal (JsonNode *node); +JSON_AVAILABLE_IN_1_2 +gboolean json_node_is_immutable (JsonNode *node); + +JSON_AVAILABLE_IN_1_2 +guint json_string_hash (gconstpointer key); +JSON_AVAILABLE_IN_1_2 +gboolean json_string_equal (gconstpointer a, + gconstpointer b); +JSON_AVAILABLE_IN_1_2 +gint json_string_compare (gconstpointer a, + gconstpointer b); + +JSON_AVAILABLE_IN_1_2 +guint json_node_hash (gconstpointer key); +JSON_AVAILABLE_IN_1_2 +gboolean json_node_equal (gconstpointer a, + gconstpointer b); + +/* + * JsonObject + */ +JSON_AVAILABLE_IN_1_0 +GType json_object_get_type (void) G_GNUC_CONST; +JSON_AVAILABLE_IN_1_0 +JsonObject * json_object_new (void); +JSON_AVAILABLE_IN_1_0 +JsonObject * json_object_ref (JsonObject *object); +JSON_AVAILABLE_IN_1_0 +void json_object_unref (JsonObject *object); + +JSON_DEPRECATED_IN_1_0_FOR(json_object_set_member) +void json_object_add_member (JsonObject *object, + const gchar *member_name, + JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +void json_object_set_member (JsonObject *object, + const gchar *member_name, + JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_object_set_int_member (JsonObject *object, + const gchar *member_name, + gint64 value); +JSON_AVAILABLE_IN_1_0 +void json_object_set_double_member (JsonObject *object, + const gchar *member_name, + gdouble value); +JSON_AVAILABLE_IN_1_0 +void json_object_set_boolean_member (JsonObject *object, + const gchar *member_name, + gboolean value); +JSON_AVAILABLE_IN_1_0 +void json_object_set_string_member (JsonObject *object, + const gchar *member_name, + const gchar *value); +JSON_AVAILABLE_IN_1_0 +void json_object_set_null_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +void json_object_set_array_member (JsonObject *object, + const gchar *member_name, + JsonArray *value); +JSON_AVAILABLE_IN_1_0 +void json_object_set_object_member (JsonObject *object, + const gchar *member_name, + JsonObject *value); +JSON_AVAILABLE_IN_1_0 +GList * json_object_get_members (JsonObject *object); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_object_get_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_object_dup_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +gint64 json_object_get_int_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_6 +gint64 json_object_get_int_member_with_default (JsonObject *object, + const char *member_name, + gint64 default_value); +JSON_AVAILABLE_IN_1_0 +gdouble json_object_get_double_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_6 +double json_object_get_double_member_with_default (JsonObject *object, + const char *member_name, + double default_value); +JSON_AVAILABLE_IN_1_0 +gboolean json_object_get_boolean_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_6 +gboolean json_object_get_boolean_member_with_default (JsonObject *object, + const char *member_name, + gboolean default_value); +JSON_AVAILABLE_IN_1_0 +const gchar * json_object_get_string_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_6 +const char * json_object_get_string_member_with_default (JsonObject *object, + const char *member_name, + const char *default_value); +JSON_AVAILABLE_IN_1_0 +gboolean json_object_get_null_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +JsonArray * json_object_get_array_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +JsonObject * json_object_get_object_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +gboolean json_object_has_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +void json_object_remove_member (JsonObject *object, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +GList * json_object_get_values (JsonObject *object); +JSON_AVAILABLE_IN_1_0 +guint json_object_get_size (JsonObject *object); +JSON_AVAILABLE_IN_1_0 +void json_object_foreach_member (JsonObject *object, + JsonObjectForeach func, + gpointer data); + +JSON_AVAILABLE_IN_1_2 +void json_object_seal (JsonObject *object); +JSON_AVAILABLE_IN_1_2 +gboolean json_object_is_immutable (JsonObject *object); + +JSON_AVAILABLE_IN_1_2 +guint json_object_hash (gconstpointer key); +JSON_AVAILABLE_IN_1_2 +gboolean json_object_equal (gconstpointer a, + gconstpointer b); + +/** + * JsonObjectIter: + * + * An iterator object used to iterate over the members of a JSON object. + * + * `JsonObjectIter` must be allocated on the stack and initialised using + * [method@Json.ObjectIter.init] or [method@Json.ObjectIter.init_ordered]. + * + * The iterator is invalidated if the object is modified during + * iteration. + * + * All the fields in the `JsonObjectIter` structure are private and should + * never be accessed directly. + * + * Since: 1.2 + */ +typedef struct { + /*< private >*/ + gpointer priv_pointer[6]; + int priv_int[2]; + gboolean priv_boolean[1]; +} JsonObjectIter; + +JSON_AVAILABLE_IN_1_2 +void json_object_iter_init (JsonObjectIter *iter, + JsonObject *object); +JSON_AVAILABLE_IN_1_2 +gboolean json_object_iter_next (JsonObjectIter *iter, + const gchar **member_name, + JsonNode **member_node); + +JSON_AVAILABLE_IN_1_6 +void json_object_iter_init_ordered (JsonObjectIter *iter, + JsonObject *object); +JSON_AVAILABLE_IN_1_6 +gboolean json_object_iter_next_ordered (JsonObjectIter *iter, + const char **member_name, + JsonNode **member_node); + +JSON_AVAILABLE_IN_1_0 +GType json_array_get_type (void) G_GNUC_CONST; +JSON_AVAILABLE_IN_1_0 +JsonArray * json_array_new (void); +JSON_AVAILABLE_IN_1_0 +JsonArray * json_array_sized_new (guint n_elements); +JSON_AVAILABLE_IN_1_0 +JsonArray * json_array_ref (JsonArray *array); +JSON_AVAILABLE_IN_1_0 +void json_array_unref (JsonArray *array); +JSON_AVAILABLE_IN_1_0 +void json_array_add_element (JsonArray *array, + JsonNode *node); +JSON_AVAILABLE_IN_1_0 +void json_array_add_int_element (JsonArray *array, + gint64 value); +JSON_AVAILABLE_IN_1_0 +void json_array_add_double_element (JsonArray *array, + gdouble value); +JSON_AVAILABLE_IN_1_0 +void json_array_add_boolean_element (JsonArray *array, + gboolean value); +JSON_AVAILABLE_IN_1_0 +void json_array_add_string_element (JsonArray *array, + const gchar *value); +JSON_AVAILABLE_IN_1_0 +void json_array_add_null_element (JsonArray *array); +JSON_AVAILABLE_IN_1_0 +void json_array_add_array_element (JsonArray *array, + JsonArray *value); +JSON_AVAILABLE_IN_1_0 +void json_array_add_object_element (JsonArray *array, + JsonObject *value); +JSON_AVAILABLE_IN_1_0 +GList * json_array_get_elements (JsonArray *array); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_array_get_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +gint64 json_array_get_int_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +gdouble json_array_get_double_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +gboolean json_array_get_boolean_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +const gchar * json_array_get_string_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +gboolean json_array_get_null_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +JsonArray * json_array_get_array_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +JsonObject * json_array_get_object_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_array_dup_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +void json_array_remove_element (JsonArray *array, + guint index_); +JSON_AVAILABLE_IN_1_0 +guint json_array_get_length (JsonArray *array); +JSON_AVAILABLE_IN_1_0 +void json_array_foreach_element (JsonArray *array, + JsonArrayForeach func, + gpointer data); +JSON_AVAILABLE_IN_1_2 +void json_array_seal (JsonArray *array); +JSON_AVAILABLE_IN_1_2 +gboolean json_array_is_immutable (JsonArray *array); + +JSON_AVAILABLE_IN_1_2 +guint json_array_hash (gconstpointer key); +JSON_AVAILABLE_IN_1_2 +gboolean json_array_equal (gconstpointer a, + gconstpointer b); + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonArray, json_array_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonObject, json_object_unref) +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_unref) +#endif + +G_END_DECLS + +#endif /* __JSON_TYPES_H__ */ + +/* json-builder.h: JSON tree builder * - * Licence: wxWindows Library Licence, Version 3.1 + * This file is part of JSON-GLib + * Copyright (C) 2010 Luca Bruno + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Luca Bruno */ -#ifndef __GUM_MIPS_WRITER_H__ -#define __GUM_MIPS_WRITER_H__ +#ifndef __JSON_BUILDER_H__ +#define __JSON_BUILDER_H__ +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif -#define GUM_MIPS_J_MAX_DISTANCE (1 << 28) G_BEGIN_DECLS -typedef struct _GumMipsWriter GumMipsWriter; +#define JSON_TYPE_BUILDER (json_builder_get_type ()) +#define JSON_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_BUILDER, JsonBuilder)) +#define JSON_IS_BUILDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_BUILDER)) +#define JSON_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_BUILDER, JsonBuilderClass)) +#define JSON_IS_BUILDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_BUILDER)) +#define JSON_BUILDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_BUILDER, JsonBuilderClass)) -struct _GumMipsWriter -{ - volatile gint ref_count; - gboolean flush_on_destroy; +typedef struct _JsonBuilder JsonBuilder; +typedef struct _JsonBuilderPrivate JsonBuilderPrivate; +typedef struct _JsonBuilderClass JsonBuilderClass; - guint32 * base; - guint32 * code; - GumAddress pc; +struct _JsonBuilder +{ + /*< private >*/ + GObject parent_instance; - GumMetalHashTable * label_defs; - GumMetalArray label_refs; + JsonBuilderPrivate *priv; }; -GUM_API GumMipsWriter * gum_mips_writer_new (gpointer code_address); -GUM_API GumMipsWriter * gum_mips_writer_ref (GumMipsWriter * writer); -GUM_API void gum_mips_writer_unref (GumMipsWriter * writer); +struct _JsonBuilderClass +{ + /*< private >*/ + GObjectClass parent_class; -GUM_API void gum_mips_writer_init (GumMipsWriter * writer, - gpointer code_address); -GUM_API void gum_mips_writer_clear (GumMipsWriter * writer); + /* padding, for future expansion */ + void (* _json_reserved1) (void); + void (* _json_reserved2) (void); +}; -GUM_API void gum_mips_writer_reset (GumMipsWriter * writer, - gpointer code_address); +JSON_AVAILABLE_IN_1_0 +GType json_builder_get_type (void) G_GNUC_CONST; + +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_new (void); +JSON_AVAILABLE_IN_1_2 +JsonBuilder *json_builder_new_immutable (void); +JSON_AVAILABLE_IN_1_0 +JsonNode *json_builder_get_root (JsonBuilder *builder); +JSON_AVAILABLE_IN_1_0 +void json_builder_reset (JsonBuilder *builder); + +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_begin_array (JsonBuilder *builder); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_end_array (JsonBuilder *builder); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_begin_object (JsonBuilder *builder); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_end_object (JsonBuilder *builder); + +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_set_member_name (JsonBuilder *builder, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_add_value (JsonBuilder *builder, + JsonNode *node); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_add_int_value (JsonBuilder *builder, + gint64 value); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_add_double_value (JsonBuilder *builder, + gdouble value); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_add_boolean_value (JsonBuilder *builder, + gboolean value); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_add_string_value (JsonBuilder *builder, + const gchar *value); +JSON_AVAILABLE_IN_1_0 +JsonBuilder *json_builder_add_null_value (JsonBuilder *builder); + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonBuilder, g_object_unref) +#endif -GUM_API gpointer gum_mips_writer_cur (GumMipsWriter * self); -GUM_API guint gum_mips_writer_offset (GumMipsWriter * self); -GUM_API void gum_mips_writer_skip (GumMipsWriter * self, guint n_bytes); +G_END_DECLS -GUM_API gboolean gum_mips_writer_flush (GumMipsWriter * self); +#endif /* __JSON_BUILDER_H__ */ +/* json-generator.h - JSON streams generator + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ -GUM_API gboolean gum_mips_writer_put_label (GumMipsWriter * self, - gconstpointer id); +#ifndef __JSON_GENERATOR_H__ +#define __JSON_GENERATOR_H__ -GUM_API void gum_mips_writer_put_call_address_with_arguments ( - GumMipsWriter * self, GumAddress func, guint n_args, ...); -GUM_API void gum_mips_writer_put_call_address_with_arguments_array ( - GumMipsWriter * self, GumAddress func, guint n_args, - const GumArgument * args); -GUM_API void gum_mips_writer_put_call_reg_with_arguments (GumMipsWriter * self, - mips_reg reg, guint n_args, ...); -GUM_API void gum_mips_writer_put_call_reg_with_arguments_array ( - GumMipsWriter * self, mips_reg reg, guint n_args, const GumArgument * args); +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif -GUM_API gboolean gum_mips_writer_can_branch_directly_between (GumAddress from, - GumAddress to); -GUM_API gboolean gum_mips_writer_put_j_address (GumMipsWriter * self, - GumAddress address); -GUM_API gboolean gum_mips_writer_put_j_address_without_nop ( - GumMipsWriter * self, GumAddress address); -GUM_API void gum_mips_writer_put_j_label (GumMipsWriter * self, - gconstpointer label_id); -GUM_API void gum_mips_writer_put_jr_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_jal_address (GumMipsWriter * self, - guint32 address); -GUM_API void gum_mips_writer_put_jalr_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_b_offset (GumMipsWriter * self, gint32 offset); -GUM_API void gum_mips_writer_put_beq_reg_reg_label (GumMipsWriter * self, - mips_reg right_reg, mips_reg left_reg, gconstpointer label_id); -GUM_API void gum_mips_writer_put_ret (GumMipsWriter * self); -GUM_API void gum_mips_writer_put_la_reg_address (GumMipsWriter * self, - mips_reg reg, GumAddress address); -GUM_API void gum_mips_writer_put_lui_reg_imm (GumMipsWriter * self, - mips_reg reg, guint imm); -GUM_API void gum_mips_writer_put_dsll_reg_reg (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg, guint amount); -GUM_API void gum_mips_writer_put_ori_reg_reg_imm (GumMipsWriter * self, - mips_reg rt, mips_reg rs, guint imm); -GUM_API void gum_mips_writer_put_ld_reg_reg_offset (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg, gsize src_offset); -GUM_API void gum_mips_writer_put_lw_reg_reg_offset (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg, gsize src_offset); -GUM_API void gum_mips_writer_put_sw_reg_reg_offset (GumMipsWriter * self, - mips_reg src_reg, mips_reg dst_reg, gsize dst_offset); -GUM_API void gum_mips_writer_put_move_reg_reg (GumMipsWriter * self, - mips_reg dst_reg, mips_reg src_reg); -GUM_API void gum_mips_writer_put_addu_reg_reg_reg (GumMipsWriter * self, - mips_reg dst_reg, mips_reg left_reg, mips_reg right_reg); -GUM_API void gum_mips_writer_put_addi_reg_reg_imm (GumMipsWriter * self, - mips_reg dst_reg, mips_reg left_reg, gint32 imm); -GUM_API void gum_mips_writer_put_addi_reg_imm (GumMipsWriter * self, - mips_reg dst_reg, gint32 imm); -GUM_API void gum_mips_writer_put_sub_reg_reg_imm (GumMipsWriter * self, - mips_reg dst_reg, mips_reg left_reg, gint32 imm); +G_BEGIN_DECLS -GUM_API void gum_mips_writer_put_push_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_pop_reg (GumMipsWriter * self, mips_reg reg); +#define JSON_TYPE_GENERATOR (json_generator_get_type ()) +#define JSON_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_GENERATOR, JsonGenerator)) +#define JSON_IS_GENERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_GENERATOR)) +#define JSON_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_GENERATOR, JsonGeneratorClass)) +#define JSON_IS_GENERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_GENERATOR)) +#define JSON_GENERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_GENERATOR, JsonGeneratorClass)) -GUM_API void gum_mips_writer_put_mfhi_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_mflo_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_mthi_reg (GumMipsWriter * self, mips_reg reg); -GUM_API void gum_mips_writer_put_mtlo_reg (GumMipsWriter * self, mips_reg reg); +typedef struct _JsonGenerator JsonGenerator; +typedef struct _JsonGeneratorPrivate JsonGeneratorPrivate; +typedef struct _JsonGeneratorClass JsonGeneratorClass; + +struct _JsonGenerator +{ + /*< private >*/ + GObject parent_instance; -GUM_API void gum_mips_writer_put_nop (GumMipsWriter * self); -GUM_API void gum_mips_writer_put_break (GumMipsWriter * self); + JsonGeneratorPrivate *priv; +}; -GUM_API void gum_mips_writer_put_prologue_trampoline (GumMipsWriter * self, - mips_reg reg, GumAddress address); +struct _JsonGeneratorClass +{ + /*< private >*/ + GObjectClass parent_class; -GUM_API void gum_mips_writer_put_instruction (GumMipsWriter * self, - guint32 insn); -GUM_API gboolean gum_mips_writer_put_bytes (GumMipsWriter * self, - const guint8 * data, guint n); + /* padding, for future expansion */ + void (* _json_reserved1) (void); + void (* _json_reserved2) (void); + void (* _json_reserved3) (void); + void (* _json_reserved4) (void); +}; -G_END_DECLS +JSON_AVAILABLE_IN_1_0 +GType json_generator_get_type (void) G_GNUC_CONST; + +JSON_AVAILABLE_IN_1_0 +JsonGenerator * json_generator_new (void); + +JSON_AVAILABLE_IN_1_0 +void json_generator_set_pretty (JsonGenerator *generator, + gboolean is_pretty); +JSON_AVAILABLE_IN_1_0 +gboolean json_generator_get_pretty (JsonGenerator *generator); +JSON_AVAILABLE_IN_1_0 +void json_generator_set_indent (JsonGenerator *generator, + guint indent_level); +JSON_AVAILABLE_IN_1_0 +guint json_generator_get_indent (JsonGenerator *generator); +JSON_AVAILABLE_IN_1_0 +void json_generator_set_indent_char (JsonGenerator *generator, + gunichar indent_char); +JSON_AVAILABLE_IN_1_0 +gunichar json_generator_get_indent_char (JsonGenerator *generator); +JSON_AVAILABLE_IN_1_0 +void json_generator_set_root (JsonGenerator *generator, + JsonNode *node); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_generator_get_root (JsonGenerator *generator); + +JSON_AVAILABLE_IN_1_4 +GString *json_generator_to_gstring (JsonGenerator *generator, + GString *string); + +JSON_AVAILABLE_IN_1_0 +gchar * json_generator_to_data (JsonGenerator *generator, + gsize *length); +JSON_AVAILABLE_IN_1_0 +gboolean json_generator_to_file (JsonGenerator *generator, + const gchar *filename, + GError **error); +JSON_AVAILABLE_IN_1_0 +gboolean json_generator_to_stream (JsonGenerator *generator, + GOutputStream *stream, + GCancellable *cancellable, + GError **error); +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonGenerator, g_object_unref) #endif -G_BEGIN_DECLS +G_END_DECLS -#define GUM_TYPE_STALKER (gum_stalker_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumStalker, gum_stalker, GUM, STALKER, GObject) +#endif /* __JSON_GENERATOR_H__ */ +/* json-parser.h - JSON streams parser + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ -#define GUM_TYPE_STALKER_TRANSFORMER (gum_stalker_transformer_get_type ()) -GUM_DECLARE_INTERFACE (GumStalkerTransformer, gum_stalker_transformer, GUM, - STALKER_TRANSFORMER, GObject) +#ifndef __JSON_PARSER_H__ +#define __JSON_PARSER_H__ -#define GUM_TYPE_DEFAULT_STALKER_TRANSFORMER \ - (gum_default_stalker_transformer_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumDefaultStalkerTransformer, - gum_default_stalker_transformer, - GUM, DEFAULT_STALKER_TRANSFORMER, - GObject) +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif -#define GUM_TYPE_CALLBACK_STALKER_TRANSFORMER \ - (gum_callback_stalker_transformer_get_type ()) -GUM_DECLARE_FINAL_TYPE (GumCallbackStalkerTransformer, - gum_callback_stalker_transformer, - GUM, CALLBACK_STALKER_TRANSFORMER, - GObject) -#define GUM_TYPE_STALKER_OBSERVER (gum_stalker_observer_get_type ()) -GUM_DECLARE_INTERFACE (GumStalkerObserver, gum_stalker_observer, GUM, - STALKER_OBSERVER, GObject) +G_BEGIN_DECLS -typedef struct _GumStalkerIterator GumStalkerIterator; -typedef struct _GumStalkerOutput GumStalkerOutput; -typedef struct _GumBackpatch GumBackpatch; -typedef struct _GumBackpatchInstruction GumBackpatchInstruction; -typedef void (* GumStalkerIncrementFunc) (GumStalkerObserver * self); -typedef void (* GumStalkerNotifyBackpatchFunc) (GumStalkerObserver * self, - const GumBackpatch * backpatch, gsize size); -typedef void (* GumStalkerSwitchCallbackFunc) (GumStalkerObserver * self, - gpointer from_address, gpointer start_address, gpointer from_insn, - gpointer * target); -typedef union _GumStalkerWriter GumStalkerWriter; -typedef void (* GumStalkerTransformerCallback) (GumStalkerIterator * iterator, - GumStalkerOutput * output, gpointer user_data); -typedef void (* GumStalkerCallout) (GumCpuContext * cpu_context, - gpointer user_data); +#define JSON_TYPE_PARSER (json_parser_get_type ()) +#define JSON_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_PARSER, JsonParser)) +#define JSON_IS_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_PARSER)) +#define JSON_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_PARSER, JsonParserClass)) +#define JSON_IS_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_PARSER)) +#define JSON_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_PARSER, JsonParserClass)) -typedef guint GumProbeId; -typedef struct _GumCallDetails GumCallDetails; -typedef void (* GumCallProbeCallback) (GumCallDetails * details, - gpointer user_data); -typedef void (* GumStalkerRunOnThreadFunc) (const GumCpuContext * cpu_context, - gpointer user_data); +/** + * JSON_PARSER_ERROR: + * + * Error domain for `JsonParser`. + */ +#define JSON_PARSER_ERROR (json_parser_error_quark ()) -#ifndef GUM_DIET +typedef struct _JsonParser JsonParser; +typedef struct _JsonParserPrivate JsonParserPrivate; +typedef struct _JsonParserClass JsonParserClass; -struct _GumStalkerTransformerInterface +/** + * JsonParserError: + * @JSON_PARSER_ERROR_PARSE: parse error + * @JSON_PARSER_ERROR_TRAILING_COMMA: unexpected trailing comma + * @JSON_PARSER_ERROR_MISSING_COMMA: expected comma + * @JSON_PARSER_ERROR_MISSING_COLON: expected colon + * @JSON_PARSER_ERROR_INVALID_BAREWORD: invalid bareword + * @JSON_PARSER_ERROR_EMPTY_MEMBER_NAME: empty member name (Since: 0.16) + * @JSON_PARSER_ERROR_INVALID_DATA: invalid data (Since: 0.18) + * @JSON_PARSER_ERROR_UNKNOWN: unknown error + * + * Error codes for `JSON_PARSER_ERROR`. + * + * This enumeration can be extended at later date + */ +typedef enum { + JSON_PARSER_ERROR_PARSE, + JSON_PARSER_ERROR_TRAILING_COMMA, + JSON_PARSER_ERROR_MISSING_COMMA, + JSON_PARSER_ERROR_MISSING_COLON, + JSON_PARSER_ERROR_INVALID_BAREWORD, + JSON_PARSER_ERROR_EMPTY_MEMBER_NAME, + JSON_PARSER_ERROR_INVALID_DATA, + + JSON_PARSER_ERROR_UNKNOWN +} JsonParserError; + +struct _JsonParser { - GTypeInterface parent; + /*< private >*/ + GObject parent_instance; - void (* transform_block) (GumStalkerTransformer * self, - GumStalkerIterator * iterator, GumStalkerOutput * output); + JsonParserPrivate *priv; }; -struct _GumStalkerObserverInterface +/** + * JsonParserClass: + * @parse_start: class handler for the JsonParser::parse-start signal + * @object_start: class handler for the JsonParser::object-start signal + * @object_member: class handler for the JsonParser::object-member signal + * @object_end: class handler for the JsonParser::object-end signal + * @array_start: class handler for the JsonParser::array-start signal + * @array_element: class handler for the JsonParser::array-element signal + * @array_end: class handler for the JsonParser::array-end signal + * @parse_end: class handler for the JsonParser::parse-end signal + * @error: class handler for the JsonParser::error signal + * + * The class structure for the JsonParser type. + */ +struct _JsonParserClass { - GTypeInterface parent; + /*< private >*/ + GObjectClass parent_class; - /* Common */ - GumStalkerIncrementFunc increment_total; + /*< public >*/ + void (* parse_start) (JsonParser *parser); - GumStalkerIncrementFunc increment_call_imm; - GumStalkerIncrementFunc increment_call_reg; + void (* object_start) (JsonParser *parser); + void (* object_member) (JsonParser *parser, + JsonObject *object, + const gchar *member_name); + void (* object_end) (JsonParser *parser, + JsonObject *object); - /* x86 only */ - GumStalkerIncrementFunc increment_call_mem; + void (* array_start) (JsonParser *parser); + void (* array_element) (JsonParser *parser, + JsonArray *array, + gint index_); + void (* array_end) (JsonParser *parser, + JsonArray *array); - /* Arm64 only */ - GumStalkerIncrementFunc increment_excluded_call_reg; + void (* parse_end) (JsonParser *parser); + + void (* error) (JsonParser *parser, + const GError *error); - /* x86 only */ - GumStalkerIncrementFunc increment_ret_slow_path; + /*< private >*/ + /* padding for future expansion */ + void (* _json_reserved1) (void); + void (* _json_reserved2) (void); + void (* _json_reserved3) (void); + void (* _json_reserved4) (void); + void (* _json_reserved5) (void); + void (* _json_reserved6) (void); + void (* _json_reserved7) (void); + void (* _json_reserved8) (void); +}; - /* Arm64 only */ - GumStalkerIncrementFunc increment_ret; +JSON_AVAILABLE_IN_1_0 +GQuark json_parser_error_quark (void); +JSON_AVAILABLE_IN_1_0 +GType json_parser_get_type (void) G_GNUC_CONST; + +JSON_AVAILABLE_IN_1_0 +JsonParser *json_parser_new (void); +JSON_AVAILABLE_IN_1_2 +JsonParser *json_parser_new_immutable (void); +JSON_AVAILABLE_IN_1_0 +gboolean json_parser_load_from_file (JsonParser *parser, + const gchar *filename, + GError **error); +JSON_AVAILABLE_IN_1_6 +gboolean json_parser_load_from_mapped_file (JsonParser *parser, + const gchar *filename, + GError **error); +JSON_AVAILABLE_IN_1_0 +gboolean json_parser_load_from_data (JsonParser *parser, + const gchar *data, + gssize length, + GError **error); +JSON_AVAILABLE_IN_1_0 +gboolean json_parser_load_from_stream (JsonParser *parser, + GInputStream *stream, + GCancellable *cancellable, + GError **error); +JSON_AVAILABLE_IN_1_0 +void json_parser_load_from_stream_async (JsonParser *parser, + GInputStream *stream, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +JSON_AVAILABLE_IN_1_0 +gboolean json_parser_load_from_stream_finish (JsonParser *parser, + GAsyncResult *result, + GError **error); + +JSON_AVAILABLE_IN_1_0 +JsonNode * json_parser_get_root (JsonParser *parser); +JSON_AVAILABLE_IN_1_4 +JsonNode * json_parser_steal_root (JsonParser *parser); + +JSON_AVAILABLE_IN_1_0 +guint json_parser_get_current_line (JsonParser *parser); +JSON_AVAILABLE_IN_1_0 +guint json_parser_get_current_pos (JsonParser *parser); +JSON_AVAILABLE_IN_1_0 +gboolean json_parser_has_assignment (JsonParser *parser, + gchar **variable_name); + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonParser, g_object_unref) +#endif - /* Common */ - GumStalkerIncrementFunc increment_post_call_invoke; - GumStalkerIncrementFunc increment_excluded_call_imm; +G_END_DECLS - /* Common */ - GumStalkerIncrementFunc increment_jmp_imm; - GumStalkerIncrementFunc increment_jmp_reg; +#endif /* __JSON_PARSER_H__ */ +/* json-path.h - JSONPath implementation + * + * This file is part of JSON-GLib + * Copyright © 2011 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ - /* x86 only */ - GumStalkerIncrementFunc increment_jmp_mem; - GumStalkerIncrementFunc increment_jmp_cond_imm; - GumStalkerIncrementFunc increment_jmp_cond_mem; - GumStalkerIncrementFunc increment_jmp_cond_reg; - GumStalkerIncrementFunc increment_jmp_cond_jcxz; +#ifndef __JSON_PATH_H__ +#define __JSON_PATH_H__ - /* Arm64 only */ - GumStalkerIncrementFunc increment_jmp_cond_cc; - GumStalkerIncrementFunc increment_jmp_cond_cbz; - GumStalkerIncrementFunc increment_jmp_cond_cbnz; - GumStalkerIncrementFunc increment_jmp_cond_tbz; - GumStalkerIncrementFunc increment_jmp_cond_tbnz; +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif - /* Common */ - GumStalkerIncrementFunc increment_jmp_continuation; - /* x86 only */ - GumStalkerIncrementFunc increment_sysenter_slow_path; +G_BEGIN_DECLS - GumStalkerNotifyBackpatchFunc notify_backpatch; +#define JSON_TYPE_PATH (json_path_get_type ()) +#define JSON_PATH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_PATH, JsonPath)) +#define JSON_IS_PATH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_PATH)) - GumStalkerSwitchCallbackFunc switch_callback; -}; +/** + * JSON_PATH_ERROR: + * + * Error domain for `JsonPath`. + * + * Since: 0.14 + */ +#define JSON_PATH_ERROR (json_path_error_quark ()) +/** + * JsonPathError: + * @JSON_PATH_ERROR_INVALID_QUERY: Invalid query + * + * Error codes for `JSON_PATH_ERROR`. + * + * This enumeration can be extended at later date + * + * Since: 0.14 + */ +typedef enum { + JSON_PATH_ERROR_INVALID_QUERY +} JsonPathError; + +typedef struct _JsonPath JsonPath; +typedef struct _JsonPathClass JsonPathClass; + +JSON_AVAILABLE_IN_1_0 +GType json_path_get_type (void) G_GNUC_CONST; +JSON_AVAILABLE_IN_1_0 +GQuark json_path_error_quark (void); + +JSON_AVAILABLE_IN_1_0 +JsonPath * json_path_new (void); + +JSON_AVAILABLE_IN_1_0 +gboolean json_path_compile (JsonPath *path, + const char *expression, + GError **error); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_path_match (JsonPath *path, + JsonNode *root); + +JSON_AVAILABLE_IN_1_0 +JsonNode * json_path_query (const char *expression, + JsonNode *root, + GError **error); + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonPath, g_object_unref) #endif -union _GumStalkerWriter -{ - gpointer instance; - GumX86Writer * x86; - GumArmWriter * arm; - GumThumbWriter * thumb; - GumArm64Writer * arm64; - GumMipsWriter * mips; -}; +G_END_DECLS -struct _GumStalkerOutput +#endif /* __JSON_PATH_H__ */ +/* json-reader.h - JSON cursor parser + * + * This file is part of JSON-GLib + * Copyright (C) 2010 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ + +#ifndef __JSON_READER_H__ +#define __JSON_READER_H__ + +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +#define JSON_TYPE_READER (json_reader_get_type ()) +#define JSON_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_READER, JsonReader)) +#define JSON_IS_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_READER)) +#define JSON_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), JSON_TYPE_READER, JsonReaderClass)) +#define JSON_IS_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), JSON_TYPE_READER)) +#define JSON_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), JSON_TYPE_READER, JsonReaderClass)) + +/** + * JSON_READER_ERROR: + * + * Error domain for `JsonReader`. + * + * Since: 0.12 + */ +#define JSON_READER_ERROR (json_reader_error_quark ()) + +typedef struct _JsonReader JsonReader; +typedef struct _JsonReaderPrivate JsonReaderPrivate; +typedef struct _JsonReaderClass JsonReaderClass; + +/** + * JsonReaderError: + * @JSON_READER_ERROR_NO_ARRAY: No array found at the current position + * @JSON_READER_ERROR_INVALID_INDEX: Index out of bounds + * @JSON_READER_ERROR_NO_OBJECT: No object found at the current position + * @JSON_READER_ERROR_INVALID_MEMBER: Member not found + * @JSON_READER_ERROR_INVALID_NODE: No valid node found at the current position + * @JSON_READER_ERROR_NO_VALUE: The node at the current position does not + * hold a value + * @JSON_READER_ERROR_INVALID_TYPE: The node at the current position does not + * hold a value of the desired type + * + * Error codes for `JSON_READER_ERROR`. + * + * This enumeration can be extended at later date + * + * Since: 0.12 + */ +typedef enum { + JSON_READER_ERROR_NO_ARRAY, + JSON_READER_ERROR_INVALID_INDEX, + JSON_READER_ERROR_NO_OBJECT, + JSON_READER_ERROR_INVALID_MEMBER, + JSON_READER_ERROR_INVALID_NODE, + JSON_READER_ERROR_NO_VALUE, + JSON_READER_ERROR_INVALID_TYPE +} JsonReaderError; + +struct _JsonReader { - GumStalkerWriter writer; - GumInstructionEncoding encoding; + /*< private >*/ + GObject parent_instance; + + JsonReaderPrivate *priv; }; -struct _GumCallDetails +struct _JsonReaderClass { - gpointer target_address; - gpointer return_address; - gpointer stack_data; - GumCpuContext * cpu_context; + /*< private >*/ + GObjectClass parent_class; + + void (*_json_padding0) (void); + void (*_json_padding1) (void); + void (*_json_padding2) (void); + void (*_json_padding3) (void); + void (*_json_padding4) (void); }; -GUM_API gboolean gum_stalker_is_supported (void); +JSON_AVAILABLE_IN_1_0 +GQuark json_reader_error_quark (void); +JSON_AVAILABLE_IN_1_0 +GType json_reader_get_type (void) G_GNUC_CONST; + +JSON_AVAILABLE_IN_1_0 +JsonReader * json_reader_new (JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +void json_reader_set_root (JsonReader *reader, + JsonNode *root); + +JSON_AVAILABLE_IN_1_0 +const GError * json_reader_get_error (JsonReader *reader); + +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_is_array (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_read_element (JsonReader *reader, + guint index_); +JSON_AVAILABLE_IN_1_0 +void json_reader_end_element (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gint json_reader_count_elements (JsonReader *reader); + +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_is_object (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_read_member (JsonReader *reader, + const gchar *member_name); +JSON_AVAILABLE_IN_1_0 +void json_reader_end_member (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gint json_reader_count_members (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gchar ** json_reader_list_members (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +const gchar * json_reader_get_member_name (JsonReader *reader); + +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_is_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +JsonNode * json_reader_get_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gint64 json_reader_get_int_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gdouble json_reader_get_double_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +const gchar * json_reader_get_string_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_get_boolean_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_0 +gboolean json_reader_get_null_value (JsonReader *reader); +JSON_AVAILABLE_IN_1_8 +JsonNode * json_reader_get_current_node (JsonReader *reader); + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonReader, g_object_unref) +#endif -GUM_API void gum_stalker_activate_experimental_unwind_support (void); +G_END_DECLS -GUM_API GumStalker * gum_stalker_new (void); +#endif /* __JSON_READER_H__ */ +/* json-utils.h - JSON utility API + * + * This file is part of JSON-GLib + * Copyright 2015 Emmanuele Bassi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + */ -GUM_API void gum_stalker_exclude (GumStalker * self, - const GumMemoryRange * range); +#ifndef __JSON_UTILS_H__ +#define __JSON_UTILS_H__ -GUM_API gint gum_stalker_get_trust_threshold (GumStalker * self); -GUM_API void gum_stalker_set_trust_threshold (GumStalker * self, - gint trust_threshold); +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif -GUM_API void gum_stalker_flush (GumStalker * self); -GUM_API void gum_stalker_stop (GumStalker * self); -GUM_API gboolean gum_stalker_garbage_collect (GumStalker * self); -GUM_API void gum_stalker_follow_me (GumStalker * self, - GumStalkerTransformer * transformer, GumEventSink * sink); -GUM_API void gum_stalker_unfollow_me (GumStalker * self); -GUM_API gboolean gum_stalker_is_following_me (GumStalker * self); +G_BEGIN_DECLS -GUM_API void gum_stalker_follow (GumStalker * self, GumThreadId thread_id, - GumStalkerTransformer * transformer, GumEventSink * sink); -GUM_API void gum_stalker_unfollow (GumStalker * self, GumThreadId thread_id); +JSON_AVAILABLE_IN_1_2 +JsonNode * json_from_string (const char *str, + GError **error); +JSON_AVAILABLE_IN_1_2 +char * json_to_string (JsonNode *node, + gboolean pretty); -GUM_API void gum_stalker_activate (GumStalker * self, gconstpointer target); -GUM_API void gum_stalker_deactivate (GumStalker * self); +G_END_DECLS -GUM_API void gum_stalker_set_observer (GumStalker * self, - GumStalkerObserver * observer); +#endif /* __JSON_UTILS_H__ */ -GUM_API void gum_stalker_prefetch (GumStalker * self, gconstpointer address, - gint recycle_count); -GUM_API void gum_stalker_prefetch_backpatch (GumStalker * self, - const GumBackpatch * notification); -GUM_API void gum_stalker_recompile (GumStalker * self, gconstpointer address); -GUM_API gpointer gum_stalker_backpatch_get_from ( - const GumBackpatch * backpatch); -GUM_API gpointer gum_stalker_backpatch_get_to ( - const GumBackpatch * backpatch); +/* This file is generated by glib-mkenums, do not modify it. This code is licensed under the same license as the containing project. Note that it links to GLib, so must comply with the LGPL linking clauses. */ -GUM_API void gum_stalker_invalidate (GumStalker * self, gconstpointer address); -GUM_API void gum_stalker_invalidate_for_thread (GumStalker * self, - GumThreadId thread_id, gconstpointer address); +#ifndef __JSON_ENUM_TYPES_H__ +#define __JSON_ENUM_TYPES_H__ -GUM_API GumProbeId gum_stalker_add_call_probe (GumStalker * self, - gpointer target_address, GumCallProbeCallback callback, gpointer data, - GDestroyNotify notify); -GUM_API void gum_stalker_remove_call_probe (GumStalker * self, - GumProbeId id); +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif -GUM_API gboolean gum_stalker_run_on_thread (GumStalker * self, - GumThreadId thread_id, GumStalkerRunOnThreadFunc func, gpointer data, - GDestroyNotify data_destroy); -GUM_API gboolean gum_stalker_run_on_thread_sync (GumStalker * self, - GumThreadId thread_id, GumStalkerRunOnThreadFunc func, gpointer data); -GUM_API GumStalkerTransformer * gum_stalker_transformer_make_default (void); -GUM_API GumStalkerTransformer * gum_stalker_transformer_make_from_callback ( - GumStalkerTransformerCallback callback, gpointer data, - GDestroyNotify data_destroy); +G_BEGIN_DECLS +/* enumerations from "json-parser.h" */ +JSON_AVAILABLE_IN_1_0 +GType json_parser_error_get_type (void) G_GNUC_CONST; +#define JSON_TYPE_PARSER_ERROR (json_parser_error_get_type()) +/* enumerations from "json-path.h" */ +JSON_AVAILABLE_IN_1_0 +GType json_path_error_get_type (void) G_GNUC_CONST; +#define JSON_TYPE_PATH_ERROR (json_path_error_get_type()) +/* enumerations from "json-reader.h" */ +JSON_AVAILABLE_IN_1_0 +GType json_reader_error_get_type (void) G_GNUC_CONST; +#define JSON_TYPE_READER_ERROR (json_reader_error_get_type()) +/* enumerations from "json-types.h" */ +JSON_AVAILABLE_IN_1_0 +GType json_node_type_get_type (void) G_GNUC_CONST; +#define JSON_TYPE_NODE_TYPE (json_node_type_get_type()) +G_END_DECLS -GUM_API void gum_stalker_transformer_transform_block ( - GumStalkerTransformer * self, GumStalkerIterator * iterator, - GumStalkerOutput * output); +#endif /* !__JSON_ENUM_TYPES_H__ */ -GUM_API gboolean gum_stalker_iterator_next (GumStalkerIterator * self, - const cs_insn ** insn); -GUM_API void gum_stalker_iterator_keep (GumStalkerIterator * self); -GUM_API GumMemoryAccess gum_stalker_iterator_get_memory_access ( - GumStalkerIterator * self); -GUM_API void gum_stalker_iterator_put_callout (GumStalkerIterator * self, - GumStalkerCallout callout, gpointer data, GDestroyNotify data_destroy); -GUM_API void gum_stalker_iterator_put_chaining_return ( - GumStalkerIterator * self); -GUM_API csh gum_stalker_iterator_get_capstone (GumStalkerIterator * self); +/* Generated data ends here */ -#define GUM_DECLARE_OBSERVER_INCREMENT(name) \ - GUM_API void gum_stalker_observer_increment_##name ( \ - GumStalkerObserver * observer); -GUM_DECLARE_OBSERVER_INCREMENT (total) +/* json-gobject.h - JSON GObject integration + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Emmanuele Bassi + */ -GUM_DECLARE_OBSERVER_INCREMENT (call_imm) -GUM_DECLARE_OBSERVER_INCREMENT (call_reg) +#ifndef __JSON_GOBJECT_H__ +#define __JSON_GOBJECT_H__ -GUM_DECLARE_OBSERVER_INCREMENT (call_mem) -GUM_DECLARE_OBSERVER_INCREMENT (excluded_call_reg) +G_BEGIN_DECLS -GUM_DECLARE_OBSERVER_INCREMENT (ret_slow_path) +#define JSON_TYPE_SERIALIZABLE (json_serializable_get_type ()) +#define JSON_SERIALIZABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), JSON_TYPE_SERIALIZABLE, JsonSerializable)) +#define JSON_IS_SERIALIZABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), JSON_TYPE_SERIALIZABLE)) +#define JSON_SERIALIZABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), JSON_TYPE_SERIALIZABLE, JsonSerializableIface)) -GUM_DECLARE_OBSERVER_INCREMENT (ret) +typedef struct _JsonSerializable JsonSerializable; /* dummy */ +typedef struct _JsonSerializableIface JsonSerializableIface; -GUM_DECLARE_OBSERVER_INCREMENT (post_call_invoke) -GUM_DECLARE_OBSERVER_INCREMENT (excluded_call_imm) +/** + * JsonSerializableIface: + * @serialize_property: virtual function for serializing an object property + * into JSON + * @deserialize_property: virtual function for deserializing JSON + * into an object property + * @find_property: virtual function for finding a property definition using + * its name + * @list_properties: virtual function for listing the installed property + * definitions + * @set_property: virtual function for setting a property + * @get_property: virtual function for getting a property + * + * Interface that allows serializing and deserializing object instances + * with properties storing complex data types. + * + * The [func@Json.gobject_from_data] and [func@Json.gobject_to_data] + * functions will check if the passed object type implements this interface, + * so it can also be used to override the default property serialization + * sequence. + */ +struct _JsonSerializableIface +{ + /*< private >*/ + GTypeInterface g_iface; -GUM_DECLARE_OBSERVER_INCREMENT (jmp_imm) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_reg) + /*< public >*/ + JsonNode *(* serialize_property) (JsonSerializable *serializable, + const gchar *property_name, + const GValue *value, + GParamSpec *pspec); + gboolean (* deserialize_property) (JsonSerializable *serializable, + const gchar *property_name, + GValue *value, + GParamSpec *pspec, + JsonNode *property_node); + + GParamSpec * (* find_property) (JsonSerializable *serializable, + const char *name); + GParamSpec **(* list_properties) (JsonSerializable *serializable, + guint *n_pspecs); + void (* set_property) (JsonSerializable *serializable, + GParamSpec *pspec, + const GValue *value); + void (* get_property) (JsonSerializable *serializable, + GParamSpec *pspec, + GValue *value); +}; -GUM_DECLARE_OBSERVER_INCREMENT (jmp_mem) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_imm) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_mem) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_reg) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_jcxz) +JSON_AVAILABLE_IN_1_0 +GType json_serializable_get_type (void) G_GNUC_CONST; + +JSON_AVAILABLE_IN_1_0 +JsonNode *json_serializable_serialize_property (JsonSerializable *serializable, + const gchar *property_name, + const GValue *value, + GParamSpec *pspec); +JSON_AVAILABLE_IN_1_0 +gboolean json_serializable_deserialize_property (JsonSerializable *serializable, + const gchar *property_name, + GValue *value, + GParamSpec *pspec, + JsonNode *property_node); + +JSON_AVAILABLE_IN_1_0 +GParamSpec * json_serializable_find_property (JsonSerializable *serializable, + const char *name); +JSON_AVAILABLE_IN_1_0 +GParamSpec ** json_serializable_list_properties (JsonSerializable *serializable, + guint *n_pspecs); +JSON_AVAILABLE_IN_1_0 +void json_serializable_set_property (JsonSerializable *serializable, + GParamSpec *pspec, + const GValue *value); +JSON_AVAILABLE_IN_1_0 +void json_serializable_get_property (JsonSerializable *serializable, + GParamSpec *pspec, + GValue *value); + +JSON_AVAILABLE_IN_1_0 +JsonNode *json_serializable_default_serialize_property (JsonSerializable *serializable, + const gchar *property_name, + const GValue *value, + GParamSpec *pspec); +JSON_AVAILABLE_IN_1_0 +gboolean json_serializable_default_deserialize_property (JsonSerializable *serializable, + const gchar *property_name, + GValue *value, + GParamSpec *pspec, + JsonNode *property_node); + +/** + * JsonBoxedSerializeFunc: + * @boxed: a boxed data structure + * + * Serializes the passed `GBoxed` and stores it inside a `JsonNode`, for instance: + * + * ```c + * static JsonNode * + * my_point_serialize (gconstpointer boxed) + * { + * const MyPoint *point = boxed; + * + * g_autoptr(JsonBuilder) builder = json_builder_new (); + * + * json_builder_begin_object (builder); + * json_builder_set_member_name (builder, "x"); + * json_builder_add_double_value (builder, point->x); + * json_builder_set_member_name (builder, "y"); + * json_builder_add_double_value (builder, point->y); + * json_builder_end_object (builder); + * + * return json_builder_get_root (builder); + * } + * ``` + * + * Return value: the newly created JSON node tree representing the boxed data + * + * Since: 0.10 + */ +typedef JsonNode *(* JsonBoxedSerializeFunc) (gconstpointer boxed); -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_cc) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_cbz) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_cbnz) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_tbz) -GUM_DECLARE_OBSERVER_INCREMENT (jmp_cond_tbnz) +/** + * JsonBoxedDeserializeFunc: + * @node: a node tree representing a boxed data + * + * Deserializes the contents of the passed `JsonNode` into a `GBoxed`, for instance: + * + * ```c + * static gpointer + * my_point_deserialize (JsonNode *node) + * { + * double x = 0.0, y = 0.0; + * + * if (JSON_NODE_HOLDS_ARRAY (node)) + * { + * JsonArray *array = json_node_get_array (node); + * + * if (json_array_get_length (array) == 2) + * { + * x = json_array_get_double_element (array, 0); + * y = json_array_get_double_element (array, 1); + * } + * } + * else if (JSON_NODE_HOLDS_OBJECT (node)) + * { + * JsonObject *obj = json_node_get_object (node); + * + * x = json_object_get_double_member_with_default (obj, "x", 0.0); + * y = json_object_get_double_member_with_default (obj, "y", 0.0); + * } + * + * // my_point_new() is defined elsewhere + * return my_point_new (x, y); + * } + * ``` + * + * Return value: the newly created boxed structure + * + * Since: 0.10 + */ +typedef gpointer (* JsonBoxedDeserializeFunc) (JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +void json_boxed_register_serialize_func (GType gboxed_type, + JsonNodeType node_type, + JsonBoxedSerializeFunc serialize_func); +JSON_AVAILABLE_IN_1_0 +void json_boxed_register_deserialize_func (GType gboxed_type, + JsonNodeType node_type, + JsonBoxedDeserializeFunc deserialize_func); +JSON_AVAILABLE_IN_1_0 +gboolean json_boxed_can_serialize (GType gboxed_type, + JsonNodeType *node_type); +JSON_AVAILABLE_IN_1_0 +gboolean json_boxed_can_deserialize (GType gboxed_type, + JsonNodeType node_type); +JSON_AVAILABLE_IN_1_0 +JsonNode *json_boxed_serialize (GType gboxed_type, + gconstpointer boxed); +JSON_AVAILABLE_IN_1_0 +gpointer json_boxed_deserialize (GType gboxed_type, + JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +JsonNode *json_gobject_serialize (GObject *gobject); +JSON_AVAILABLE_IN_1_0 +GObject * json_gobject_deserialize (GType gtype, + JsonNode *node); + +JSON_AVAILABLE_IN_1_0 +GObject * json_gobject_from_data (GType gtype, + const gchar *data, + gssize length, + GError **error); +JSON_AVAILABLE_IN_1_0 +gchar * json_gobject_to_data (GObject *gobject, + gsize *length); + +JSON_DEPRECATED_IN_1_0_FOR(json_gobject_from_data) +GObject * json_construct_gobject (GType gtype, + const gchar *data, + gsize length, + GError **error); +JSON_DEPRECATED_IN_1_0_FOR(json_gobject_to_data) +gchar * json_serialize_gobject (GObject *gobject, + gsize *length) G_GNUC_MALLOC; + +#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC +G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonSerializable, g_object_unref) +#endif -GUM_DECLARE_OBSERVER_INCREMENT (jmp_continuation) +G_END_DECLS -GUM_DECLARE_OBSERVER_INCREMENT (sysenter_slow_path) +#endif /* __JSON_GOBJECT_H__ */ -GUM_API void gum_stalker_observer_notify_backpatch ( - GumStalkerObserver * observer, const GumBackpatch * backpatch, gsize size); +/* json-gvariant.h - JSON GVariant integration + * + * This file is part of JSON-GLib + * Copyright (C) 2007 OpenedHand Ltd. + * Copyright (C) 2009 Intel Corp. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see . + * + * Author: + * Eduardo Lima Mitev + */ -GUM_API void gum_stalker_observer_switch_callback ( - GumStalkerObserver * observer, gpointer from_address, - gpointer start_address, gpointer from_insn, gpointer * target); +#ifndef __JSON_GVARIANT_H__ +#define __JSON_GVARIANT_H__ + +#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION) +#error "Only can be included directly." +#endif + + +G_BEGIN_DECLS + +JSON_AVAILABLE_IN_1_0 +JsonNode * json_gvariant_serialize (GVariant *variant); +JSON_AVAILABLE_IN_1_0 +gchar * json_gvariant_serialize_data (GVariant *variant, + gsize *length); + +JSON_AVAILABLE_IN_1_0 +GVariant * json_gvariant_deserialize (JsonNode *json_node, + const gchar *signature, + GError **error); +JSON_AVAILABLE_IN_1_0 +GVariant * json_gvariant_deserialize_data (const gchar *json, + gssize length, + const gchar *signature, + GError **error); G_END_DECLS -#endif -/* - * Copyright (C) 2008-2010 Ole André Vadla Ravnås - * Copyright (C) 2008 Christian Berentsen - * Copyright (C) 2020 Matt Oh - * - * Licence: wxWindows Library Licence, Version 3.1 - */ +#endif /* __JSON_GVARIANT_H__ */ -#ifndef __GUM_SYMBOL_UTIL_H__ -#define __GUM_SYMBOL_UTIL_H__ +#undef __JSON_GLIB_INSIDE__ +#endif /* __JSON_GLIB_H__ */ -typedef struct _GumDebugSymbolDetails GumDebugSymbolDetails; +G_BEGIN_DECLS -struct _GumDebugSymbolDetails +#define GUM_TYPE_SCRIPT (gum_script_get_type ()) +G_DECLARE_INTERFACE (GumScript, gum_script, GUM, SCRIPT, GObject) + +typedef void (* GumScriptMessageHandler) (const gchar * message, GBytes * data, + gpointer user_data); +typedef void (* GumScriptDebugMessageHandler) (const gchar * message, + gpointer user_data); + +struct _GumScriptInterface { - GumAddress address; - gchar module_name[GUM_MAX_PATH + 1]; - gchar symbol_name[GUM_MAX_SYMBOL_NAME + 1]; - gchar file_name[GUM_MAX_PATH + 1]; - guint line_number; - guint column; + GTypeInterface parent; + + void (* load) (GumScript * self, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + void (* load_finish) (GumScript * self, GAsyncResult * result); + void (* load_sync) (GumScript * self, GCancellable * cancellable); + void (* unload) (GumScript * self, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + void (* unload_finish) (GumScript * self, GAsyncResult * result); + void (* unload_sync) (GumScript * self, GCancellable * cancellable); + + void (* set_message_handler) (GumScript * self, + GumScriptMessageHandler handler, gpointer data, + GDestroyNotify data_destroy); + void (* post) (GumScript * self, const gchar * message, GBytes * data); + + void (* set_debug_message_handler) (GumScript * self, + GumScriptDebugMessageHandler handler, gpointer data, + GDestroyNotify data_destroy); + void (* post_debug_message) (GumScript * self, const gchar * message); + + GumStalker * (* get_stalker) (GumScript * self); }; -G_BEGIN_DECLS +GUM_API void gum_script_load (GumScript * self, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +GUM_API void gum_script_load_finish (GumScript * self, GAsyncResult * result); +GUM_API void gum_script_load_sync (GumScript * self, + GCancellable * cancellable); +GUM_API void gum_script_unload (GumScript * self, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +GUM_API void gum_script_unload_finish (GumScript * self, GAsyncResult * result); +GUM_API void gum_script_unload_sync (GumScript * self, + GCancellable * cancellable); + +GUM_API void gum_script_set_message_handler (GumScript * self, + GumScriptMessageHandler handler, gpointer data, + GDestroyNotify data_destroy); +GUM_API void gum_script_post (GumScript * self, const gchar * message, + GBytes * data); -GUM_API gboolean gum_symbol_details_from_address (gpointer address, - GumDebugSymbolDetails * details); -GUM_API gchar * gum_symbol_name_from_address (gpointer address); +GUM_API void gum_script_set_debug_message_handler (GumScript * self, + GumScriptDebugMessageHandler handler, gpointer data, + GDestroyNotify data_destroy); +GUM_API void gum_script_post_debug_message (GumScript * self, + const gchar * message); -GUM_API gpointer gum_find_function (const gchar * name); -GUM_API GArray * gum_find_functions_named (const gchar * name); -GUM_API GArray * gum_find_functions_matching (const gchar * str); -GUM_API gboolean gum_load_symbols (const gchar * path); +GUM_API GumStalker * gum_script_get_stalker (GumScript * self); G_END_DECLS #endif /* - * Copyright (C) 2010-2014 Ole André Vadla Ravnås + * Copyright (C) 2015-2017 Ole André Vadla Ravnås * * Licence: wxWindows Library Licence, Version 3.1 */ -#ifndef __GUM_SYS_INTERNALS_H__ -#define __GUM_SYS_INTERNALS_H__ +#ifndef __GUM_SCRIPT_SCHEDULER_H__ +#define __GUM_SCRIPT_SCHEDULER_H__ -#ifdef G_OS_WIN32 +G_BEGIN_DECLS -# if GLIB_SIZEOF_VOID_P == 4 -# define GUM_TEB_OFFSET_SELF 0x0018 -# define GUM_TEB_OFFSET_TID 0x0024 -# else -# define GUM_TEB_OFFSET_SELF 0x0030 -# define GUM_TEB_OFFSET_TID 0x0048 -# endif +#define GUM_TYPE_SCRIPT_SCHEDULER (gum_script_scheduler_get_type ()) +G_DECLARE_FINAL_TYPE (GumScriptScheduler, gum_script_scheduler, GUM, + SCRIPT_SCHEDULER, GObject) -#endif +typedef struct _GumScriptJob GumScriptJob; +typedef void (* GumScriptJobFunc) (gpointer data); -#endif -/* - * Copyright (C) 2010-2017 Ole André Vadla Ravnås - * - * Licence: wxWindows Library Licence, Version 3.1 - */ +GUM_API GumScriptScheduler * gum_script_scheduler_new (void); -#ifndef __GUM_TLS_H__ -#define __GUM_TLS_H__ +GUM_API void gum_script_scheduler_enable_background_thread ( + GumScriptScheduler * self); +GUM_API void gum_script_scheduler_disable_background_thread ( + GumScriptScheduler * self); +GUM_API void gum_script_scheduler_start (GumScriptScheduler * self); +GUM_API void gum_script_scheduler_stop (GumScriptScheduler * self); + +GUM_API GMainContext * gum_script_scheduler_get_js_context ( + GumScriptScheduler * self); + +GUM_API void gum_script_scheduler_push_job_on_js_thread ( + GumScriptScheduler * self, gint priority, GumScriptJobFunc func, + gpointer data, GDestroyNotify data_destroy); +GUM_API void gum_script_scheduler_push_job_on_thread_pool ( + GumScriptScheduler * self, GumScriptJobFunc func, gpointer data, + GDestroyNotify data_destroy); + +GUM_API GumScriptJob * gum_script_job_new (GumScriptScheduler * scheduler, + GumScriptJobFunc func, gpointer data, GDestroyNotify data_destroy); +GUM_API void gum_script_job_free (GumScriptJob * job); +GUM_API void gum_script_job_start_on_js_thread (GumScriptJob * job); + +G_END_DECLS +#endif G_BEGIN_DECLS -typedef gsize GumTlsKey; +#define GUM_MAX_ASSET_SIZE (100 * 1024 * 1024) -GUM_API GumTlsKey gum_tls_key_new (void); -GUM_API void gum_tls_key_free (GumTlsKey key); +#define GUM_TYPE_SCRIPT_BACKEND (gum_script_backend_get_type ()) +G_DECLARE_INTERFACE (GumScriptBackend, gum_script_backend, GUM, SCRIPT_BACKEND, + GObject) -GUM_API gpointer gum_tls_key_get_value (GumTlsKey key); -GUM_API void gum_tls_key_set_value (GumTlsKey key, gpointer value); +typedef void (* GumScriptBackendLockedFunc) (gpointer user_data); + +struct _GumScriptBackendInterface +{ + GTypeInterface parent; + + void (* create) (GumScriptBackend * self, const gchar * name, + const gchar * source, GBytes * snapshot, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + GumScript * (* create_finish) (GumScriptBackend * self, GAsyncResult * result, + GError ** error); + GumScript * (* create_sync) (GumScriptBackend * self, const gchar * name, + const gchar * source, GBytes * snapshot, GCancellable * cancellable, + GError ** error); + void (* create_from_bytes) (GumScriptBackend * self, GBytes * bytes, + GBytes * snapshot, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + GumScript * (* create_from_bytes_finish) (GumScriptBackend * self, + GAsyncResult * result, GError ** error); + GumScript * (* create_from_bytes_sync) (GumScriptBackend * self, + GBytes * bytes, GBytes * snapshot, GCancellable * cancellable, + GError ** error); + + void (* compile) (GumScriptBackend * self, const gchar * name, + const gchar * source, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + GBytes * (* compile_finish) (GumScriptBackend * self, GAsyncResult * result, + GError ** error); + GBytes * (* compile_sync) (GumScriptBackend * self, const gchar * name, + const gchar * source, GCancellable * cancellable, GError ** error); + void (* snapshot) (GumScriptBackend * self, const gchar * embed_script, + const gchar * warmup_script, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); + GBytes * (* snapshot_finish) (GumScriptBackend * self, GAsyncResult * result, + GError ** error); + GBytes * (* snapshot_sync) (GumScriptBackend * self, + const gchar * embed_script, const gchar * warmup_script, + GCancellable * cancellable, GError ** error); + + void (* with_lock_held) (GumScriptBackend * self, + GumScriptBackendLockedFunc func, gpointer user_data); + gboolean (* is_locked) (GumScriptBackend * self); +}; + +GUM_API GumScriptBackend * gum_script_backend_obtain (void); +GUM_API GumScriptBackend * gum_script_backend_obtain_qjs (void); +GUM_API GumScriptBackend * gum_script_backend_obtain_v8 (void); + +GUM_API void gum_script_backend_create (GumScriptBackend * self, + const gchar * name, const gchar * source, GBytes * snapshot, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +GUM_API GumScript * gum_script_backend_create_finish (GumScriptBackend * self, + GAsyncResult * result, GError ** error); +GUM_API GumScript * gum_script_backend_create_sync (GumScriptBackend * self, + const gchar * name, const gchar * source, GBytes * snapshot, + GCancellable * cancellable, GError ** error); +GUM_API void gum_script_backend_create_from_bytes (GumScriptBackend * self, + GBytes * bytes, GBytes * snapshot, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +GUM_API GumScript * gum_script_backend_create_from_bytes_finish ( + GumScriptBackend * self, GAsyncResult * result, GError ** error); +GUM_API GumScript * gum_script_backend_create_from_bytes_sync ( + GumScriptBackend * self, GBytes * bytes, GBytes * snapshot, + GCancellable * cancellable, GError ** error); + +GUM_API void gum_script_backend_compile (GumScriptBackend * self, + const gchar * name, const gchar * source, GCancellable * cancellable, + GAsyncReadyCallback callback, gpointer user_data); +GUM_API GBytes * gum_script_backend_compile_finish (GumScriptBackend * self, + GAsyncResult * result, GError ** error); +GUM_API GBytes * gum_script_backend_compile_sync (GumScriptBackend * self, + const gchar * name, const gchar * source, GCancellable * cancellable, + GError ** error); +GUM_API void gum_script_backend_snapshot (GumScriptBackend * self, + const gchar * embed_script, const gchar * warmup_script, + GCancellable * cancellable, GAsyncReadyCallback callback, + gpointer user_data); +GUM_API GBytes * gum_script_backend_snapshot_finish (GumScriptBackend * self, + GAsyncResult * result, GError ** error); +GUM_API GBytes * gum_script_backend_snapshot_sync (GumScriptBackend * self, + const gchar * embed_script, const gchar * warmup_script, + GCancellable * cancellable, GError ** error); + +GUM_API void gum_script_backend_with_lock_held (GumScriptBackend * self, + GumScriptBackendLockedFunc func, gpointer user_data); +GUM_API gboolean gum_script_backend_is_locked (GumScriptBackend * self); + +GUM_API GumScriptScheduler * gum_script_backend_get_scheduler (void); + +GUM_API gchar * gum_script_backend_extract_inline_source_map ( + const gchar * source); G_END_DECLS #endif +/* + * Copyright (C) 2018-2022 Ole André Vadla Ravnås + * + * Licence: wxWindows Library Licence, Version 3.1 + */ + +#ifndef __GUM_INSPECTOR_SERVER_H__ +#define __GUM_INSPECTOR_SERVER_H__ + G_BEGIN_DECLS -GUM_API void gum_init (void); -GUM_API void gum_shutdown (void); -GUM_API void gum_deinit (void); +#define GUM_TYPE_INSPECTOR_SERVER (gum_inspector_server_get_type ()) +G_DECLARE_FINAL_TYPE (GumInspectorServer, gum_inspector_server, GUM, + INSPECTOR_SERVER, GObject) -GUM_API void gum_init_embedded (void); -GUM_API void gum_deinit_embedded (void); +GUM_API GumInspectorServer * gum_inspector_server_new (void); +GUM_API GumInspectorServer * gum_inspector_server_new_with_port (guint port); -GUM_API void gum_prepare_to_fork (void); -GUM_API void gum_recover_from_fork_in_parent (void); -GUM_API void gum_recover_from_fork_in_child (void); +GUM_API gboolean gum_inspector_server_start (GumInspectorServer * self, + GError ** error); +GUM_API void gum_inspector_server_stop (GumInspectorServer * self); + +GUM_API void gum_inspector_server_post_message (GumInspectorServer * self, + const gchar * message); G_END_DECLS diff --git a/frida-sys/FRIDA_VERSION b/frida-sys/FRIDA_VERSION index 781b9682..b5b922b0 100644 --- a/frida-sys/FRIDA_VERSION +++ b/frida-sys/FRIDA_VERSION @@ -1 +1 @@ -16.5.2 +16.5.6