summaryrefslogtreecommitdiff
path: root/impls/monero.rs
diff options
context:
space:
mode:
authorsneurlax <sneurlax@gmail.com>2024-10-10 21:30:28 -0500
committersneurlax <sneurlax@gmail.com>2024-10-10 21:30:28 -0500
commit3ceeecc3bc0213622efa7b6135f442ff2da14286 (patch)
tree2c66e2db46dbe4069e21a2fb74c51d834c9230f2 /impls/monero.rs
parentc2c2f2c00dba3b7253627ddfaec37b2d015ba36b (diff)
/monero_rust -> /monero.rs
just to match the style in impls and sneurlax/monero_c -> MrCyjaneK/monero_c
Diffstat (limited to 'impls/monero.rs')
-rw-r--r--impls/monero.rs/.gitignore3
-rw-r--r--impls/monero.rs/Cargo.lock288
-rw-r--r--impls/monero.rs/Cargo.toml21
-rw-r--r--impls/monero.rs/LICENSE22
-rw-r--r--impls/monero.rs/README.md46
-rw-r--r--impls/monero.rs/build.rs30
-rw-r--r--impls/monero.rs/example/Cargo.lock295
-rw-r--r--impls/monero.rs/example/Cargo.toml7
-rw-r--r--impls/monero.rs/example/src/main.rs25
-rwxr-xr-ximpls/monero.rs/scripts/build_monero_c.sh102
-rw-r--r--impls/monero.rs/src/bindings.rs2732
-rw-r--r--impls/monero.rs/src/lib.rs223
-rw-r--r--impls/monero.rs/src/main.rs25
13 files changed, 3819 insertions, 0 deletions
diff --git a/impls/monero.rs/.gitignore b/impls/monero.rs/.gitignore
new file mode 100644
index 0000000..e5eea29
--- /dev/null
+++ b/impls/monero.rs/.gitignore
@@ -0,0 +1,3 @@
+target/
+scripts/monero_c
+lib/
diff --git a/impls/monero.rs/Cargo.lock b/impls/monero.rs/Cargo.lock
new file mode 100644
index 0000000..bf7f0e5
--- /dev/null
+++ b/impls/monero.rs/Cargo.lock
@@ -0,0 +1,288 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "bindgen"
+version = "0.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f"
+dependencies = [
+ "bitflags",
+ "cexpr",
+ "clang-sys",
+ "itertools",
+ "log",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "rustc-hash",
+ "shlex",
+ "syn",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+
+[[package]]
+name = "cexpr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
+dependencies = [
+ "nom",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clang-sys"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
+dependencies = [
+ "glob",
+ "libc",
+ "libloading",
+]
+
+[[package]]
+name = "either"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+
+[[package]]
+name = "glob"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+
+[[package]]
+name = "itertools"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.159"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
+
+[[package]]
+name = "libloading"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
+dependencies = [
+ "cfg-if",
+ "windows-targets",
+]
+
+[[package]]
+name = "log"
+version = "0.4.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+
+[[package]]
+name = "memchr"
+version = "2.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+
+[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
+name = "monero_rust"
+version = "0.0.1"
+dependencies = [
+ "bindgen",
+ "libc",
+ "libloading",
+]
+
+[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
+name = "prettyplease"
+version = "0.2.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
+
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "syn"
+version = "2.0.79"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
diff --git a/impls/monero.rs/Cargo.toml b/impls/monero.rs/Cargo.toml
new file mode 100644
index 0000000..af37515
--- /dev/null
+++ b/impls/monero.rs/Cargo.toml
@@ -0,0 +1,21 @@
+[package]
+name = "monero_rust"
+version = "0.0.1"
+edition = "2021"
+description = "monero_c Rust bindings."
+repository = "https://github.com/ManyMath/monero_rust"
+license = "MIT"
+build = "build.rs"
+
+[lib]
+name = "monero_rust"
+path = "src/lib.rs"
+crate-type = ["lib", "cdylib"]
+
+[dependencies]
+libc = "0.2"
+libloading = "0.8.5"
+
+[build-dependencies]
+bindgen = "0.70.1"
+
diff --git a/impls/monero.rs/LICENSE b/impls/monero.rs/LICENSE
new file mode 100644
index 0000000..45a85f9
--- /dev/null
+++ b/impls/monero.rs/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2024 Joshua Babb
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
diff --git a/impls/monero.rs/README.md b/impls/monero.rs/README.md
new file mode 100644
index 0000000..fbac577
--- /dev/null
+++ b/impls/monero.rs/README.md
@@ -0,0 +1,46 @@
+# `monero_rust`
+Proof of concept `monero_c` bindings for Rust.
+
+## Getting started
+<!--
+### Prerequisites
+You may need
+```
+sudo apt-get install libhidapi-dev
+```
+-->
+### Build `monero_c`
+Build the monero_c library for your architecture. Follow the upstream docs at
+https://github.com/MrCyjaneK/monero_c <!-- TODO: use example CMakeLists --> and
+place the library at `monero_c/impls/monero_rust/lib/libwallet2_api_c.so` or use
+the provided script:
+```
+cd scripts
+./build_monero_c.sh
+```
+
+or build it manually as in:
+```
+git clone https://git.mrcyjanek.net/MrCyjaneK/monero_c --branch rust
+cd monero_c
+git submodule update --init --recursive
+rm -rf monero wownero release # Clean any previous builds.
+git submodule update --init --recursive --force
+./apply_patches.sh monero
+./build_single.sh monero x86_64-linux-gnu -j$(nproc)
+
+# Adjust the commands below for your arch.
+unxz -f release/monero/x86_64-linux-gnu_libwallet2_api_c.so.xz
+mv release/monero/x86_64-linux-gnu_libwallet2_api_c.so ../lib/libwallet2_api_c.so
+# The library should be at monero_c/impls/monero_rust/lib/libwallet2_api_c.so.
+```
+
+### Run `monero_rust` demo
+From `monero_c/impls/monero_rust`:
+```
+cargo run
+```
+
+## Using `monero_rust` in your own crate
+Refer to the `example` folder. `libwallet2_api_c.so` must be in the same
+directory as the binary (*eg.* at `example/target/debug/libwallet2_api_c.so`).
diff --git a/impls/monero.rs/build.rs b/impls/monero.rs/build.rs
new file mode 100644
index 0000000..c3dd63a
--- /dev/null
+++ b/impls/monero.rs/build.rs
@@ -0,0 +1,30 @@
+use std::env;
+use std::path::PathBuf;
+
+fn main() {
+ println!("cargo:rerun-if-changed=build.rs");
+
+ let lib_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("lib");
+ let monero_include_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("../../monero_libwallet2_api_c/src/main/cpp/");
+
+ println!("cargo:rustc-link-search=native={}", lib_dir.display());
+ println!("cargo:rustc-link-lib=dylib=wallet2_api_c");
+ println!("cargo:rustc-link-lib=dylib=stdc++");
+ println!("cargo:rustc-link-lib=dylib=hidapi-hidraw");
+
+ println!("cargo:rustc-link-arg-bin=monero_rust=-Wl,-rpath,$ORIGIN/../../lib");
+
+ // Generate Rust bindings.
+ let bindings = bindgen::Builder::default()
+ .header("../../monero_libwallet2_api_c/src/main/cpp/wallet2_api_c.h")
+ .clang_arg(format!("-I{}", monero_include_dir.display()))
+ .generate()
+ .expect("Unable to generate bindings");
+ let out_path = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
+ .join("src")
+ .join("bindings.rs");
+ bindings
+ .write_to_file(&out_path)
+ .expect("Couldn't write bindings!");
+}
diff --git a/impls/monero.rs/example/Cargo.lock b/impls/monero.rs/example/Cargo.lock
new file mode 100644
index 0000000..d921e0d
--- /dev/null
+++ b/impls/monero.rs/example/Cargo.lock
@@ -0,0 +1,295 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "aho-corasick"
+version = "1.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "bindgen"
+version = "0.70.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f"
+dependencies = [
+ "bitflags",
+ "cexpr",
+ "clang-sys",
+ "itertools",
+ "log",
+ "prettyplease",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "rustc-hash",
+ "shlex",
+ "syn",
+]
+
+[[package]]
+name = "bitflags"
+version = "2.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
+
+[[package]]
+name = "cexpr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
+dependencies = [
+ "nom",
+]
+
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
+[[package]]
+name = "clang-sys"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
+dependencies = [
+ "glob",
+ "libc",
+ "libloading",
+]
+
+[[package]]
+name = "either"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
+
+[[package]]
+name = "glob"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
+
+[[package]]
+name = "itertools"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
+dependencies = [
+ "either",
+]
+
+[[package]]
+name = "libc"
+version = "0.2.159"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
+
+[[package]]
+name = "libloading"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
+dependencies = [
+ "cfg-if",
+ "windows-targets",
+]
+
+[[package]]
+name = "log"
+version = "0.4.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
+
+[[package]]
+name = "memchr"
+version = "2.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
+
+[[package]]
+name = "minimal-lexical"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
+
+[[package]]
+name = "monero_example"
+version = "0.0.1"
+dependencies = [
+ "monero_rust",
+]
+
+[[package]]
+name = "monero_rust"
+version = "0.0.1"
+dependencies = [
+ "bindgen",
+ "libc",
+ "libloading",
+]
+
+[[package]]
+name = "nom"
+version = "7.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
+dependencies = [
+ "memchr",
+ "minimal-lexical",
+]
+
+[[package]]
+name = "prettyplease"
+version = "0.2.22"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba"
+dependencies = [
+ "proc-macro2",
+ "syn",
+]
+
+[[package]]
+name = "proc-macro2"
+version = "1.0.87"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
+dependencies = [
+ "unicode-ident",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
+dependencies = [
+ "proc-macro2",
+]
+
+[[package]]
+name = "regex"
+version = "1.11.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-automata",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-automata"
+version = "0.4.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3"
+dependencies = [
+ "aho-corasick",
+ "memchr",
+ "regex-syntax",
+]
+
+[[package]]
+name = "regex-syntax"
+version = "0.8.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
+
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
+[[package]]
+name = "syn"
+version = "2.0.79"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "unicode-ident",
+]
+
+[[package]]
+name = "unicode-ident"
+version = "1.0.13"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
+
+[[package]]
+name = "windows-targets"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
+dependencies = [
+ "windows_aarch64_gnullvm",
+ "windows_aarch64_msvc",
+ "windows_i686_gnu",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc",
+ "windows_x86_64_gnu",
+ "windows_x86_64_gnullvm",
+ "windows_x86_64_msvc",
+]
+
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
+
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
+
+[[package]]
+name = "windows_i686_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
+
+[[package]]
+name = "windows_i686_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
+
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
+
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
+
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
diff --git a/impls/monero.rs/example/Cargo.toml b/impls/monero.rs/example/Cargo.toml
new file mode 100644
index 0000000..e0b7823
--- /dev/null
+++ b/impls/monero.rs/example/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "monero_example"
+version = "0.0.1"
+edition = "2021"
+
+[dependencies]
+monero_rust = { path = ".." }
diff --git a/impls/monero.rs/example/src/main.rs b/impls/monero.rs/example/src/main.rs
new file mode 100644
index 0000000..aae688b
--- /dev/null
+++ b/impls/monero.rs/example/src/main.rs
@@ -0,0 +1,25 @@
+use monero_rust::{WalletError, WalletManager, NETWORK_TYPE_MAINNET};
+
+fn main() -> Result<(), WalletError> {
+ let wallet_manager = WalletManager::new(None)?;
+
+ let wallet = wallet_manager.create_wallet(
+ "wallet",
+ "password",
+ "English",
+ NETWORK_TYPE_MAINNET,
+ )?;
+
+ match wallet.get_seed("") {
+ Ok(seed) => println!("Seed: {}", seed),
+ Err(e) => {
+ eprintln!("Failed to get seed: {:?}", e);
+ return Err(e);
+ }
+ }
+
+ let address = wallet.get_address(0, 0)?;
+ println!("Wallet Address: {}", address);
+
+ Ok(())
+}
diff --git a/impls/monero.rs/scripts/build_monero_c.sh b/impls/monero.rs/scripts/build_monero_c.sh
new file mode 100755
index 0000000..a92adfe
--- /dev/null
+++ b/impls/monero.rs/scripts/build_monero_c.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+set -x -e
+
+# See https://github.com/MrCyjaneK/monero_c for the most up-to-date build docs,
+# this is an example and a starting point for building monero_c for use in Rust
+# but it should be automated either using CMake or Cargo (preferred).
+
+# Detect architecture.
+ARCH=$(uname -m)
+OS=$(uname -s)
+
+case $ARCH-$OS in
+ x86_64-Linux)
+ TARGET_ARCH="x86_64-linux-gnu"
+ ;;
+ i686-Linux)
+ TARGET_ARCH="i686-linux-gnu"
+ ;;
+ aarch64-Linux)
+ TARGET_ARCH="aarch64-linux-gnu"
+ ;;
+ x86_64-Android)
+ TARGET_ARCH="x86_64-linux-android"
+ ;;
+ i686-Android)
+ TARGET_ARCH="i686-linux-android"
+ ;;
+ aarch64-Android)
+ TARGET_ARCH="aarch64-linux-android"
+ ;;
+ armv7l-Android)
+ TARGET_ARCH="arm-linux-androideabi"
+ ;;
+ i686-Windows)
+ TARGET_ARCH="i686-w64-mingw32"
+ ;;
+ x86_64-Windows)
+ TARGET_ARCH="x86_64-w64-mingw32"
+ ;;
+ x86_64-Darwin)
+ TARGET_ARCH="host-apple-darwin"
+ ;;
+ arm64-Darwin)
+ TARGET_ARCH="host-apple-ios"
+ ;;
+ *)
+ echo "Unsupported architecture: $ARCH on OS: $OS"
+ exit 1
+ ;;
+esac
+
+#../prepare_moneroc.sh
+# See https://github.com/cypherstack/flutter_libmonero/blob/main/scripts/prepare_moneroc.sh
+# flutter_libmonero/scripts/prepare_moneroc.sh:
+
+if [[ ! -d "monero_c" ]];
+then
+ #rm -rf monero_c
+ git clone https://github.com/sneurlax/monero_c --branch rust
+fi
+cd monero_c
+#git checkout "6eb571ea498ed7b854934785f00fabfd0dadf75b"
+git reset --hard
+#git config submodule.libs/wownero.url https://git.cypherstack.com/Cypher_Stack/wownero
+#git config submodule.libs/wownero-seed.url https://git.cypherstack.com/Cypher_Stack/wownero-seed
+git submodule update --init --force --recursive
+./apply_patches.sh monero
+#./apply_patches.sh wownero
+
+if [[ ! -f "monero/.patch-applied" ]];
+then
+ ./apply_patches.sh monero
+fi
+
+#if [[ ! -f "wownero/.patch-applied" ]];
+#then
+# ./apply_patches.sh wownero
+#fi
+
+# flutter_libmonero/scripts/linux/build_all.sh cont. ...
+
+pushd ../monero_c
+ ./build_single.sh monero "$TARGET_ARCH" -j$(nproc)
+ #./build_single.sh wownero "$TARGET_ARCH" -j$(nproc)
+popd
+
+unxz -f release/monero/${TARGET_ARCH}_libwallet2_api_c.so.xz
+#unxz -f release/wownero/${TARGET_ARCH}_libwallet2_api_c.so.xz
+
+# Navigate back to /scripts.
+cd ..
+
+# Copy the built .so file to a generic name.
+SO_FILE="monero_c/release/monero/${TARGET_ARCH}_libwallet2_api_c.so"
+if [[ -f "$SO_FILE" ]]; then
+ cp "$SO_FILE" "../lib/libwallet2_api_c.so"
+ echo "Copied $SO_FILE to libwallet2_api_c.so"
+else
+ echo "Error: $SO_FILE not found."
+ exit 1
+fi
diff --git a/impls/monero.rs/src/bindings.rs b/impls/monero.rs/src/bindings.rs
new file mode 100644
index 0000000..6ef0c8f
--- /dev/null
+++ b/impls/monero.rs/src/bindings.rs
@@ -0,0 +1,2732 @@
+/* automatically generated by rust-bindgen 0.70.1 */
+
+pub const _STDINT_H: u32 = 1;
+pub const _FEATURES_H: u32 = 1;
+pub const _DEFAULT_SOURCE: u32 = 1;
+pub const __GLIBC_USE_ISOC2X: u32 = 0;
+pub const __USE_ISOC11: u32 = 1;
+pub const __USE_ISOC99: u32 = 1;
+pub const __USE_ISOC95: u32 = 1;
+pub const __USE_POSIX_IMPLICITLY: u32 = 1;
+pub const _POSIX_SOURCE: u32 = 1;
+pub const _POSIX_C_SOURCE: u32 = 200809;
+pub const __USE_POSIX: u32 = 1;
+pub const __USE_POSIX2: u32 = 1;
+pub const __USE_POSIX199309: u32 = 1;
+pub const __USE_POSIX199506: u32 = 1;
+pub const __USE_XOPEN2K: u32 = 1;
+pub const __USE_XOPEN2K8: u32 = 1;
+pub const _ATFILE_SOURCE: u32 = 1;
+pub const __USE_MISC: u32 = 1;
+pub const __USE_ATFILE: u32 = 1;
+pub const __USE_FORTIFY_LEVEL: u32 = 0;
+pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
+pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
+pub const _STDC_PREDEF_H: u32 = 1;
+pub const __STDC_IEC_559__: u32 = 1;
+pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
+pub const __STDC_ISO_10646__: u32 = 201706;
+pub const __GNU_LIBRARY__: u32 = 6;
+pub const __GLIBC__: u32 = 2;
+pub const __GLIBC_MINOR__: u32 = 31;
+pub const _SYS_CDEFS_H: u32 = 1;
+pub const __glibc_c99_flexarr_available: u32 = 1;
+pub const __WORDSIZE: u32 = 64;
+pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
+pub const __SYSCALL_WORDSIZE: u32 = 64;
+pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0;
+pub const __HAVE_GENERIC_SELECTION: u32 = 1;
+pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
+pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
+pub const _BITS_TYPES_H: u32 = 1;
+pub const __TIMESIZE: u32 = 64;
+pub const _BITS_TYPESIZES_H: u32 = 1;
+pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
+pub const __INO_T_MATCHES_INO64_T: u32 = 1;
+pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
+pub const __STATFS_MATCHES_STATFS64: u32 = 1;
+pub const __FD_SETSIZE: u32 = 1024;
+pub const _BITS_TIME64_H: u32 = 1;
+pub const _BITS_WCHAR_H: u32 = 1;
+pub const _BITS_STDINT_INTN_H: u32 = 1;
+pub const _BITS_STDINT_UINTN_H: u32 = 1;
+pub const INT8_MIN: i32 = -128;
+pub const INT16_MIN: i32 = -32768;
+pub const INT32_MIN: i32 = -2147483648;
+pub const INT8_MAX: u32 = 127;
+pub const INT16_MAX: u32 = 32767;
+pub const INT32_MAX: u32 = 2147483647;
+pub const UINT8_MAX: u32 = 255;
+pub const UINT16_MAX: u32 = 65535;
+pub const UINT32_MAX: u32 = 4294967295;
+pub const INT_LEAST8_MIN: i32 = -128;
+pub const INT_LEAST16_MIN: i32 = -32768;
+pub const INT_LEAST32_MIN: i32 = -2147483648;
+pub const INT_LEAST8_MAX: u32 = 127;
+pub const INT_LEAST16_MAX: u32 = 32767;
+pub const INT_LEAST32_MAX: u32 = 2147483647;
+pub const UINT_LEAST8_MAX: u32 = 255;
+pub const UINT_LEAST16_MAX: u32 = 65535;
+pub const UINT_LEAST32_MAX: u32 = 4294967295;
+pub const INT_FAST8_MIN: i32 = -128;
+pub const INT_FAST16_MIN: i64 = -9223372036854775808;
+pub const INT_FAST32_MIN: i64 = -9223372036854775808;
+pub const INT_FAST8_MAX: u32 = 127;
+pub const INT_FAST16_MAX: u64 = 9223372036854775807;
+pub const INT_FAST32_MAX: u64 = 9223372036854775807;
+pub const UINT_FAST8_MAX: u32 = 255;
+pub const UINT_FAST16_MAX: i32 = -1;
+pub const UINT_FAST32_MAX: i32 = -1;
+pub const INTPTR_MIN: i64 = -9223372036854775808;
+pub const INTPTR_MAX: u64 = 9223372036854775807;
+pub const UINTPTR_MAX: i32 = -1;
+pub const PTRDIFF_MIN: i64 = -9223372036854775808;
+pub const PTRDIFF_MAX: u64 = 9223372036854775807;
+pub const SIG_ATOMIC_MIN: i32 = -2147483648;
+pub const SIG_ATOMIC_MAX: u32 = 2147483647;
+pub const SIZE_MAX: i32 = -1;
+pub const WINT_MIN: u32 = 0;
+pub const WINT_MAX: u32 = 4294967295;
+pub const true_: u32 = 1;
+pub const false_: u32 = 0;
+pub const __bool_true_false_are_defined: u32 = 1;
+pub const _UNISTD_H: u32 = 1;
+pub const _POSIX_VERSION: u32 = 200809;
+pub const __POSIX2_THIS_VERSION: u32 = 200809;
+pub const _POSIX2_VERSION: u32 = 200809;
+pub const _POSIX2_C_VERSION: u32 = 200809;
+pub const _POSIX2_C_BIND: u32 = 200809;
+pub const _POSIX2_C_DEV: u32 = 200809;
+pub const _POSIX2_SW_DEV: u32 = 200809;
+pub const _POSIX2_LOCALEDEF: u32 = 200809;
+pub const _XOPEN_VERSION: u32 = 700;
+pub const _XOPEN_XCU_VERSION: u32 = 4;
+pub const _XOPEN_XPG2: u32 = 1;
+pub const _XOPEN_XPG3: u32 = 1;
+pub const _XOPEN_XPG4: u32 = 1;
+pub const _XOPEN_UNIX: u32 = 1;
+pub const _XOPEN_ENH_I18N: u32 = 1;
+pub const _XOPEN_LEGACY: u32 = 1;
+pub const _BITS_POSIX_OPT_H: u32 = 1;
+pub const _POSIX_JOB_CONTROL: u32 = 1;
+pub const _POSIX_SAVED_IDS: u32 = 1;
+pub const _POSIX_PRIORITY_SCHEDULING: u32 = 200809;
+pub const _POSIX_SYNCHRONIZED_IO: u32 = 200809;
+pub const _POSIX_FSYNC: u32 = 200809;
+pub const _POSIX_MAPPED_FILES: u32 = 200809;
+pub const _POSIX_MEMLOCK: u32 = 200809;
+pub const _POSIX_MEMLOCK_RANGE: u32 = 200809;
+pub const _POSIX_MEMORY_PROTECTION: u32 = 200809;
+pub const _POSIX_CHOWN_RESTRICTED: u32 = 0;
+pub const _POSIX_VDISABLE: u8 = 0u8;
+pub const _POSIX_NO_TRUNC: u32 = 1;
+pub const _XOPEN_REALTIME: u32 = 1;
+pub const _XOPEN_REALTIME_THREADS: u32 = 1;
+pub const _XOPEN_SHM: u32 = 1;
+pub const _POSIX_THREADS: u32 = 200809;
+pub const _POSIX_REENTRANT_FUNCTIONS: u32 = 1;
+pub const _POSIX_THREAD_SAFE_FUNCTIONS: u32 = 200809;
+pub const _POSIX_THREAD_PRIORITY_SCHEDULING: u32 = 200809;
+pub const _POSIX_THREAD_ATTR_STACKSIZE: u32 = 200809;
+pub const _POSIX_THREAD_ATTR_STACKADDR: u32 = 200809;
+pub const _POSIX_THREAD_PRIO_INHERIT: u32 = 200809;
+pub const _POSIX_THREAD_PRIO_PROTECT: u32 = 200809;
+pub const _POSIX_THREAD_ROBUST_PRIO_INHERIT: u32 = 200809;
+pub const _POSIX_THREAD_ROBUST_PRIO_PROTECT: i32 = -1;
+pub const _POSIX_SEMAPHORES: u32 = 200809;
+pub const _POSIX_REALTIME_SIGNALS: u32 = 200809;
+pub const _POSIX_ASYNCHRONOUS_IO: u32 = 200809;
+pub const _POSIX_ASYNC_IO: u32 = 1;
+pub const _LFS_ASYNCHRONOUS_IO: u32 = 1;
+pub const _POSIX_PRIORITIZED_IO: u32 = 200809;
+pub const _LFS64_ASYNCHRONOUS_IO: u32 = 1;
+pub const _LFS_LARGEFILE: u32 = 1;
+pub const _LFS64_LARGEFILE: u32 = 1;
+pub const _LFS64_STDIO: u32 = 1;
+pub const _POSIX_SHARED_MEMORY_OBJECTS: u32 = 200809;
+pub const _POSIX_CPUTIME: u32 = 0;
+pub const _POSIX_THREAD_CPUTIME: u32 = 0;
+pub const _POSIX_REGEXP: u32 = 1;
+pub const _POSIX_READER_WRITER_LOCKS: u32 = 200809;
+pub const _POSIX_SHELL: u32 = 1;
+pub const _POSIX_TIMEOUTS: u32 = 200809;
+pub const _POSIX_SPIN_LOCKS: u32 = 200809;
+pub const _POSIX_SPAWN: u32 = 200809;
+pub const _POSIX_TIMERS: u32 = 200809;
+pub const _POSIX_BARRIERS: u32 = 200809;
+pub const _POSIX_MESSAGE_PASSING: u32 = 200809;
+pub const _POSIX_THREAD_PROCESS_SHARED: u32 = 200809;
+pub const _POSIX_MONOTONIC_CLOCK: u32 = 0;
+pub const _POSIX_CLOCK_SELECTION: u32 = 200809;
+pub const _POSIX_ADVISORY_INFO: u32 = 200809;
+pub const _POSIX_IPV6: u32 = 200809;
+pub const _POSIX_RAW_SOCKETS: u32 = 200809;
+pub const _POSIX2_CHAR_TERM: u32 = 200809;
+pub const _POSIX_SPORADIC_SERVER: i32 = -1;
+pub const _POSIX_THREAD_SPORADIC_SERVER: i32 = -1;
+pub const _POSIX_TRACE: i32 = -1;
+pub const _POSIX_TRACE_EVENT_FILTER: i32 = -1;
+pub const _POSIX_TRACE_INHERIT: i32 = -1;
+pub const _POSIX_TRACE_LOG: i32 = -1;
+pub const _POSIX_TYPED_MEMORY_OBJECTS: i32 = -1;
+pub const _POSIX_V7_LPBIG_OFFBIG: i32 = -1;
+pub const _POSIX_V6_LPBIG_OFFBIG: i32 = -1;
+pub const _XBS5_LPBIG_OFFBIG: i32 = -1;
+pub const _POSIX_V7_LP64_OFF64: u32 = 1;
+pub const _POSIX_V6_LP64_OFF64: u32 = 1;
+pub const _XBS5_LP64_OFF64: u32 = 1;
+pub const __ILP32_OFF32_CFLAGS: &[u8; 5] = b"-m32\0";
+pub const __ILP32_OFF32_LDFLAGS: &[u8; 5] = b"-m32\0";
+pub const __ILP32_OFFBIG_CFLAGS: &[u8; 48] = b"-m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64\0";
+pub const __ILP32_OFFBIG_LDFLAGS: &[u8; 5] = b"-m32\0";
+pub const __LP64_OFF64_CFLAGS: &[u8; 5] = b"-m64\0";
+pub const __LP64_OFF64_LDFLAGS: &[u8; 5] = b"-m64\0";
+pub const STDIN_FILENO: u32 = 0;
+pub const STDOUT_FILENO: u32 = 1;
+pub const STDERR_FILENO: u32 = 2;
+pub const R_OK: u32 = 4;
+pub const W_OK: u32 = 2;
+pub const X_OK: u32 = 1;
+pub const F_OK: u32 = 0;
+pub const SEEK_SET: u32 = 0;
+pub const SEEK_CUR: u32 = 1;
+pub const SEEK_END: u32 = 2;
+pub const L_SET: u32 = 0;
+pub const L_INCR: u32 = 1;
+pub const L_XTND: u32 = 2;
+pub const _GETOPT_POSIX_H: u32 = 1;
+pub const _GETOPT_CORE_H: u32 = 1;
+pub const F_ULOCK: u32 = 0;
+pub const F_LOCK: u32 = 1;
+pub const F_TLOCK: u32 = 2;
+pub const F_TEST: u32 = 3;
+pub type __u_char = ::std::os::raw::c_uchar;
+pub type __u_short = ::std::os::raw::c_ushort;
+pub type __u_int = ::std::os::raw::c_uint;
+pub type __u_long = ::std::os::raw::c_ulong;
+pub type __int8_t = ::std::os::raw::c_schar;
+pub type __uint8_t = ::std::os::raw::c_uchar;
+pub type __int16_t = ::std::os::raw::c_short;
+pub type __uint16_t = ::std::os::raw::c_ushort;
+pub type __int32_t = ::std::os::raw::c_int;
+pub type __uint32_t = ::std::os::raw::c_uint;
+pub type __int64_t = ::std::os::raw::c_long;
+pub type __uint64_t = ::std::os::raw::c_ulong;
+pub type __int_least8_t = __int8_t;
+pub type __uint_least8_t = __uint8_t;
+pub type __int_least16_t = __int16_t;
+pub type __uint_least16_t = __uint16_t;
+pub type __int_least32_t = __int32_t;
+pub type __uint_least32_t = __uint32_t;
+pub type __int_least64_t = __int64_t;
+pub type __uint_least64_t = __uint64_t;
+pub type __quad_t = ::std::os::raw::c_long;
+pub type __u_quad_t = ::std::os::raw::c_ulong;
+pub type __intmax_t = ::std::os::raw::c_long;
+pub type __uintmax_t = ::std::os::raw::c_ulong;
+pub type __dev_t = ::std::os::raw::c_ulong;
+pub type __uid_t = ::std::os::raw::c_uint;
+pub type __gid_t = ::std::os::raw::c_uint;
+pub type __ino_t = ::std::os::raw::c_ulong;
+pub type __ino64_t = ::std::os::raw::c_ulong;
+pub type __mode_t = ::std::os::raw::c_uint;
+pub type __nlink_t = ::std::os::raw::c_ulong;
+pub type __off_t = ::std::os::raw::c_long;
+pub type __off64_t = ::std::os::raw::c_long;
+pub type __pid_t = ::std::os::raw::c_int;
+#[repr(C)]
+#[derive(Debug, Copy, Clone)]
+pub struct __fsid_t {
+ pub __val: [::std::os::raw::c_int; 2usize],
+}
+#[allow(clippy::unnecessary_operation, clippy::identity_op)]
+const _: () = {
+ ["Size of __fsid_t"][::std::mem::size_of::<__fsid_t>() - 8usize];
+ ["Alignment of __fsid_t"][::std::mem::align_of::<__fsid_t>() - 4usize];
+ ["Offset of field: __fsid_t::__val"][::std::mem::offset_of!(__fsid_t, __val) - 0usize];
+};
+pub type __clock_t = ::std::os::raw::c_long;
+pub type __rlim_t = ::std::os::raw::c_ulong;
+pub type __rlim64_t = ::std::os::raw::c_ulong;
+pub type __id_t = ::std::os::raw::c_uint;
+pub type __time_t = ::std::os::raw::c_long;
+pub type __useconds_t = ::std::os::raw::c_uint;
+pub type __suseconds_t = ::std::os::raw::c_long;
+pub type __daddr_t = ::std::os::raw::c_int;
+pub type __key_t = ::std::os::raw::c_int;
+pub type __clockid_t = ::std::os::raw::c_int;
+pub type __timer_t = *mut ::std::os::raw::c_void;
+pub type __blksize_t = ::std::os::raw::c_long;
+pub type __blkcnt_t = ::std::os::raw::c_long;
+pub type __blkcnt64_t = ::std::os::raw::c_long;
+pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
+pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
+pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
+pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
+pub type __fsword_t = ::std::os::raw::c_long;
+pub type __ssize_t = ::std::os::raw::c_long;
+pub type __syscall_slong_t = ::std::os::raw::c_long;
+pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
+pub type __loff_t = __off64_t;
+pub type __caddr_t = *mut ::std::os::raw::c_char;
+pub type __intptr_t = ::std::os::raw::c_long;
+pub type __socklen_t = ::std::os::raw::c_uint;
+pub type __sig_atomic_t = ::std::os::raw::c_int;
+pub type int_least8_t = __int_least8_t;
+pub type int_least16_t = __int_least16_t;
+pub type int_least32_t = __int_least32_t;
+pub type int_least64_t = __int_least64_t;
+pub type uint_least8_t = __uint_least8_t;
+pub type uint_least16_t = __uint_least16_t;
+pub type uint_least32_t = __uint_least32_t;
+pub type uint_least64_t = __uint_least64_t;
+pub type int_fast8_t = ::std::os::raw::c_schar;
+pub type int_fast16_t = ::std::os::raw::c_long;
+pub type int_fast32_t = ::std::os::raw::c_long;
+pub type int_fast64_t = ::std::os::raw::c_long;
+pub type uint_fast8_t = ::std::os::raw::c_uchar;
+pub type uint_fast16_t = ::std::os::raw::c_ulong;
+pub type uint_fast32_t = ::std::os::raw::c_ulong;
+pub type uint_fast64_t = ::std::os::raw::c_ulong;
+pub type intmax_t = __intmax_t;
+pub type uintmax_t = __uintmax_t;
+pub type wchar_t = ::std::os::raw::c_int;
+#[repr(C)]
+#[repr(align(16))]
+#[derive(Debug, Copy, Clone)]
+pub struct max_align_t {
+ pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
+ pub __bindgen_padding_0: u64,
+ pub __clang_max_align_nonce2: u128,
+}
+#[allow(clippy::unnecessary_operation, clippy::identity_op)]
+const _: () = {
+ ["Size of max_align_t"][::std::mem::size_of::<max_align_t>() - 32usize];
+ ["Alignment of max_align_t"][::std::mem::align_of::<max_align_t>() - 16usize];
+ ["Offset of field: max_align_t::__clang_max_align_nonce1"]
+ [::std::mem::offset_of!(max_align_t, __clang_max_align_nonce1) - 0usize];
+ ["Offset of field: max_align_t::__clang_max_align_nonce2"]
+ [::std::mem::offset_of!(max_align_t, __clang_max_align_nonce2) - 16usize];
+};
+pub type gid_t = __gid_t;
+pub type uid_t = __uid_t;
+pub type off_t = __off_t;
+pub type useconds_t = __useconds_t;
+pub type pid_t = __pid_t;
+pub type socklen_t = __socklen_t;
+extern "C" {
+ pub fn access(
+ __name: *const ::std::os::raw::c_char,
+ __type: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn faccessat(
+ __fd: ::std::os::raw::c_int,
+ __file: *const ::std::os::raw::c_char,
+ __type: ::std::os::raw::c_int,
+ __flag: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn lseek(
+ __fd: ::std::os::raw::c_int,
+ __offset: __off_t,
+ __whence: ::std::os::raw::c_int,
+ ) -> __off_t;
+}
+extern "C" {
+ pub fn close(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn read(
+ __fd: ::std::os::raw::c_int,
+ __buf: *mut ::std::os::raw::c_void,
+ __nbytes: usize,
+ ) -> isize;
+}
+extern "C" {
+ pub fn write(
+ __fd: ::std::os::raw::c_int,
+ __buf: *const ::std::os::raw::c_void,
+ __n: usize,
+ ) -> isize;
+}
+extern "C" {
+ pub fn pread(
+ __fd: ::std::os::raw::c_int,
+ __buf: *mut ::std::os::raw::c_void,
+ __nbytes: usize,
+ __offset: __off_t,
+ ) -> isize;
+}
+extern "C" {
+ pub fn pwrite(
+ __fd: ::std::os::raw::c_int,
+ __buf: *const ::std::os::raw::c_void,
+ __n: usize,
+ __offset: __off_t,
+ ) -> isize;
+}
+extern "C" {
+ pub fn pipe(__pipedes: *mut ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn alarm(__seconds: ::std::os::raw::c_uint) -> ::std::os::raw::c_uint;
+}
+extern "C" {
+ pub fn sleep(__seconds: ::std::os::raw::c_uint) -> ::std::os::raw::c_uint;
+}
+extern "C" {
+ pub fn ualarm(__value: __useconds_t, __interval: __useconds_t) -> __useconds_t;
+}
+extern "C" {
+ pub fn usleep(__useconds: __useconds_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn pause() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn chown(
+ __file: *const ::std::os::raw::c_char,
+ __owner: __uid_t,
+ __group: __gid_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fchown(
+ __fd: ::std::os::raw::c_int,
+ __owner: __uid_t,
+ __group: __gid_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn lchown(
+ __file: *const ::std::os::raw::c_char,
+ __owner: __uid_t,
+ __group: __gid_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fchownat(
+ __fd: ::std::os::raw::c_int,
+ __file: *const ::std::os::raw::c_char,
+ __owner: __uid_t,
+ __group: __gid_t,
+ __flag: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn chdir(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fchdir(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getcwd(__buf: *mut ::std::os::raw::c_char, __size: usize)
+ -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn getwd(__buf: *mut ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn dup(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn dup2(__fd: ::std::os::raw::c_int, __fd2: ::std::os::raw::c_int)
+ -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub static mut __environ: *mut *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn execve(
+ __path: *const ::std::os::raw::c_char,
+ __argv: *const *mut ::std::os::raw::c_char,
+ __envp: *const *mut ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fexecve(
+ __fd: ::std::os::raw::c_int,
+ __argv: *const *mut ::std::os::raw::c_char,
+ __envp: *const *mut ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn execv(
+ __path: *const ::std::os::raw::c_char,
+ __argv: *const *mut ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn execle(
+ __path: *const ::std::os::raw::c_char,
+ __arg: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn execl(
+ __path: *const ::std::os::raw::c_char,
+ __arg: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn execvp(
+ __file: *const ::std::os::raw::c_char,
+ __argv: *const *mut ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn execlp(
+ __file: *const ::std::os::raw::c_char,
+ __arg: *const ::std::os::raw::c_char,
+ ...
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn nice(__inc: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn _exit(__status: ::std::os::raw::c_int) -> !;
+}
+pub const _PC_LINK_MAX: _bindgen_ty_1 = 0;
+pub const _PC_MAX_CANON: _bindgen_ty_1 = 1;
+pub const _PC_MAX_INPUT: _bindgen_ty_1 = 2;
+pub const _PC_NAME_MAX: _bindgen_ty_1 = 3;
+pub const _PC_PATH_MAX: _bindgen_ty_1 = 4;
+pub const _PC_PIPE_BUF: _bindgen_ty_1 = 5;
+pub const _PC_CHOWN_RESTRICTED: _bindgen_ty_1 = 6;
+pub const _PC_NO_TRUNC: _bindgen_ty_1 = 7;
+pub const _PC_VDISABLE: _bindgen_ty_1 = 8;
+pub const _PC_SYNC_IO: _bindgen_ty_1 = 9;
+pub const _PC_ASYNC_IO: _bindgen_ty_1 = 10;
+pub const _PC_PRIO_IO: _bindgen_ty_1 = 11;
+pub const _PC_SOCK_MAXBUF: _bindgen_ty_1 = 12;
+pub const _PC_FILESIZEBITS: _bindgen_ty_1 = 13;
+pub const _PC_REC_INCR_XFER_SIZE: _bindgen_ty_1 = 14;
+pub const _PC_REC_MAX_XFER_SIZE: _bindgen_ty_1 = 15;
+pub const _PC_REC_MIN_XFER_SIZE: _bindgen_ty_1 = 16;
+pub const _PC_REC_XFER_ALIGN: _bindgen_ty_1 = 17;
+pub const _PC_ALLOC_SIZE_MIN: _bindgen_ty_1 = 18;
+pub const _PC_SYMLINK_MAX: _bindgen_ty_1 = 19;
+pub const _PC_2_SYMLINKS: _bindgen_ty_1 = 20;
+pub type _bindgen_ty_1 = ::std::os::raw::c_uint;
+pub const _SC_ARG_MAX: _bindgen_ty_2 = 0;
+pub const _SC_CHILD_MAX: _bindgen_ty_2 = 1;
+pub const _SC_CLK_TCK: _bindgen_ty_2 = 2;
+pub const _SC_NGROUPS_MAX: _bindgen_ty_2 = 3;
+pub const _SC_OPEN_MAX: _bindgen_ty_2 = 4;
+pub const _SC_STREAM_MAX: _bindgen_ty_2 = 5;
+pub const _SC_TZNAME_MAX: _bindgen_ty_2 = 6;
+pub const _SC_JOB_CONTROL: _bindgen_ty_2 = 7;
+pub const _SC_SAVED_IDS: _bindgen_ty_2 = 8;
+pub const _SC_REALTIME_SIGNALS: _bindgen_ty_2 = 9;
+pub const _SC_PRIORITY_SCHEDULING: _bindgen_ty_2 = 10;
+pub const _SC_TIMERS: _bindgen_ty_2 = 11;
+pub const _SC_ASYNCHRONOUS_IO: _bindgen_ty_2 = 12;
+pub const _SC_PRIORITIZED_IO: _bindgen_ty_2 = 13;
+pub const _SC_SYNCHRONIZED_IO: _bindgen_ty_2 = 14;
+pub const _SC_FSYNC: _bindgen_ty_2 = 15;
+pub const _SC_MAPPED_FILES: _bindgen_ty_2 = 16;
+pub const _SC_MEMLOCK: _bindgen_ty_2 = 17;
+pub const _SC_MEMLOCK_RANGE: _bindgen_ty_2 = 18;
+pub const _SC_MEMORY_PROTECTION: _bindgen_ty_2 = 19;
+pub const _SC_MESSAGE_PASSING: _bindgen_ty_2 = 20;
+pub const _SC_SEMAPHORES: _bindgen_ty_2 = 21;
+pub const _SC_SHARED_MEMORY_OBJECTS: _bindgen_ty_2 = 22;
+pub const _SC_AIO_LISTIO_MAX: _bindgen_ty_2 = 23;
+pub const _SC_AIO_MAX: _bindgen_ty_2 = 24;
+pub const _SC_AIO_PRIO_DELTA_MAX: _bindgen_ty_2 = 25;
+pub const _SC_DELAYTIMER_MAX: _bindgen_ty_2 = 26;
+pub const _SC_MQ_OPEN_MAX: _bindgen_ty_2 = 27;
+pub const _SC_MQ_PRIO_MAX: _bindgen_ty_2 = 28;
+pub const _SC_VERSION: _bindgen_ty_2 = 29;
+pub const _SC_PAGESIZE: _bindgen_ty_2 = 30;
+pub const _SC_RTSIG_MAX: _bindgen_ty_2 = 31;
+pub const _SC_SEM_NSEMS_MAX: _bindgen_ty_2 = 32;
+pub const _SC_SEM_VALUE_MAX: _bindgen_ty_2 = 33;
+pub const _SC_SIGQUEUE_MAX: _bindgen_ty_2 = 34;
+pub const _SC_TIMER_MAX: _bindgen_ty_2 = 35;
+pub const _SC_BC_BASE_MAX: _bindgen_ty_2 = 36;
+pub const _SC_BC_DIM_MAX: _bindgen_ty_2 = 37;
+pub const _SC_BC_SCALE_MAX: _bindgen_ty_2 = 38;
+pub const _SC_BC_STRING_MAX: _bindgen_ty_2 = 39;
+pub const _SC_COLL_WEIGHTS_MAX: _bindgen_ty_2 = 40;
+pub const _SC_EQUIV_CLASS_MAX: _bindgen_ty_2 = 41;
+pub const _SC_EXPR_NEST_MAX: _bindgen_ty_2 = 42;
+pub const _SC_LINE_MAX: _bindgen_ty_2 = 43;
+pub const _SC_RE_DUP_MAX: _bindgen_ty_2 = 44;
+pub const _SC_CHARCLASS_NAME_MAX: _bindgen_ty_2 = 45;
+pub const _SC_2_VERSION: _bindgen_ty_2 = 46;
+pub const _SC_2_C_BIND: _bindgen_ty_2 = 47;
+pub const _SC_2_C_DEV: _bindgen_ty_2 = 48;
+pub const _SC_2_FORT_DEV: _bindgen_ty_2 = 49;
+pub const _SC_2_FORT_RUN: _bindgen_ty_2 = 50;
+pub const _SC_2_SW_DEV: _bindgen_ty_2 = 51;
+pub const _SC_2_LOCALEDEF: _bindgen_ty_2 = 52;
+pub const _SC_PII: _bindgen_ty_2 = 53;
+pub const _SC_PII_XTI: _bindgen_ty_2 = 54;
+pub const _SC_PII_SOCKET: _bindgen_ty_2 = 55;
+pub const _SC_PII_INTERNET: _bindgen_ty_2 = 56;
+pub const _SC_PII_OSI: _bindgen_ty_2 = 57;
+pub const _SC_POLL: _bindgen_ty_2 = 58;
+pub const _SC_SELECT: _bindgen_ty_2 = 59;
+pub const _SC_UIO_MAXIOV: _bindgen_ty_2 = 60;
+pub const _SC_IOV_MAX: _bindgen_ty_2 = 60;
+pub const _SC_PII_INTERNET_STREAM: _bindgen_ty_2 = 61;
+pub const _SC_PII_INTERNET_DGRAM: _bindgen_ty_2 = 62;
+pub const _SC_PII_OSI_COTS: _bindgen_ty_2 = 63;
+pub const _SC_PII_OSI_CLTS: _bindgen_ty_2 = 64;
+pub const _SC_PII_OSI_M: _bindgen_ty_2 = 65;
+pub const _SC_T_IOV_MAX: _bindgen_ty_2 = 66;
+pub const _SC_THREADS: _bindgen_ty_2 = 67;
+pub const _SC_THREAD_SAFE_FUNCTIONS: _bindgen_ty_2 = 68;
+pub const _SC_GETGR_R_SIZE_MAX: _bindgen_ty_2 = 69;
+pub const _SC_GETPW_R_SIZE_MAX: _bindgen_ty_2 = 70;
+pub const _SC_LOGIN_NAME_MAX: _bindgen_ty_2 = 71;
+pub const _SC_TTY_NAME_MAX: _bindgen_ty_2 = 72;
+pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: _bindgen_ty_2 = 73;
+pub const _SC_THREAD_KEYS_MAX: _bindgen_ty_2 = 74;
+pub const _SC_THREAD_STACK_MIN: _bindgen_ty_2 = 75;
+pub const _SC_THREAD_THREADS_MAX: _bindgen_ty_2 = 76;
+pub const _SC_THREAD_ATTR_STACKADDR: _bindgen_ty_2 = 77;
+pub const _SC_THREAD_ATTR_STACKSIZE: _bindgen_ty_2 = 78;
+pub const _SC_THREAD_PRIORITY_SCHEDULING: _bindgen_ty_2 = 79;
+pub const _SC_THREAD_PRIO_INHERIT: _bindgen_ty_2 = 80;
+pub const _SC_THREAD_PRIO_PROTECT: _bindgen_ty_2 = 81;
+pub const _SC_THREAD_PROCESS_SHARED: _bindgen_ty_2 = 82;
+pub const _SC_NPROCESSORS_CONF: _bindgen_ty_2 = 83;
+pub const _SC_NPROCESSORS_ONLN: _bindgen_ty_2 = 84;
+pub const _SC_PHYS_PAGES: _bindgen_ty_2 = 85;
+pub const _SC_AVPHYS_PAGES: _bindgen_ty_2 = 86;
+pub const _SC_ATEXIT_MAX: _bindgen_ty_2 = 87;
+pub const _SC_PASS_MAX: _bindgen_ty_2 = 88;
+pub const _SC_XOPEN_VERSION: _bindgen_ty_2 = 89;
+pub const _SC_XOPEN_XCU_VERSION: _bindgen_ty_2 = 90;
+pub const _SC_XOPEN_UNIX: _bindgen_ty_2 = 91;
+pub const _SC_XOPEN_CRYPT: _bindgen_ty_2 = 92;
+pub const _SC_XOPEN_ENH_I18N: _bindgen_ty_2 = 93;
+pub const _SC_XOPEN_SHM: _bindgen_ty_2 = 94;
+pub const _SC_2_CHAR_TERM: _bindgen_ty_2 = 95;
+pub const _SC_2_C_VERSION: _bindgen_ty_2 = 96;
+pub const _SC_2_UPE: _bindgen_ty_2 = 97;
+pub const _SC_XOPEN_XPG2: _bindgen_ty_2 = 98;
+pub const _SC_XOPEN_XPG3: _bindgen_ty_2 = 99;
+pub const _SC_XOPEN_XPG4: _bindgen_ty_2 = 100;
+pub const _SC_CHAR_BIT: _bindgen_ty_2 = 101;
+pub const _SC_CHAR_MAX: _bindgen_ty_2 = 102;
+pub const _SC_CHAR_MIN: _bindgen_ty_2 = 103;
+pub const _SC_INT_MAX: _bindgen_ty_2 = 104;
+pub const _SC_INT_MIN: _bindgen_ty_2 = 105;
+pub const _SC_LONG_BIT: _bindgen_ty_2 = 106;
+pub const _SC_WORD_BIT: _bindgen_ty_2 = 107;
+pub const _SC_MB_LEN_MAX: _bindgen_ty_2 = 108;
+pub const _SC_NZERO: _bindgen_ty_2 = 109;
+pub const _SC_SSIZE_MAX: _bindgen_ty_2 = 110;
+pub const _SC_SCHAR_MAX: _bindgen_ty_2 = 111;
+pub const _SC_SCHAR_MIN: _bindgen_ty_2 = 112;
+pub const _SC_SHRT_MAX: _bindgen_ty_2 = 113;
+pub const _SC_SHRT_MIN: _bindgen_ty_2 = 114;
+pub const _SC_UCHAR_MAX: _bindgen_ty_2 = 115;
+pub const _SC_UINT_MAX: _bindgen_ty_2 = 116;
+pub const _SC_ULONG_MAX: _bindgen_ty_2 = 117;
+pub const _SC_USHRT_MAX: _bindgen_ty_2 = 118;
+pub const _SC_NL_ARGMAX: _bindgen_ty_2 = 119;
+pub const _SC_NL_LANGMAX: _bindgen_ty_2 = 120;
+pub const _SC_NL_MSGMAX: _bindgen_ty_2 = 121;
+pub const _SC_NL_NMAX: _bindgen_ty_2 = 122;
+pub const _SC_NL_SETMAX: _bindgen_ty_2 = 123;
+pub const _SC_NL_TEXTMAX: _bindgen_ty_2 = 124;
+pub const _SC_XBS5_ILP32_OFF32: _bindgen_ty_2 = 125;
+pub const _SC_XBS5_ILP32_OFFBIG: _bindgen_ty_2 = 126;
+pub const _SC_XBS5_LP64_OFF64: _bindgen_ty_2 = 127;
+pub const _SC_XBS5_LPBIG_OFFBIG: _bindgen_ty_2 = 128;
+pub const _SC_XOPEN_LEGACY: _bindgen_ty_2 = 129;
+pub const _SC_XOPEN_REALTIME: _bindgen_ty_2 = 130;
+pub const _SC_XOPEN_REALTIME_THREADS: _bindgen_ty_2 = 131;
+pub const _SC_ADVISORY_INFO: _bindgen_ty_2 = 132;
+pub const _SC_BARRIERS: _bindgen_ty_2 = 133;
+pub const _SC_BASE: _bindgen_ty_2 = 134;
+pub const _SC_C_LANG_SUPPORT: _bindgen_ty_2 = 135;
+pub const _SC_C_LANG_SUPPORT_R: _bindgen_ty_2 = 136;
+pub const _SC_CLOCK_SELECTION: _bindgen_ty_2 = 137;
+pub const _SC_CPUTIME: _bindgen_ty_2 = 138;
+pub const _SC_THREAD_CPUTIME: _bindgen_ty_2 = 139;
+pub const _SC_DEVICE_IO: _bindgen_ty_2 = 140;
+pub const _SC_DEVICE_SPECIFIC: _bindgen_ty_2 = 141;
+pub const _SC_DEVICE_SPECIFIC_R: _bindgen_ty_2 = 142;
+pub const _SC_FD_MGMT: _bindgen_ty_2 = 143;
+pub const _SC_FIFO: _bindgen_ty_2 = 144;
+pub const _SC_PIPE: _bindgen_ty_2 = 145;
+pub const _SC_FILE_ATTRIBUTES: _bindgen_ty_2 = 146;
+pub const _SC_FILE_LOCKING: _bindgen_ty_2 = 147;
+pub const _SC_FILE_SYSTEM: _bindgen_ty_2 = 148;
+pub const _SC_MONOTONIC_CLOCK: _bindgen_ty_2 = 149;
+pub const _SC_MULTI_PROCESS: _bindgen_ty_2 = 150;
+pub const _SC_SINGLE_PROCESS: _bindgen_ty_2 = 151;
+pub const _SC_NETWORKING: _bindgen_ty_2 = 152;
+pub const _SC_READER_WRITER_LOCKS: _bindgen_ty_2 = 153;
+pub const _SC_SPIN_LOCKS: _bindgen_ty_2 = 154;
+pub const _SC_REGEXP: _bindgen_ty_2 = 155;
+pub const _SC_REGEX_VERSION: _bindgen_ty_2 = 156;
+pub const _SC_SHELL: _bindgen_ty_2 = 157;
+pub const _SC_SIGNALS: _bindgen_ty_2 = 158;
+pub const _SC_SPAWN: _bindgen_ty_2 = 159;
+pub const _SC_SPORADIC_SERVER: _bindgen_ty_2 = 160;
+pub const _SC_THREAD_SPORADIC_SERVER: _bindgen_ty_2 = 161;
+pub const _SC_SYSTEM_DATABASE: _bindgen_ty_2 = 162;
+pub const _SC_SYSTEM_DATABASE_R: _bindgen_ty_2 = 163;
+pub const _SC_TIMEOUTS: _bindgen_ty_2 = 164;
+pub const _SC_TYPED_MEMORY_OBJECTS: _bindgen_ty_2 = 165;
+pub const _SC_USER_GROUPS: _bindgen_ty_2 = 166;
+pub const _SC_USER_GROUPS_R: _bindgen_ty_2 = 167;
+pub const _SC_2_PBS: _bindgen_ty_2 = 168;
+pub const _SC_2_PBS_ACCOUNTING: _bindgen_ty_2 = 169;
+pub const _SC_2_PBS_LOCATE: _bindgen_ty_2 = 170;
+pub const _SC_2_PBS_MESSAGE: _bindgen_ty_2 = 171;
+pub const _SC_2_PBS_TRACK: _bindgen_ty_2 = 172;
+pub const _SC_SYMLOOP_MAX: _bindgen_ty_2 = 173;
+pub const _SC_STREAMS: _bindgen_ty_2 = 174;
+pub const _SC_2_PBS_CHECKPOINT: _bindgen_ty_2 = 175;
+pub const _SC_V6_ILP32_OFF32: _bindgen_ty_2 = 176;
+pub const _SC_V6_ILP32_OFFBIG: _bindgen_ty_2 = 177;
+pub const _SC_V6_LP64_OFF64: _bindgen_ty_2 = 178;
+pub const _SC_V6_LPBIG_OFFBIG: _bindgen_ty_2 = 179;
+pub const _SC_HOST_NAME_MAX: _bindgen_ty_2 = 180;
+pub const _SC_TRACE: _bindgen_ty_2 = 181;
+pub const _SC_TRACE_EVENT_FILTER: _bindgen_ty_2 = 182;
+pub const _SC_TRACE_INHERIT: _bindgen_ty_2 = 183;
+pub const _SC_TRACE_LOG: _bindgen_ty_2 = 184;
+pub const _SC_LEVEL1_ICACHE_SIZE: _bindgen_ty_2 = 185;
+pub const _SC_LEVEL1_ICACHE_ASSOC: _bindgen_ty_2 = 186;
+pub const _SC_LEVEL1_ICACHE_LINESIZE: _bindgen_ty_2 = 187;
+pub const _SC_LEVEL1_DCACHE_SIZE: _bindgen_ty_2 = 188;
+pub const _SC_LEVEL1_DCACHE_ASSOC: _bindgen_ty_2 = 189;
+pub const _SC_LEVEL1_DCACHE_LINESIZE: _bindgen_ty_2 = 190;
+pub const _SC_LEVEL2_CACHE_SIZE: _bindgen_ty_2 = 191;
+pub const _SC_LEVEL2_CACHE_ASSOC: _bindgen_ty_2 = 192;
+pub const _SC_LEVEL2_CACHE_LINESIZE: _bindgen_ty_2 = 193;
+pub const _SC_LEVEL3_CACHE_SIZE: _bindgen_ty_2 = 194;
+pub const _SC_LEVEL3_CACHE_ASSOC: _bindgen_ty_2 = 195;
+pub const _SC_LEVEL3_CACHE_LINESIZE: _bindgen_ty_2 = 196;
+pub const _SC_LEVEL4_CACHE_SIZE: _bindgen_ty_2 = 197;
+pub const _SC_LEVEL4_CACHE_ASSOC: _bindgen_ty_2 = 198;
+pub const _SC_LEVEL4_CACHE_LINESIZE: _bindgen_ty_2 = 199;
+pub const _SC_IPV6: _bindgen_ty_2 = 235;
+pub const _SC_RAW_SOCKETS: _bindgen_ty_2 = 236;
+pub const _SC_V7_ILP32_OFF32: _bindgen_ty_2 = 237;
+pub const _SC_V7_ILP32_OFFBIG: _bindgen_ty_2 = 238;
+pub const _SC_V7_LP64_OFF64: _bindgen_ty_2 = 239;
+pub const _SC_V7_LPBIG_OFFBIG: _bindgen_ty_2 = 240;
+pub const _SC_SS_REPL_MAX: _bindgen_ty_2 = 241;
+pub const _SC_TRACE_EVENT_NAME_MAX: _bindgen_ty_2 = 242;
+pub const _SC_TRACE_NAME_MAX: _bindgen_ty_2 = 243;
+pub const _SC_TRACE_SYS_MAX: _bindgen_ty_2 = 244;
+pub const _SC_TRACE_USER_EVENT_MAX: _bindgen_ty_2 = 245;
+pub const _SC_XOPEN_STREAMS: _bindgen_ty_2 = 246;
+pub const _SC_THREAD_ROBUST_PRIO_INHERIT: _bindgen_ty_2 = 247;
+pub const _SC_THREAD_ROBUST_PRIO_PROTECT: _bindgen_ty_2 = 248;
+pub type _bindgen_ty_2 = ::std::os::raw::c_uint;
+pub const _CS_PATH: _bindgen_ty_3 = 0;
+pub const _CS_V6_WIDTH_RESTRICTED_ENVS: _bindgen_ty_3 = 1;
+pub const _CS_GNU_LIBC_VERSION: _bindgen_ty_3 = 2;
+pub const _CS_GNU_LIBPTHREAD_VERSION: _bindgen_ty_3 = 3;
+pub const _CS_V5_WIDTH_RESTRICTED_ENVS: _bindgen_ty_3 = 4;
+pub const _CS_V7_WIDTH_RESTRICTED_ENVS: _bindgen_ty_3 = 5;
+pub const _CS_LFS_CFLAGS: _bindgen_ty_3 = 1000;
+pub const _CS_LFS_LDFLAGS: _bindgen_ty_3 = 1001;
+pub const _CS_LFS_LIBS: _bindgen_ty_3 = 1002;
+pub const _CS_LFS_LINTFLAGS: _bindgen_ty_3 = 1003;
+pub const _CS_LFS64_CFLAGS: _bindgen_ty_3 = 1004;
+pub const _CS_LFS64_LDFLAGS: _bindgen_ty_3 = 1005;
+pub const _CS_LFS64_LIBS: _bindgen_ty_3 = 1006;
+pub const _CS_LFS64_LINTFLAGS: _bindgen_ty_3 = 1007;
+pub const _CS_XBS5_ILP32_OFF32_CFLAGS: _bindgen_ty_3 = 1100;
+pub const _CS_XBS5_ILP32_OFF32_LDFLAGS: _bindgen_ty_3 = 1101;
+pub const _CS_XBS5_ILP32_OFF32_LIBS: _bindgen_ty_3 = 1102;
+pub const _CS_XBS5_ILP32_OFF32_LINTFLAGS: _bindgen_ty_3 = 1103;
+pub const _CS_XBS5_ILP32_OFFBIG_CFLAGS: _bindgen_ty_3 = 1104;
+pub const _CS_XBS5_ILP32_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1105;
+pub const _CS_XBS5_ILP32_OFFBIG_LIBS: _bindgen_ty_3 = 1106;
+pub const _CS_XBS5_ILP32_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1107;
+pub const _CS_XBS5_LP64_OFF64_CFLAGS: _bindgen_ty_3 = 1108;
+pub const _CS_XBS5_LP64_OFF64_LDFLAGS: _bindgen_ty_3 = 1109;
+pub const _CS_XBS5_LP64_OFF64_LIBS: _bindgen_ty_3 = 1110;
+pub const _CS_XBS5_LP64_OFF64_LINTFLAGS: _bindgen_ty_3 = 1111;
+pub const _CS_XBS5_LPBIG_OFFBIG_CFLAGS: _bindgen_ty_3 = 1112;
+pub const _CS_XBS5_LPBIG_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1113;
+pub const _CS_XBS5_LPBIG_OFFBIG_LIBS: _bindgen_ty_3 = 1114;
+pub const _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1115;
+pub const _CS_POSIX_V6_ILP32_OFF32_CFLAGS: _bindgen_ty_3 = 1116;
+pub const _CS_POSIX_V6_ILP32_OFF32_LDFLAGS: _bindgen_ty_3 = 1117;
+pub const _CS_POSIX_V6_ILP32_OFF32_LIBS: _bindgen_ty_3 = 1118;
+pub const _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS: _bindgen_ty_3 = 1119;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS: _bindgen_ty_3 = 1120;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1121;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_LIBS: _bindgen_ty_3 = 1122;
+pub const _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1123;
+pub const _CS_POSIX_V6_LP64_OFF64_CFLAGS: _bindgen_ty_3 = 1124;
+pub const _CS_POSIX_V6_LP64_OFF64_LDFLAGS: _bindgen_ty_3 = 1125;
+pub const _CS_POSIX_V6_LP64_OFF64_LIBS: _bindgen_ty_3 = 1126;
+pub const _CS_POSIX_V6_LP64_OFF64_LINTFLAGS: _bindgen_ty_3 = 1127;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS: _bindgen_ty_3 = 1128;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1129;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_LIBS: _bindgen_ty_3 = 1130;
+pub const _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1131;
+pub const _CS_POSIX_V7_ILP32_OFF32_CFLAGS: _bindgen_ty_3 = 1132;
+pub const _CS_POSIX_V7_ILP32_OFF32_LDFLAGS: _bindgen_ty_3 = 1133;
+pub const _CS_POSIX_V7_ILP32_OFF32_LIBS: _bindgen_ty_3 = 1134;
+pub const _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS: _bindgen_ty_3 = 1135;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS: _bindgen_ty_3 = 1136;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1137;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_LIBS: _bindgen_ty_3 = 1138;
+pub const _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1139;
+pub const _CS_POSIX_V7_LP64_OFF64_CFLAGS: _bindgen_ty_3 = 1140;
+pub const _CS_POSIX_V7_LP64_OFF64_LDFLAGS: _bindgen_ty_3 = 1141;
+pub const _CS_POSIX_V7_LP64_OFF64_LIBS: _bindgen_ty_3 = 1142;
+pub const _CS_POSIX_V7_LP64_OFF64_LINTFLAGS: _bindgen_ty_3 = 1143;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS: _bindgen_ty_3 = 1144;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS: _bindgen_ty_3 = 1145;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_LIBS: _bindgen_ty_3 = 1146;
+pub const _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS: _bindgen_ty_3 = 1147;
+pub const _CS_V6_ENV: _bindgen_ty_3 = 1148;
+pub const _CS_V7_ENV: _bindgen_ty_3 = 1149;
+pub type _bindgen_ty_3 = ::std::os::raw::c_uint;
+extern "C" {
+ pub fn pathconf(
+ __path: *const ::std::os::raw::c_char,
+ __name: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_long;
+}
+extern "C" {
+ pub fn fpathconf(
+ __fd: ::std::os::raw::c_int,
+ __name: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_long;
+}
+extern "C" {
+ pub fn sysconf(__name: ::std::os::raw::c_int) -> ::std::os::raw::c_long;
+}
+extern "C" {
+ pub fn confstr(
+ __name: ::std::os::raw::c_int,
+ __buf: *mut ::std::os::raw::c_char,
+ __len: usize,
+ ) -> usize;
+}
+extern "C" {
+ pub fn getpid() -> __pid_t;
+}
+extern "C" {
+ pub fn getppid() -> __pid_t;
+}
+extern "C" {
+ pub fn getpgrp() -> __pid_t;
+}
+extern "C" {
+ pub fn __getpgid(__pid: __pid_t) -> __pid_t;
+}
+extern "C" {
+ pub fn getpgid(__pid: __pid_t) -> __pid_t;
+}
+extern "C" {
+ pub fn setpgid(__pid: __pid_t, __pgid: __pid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setpgrp() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setsid() -> __pid_t;
+}
+extern "C" {
+ pub fn getsid(__pid: __pid_t) -> __pid_t;
+}
+extern "C" {
+ pub fn getuid() -> __uid_t;
+}
+extern "C" {
+ pub fn geteuid() -> __uid_t;
+}
+extern "C" {
+ pub fn getgid() -> __gid_t;
+}
+extern "C" {
+ pub fn getegid() -> __gid_t;
+}
+extern "C" {
+ pub fn getgroups(__size: ::std::os::raw::c_int, __list: *mut __gid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setuid(__uid: __uid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setreuid(__ruid: __uid_t, __euid: __uid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn seteuid(__uid: __uid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setgid(__gid: __gid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setregid(__rgid: __gid_t, __egid: __gid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setegid(__gid: __gid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fork() -> __pid_t;
+}
+extern "C" {
+ pub fn vfork() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ttyname(__fd: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn ttyname_r(
+ __fd: ::std::os::raw::c_int,
+ __buf: *mut ::std::os::raw::c_char,
+ __buflen: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn isatty(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ttyslot() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn link(
+ __from: *const ::std::os::raw::c_char,
+ __to: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn linkat(
+ __fromfd: ::std::os::raw::c_int,
+ __from: *const ::std::os::raw::c_char,
+ __tofd: ::std::os::raw::c_int,
+ __to: *const ::std::os::raw::c_char,
+ __flags: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn symlink(
+ __from: *const ::std::os::raw::c_char,
+ __to: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn readlink(
+ __path: *const ::std::os::raw::c_char,
+ __buf: *mut ::std::os::raw::c_char,
+ __len: usize,
+ ) -> isize;
+}
+extern "C" {
+ pub fn symlinkat(
+ __from: *const ::std::os::raw::c_char,
+ __tofd: ::std::os::raw::c_int,
+ __to: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn readlinkat(
+ __fd: ::std::os::raw::c_int,
+ __path: *const ::std::os::raw::c_char,
+ __buf: *mut ::std::os::raw::c_char,
+ __len: usize,
+ ) -> isize;
+}
+extern "C" {
+ pub fn unlink(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn unlinkat(
+ __fd: ::std::os::raw::c_int,
+ __name: *const ::std::os::raw::c_char,
+ __flag: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn rmdir(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn tcgetpgrp(__fd: ::std::os::raw::c_int) -> __pid_t;
+}
+extern "C" {
+ pub fn tcsetpgrp(__fd: ::std::os::raw::c_int, __pgrp_id: __pid_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getlogin() -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn getlogin_r(
+ __name: *mut ::std::os::raw::c_char,
+ __name_len: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setlogin(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub static mut optarg: *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub static mut optind: ::std::os::raw::c_int;
+}
+extern "C" {
+ pub static mut opterr: ::std::os::raw::c_int;
+}
+extern "C" {
+ pub static mut optopt: ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getopt(
+ ___argc: ::std::os::raw::c_int,
+ ___argv: *const *mut ::std::os::raw::c_char,
+ __shortopts: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn gethostname(__name: *mut ::std::os::raw::c_char, __len: usize) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn sethostname(
+ __name: *const ::std::os::raw::c_char,
+ __len: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn sethostid(__id: ::std::os::raw::c_long) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getdomainname(
+ __name: *mut ::std::os::raw::c_char,
+ __len: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn setdomainname(
+ __name: *const ::std::os::raw::c_char,
+ __len: usize,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn vhangup() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn revoke(__file: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn profil(
+ __sample_buffer: *mut ::std::os::raw::c_ushort,
+ __size: usize,
+ __offset: usize,
+ __scale: ::std::os::raw::c_uint,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn acct(__name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getusershell() -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn endusershell();
+}
+extern "C" {
+ pub fn setusershell();
+}
+extern "C" {
+ pub fn daemon(
+ __nochdir: ::std::os::raw::c_int,
+ __noclose: ::std::os::raw::c_int,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn chroot(__path: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getpass(__prompt: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn fsync(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn gethostid() -> ::std::os::raw::c_long;
+}
+extern "C" {
+ pub fn sync();
+}
+extern "C" {
+ pub fn getpagesize() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn getdtablesize() -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn truncate(
+ __file: *const ::std::os::raw::c_char,
+ __length: __off_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn ftruncate(__fd: ::std::os::raw::c_int, __length: __off_t) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn brk(__addr: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn sbrk(__delta: isize) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn syscall(__sysno: ::std::os::raw::c_long, ...) -> ::std::os::raw::c_long;
+}
+extern "C" {
+ pub fn lockf(
+ __fd: ::std::os::raw::c_int,
+ __cmd: ::std::os::raw::c_int,
+ __len: __off_t,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn fdatasync(__fildes: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn crypt(
+ __key: *const ::std::os::raw::c_char,
+ __salt: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn getentropy(
+ __buffer: *mut ::std::os::raw::c_void,
+ __length: usize,
+ ) -> ::std::os::raw::c_int;
+}
+pub const MONERO_wallet2_api_c_h_sha256: &[u8; 65] =
+ b"e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad\0";
+pub const MONERO_wallet2_api_c_cpp_sha256 : & [u8 ; 106] = b"dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd\0" ;
+pub const MONERO_wallet2_api_c_exp_sha256: &[u8; 65] =
+ b"c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c\0";
+pub const NetworkType_MAINNET: ::std::os::raw::c_int = 0;
+pub const NetworkType_TESTNET: ::std::os::raw::c_int = 1;
+pub const NetworkType_STAGENET: ::std::os::raw::c_int = 2;
+pub const PendingTransactionStatus_Ok: ::std::os::raw::c_int = 0;
+pub const PendingTransactionStatus_Error: ::std::os::raw::c_int = 1;
+pub const PendingTransactionStatus_Critical: ::std::os::raw::c_int = 2;
+pub const Priority_Default: ::std::os::raw::c_int = 0;
+pub const Priority_Low: ::std::os::raw::c_int = 1;
+pub const Priority_Medium: ::std::os::raw::c_int = 2;
+pub const Priority_High: ::std::os::raw::c_int = 3;
+pub const Priority_Last: ::std::os::raw::c_int = 4;
+extern "C" {
+ pub fn MONERO_PendingTransaction_status(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_errorString(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_commit(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ filename: *const ::std::os::raw::c_char,
+ overwrite: bool,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_commitUR(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ max_fragment_length: ::std::os::raw::c_int,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_amount(pendingTx_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_dust(pendingTx_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_fee(pendingTx_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_txid(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_txCount(pendingTx_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_subaddrAccount(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_subaddrIndices(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_multisigSignData(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_signMultisigTx(pendingTx_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_signersKeys(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_PendingTransaction_hex(
+ pendingTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+pub const UnsignedTransactionStatus_Ok: ::std::os::raw::c_int = 0;
+pub const UnsignedTransactionStatus_Error: ::std::os::raw::c_int = 1;
+pub const UnsignedTransactionStatus_Critical: ::std::os::raw::c_int = 2;
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_status(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_errorString(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_amount(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_fee(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_mixin(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_confirmationMessage(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_paymentId(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_recipientAddress(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_minMixinCount(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_txCount(unsignedTx_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_sign(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ signedFileName: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_UnsignedTransaction_signUR(
+ unsignedTx_ptr: *mut ::std::os::raw::c_void,
+ max_fragment_length: ::std::os::raw::c_int,
+ ) -> *const ::std::os::raw::c_char;
+}
+pub const TransactionInfoDirection_In: ::std::os::raw::c_int = 0;
+pub const TransactionInfoDirection_Out: ::std::os::raw::c_int = 1;
+extern "C" {
+ pub fn MONERO_TransactionInfo_direction(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_isPending(txInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_isFailed(txInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_isCoinbase(txInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_amount(txInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_fee(txInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_blockHeight(txInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_description(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_subaddrIndex(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_subaddrAccount(txInfo_ptr: *mut ::std::os::raw::c_void) -> u32;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_label(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_confirmations(txInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_unlockTime(txInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_hash(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_timestamp(txInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_paymentId(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_transfers_count(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_transfers_amount(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_TransactionInfo_transfers_address(
+ txInfo_ptr: *mut ::std::os::raw::c_void,
+ address: ::std::os::raw::c_int,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_TransactionHistory_count(
+ txHistory_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_TransactionHistory_transaction(
+ txHistory_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_TransactionHistory_transactionById(
+ txHistory_ptr: *mut ::std::os::raw::c_void,
+ id: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_TransactionHistory_refresh(txHistory_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_TransactionHistory_setTxNote(
+ txHistory_ptr: *mut ::std::os::raw::c_void,
+ txid: *const ::std::os::raw::c_char,
+ note: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_AddressBookRow_extra(
+ addressBookRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_AddressBookRow_getAddress(
+ addressBookRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_AddressBookRow_getDescription(
+ addressBookRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_AddressBookRow_getPaymentId(
+ addressBookRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_AddressBookRow_getRowId(addressBookRow_ptr: *mut ::std::os::raw::c_void)
+ -> usize;
+}
+pub const AddressBookErrorCodeStatus_Ok: ::std::os::raw::c_int = 0;
+pub const AddressBookErrorCodeGeneral_Error: ::std::os::raw::c_int = 1;
+pub const AddressBookErrorCodeInvalid_Address: ::std::os::raw::c_int = 2;
+pub const AddressBookErrorCodeInvalidPaymentId: ::std::os::raw::c_int = 3;
+extern "C" {
+ pub fn MONERO_AddressBook_getAll_size(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_getAll_byIndex(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_addRow(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ dst_addr: *const ::std::os::raw::c_char,
+ payment_id: *const ::std::os::raw::c_char,
+ description: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_deleteRow(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ rowId: usize,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_setDescription(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ rowId: usize,
+ description: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_refresh(addressBook_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_AddressBook_errorString(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_errorCode(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_AddressBook_lookupPaymentID(
+ addressBook_ptr: *mut ::std::os::raw::c_void,
+ payment_id: *const ::std::os::raw::c_char,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_blockHeight(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_hash(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_internalOutputIndex(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> usize;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_globalOutputIndex(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_spent(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_frozen(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_spentHeight(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_amount(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_rct(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_keyImageKnown(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_pkIndex(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> usize;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_subaddrIndex(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u32;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_subaddrAccount(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u32;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_address(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_addressLabel(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_keyImage(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_unlockTime(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_unlocked(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_pubKey(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_coinbase(coinsInfo_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_CoinsInfo_description(
+ coinsInfo_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Coins_count(coins_ptr: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Coins_coin(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Coins_getAll_size(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Coins_getAll_byIndex(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Coins_refresh(coins_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_Coins_setFrozenByPublicKey(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ public_key: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Coins_setFrozen(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ );
+}
+extern "C" {
+ pub fn MONERO_Coins_thaw(coins_ptr: *mut ::std::os::raw::c_void, index: ::std::os::raw::c_int);
+}
+extern "C" {
+ pub fn MONERO_Coins_thawByPublicKey(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ public_key: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Coins_isTransferUnlocked(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ unlockTime: u64,
+ blockHeight: u64,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Coins_setDescription(
+ coins_ptr: *mut ::std::os::raw::c_void,
+ public_key: *const ::std::os::raw::c_char,
+ description: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_SubaddressRow_extra(
+ subaddressRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressRow_getAddress(
+ subaddressRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressRow_getLabel(
+ subaddressRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressRow_getRowId(subaddressRow_ptr: *mut ::std::os::raw::c_void) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Subaddress_getAll_size(
+ subaddress_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Subaddress_getAll_byIndex(
+ subaddress_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Subaddress_addRow(
+ subaddress_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Subaddress_setLabel(
+ subaddress_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ addressIndex: u32,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Subaddress_refresh(
+ subaddress_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ );
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccountRow_extra(
+ subaddressAccountRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccountRow_getAddress(
+ subaddressAccountRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccountRow_getLabel(
+ subaddressAccountRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccountRow_getBalance(
+ subaddressAccountRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccountRow_getUnlockedBalance(
+ subaddressAccountRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccountRow_getRowId(
+ subaddressAccountRow_ptr: *mut ::std::os::raw::c_void,
+ ) -> usize;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccount_getAll_size(
+ subaddressAccount_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccount_getAll_byIndex(
+ subaddressAccount_ptr: *mut ::std::os::raw::c_void,
+ index: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccount_addRow(
+ subaddressAccount_ptr: *mut ::std::os::raw::c_void,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccount_setLabel(
+ subaddressAccount_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_SubaddressAccount_refresh(subaddressAccount_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_MultisigState_isMultisig(multisigState_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_MultisigState_isReady(multisigState_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_MultisigState_threshold(multisigState_ptr: *mut ::std::os::raw::c_void) -> u32;
+}
+extern "C" {
+ pub fn MONERO_MultisigState_total(multisigState_ptr: *mut ::std::os::raw::c_void) -> u32;
+}
+extern "C" {
+ pub fn MONERO_DeviceProgress_progress(deviceProgress_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_DeviceProgress_indeterminate(
+ deviceProgress_ptr: *mut ::std::os::raw::c_void,
+ ) -> bool;
+}
+pub const WalletDevice_Software: ::std::os::raw::c_int = 0;
+pub const WalletDevice_Ledger: ::std::os::raw::c_int = 1;
+pub const WalletDevice_Trezor: ::std::os::raw::c_int = 2;
+pub const WalletStatus_Ok: ::std::os::raw::c_int = 0;
+pub const WalletStatus_Error: ::std::os::raw::c_int = 1;
+pub const WalletStatus_Critical: ::std::os::raw::c_int = 2;
+pub const WalletConnectionStatus_Disconnected: ::std::os::raw::c_int = 0;
+pub const WalletConnectionStatus_Connected: ::std::os::raw::c_int = 1;
+pub const WalletConnectionStatus_WrongVersion: ::std::os::raw::c_int = 2;
+pub const WalletBackgroundSync_Off: ::std::os::raw::c_int = 0;
+pub const WalletBackgroundSync_ReusePassword: ::std::os::raw::c_int = 1;
+pub const BackgroundSync_CustomPassword: ::std::os::raw::c_int = 2;
+extern "C" {
+ pub fn MONERO_Wallet_seed(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ seed_offset: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getSeedLanguage(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setSeedLanguage(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ arg: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_status(wallet_ptr: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Wallet_errorString(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setPassword(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ password: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getPassword(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setDevicePin(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ pin: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setDevicePassphrase(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ passphrase: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_address(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u64,
+ addressIndex: u64,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_path(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_nettype(wallet_ptr: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Wallet_useForkRules(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ version: u8,
+ early_blocks: i64,
+ ) -> u8;
+}
+extern "C" {
+ pub fn MONERO_Wallet_integratedAddress(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ payment_id: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_secretViewKey(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_publicViewKey(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_secretSpendKey(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_publicSpendKey(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_publicMultisigSignerKey(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_stop(wallet_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_Wallet_store(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_filename(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_keysFilename(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_init(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ daemon_address: *const ::std::os::raw::c_char,
+ upper_transaction_size_limit: u64,
+ daemon_username: *const ::std::os::raw::c_char,
+ daemon_password: *const ::std::os::raw::c_char,
+ use_ssl: bool,
+ lightWallet: bool,
+ proxy_address: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_createWatchOnly(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ language: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setRefreshFromBlockHeight(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ refresh_from_block_height: u64,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_getRefreshFromBlockHeight(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setRecoveringFromSeed(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ recoveringFromSeed: bool,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_setRecoveringFromDevice(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ recoveringFromDevice: bool,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_setSubaddressLookahead(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ major: u32,
+ minor: u32,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_connectToDaemon(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_connected(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setTrustedDaemon(wallet_ptr: *mut ::std::os::raw::c_void, arg: bool);
+}
+extern "C" {
+ pub fn MONERO_Wallet_trustedDaemon(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setProxy(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ address: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_balance(wallet_ptr: *mut ::std::os::raw::c_void, accountIndex: u32)
+ -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_unlockedBalance(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_viewOnlyBalance(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_watchOnly(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_isDeterministic(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_blockChainHeight(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_approximateBlockChainHeight(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_estimateBlockChainHeight(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_daemonBlockChainHeight(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_daemonBlockChainHeight_cached(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_daemonBlockChainHeight_runThread(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ seconds: ::std::os::raw::c_int,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_daemonBlockChainTargetHeight(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_synchronized(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_displayAmount(amount: u64) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_amountFromString(amount: *const ::std::os::raw::c_char) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_amountFromDouble(amount: f64) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_genPaymentId() -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_paymentIdValid(paiment_id: *const ::std::os::raw::c_char) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_addressValid(
+ str_: *const ::std::os::raw::c_char,
+ nettype: ::std::os::raw::c_int,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_keyValid(
+ secret_key_string: *const ::std::os::raw::c_char,
+ address_string: *const ::std::os::raw::c_char,
+ isViewKey: bool,
+ nettype: ::std::os::raw::c_int,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_keyValid_error(
+ secret_key_string: *const ::std::os::raw::c_char,
+ address_string: *const ::std::os::raw::c_char,
+ isViewKey: bool,
+ nettype: ::std::os::raw::c_int,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_paymentIdFromAddress(
+ strarg: *const ::std::os::raw::c_char,
+ nettype: ::std::os::raw::c_int,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_maximumAllowedAmount() -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_init3(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ argv0: *const ::std::os::raw::c_char,
+ default_log_base_name: *const ::std::os::raw::c_char,
+ log_path: *const ::std::os::raw::c_char,
+ console: bool,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_getPolyseed(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ passphrase: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_createPolyseed(
+ language: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_startRefresh(wallet_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_Wallet_pauseRefresh(wallet_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_Wallet_refresh(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_refreshAsync(wallet_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_Wallet_rescanBlockchain(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_rescanBlockchainAsync(wallet_ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_Wallet_setAutoRefreshInterval(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ millis: ::std::os::raw::c_int,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_autoRefreshInterval(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Wallet_addSubaddressAccount(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_numSubaddressAccounts(wallet_ptr: *mut ::std::os::raw::c_void) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Wallet_numSubaddresses(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ ) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Wallet_addSubaddress(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_getSubaddressLabel(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ addressIndex: u32,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setSubaddressLabel(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ addressIndex: u32,
+ label: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_multisig(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getMultisigInfo(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_makeMultisig(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ info: *const ::std::os::raw::c_char,
+ info_separator: *const ::std::os::raw::c_char,
+ threshold: u32,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_exchangeMultisigKeys(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ info: *const ::std::os::raw::c_char,
+ info_separator: *const ::std::os::raw::c_char,
+ force_update_use_with_caution: bool,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_exportMultisigImages(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_importMultisigImages(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ info: *const ::std::os::raw::c_char,
+ info_separator: *const ::std::os::raw::c_char,
+ ) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Wallet_hasMultisigPartialKeyImages(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Wallet_restoreMultisigTransaction(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ signData: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_createTransactionMultDest(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ dst_addr_list: *const ::std::os::raw::c_char,
+ dst_addr_list_separator: *const ::std::os::raw::c_char,
+ payment_id: *const ::std::os::raw::c_char,
+ amount_sweep_all: bool,
+ amount_list: *const ::std::os::raw::c_char,
+ amount_list_separator: *const ::std::os::raw::c_char,
+ mixin_count: u32,
+ pendingTransactionPriority: ::std::os::raw::c_int,
+ subaddr_account: u32,
+ preferredInputs: *const ::std::os::raw::c_char,
+ preferredInputs_separator: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_createTransaction(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ dst_addr: *const ::std::os::raw::c_char,
+ payment_id: *const ::std::os::raw::c_char,
+ amount: u64,
+ mixin_count: u32,
+ pendingTransactionPriority: ::std::os::raw::c_int,
+ subaddr_account: u32,
+ preferredInputs: *const ::std::os::raw::c_char,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_loadUnsignedTx(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ unsigned_filename: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_loadUnsignedTxUR(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ input: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_submitTransaction(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ fileName: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_submitTransactionUR(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ input: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_hasUnknownKeyImages(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_exportKeyImages(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ filename: *const ::std::os::raw::c_char,
+ all: bool,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_exportKeyImagesUR(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ max_fragment_length: usize,
+ all: bool,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_importKeyImages(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ filename: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_importKeyImagesUR(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ input: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_exportOutputs(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ filename: *const ::std::os::raw::c_char,
+ all: bool,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_exportOutputsUR(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ max_fragment_length: usize,
+ all: bool,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_importOutputs(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ filename: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_importOutputsUR(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ input: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setupBackgroundSync(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ background_sync_type: ::std::os::raw::c_int,
+ wallet_password: *const ::std::os::raw::c_char,
+ background_cache_password: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getBackgroundSyncType(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Wallet_startBackgroundSync(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_stopBackgroundSync(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ wallet_password: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_isBackgroundSyncing(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_isBackgroundWallet(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_history(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_addressBook(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_coins(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_subaddress(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_subaddressAccount(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_Wallet_defaultMixin(wallet_ptr: *mut ::std::os::raw::c_void) -> u32;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setDefaultMixin(wallet_ptr: *mut ::std::os::raw::c_void, arg: u32);
+}
+extern "C" {
+ pub fn MONERO_Wallet_setCacheAttribute(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ key: *const ::std::os::raw::c_char,
+ val: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getCacheAttribute(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ key: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setUserNote(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ txid: *const ::std::os::raw::c_char,
+ note: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getUserNote(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ txid: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getTxKey(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ txid: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_signMessage(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ message: *const ::std::os::raw::c_char,
+ address: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_verifySignedMessage(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ message: *const ::std::os::raw::c_char,
+ address: *const ::std::os::raw::c_char,
+ signature: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_rescanSpent(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setOffline(wallet_ptr: *mut ::std::os::raw::c_void, offline: bool);
+}
+extern "C" {
+ pub fn MONERO_Wallet_isOffline(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_segregatePreForkOutputs(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ segregate: bool,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_segregationHeight(wallet_ptr: *mut ::std::os::raw::c_void, height: u64);
+}
+extern "C" {
+ pub fn MONERO_Wallet_keyReuseMitigation2(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ mitigation: bool,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_lockKeysFile(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_unlockKeysFile(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_isKeysFileLocked(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getDeviceType(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_Wallet_coldKeyImageSync(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ spent: u64,
+ unspent: u64,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_deviceShowAddress(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ accountIndex: u32,
+ addressIndex: u32,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_Wallet_reconnectDevice(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getBytesReceived(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getBytesSent(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getStateIsConnected(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getSendToDevice(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_uchar;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getSendToDeviceLength(wallet_ptr: *mut ::std::os::raw::c_void) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getReceivedFromDevice(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_uchar;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getReceivedFromDeviceLength(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> usize;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getWaitsForDeviceSend(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_getWaitsForDeviceReceive(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_Wallet_setDeviceReceivedData(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ data: *mut ::std::os::raw::c_uchar,
+ len: usize,
+ );
+}
+extern "C" {
+ pub fn MONERO_Wallet_setDeviceSendData(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ data: *mut ::std::os::raw::c_uchar,
+ len: usize,
+ );
+}
+extern "C" {
+ pub fn MONERO_WalletManager_createWallet(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ language: *const ::std::os::raw::c_char,
+ networkType: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_openWallet(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ networkType: ::std::os::raw::c_int,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_recoveryWallet(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ mnemonic: *const ::std::os::raw::c_char,
+ networkType: ::std::os::raw::c_int,
+ restoreHeight: u64,
+ kdfRounds: u64,
+ seedOffset: *const ::std::os::raw::c_char,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_createWalletFromKeys(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ language: *const ::std::os::raw::c_char,
+ nettype: ::std::os::raw::c_int,
+ restoreHeight: u64,
+ addressString: *const ::std::os::raw::c_char,
+ viewKeyString: *const ::std::os::raw::c_char,
+ spendKeyString: *const ::std::os::raw::c_char,
+ kdf_rounds: u64,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_createDeterministicWalletFromSpendKey(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ language: *const ::std::os::raw::c_char,
+ nettype: ::std::os::raw::c_int,
+ restoreHeight: u64,
+ spendKeyString: *const ::std::os::raw::c_char,
+ kdf_rounds: u64,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_createWalletFromDevice(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ nettype: ::std::os::raw::c_int,
+ deviceName: *const ::std::os::raw::c_char,
+ restoreHeight: u64,
+ subaddressLookahead: *const ::std::os::raw::c_char,
+ viewKeyString: *const ::std::os::raw::c_char,
+ spendKeyString: *const ::std::os::raw::c_char,
+ kdf_rounds: u64,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_createWalletFromPolyseed(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ nettype: ::std::os::raw::c_int,
+ mnemonic: *const ::std::os::raw::c_char,
+ passphrase: *const ::std::os::raw::c_char,
+ newWallet: bool,
+ restore_height: u64,
+ kdf_rounds: u64,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_closeWallet(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ store: bool,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_walletExists(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_verifyWalletPassword(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ keys_file_name: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ no_spend_key: bool,
+ kdf_rounds: u64,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_queryWalletDevice(
+ device_type: ::std::os::raw::c_int,
+ keys_file_name: *const ::std::os::raw::c_char,
+ password: *const ::std::os::raw::c_char,
+ kdf_rounds: u64,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_findWallets(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ path: *const ::std::os::raw::c_char,
+ separator: *const ::std::os::raw::c_char,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_errorString(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_setDaemonAddress(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ address: *const ::std::os::raw::c_char,
+ );
+}
+extern "C" {
+ pub fn MONERO_WalletManager_blockchainHeight(wm_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_blockchainTargetHeight(wm_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_networkDifficulty(wm_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_miningHashRate(wm_ptr: *mut ::std::os::raw::c_void) -> f64;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_blockTarget(wm_ptr: *mut ::std::os::raw::c_void) -> u64;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_isMining(wm_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_startMining(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ address: *const ::std::os::raw::c_char,
+ threads: u32,
+ backgroundMining: bool,
+ ignoreBattery: bool,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_stopMining(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ address: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_resolveOpenAlias(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ address: *const ::std::os::raw::c_char,
+ dnssec_valid: bool,
+ ) -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_WalletManager_setProxy(
+ wm_ptr: *mut ::std::os::raw::c_void,
+ address: *const ::std::os::raw::c_char,
+ ) -> bool;
+}
+pub const LogLevel_Silent: ::std::os::raw::c_int = -1;
+pub const LogLevel_0: ::std::os::raw::c_int = 0;
+pub const LogLevel_1: ::std::os::raw::c_int = 1;
+pub const LogLevel_2: ::std::os::raw::c_int = 2;
+pub const LogLevel_3: ::std::os::raw::c_int = 3;
+pub const LogLevel_4: ::std::os::raw::c_int = 4;
+pub const LogLevel_Min: ::std::os::raw::c_int = -1;
+pub const LogLevel_Max: ::std::os::raw::c_int = 4;
+extern "C" {
+ pub fn MONERO_WalletManagerFactory_getWalletManager() -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_WalletManagerFactory_setLogLevel(level: ::std::os::raw::c_int);
+}
+extern "C" {
+ pub fn MONERO_WalletManagerFactory_setLogCategories(categories: *const ::std::os::raw::c_char);
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test0();
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test1(x: bool) -> bool;
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test2(x: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test3(x: u64) -> u64;
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test4(x: u64) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test5() -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_DEBUG_test5_std() -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_DEBUG_isPointerNull(wallet_ptr: *mut ::std::os::raw::c_void) -> bool;
+}
+extern "C" {
+ pub fn MONERO_cw_getWalletListener(
+ wallet_ptr: *mut ::std::os::raw::c_void,
+ ) -> *mut ::std::os::raw::c_void;
+}
+extern "C" {
+ pub fn MONERO_cw_WalletListener_resetNeedToRefresh(
+ cw_walletListener_ptr: *mut ::std::os::raw::c_void,
+ );
+}
+extern "C" {
+ pub fn MONERO_cw_WalletListener_isNeedToRefresh(
+ cw_walletListener_ptr: *mut ::std::os::raw::c_void,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_cw_WalletListener_isNewTransactionExist(
+ cw_walletListener_ptr: *mut ::std::os::raw::c_void,
+ ) -> bool;
+}
+extern "C" {
+ pub fn MONERO_cw_WalletListener_resetIsNewTransactionExist(
+ cw_walletListener_ptr: *mut ::std::os::raw::c_void,
+ );
+}
+extern "C" {
+ pub fn MONERO_cw_WalletListener_height(
+ cw_walletListener_ptr: *mut ::std::os::raw::c_void,
+ ) -> u64;
+}
+extern "C" {
+ pub fn MONERO_free(ptr: *mut ::std::os::raw::c_void);
+}
+extern "C" {
+ pub fn MONERO_checksum_wallet2_api_c_h() -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_checksum_wallet2_api_c_cpp() -> *const ::std::os::raw::c_char;
+}
+extern "C" {
+ pub fn MONERO_checksum_wallet2_api_c_exp() -> *const ::std::os::raw::c_char;
+}
diff --git a/impls/monero.rs/src/lib.rs b/impls/monero.rs/src/lib.rs
new file mode 100644
index 0000000..2175083
--- /dev/null
+++ b/impls/monero.rs/src/lib.rs
@@ -0,0 +1,223 @@
+use std::ffi::{CStr, CString};
+use std::os::raw::{c_char, c_int, c_void};
+use std::ptr::NonNull;
+use std::sync::Arc;
+
+use libloading::{Library, Symbol};
+
+pub const NETWORK_TYPE_MAINNET: c_int = 0;
+pub const NETWORK_TYPE_TESTNET: c_int = 1;
+pub const NETWORK_TYPE_STAGENET: c_int = 2;
+
+#[derive(Debug)]
+pub enum WalletError {
+ NullPointer,
+ FfiError(String),
+ WalletErrorCode(c_int, String),
+ LibraryLoadError(String),
+}
+
+pub type WalletResult<T> = Result<T, WalletError>;
+
+pub struct WalletManager {
+ ptr: NonNull<c_void>,
+ library: Arc<Library>,
+}
+
+impl WalletManager {
+ /// Create a new WalletManager, optionally specifying the path to the shared library.
+ pub fn new(lib_path: Option<&str>) -> WalletResult<Self> {
+ let lib = match lib_path {
+ Some(path) => {
+ unsafe {
+ Library::new(path).map_err(|e| WalletError::LibraryLoadError(e.to_string()))?
+ }
+ }
+ None => {
+ // Attempt to load from the same directory as the executable.
+ let exe_path = std::env::current_exe()
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?;
+ let exe_dir = exe_path.parent().ok_or_else(|| {
+ WalletError::LibraryLoadError("Failed to get executable directory".to_string())
+ })?;
+ let lib_path = exe_dir.join("libwallet2_api_c.so");
+
+ unsafe {
+ if lib_path.exists() {
+ Library::new(lib_path)
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?
+ } else {
+ // Fallback to standard locations.
+ Library::new("libwallet2_api_c.so")
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?
+ }
+ }
+ }
+ };
+
+ let library = Arc::new(lib);
+
+ unsafe {
+ let func: Symbol<unsafe extern "C" fn() -> *mut c_void> =
+ library.get(b"MONERO_WalletManagerFactory_getWalletManager\0")
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?;
+ let ptr = func();
+ NonNull::new(ptr)
+ .map(|nn_ptr| WalletManager { ptr: nn_ptr, library })
+ .ok_or(WalletError::NullPointer)
+ }
+ }
+
+ pub fn create_wallet(
+ &self,
+ path: &str,
+ password: &str,
+ language: &str,
+ network_type: c_int,
+ ) -> WalletResult<Wallet> {
+ let c_path = CString::new(path).expect("CString::new failed");
+ let c_password = CString::new(password).expect("CString::new failed");
+ let c_language = CString::new(language).expect("CString::new failed");
+
+ unsafe {
+ let func: Symbol<
+ unsafe extern "C" fn(
+ *mut c_void,
+ *const c_char,
+ *const c_char,
+ *const c_char,
+ c_int,
+ ) -> *mut c_void,
+ > = self
+ .library
+ .get(b"MONERO_WalletManager_createWallet\0")
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?;
+ let wallet_ptr = func(
+ self.ptr.as_ptr(),
+ c_path.as_ptr(),
+ c_password.as_ptr(),
+ c_language.as_ptr(),
+ network_type,
+ );
+
+ if wallet_ptr.is_null() {
+ Err(WalletError::NullPointer)
+ } else {
+ Ok(Wallet {
+ ptr: NonNull::new_unchecked(wallet_ptr),
+ manager_ptr: self.ptr,
+ library: Arc::clone(&self.library), // Keep the library alive.
+ })
+ }
+ }
+ }
+}
+
+impl Drop for WalletManager {
+ fn drop(&mut self) {
+ // The library will be dropped automatically when all references are gone.
+ }
+}
+
+#[derive(Clone)]
+pub struct Wallet {
+ ptr: NonNull<c_void>,
+ manager_ptr: NonNull<c_void>,
+ library: Arc<Library>,
+}
+
+impl Wallet {
+ pub fn get_seed(&self, seed_offset: &str) -> WalletResult<String> {
+ let c_seed_offset = CString::new(seed_offset).expect("CString::new failed");
+
+ unsafe {
+ let func: Symbol<unsafe extern "C" fn(*mut c_void, *const c_char) -> *const c_char> =
+ self.library
+ .get(b"MONERO_Wallet_seed\0")
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?;
+ let seed_ptr = func(self.ptr.as_ptr(), c_seed_offset.as_ptr());
+
+ if seed_ptr.is_null() {
+ Err(self.get_last_error())
+ } else {
+ let seed = CStr::from_ptr(seed_ptr)
+ .to_string_lossy()
+ .into_owned();
+ if seed.is_empty() {
+ Err(WalletError::FfiError("Received empty seed".to_string()))
+ } else {
+ Ok(seed)
+ }
+ }
+ }
+ }
+
+ pub fn get_address(&self, account_index: u64, address_index: u64) -> WalletResult<String> {
+ unsafe {
+ let func: Symbol<unsafe extern "C" fn(*mut c_void, u64, u64) -> *const c_char> =
+ self.library
+ .get(b"MONERO_Wallet_address\0")
+ .map_err(|e| WalletError::LibraryLoadError(e.to_string()))?;
+ let address_ptr = func(self.ptr.as_ptr(), account_index, address_index);
+
+ if address_ptr.is_null() {
+ Err(self.get_last_error())
+ } else {
+ let address = CStr::from_ptr(address_ptr)
+ .to_string_lossy()
+ .into_owned();
+ Ok(address)
+ }
+ }
+ }
+
+ pub fn is_deterministic(&self) -> bool {
+ unsafe {
+ let func: Symbol<unsafe extern "C" fn(*mut c_void) -> bool> = self
+ .library
+ .get(b"MONERO_Wallet_isDeterministic\0")
+ .expect("Failed to load MONERO_Wallet_isDeterministic");
+ func(self.ptr.as_ptr())
+ }
+ }
+
+ fn get_last_error(&self) -> WalletError {
+ unsafe {
+ let error_func: Symbol<unsafe extern "C" fn(*mut c_void) -> *const c_char> = self
+ .library
+ .get(b"MONERO_Wallet_errorString\0")
+ .expect("Failed to load MONERO_Wallet_errorString");
+ let status_func: Symbol<unsafe extern "C" fn(*mut c_void) -> c_int> = self
+ .library
+ .get(b"MONERO_Wallet_status\0")
+ .expect("Failed to load MONERO_Wallet_status");
+
+ let error_ptr = error_func(self.ptr.as_ptr());
+ let status = status_func(self.ptr.as_ptr());
+
+ let error_msg = if error_ptr.is_null() {
+ "Unknown error".to_string()
+ } else {
+ CStr::from_ptr(error_ptr)
+ .to_string_lossy()
+ .into_owned()
+ };
+
+ WalletError::WalletErrorCode(status, error_msg)
+ }
+ }
+}
+
+impl Drop for Wallet {
+ fn drop(&mut self) {
+ unsafe {
+ let func: Symbol<
+ unsafe extern "C" fn(*mut c_void, *mut c_void, bool) -> bool,
+ > = self
+ .library
+ .get(b"MONERO_WalletManager_closeWallet\0")
+ .expect("Failed to load MONERO_WalletManager_closeWallet");
+ func(self.manager_ptr.as_ptr(), self.ptr.as_ptr(), false);
+ }
+ }
+}
diff --git a/impls/monero.rs/src/main.rs b/impls/monero.rs/src/main.rs
new file mode 100644
index 0000000..aae688b
--- /dev/null
+++ b/impls/monero.rs/src/main.rs
@@ -0,0 +1,25 @@
+use monero_rust::{WalletError, WalletManager, NETWORK_TYPE_MAINNET};
+
+fn main() -> Result<(), WalletError> {
+ let wallet_manager = WalletManager::new(None)?;
+
+ let wallet = wallet_manager.create_wallet(
+ "wallet",
+ "password",
+ "English",
+ NETWORK_TYPE_MAINNET,
+ )?;
+
+ match wallet.get_seed("") {
+ Ok(seed) => println!("Seed: {}", seed),
+ Err(e) => {
+ eprintln!("Failed to get seed: {:?}", e);
+ return Err(e);
+ }
+ }
+
+ let address = wallet.get_address(0, 0)?;
+ println!("Wallet Address: {}", address);
+
+ Ok(())
+}