From f5986a83f289616735110662d668bccb77594908 Mon Sep 17 00:00:00 2001 From: Guillermo Roche Date: Thu, 31 Oct 2024 15:20:10 +0100 Subject: [PATCH] Add wireguard and start big refactor --- Cargo.lock | 113 + Cargo.toml | 5 + build.rs | 12 + src/main.rs | 28 +- src/manage_interfaces/mod.rs | 95 + src/manage_interfaces/netlink.rs | 53 + src/namespace/bind_interface.rs | 40 +- src/wireguard_manager/add_properties.rs | 46 + src/wireguard_manager/mod.rs | 2 + src/wireguard_manager/wireguard.c | 1755 ++++++++++++++ src/wireguard_manager/wireguard.h | 105 + src/wireguard_manager/wireguard.rs | 2437 +++++++++++++++++++ src/wireguard_manager/wireguard_wrapper.c | 133 ++ src/wireguard_manager/wireguard_wrapper.h | 10 + src/wireguard_manager/wireguard_wrapper.rs | 2457 ++++++++++++++++++++ 15 files changed, 7250 insertions(+), 41 deletions(-) create mode 100644 build.rs create mode 100644 src/manage_interfaces/mod.rs create mode 100644 src/manage_interfaces/netlink.rs create mode 100644 src/wireguard_manager/add_properties.rs create mode 100644 src/wireguard_manager/mod.rs create mode 100644 src/wireguard_manager/wireguard.c create mode 100644 src/wireguard_manager/wireguard.h create mode 100644 src/wireguard_manager/wireguard.rs create mode 100644 src/wireguard_manager/wireguard_wrapper.c create mode 100644 src/wireguard_manager/wireguard_wrapper.h create mode 100644 src/wireguard_manager/wireguard_wrapper.rs diff --git a/Cargo.lock b/Cargo.lock index 3c43f69..3d34c4e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -102,6 +102,32 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[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" @@ -129,18 +155,44 @@ dependencies = [ "shlex", ] +[[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 = "colorchoice" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + [[package]] name = "env_filter" version = "0.1.2" @@ -259,6 +311,12 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "hermit-abi" version = "0.3.9" @@ -277,12 +335,31 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[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.158" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +[[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 = "lock_api" version = "0.4.12" @@ -305,6 +382,12 @@ 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 = "miniz_oxide" version = "0.7.4" @@ -330,9 +413,13 @@ dependencies = [ name = "netjailers" version = "0.1.0" dependencies = [ + "base64", + "bindgen", + "cc", "env_logger", "futures", "log", + "netlink-packet-route", "nix", "rtnetlink", "tokio", @@ -414,6 +501,16 @@ dependencies = [ "libc", ] +[[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 = "object" version = "0.36.3" @@ -464,6 +561,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[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.86" @@ -544,6 +651,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "scopeguard" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index 9d3ec2c..f982744 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,13 @@ edition = "2021" [dependencies] nix = {version = '*', features= ["fs", "mount", "sched"] } rtnetlink = {version = '*', features = ["tokio_socket"] } +netlink-packet-route = '*' futures = '*' log = '*' env_logger = '*' tokio = {version = '*', features = ["full"] } +base64 = '*' +[build-dependencies] +cc = "1" +bindgen = "0" \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..c3d4e16 --- /dev/null +++ b/build.rs @@ -0,0 +1,12 @@ + +fn main() { + cc::Build::new() + .file("src/wireguard_manager/wireguard_wrapper.c") + .compile("wireguard_wrapper.a"); + + cc::Build::new() + .file("src/wireguard_manager/wireguard.c") + .compile("wireguard.a"); + + println!("cargo::rerun-if-changed=src/wireguard.c"); +} diff --git a/src/main.rs b/src/main.rs index ee61c8c..1613267 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,39 @@ mod namespace; +mod manage_interfaces; +mod wireguard_manager; use std::io::Result; use rtnetlink::NetworkNamespace; use futures::executor::block_on; +use base64::prelude::*; fn main() { env_logger::Builder::from_default_env() .format_timestamp_secs() .filter(None, log::LevelFilter::Debug) .init(); + + let priv_key_dirty = BASE64_STANDARD.decode(b"key1").unwrap(); + let pub_key_dirty = BASE64_STANDARD.decode(b"key2").unwrap(); + let mut priv_key: [u8; 32] = Default::default(); + let mut pub_key: [u8; 32] = Default::default(); + priv_key.copy_from_slice(&priv_key_dirty[0..32]); + pub_key.copy_from_slice(&pub_key_dirty[0..32]); + //namespace::create_ns::create_ns(); let ns_name = "test-newns".to_string(); - block_on(NetworkNamespace::add(ns_name.clone())); - namespace::bind_interface::run_in_namespace(|| {namespace::bind_interface::set_lo_up().unwrap();},&ns_name); + block_on(NetworkNamespace::add(ns_name.clone())).unwrap(); + namespace::bind_interface::run_in_namespace(|| { + manage_interfaces::set_interface_lo_up().unwrap(); + }, + &ns_name).unwrap(); + namespace::bind_interface::run_in_namespace(|| { + manage_interfaces::create_wireguard_interface(String::from("wgiface"), + String::from("local_ip"), + String::from("remote_ip"), + 24, + pub_key, + priv_key).unwrap(); + }, + &ns_name).unwrap(); + //println!("{}",wireguard_manager::add_properties::set_params(pub_key, priv_key)) } diff --git a/src/manage_interfaces/mod.rs b/src/manage_interfaces/mod.rs new file mode 100644 index 0000000..e3f41ae --- /dev/null +++ b/src/manage_interfaces/mod.rs @@ -0,0 +1,95 @@ +use rtnetlink::{new_connection, Error, Handle}; +use netlink_packet_route::link::LinkMessage; +use std::net::IpAddr; +use futures::TryStreamExt; +mod netlink; + +pub fn create_wireguard_interface( + interface_name: String, + interface_ip: String, + peer_ip: String, + prefix: u8, + wg_pub_key: [u8; 32], + wg_priv_key: [u8;32]) -> Result<(), Error> { + tokio::runtime::Runtime::new().unwrap().handle().block_on( async { + let (connection, handle, _) = new_connection().unwrap(); + tokio::spawn(connection); + netlink::create_wireguard_interface(handle.clone(), interface_name.clone()).await?; + let link = netlink::get_link_interface(handle.clone(), interface_name.clone()).await?; + netlink::assign_ip(handle.clone(), link.clone(), interface_ip, prefix).await?; + crate::wireguard_manager::add_properties::set_params(wg_pub_key, wg_priv_key, peer_ip, interface_name.clone()); + netlink::set_interface_up(handle, link).await?; + Ok(()) + }) +} + +pub fn set_interface_lo_up() -> Result<(), Error> { + tokio::runtime::Runtime::new().unwrap().handle().block_on( async { + let (connection, handle, _) = new_connection().unwrap(); + tokio::spawn(connection); + let link = netlink::get_link_interface(handle.clone(), String::from("lo")).await?; + netlink::set_interface_up(handle, link).await?; + Ok(()) + }) +} + +/*pub fn set_interface_up(interface: String) -> Result<(), Error> { + tokio::runtime::Runtime::new().unwrap().handle().block_on( async { + let (connection, handle, _) = new_connection().unwrap(); + tokio::spawn(connection); + let mut links = handle.link().get().match_name(interface).execute(); + if let Some(link) = links.try_next().await.unwrap() { + let index = link.header.index; + log::debug!("index:{}", index); + handle + .link() + .set(index) + .up() + .execute() + .await.unwrap() + } else { + log::debug!("no link link lo found"); + } + }); + Ok(()) +} + +pub fn create_wireguard_interface(interface: String) -> Result<(), Error> { + tokio::runtime::Runtime::new().unwrap().handle().block_on( async { + let (connection, handle, _) = new_connection().unwrap(); + tokio::spawn(connection); + handle.link().add().wireguard(interface).execute().await.unwrap(); + }); + Ok(()) +} + +pub async fn assign_ip(handle: Handle, link: LinkMessage, interface: String, ip: String, prefix: u8) -> Result<(), Error> { + let usable_ip: IpAddr = match ip.parse() { + Ok(ip_ok) => ip_ok, + Err(_e) => { + log::debug!("malformed ip"); + return Err(Error::InvalidIp(ip.into_bytes())); + }, + }; + handle + .address() + .add(link.header.index, usable_ip, prefix) + .execute() + .await +}*/ + +pub fn get_inferfaces() -> Result<(), Error> { + tokio::runtime::Runtime::new().unwrap().handle().block_on( async { + let (connection, handle, _) = new_connection().unwrap(); + tokio::spawn(connection); + log::debug!("ARE WE STOPPING YET???"); + let mut links = handle.link().get().match_name("lo".to_string()).execute(); + if let Some(link) = links.try_next().await.unwrap() { + let index = link.header.index; + log::debug!("index:{}", index); + } else { + println!("no link link lo found"); + } + }); + Ok(()) +} diff --git a/src/manage_interfaces/netlink.rs b/src/manage_interfaces/netlink.rs new file mode 100644 index 0000000..8544db7 --- /dev/null +++ b/src/manage_interfaces/netlink.rs @@ -0,0 +1,53 @@ +use rtnetlink::{new_connection, Error, Handle}; +use netlink_packet_route::link::LinkMessage; +use std::net::IpAddr; +use futures::TryStreamExt; + +pub async fn set_interface_up(handle: Handle, + link: LinkMessage) -> Result<(), Error> { + let index = link.header.index; + log::debug!("index: {}", index); + handle + .link() + .set(index) + .up() + .execute() + .await +} + +pub async fn create_wireguard_interface( + handle: Handle, + interface: String) -> Result<(), Error> { + handle.link().add().wireguard(interface).execute().await +} + +pub async fn assign_ip( + handle: Handle, + link: LinkMessage, + ip: String, + prefix: u8) -> Result<(), Error> { + let usable_ip: IpAddr = match ip.parse() { + Ok(ip_ok) => ip_ok, + Err(_e) => { + log::debug!("malformed ip"); + return Err(Error::InvalidIp(ip.into_bytes())); + }, + }; + handle + .address() + .add(link.header.index, usable_ip, prefix) + .execute() + .await +} + +pub async fn get_link_interface( + handle: Handle, + interface: String) -> Result { + let mut links = handle.link().get().match_name(interface).execute(); + if let Some(link) = links.try_next().await.unwrap() { + Ok(link) + } else { + log::debug!("no link link lo found"); + Err(Error::RequestFailed) + } +} diff --git a/src/namespace/bind_interface.rs b/src/namespace/bind_interface.rs index 4710224..38f59de 100644 --- a/src/namespace/bind_interface.rs +++ b/src/namespace/bind_interface.rs @@ -101,7 +101,7 @@ fn prepare_namespace(ns_name: &String) -> Result<(), ()> { let mut mount_flags = MsFlags::empty(); mount_flags.insert(MsFlags::MS_REC); mount_flags.insert(MsFlags::MS_PRIVATE); - if let Err(e) = mount::(None, &PathBuf::from("/"), None, mount_flags, None) { + if let Err(_e) = mount::(None, &PathBuf::from("/"), None, mount_flags, None) { log::error!("Can not remount root directory"); () } @@ -137,41 +137,3 @@ fn prepare_namespace(ns_name: &String) -> Result<(), ()> { Ok(()) } - -pub fn set_lo_up() -> Result<(), Error> { - tokio::runtime::Runtime::new().unwrap().handle().block_on( async { - let (connection, handle, _) = new_connection().unwrap(); - tokio::spawn(connection); - log::debug!("ARE WE STOPPING YET???"); - let mut links = handle.link().get().match_name("lo".to_string()).execute(); - if let Some(link) = links.try_next().await.unwrap() { - let index = link.header.index; - log::debug!("index:{}", index); - handle - .link() - .set(index) - .up() - .execute() - .await.unwrap() - } else { - println!("no link link lo found"); - } - }); - Ok(()) -} - -pub fn get_inferfaces() -> Result<(), Error> { - tokio::runtime::Runtime::new().unwrap().handle().block_on( async { - let (connection, handle, _) = new_connection().unwrap(); - tokio::spawn(connection); - log::debug!("ARE WE STOPPING YET???"); - let mut links = handle.link().get().match_name("lo".to_string()).execute(); - if let Some(link) = links.try_next().await.unwrap() { - let index = link.header.index; - log::debug!("index:{}", index); - } else { - println!("no link link lo found"); - } - }); - Ok(()) -} diff --git a/src/wireguard_manager/add_properties.rs b/src/wireguard_manager/add_properties.rs new file mode 100644 index 0000000..cf5ac24 --- /dev/null +++ b/src/wireguard_manager/add_properties.rs @@ -0,0 +1,46 @@ +use crate::wireguard_manager::wireguard_wrapper; +use std::ffi::CString; + +pub fn get_names() -> i32 { + let index: i32; + /*unsafe { + let names = wireguard::wg_list_device_names(); + index = *names + } + return index;*/ + unsafe { + index = wireguard_wrapper::it_works(); + } + index +} + +pub fn set_params(mut wg_pub_key: [u8; 32], + mut wg_priv_key: [u8;32], + peer_ip: String, + interface_name: String) -> bool { + let mut ret = false; + unsafe { + let mut peer = wireguard_wrapper::generate_new_peer(&mut wg_pub_key, + CString::new(peer_ip).unwrap().into_raw(), + 51820); + + println!("crea la semilla"); + let mut device = wireguard_wrapper::generate_new_device(&mut wg_priv_key, + CString::new(interface_name).unwrap().into_raw(), + 51820, peer); + + println!("crea la interfaz de red"); + //let status_add_device = wireguard_wrapper::wg_add_device(device.name.as_ptr()); + let status_set_device = wireguard_wrapper::wg_set_device(&mut device); + //println!("dispositivo: {}", CString::from_raw(device.name.as_mut_ptr()).to_str().unwrap()); + /*if ret { + println!("aƱade el dispositivo"); + //println!("dispositivo: {}", CString::from_raw(device.name.as_mut_ptr()).to_str().unwrap()); + ret = ret && (wireguard_wrapper::wg_set_device(&mut device) < 0); + }*/ + //ret = status_add_device >= 0 && status_set_device >= 0; + ret = status_set_device >= 0; + wireguard_wrapper::clean_device(&mut peer); + } + ret +} diff --git a/src/wireguard_manager/mod.rs b/src/wireguard_manager/mod.rs new file mode 100644 index 0000000..46db28f --- /dev/null +++ b/src/wireguard_manager/mod.rs @@ -0,0 +1,2 @@ +mod wireguard_wrapper; +pub mod add_properties; diff --git a/src/wireguard_manager/wireguard.c b/src/wireguard_manager/wireguard.c new file mode 100644 index 0000000..4941549 --- /dev/null +++ b/src/wireguard_manager/wireguard.c @@ -0,0 +1,1755 @@ +// SPDX-License-Identifier: LGPL-2.1+ +/* + * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. + * Copyright (C) 2008-2012 Pablo Neira Ayuso . + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "wireguard.h" + +/* wireguard.h netlink uapi: */ + +#define WG_GENL_NAME "wireguard" +#define WG_GENL_VERSION 1 + +enum wg_cmd { + WG_CMD_GET_DEVICE, + WG_CMD_SET_DEVICE, + __WG_CMD_MAX +}; + +enum wgdevice_flag { + WGDEVICE_F_REPLACE_PEERS = 1U << 0 +}; +enum wgdevice_attribute { + WGDEVICE_A_UNSPEC, + WGDEVICE_A_IFINDEX, + WGDEVICE_A_IFNAME, + WGDEVICE_A_PRIVATE_KEY, + WGDEVICE_A_PUBLIC_KEY, + WGDEVICE_A_FLAGS, + WGDEVICE_A_LISTEN_PORT, + WGDEVICE_A_FWMARK, + WGDEVICE_A_PEERS, + __WGDEVICE_A_LAST +}; + +enum wgpeer_flag { + WGPEER_F_REMOVE_ME = 1U << 0, + WGPEER_F_REPLACE_ALLOWEDIPS = 1U << 1 +}; +enum wgpeer_attribute { + WGPEER_A_UNSPEC, + WGPEER_A_PUBLIC_KEY, + WGPEER_A_PRESHARED_KEY, + WGPEER_A_FLAGS, + WGPEER_A_ENDPOINT, + WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, + WGPEER_A_LAST_HANDSHAKE_TIME, + WGPEER_A_RX_BYTES, + WGPEER_A_TX_BYTES, + WGPEER_A_ALLOWEDIPS, + WGPEER_A_PROTOCOL_VERSION, + __WGPEER_A_LAST +}; + +enum wgallowedip_attribute { + WGALLOWEDIP_A_UNSPEC, + WGALLOWEDIP_A_FAMILY, + WGALLOWEDIP_A_IPADDR, + WGALLOWEDIP_A_CIDR_MASK, + __WGALLOWEDIP_A_LAST +}; + +/* libmnl mini library: */ + +#define MNL_SOCKET_AUTOPID 0 +#define MNL_ALIGNTO 4 +#define MNL_ALIGN(len) (((len)+MNL_ALIGNTO-1) & ~(MNL_ALIGNTO-1)) +#define MNL_NLMSG_HDRLEN MNL_ALIGN(sizeof(struct nlmsghdr)) +#define MNL_ATTR_HDRLEN MNL_ALIGN(sizeof(struct nlattr)) + +enum mnl_attr_data_type { + MNL_TYPE_UNSPEC, + MNL_TYPE_U8, + MNL_TYPE_U16, + MNL_TYPE_U32, + MNL_TYPE_U64, + MNL_TYPE_STRING, + MNL_TYPE_FLAG, + MNL_TYPE_MSECS, + MNL_TYPE_NESTED, + MNL_TYPE_NESTED_COMPAT, + MNL_TYPE_NUL_STRING, + MNL_TYPE_BINARY, + MNL_TYPE_MAX, +}; + +#define mnl_attr_for_each(attr, nlh, offset) \ + for ((attr) = mnl_nlmsg_get_payload_offset((nlh), (offset)); \ + mnl_attr_ok((attr), (char *)mnl_nlmsg_get_payload_tail(nlh) - (char *)(attr)); \ + (attr) = mnl_attr_next(attr)) + +#define mnl_attr_for_each_nested(attr, nest) \ + for ((attr) = mnl_attr_get_payload(nest); \ + mnl_attr_ok((attr), (char *)mnl_attr_get_payload(nest) + mnl_attr_get_payload_len(nest) - (char *)(attr)); \ + (attr) = mnl_attr_next(attr)) + +#define mnl_attr_for_each_payload(payload, payload_size) \ + for ((attr) = (payload); \ + mnl_attr_ok((attr), (char *)(payload) + payload_size - (char *)(attr)); \ + (attr) = mnl_attr_next(attr)) + +#define MNL_CB_ERROR -1 +#define MNL_CB_STOP 0 +#define MNL_CB_OK 1 + +typedef int (*mnl_attr_cb_t)(const struct nlattr *attr, void *data); +typedef int (*mnl_cb_t)(const struct nlmsghdr *nlh, void *data); + +#ifndef MNL_ARRAY_SIZE +#define MNL_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) +#endif + +static size_t mnl_ideal_socket_buffer_size(void) +{ + static size_t size = 0; + + if (size) + return size; + size = (size_t)sysconf(_SC_PAGESIZE); + if (size > 8192) + size = 8192; + return size; +} + +static size_t mnl_nlmsg_size(size_t len) +{ + return len + MNL_NLMSG_HDRLEN; +} + +static struct nlmsghdr *mnl_nlmsg_put_header(void *buf) +{ + int len = MNL_ALIGN(sizeof(struct nlmsghdr)); + struct nlmsghdr *nlh = buf; + + memset(buf, 0, len); + nlh->nlmsg_len = len; + return nlh; +} + +static void *mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, size_t size) +{ + char *ptr = (char *)nlh + nlh->nlmsg_len; + size_t len = MNL_ALIGN(size); + nlh->nlmsg_len += len; + memset(ptr, 0, len); + return ptr; +} + +static void *mnl_nlmsg_get_payload(const struct nlmsghdr *nlh) +{ + return (void *)nlh + MNL_NLMSG_HDRLEN; +} + +static void *mnl_nlmsg_get_payload_offset(const struct nlmsghdr *nlh, size_t offset) +{ + return (void *)nlh + MNL_NLMSG_HDRLEN + MNL_ALIGN(offset); +} + +static bool mnl_nlmsg_ok(const struct nlmsghdr *nlh, int len) +{ + return len >= (int)sizeof(struct nlmsghdr) && + nlh->nlmsg_len >= sizeof(struct nlmsghdr) && + (int)nlh->nlmsg_len <= len; +} + +static struct nlmsghdr *mnl_nlmsg_next(const struct nlmsghdr *nlh, int *len) +{ + *len -= MNL_ALIGN(nlh->nlmsg_len); + return (struct nlmsghdr *)((void *)nlh + MNL_ALIGN(nlh->nlmsg_len)); +} + +static void *mnl_nlmsg_get_payload_tail(const struct nlmsghdr *nlh) +{ + return (void *)nlh + MNL_ALIGN(nlh->nlmsg_len); +} + +static bool mnl_nlmsg_seq_ok(const struct nlmsghdr *nlh, unsigned int seq) +{ + return nlh->nlmsg_seq && seq ? nlh->nlmsg_seq == seq : true; +} + +static bool mnl_nlmsg_portid_ok(const struct nlmsghdr *nlh, unsigned int portid) +{ + return nlh->nlmsg_pid && portid ? nlh->nlmsg_pid == portid : true; +} + +static uint16_t mnl_attr_get_type(const struct nlattr *attr) +{ + return attr->nla_type & NLA_TYPE_MASK; +} + +static uint16_t mnl_attr_get_payload_len(const struct nlattr *attr) +{ + return attr->nla_len - MNL_ATTR_HDRLEN; +} + +static void *mnl_attr_get_payload(const struct nlattr *attr) +{ + return (void *)attr + MNL_ATTR_HDRLEN; +} + +static bool mnl_attr_ok(const struct nlattr *attr, int len) +{ + return len >= (int)sizeof(struct nlattr) && + attr->nla_len >= sizeof(struct nlattr) && + (int)attr->nla_len <= len; +} + +static struct nlattr *mnl_attr_next(const struct nlattr *attr) +{ + return (struct nlattr *)((void *)attr + MNL_ALIGN(attr->nla_len)); +} + +static int mnl_attr_type_valid(const struct nlattr *attr, uint16_t max) +{ + if (mnl_attr_get_type(attr) > max) { + errno = EOPNOTSUPP; + return -1; + } + return 1; +} + +static int __mnl_attr_validate(const struct nlattr *attr, + enum mnl_attr_data_type type, size_t exp_len) +{ + uint16_t attr_len = mnl_attr_get_payload_len(attr); + const char *attr_data = mnl_attr_get_payload(attr); + + if (attr_len < exp_len) { + errno = ERANGE; + return -1; + } + switch(type) { + case MNL_TYPE_FLAG: + if (attr_len > 0) { + errno = ERANGE; + return -1; + } + break; + case MNL_TYPE_NUL_STRING: + if (attr_len == 0) { + errno = ERANGE; + return -1; + } + if (attr_data[attr_len-1] != '\0') { + errno = EINVAL; + return -1; + } + break; + case MNL_TYPE_STRING: + if (attr_len == 0) { + errno = ERANGE; + return -1; + } + break; + case MNL_TYPE_NESTED: + + if (attr_len == 0) + break; + + if (attr_len < MNL_ATTR_HDRLEN) { + errno = ERANGE; + return -1; + } + break; + default: + + break; + } + if (exp_len && attr_len > exp_len) { + errno = ERANGE; + return -1; + } + return 0; +} + +static const size_t mnl_attr_data_type_len[MNL_TYPE_MAX] = { + [MNL_TYPE_U8] = sizeof(uint8_t), + [MNL_TYPE_U16] = sizeof(uint16_t), + [MNL_TYPE_U32] = sizeof(uint32_t), + [MNL_TYPE_U64] = sizeof(uint64_t), + [MNL_TYPE_MSECS] = sizeof(uint64_t), +}; + +static int mnl_attr_validate(const struct nlattr *attr, enum mnl_attr_data_type type) +{ + int exp_len; + + if (type >= MNL_TYPE_MAX) { + errno = EINVAL; + return -1; + } + exp_len = mnl_attr_data_type_len[type]; + return __mnl_attr_validate(attr, type, exp_len); +} + +static int mnl_attr_parse(const struct nlmsghdr *nlh, unsigned int offset, + mnl_attr_cb_t cb, void *data) +{ + int ret = MNL_CB_OK; + const struct nlattr *attr; + + mnl_attr_for_each(attr, nlh, offset) + if ((ret = cb(attr, data)) <= MNL_CB_STOP) + return ret; + return ret; +} + +static int mnl_attr_parse_nested(const struct nlattr *nested, mnl_attr_cb_t cb, + void *data) +{ + int ret = MNL_CB_OK; + const struct nlattr *attr; + + mnl_attr_for_each_nested(attr, nested) + if ((ret = cb(attr, data)) <= MNL_CB_STOP) + return ret; + return ret; +} + +static uint8_t mnl_attr_get_u8(const struct nlattr *attr) +{ + return *((uint8_t *)mnl_attr_get_payload(attr)); +} + +static uint16_t mnl_attr_get_u16(const struct nlattr *attr) +{ + return *((uint16_t *)mnl_attr_get_payload(attr)); +} + +static uint32_t mnl_attr_get_u32(const struct nlattr *attr) +{ + return *((uint32_t *)mnl_attr_get_payload(attr)); +} + +static uint64_t mnl_attr_get_u64(const struct nlattr *attr) +{ + uint64_t tmp; + memcpy(&tmp, mnl_attr_get_payload(attr), sizeof(tmp)); + return tmp; +} + +static const char *mnl_attr_get_str(const struct nlattr *attr) +{ + return mnl_attr_get_payload(attr); +} + +static void mnl_attr_put(struct nlmsghdr *nlh, uint16_t type, size_t len, + const void *data) +{ + struct nlattr *attr = mnl_nlmsg_get_payload_tail(nlh); + uint16_t payload_len = MNL_ALIGN(sizeof(struct nlattr)) + len; + int pad; + + attr->nla_type = type; + attr->nla_len = payload_len; + memcpy(mnl_attr_get_payload(attr), data, len); + nlh->nlmsg_len += MNL_ALIGN(payload_len); + pad = MNL_ALIGN(len) - len; + if (pad > 0) + memset(mnl_attr_get_payload(attr) + len, 0, pad); +} + +static void mnl_attr_put_u16(struct nlmsghdr *nlh, uint16_t type, uint16_t data) +{ + mnl_attr_put(nlh, type, sizeof(uint16_t), &data); +} + +static void mnl_attr_put_u32(struct nlmsghdr *nlh, uint16_t type, uint32_t data) +{ + mnl_attr_put(nlh, type, sizeof(uint32_t), &data); +} + +static void mnl_attr_put_strz(struct nlmsghdr *nlh, uint16_t type, const char *data) +{ + mnl_attr_put(nlh, type, strlen(data)+1, data); +} + +static struct nlattr *mnl_attr_nest_start(struct nlmsghdr *nlh, uint16_t type) +{ + struct nlattr *start = mnl_nlmsg_get_payload_tail(nlh); + + start->nla_type = NLA_F_NESTED | type; + nlh->nlmsg_len += MNL_ALIGN(sizeof(struct nlattr)); + return start; +} + +static bool mnl_attr_put_check(struct nlmsghdr *nlh, size_t buflen, + uint16_t type, size_t len, const void *data) +{ + if (nlh->nlmsg_len + MNL_ATTR_HDRLEN + MNL_ALIGN(len) > buflen) + return false; + mnl_attr_put(nlh, type, len, data); + return true; +} + +static bool mnl_attr_put_u8_check(struct nlmsghdr *nlh, size_t buflen, + uint16_t type, uint8_t data) +{ + return mnl_attr_put_check(nlh, buflen, type, sizeof(uint8_t), &data); +} + +static bool mnl_attr_put_u16_check(struct nlmsghdr *nlh, size_t buflen, + uint16_t type, uint16_t data) +{ + return mnl_attr_put_check(nlh, buflen, type, sizeof(uint16_t), &data); +} + +static bool mnl_attr_put_u32_check(struct nlmsghdr *nlh, size_t buflen, + uint16_t type, uint32_t data) +{ + return mnl_attr_put_check(nlh, buflen, type, sizeof(uint32_t), &data); +} + +static struct nlattr *mnl_attr_nest_start_check(struct nlmsghdr *nlh, size_t buflen, + uint16_t type) +{ + if (nlh->nlmsg_len + MNL_ATTR_HDRLEN > buflen) + return NULL; + return mnl_attr_nest_start(nlh, type); +} + +static void mnl_attr_nest_end(struct nlmsghdr *nlh, struct nlattr *start) +{ + start->nla_len = mnl_nlmsg_get_payload_tail(nlh) - (void *)start; +} + +static void mnl_attr_nest_cancel(struct nlmsghdr *nlh, struct nlattr *start) +{ + nlh->nlmsg_len -= mnl_nlmsg_get_payload_tail(nlh) - (void *)start; +} + +static int mnl_cb_noop(__attribute__((unused)) const struct nlmsghdr *nlh, __attribute__((unused)) void *data) +{ + return MNL_CB_OK; +} + +static int mnl_cb_error(const struct nlmsghdr *nlh, __attribute__((unused)) void *data) +{ + const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh); + + if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) { + errno = EBADMSG; + return MNL_CB_ERROR; + } + + if (err->error < 0) + errno = -err->error; + else + errno = err->error; + + return err->error == 0 ? MNL_CB_STOP : MNL_CB_ERROR; +} + +static int mnl_cb_stop(__attribute__((unused)) const struct nlmsghdr *nlh, __attribute__((unused)) void *data) +{ + return MNL_CB_STOP; +} + +static const mnl_cb_t default_cb_array[NLMSG_MIN_TYPE] = { + [NLMSG_NOOP] = mnl_cb_noop, + [NLMSG_ERROR] = mnl_cb_error, + [NLMSG_DONE] = mnl_cb_stop, + [NLMSG_OVERRUN] = mnl_cb_noop, +}; + +static int __mnl_cb_run(const void *buf, size_t numbytes, + unsigned int seq, unsigned int portid, + mnl_cb_t cb_data, void *data, + const mnl_cb_t *cb_ctl_array, + unsigned int cb_ctl_array_len) +{ + int ret = MNL_CB_OK, len = numbytes; + const struct nlmsghdr *nlh = buf; + + while (mnl_nlmsg_ok(nlh, len)) { + + if (!mnl_nlmsg_portid_ok(nlh, portid)) { + errno = ESRCH; + return -1; + } + + if (!mnl_nlmsg_seq_ok(nlh, seq)) { + errno = EPROTO; + return -1; + } + + if (nlh->nlmsg_flags & NLM_F_DUMP_INTR) { + errno = EINTR; + return -1; + } + + if (nlh->nlmsg_type >= NLMSG_MIN_TYPE) { + if (cb_data){ + ret = cb_data(nlh, data); + if (ret <= MNL_CB_STOP) + goto out; + } + } else if (nlh->nlmsg_type < cb_ctl_array_len) { + if (cb_ctl_array && cb_ctl_array[nlh->nlmsg_type]) { + ret = cb_ctl_array[nlh->nlmsg_type](nlh, data); + if (ret <= MNL_CB_STOP) + goto out; + } + } else if (default_cb_array[nlh->nlmsg_type]) { + ret = default_cb_array[nlh->nlmsg_type](nlh, data); + if (ret <= MNL_CB_STOP) + goto out; + } + nlh = mnl_nlmsg_next(nlh, &len); + } +out: + return ret; +} + +static int mnl_cb_run2(const void *buf, size_t numbytes, unsigned int seq, + unsigned int portid, mnl_cb_t cb_data, void *data, + const mnl_cb_t *cb_ctl_array, unsigned int cb_ctl_array_len) +{ + return __mnl_cb_run(buf, numbytes, seq, portid, cb_data, data, + cb_ctl_array, cb_ctl_array_len); +} + +static int mnl_cb_run(const void *buf, size_t numbytes, unsigned int seq, + unsigned int portid, mnl_cb_t cb_data, void *data) +{ + return __mnl_cb_run(buf, numbytes, seq, portid, cb_data, data, NULL, 0); +} + +struct mnl_socket { + int fd; + struct sockaddr_nl addr; +}; + +static unsigned int mnl_socket_get_portid(const struct mnl_socket *nl) +{ + return nl->addr.nl_pid; +} + +static struct mnl_socket *__mnl_socket_open(int bus, int flags) +{ + struct mnl_socket *nl; + + nl = calloc(1, sizeof(struct mnl_socket)); + if (nl == NULL) + return NULL; + + nl->fd = socket(AF_NETLINK, SOCK_RAW | flags, bus); + if (nl->fd == -1) { + free(nl); + return NULL; + } + + return nl; +} + +static struct mnl_socket *mnl_socket_open(int bus) +{ + return __mnl_socket_open(bus, 0); +} + +static int mnl_socket_bind(struct mnl_socket *nl, unsigned int groups, pid_t pid) +{ + int ret; + socklen_t addr_len; + + nl->addr.nl_family = AF_NETLINK; + nl->addr.nl_groups = groups; + nl->addr.nl_pid = pid; + + ret = bind(nl->fd, (struct sockaddr *) &nl->addr, sizeof (nl->addr)); + if (ret < 0) + return ret; + + addr_len = sizeof(nl->addr); + ret = getsockname(nl->fd, (struct sockaddr *) &nl->addr, &addr_len); + if (ret < 0) + return ret; + + if (addr_len != sizeof(nl->addr)) { + errno = EINVAL; + return -1; + } + if (nl->addr.nl_family != AF_NETLINK) { + errno = EINVAL; + return -1; + } + return 0; +} + +static ssize_t mnl_socket_sendto(const struct mnl_socket *nl, const void *buf, + size_t len) +{ + static const struct sockaddr_nl snl = { + .nl_family = AF_NETLINK + }; + return sendto(nl->fd, buf, len, 0, + (struct sockaddr *) &snl, sizeof(snl)); +} + +static ssize_t mnl_socket_recvfrom(const struct mnl_socket *nl, void *buf, + size_t bufsiz) +{ + ssize_t ret; + struct sockaddr_nl addr; + struct iovec iov = { + .iov_base = buf, + .iov_len = bufsiz, + }; + struct msghdr msg = { + .msg_name = &addr, + .msg_namelen = sizeof(struct sockaddr_nl), + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = NULL, + .msg_controllen = 0, + .msg_flags = 0, + }; + ret = recvmsg(nl->fd, &msg, 0); + if (ret == -1) + return ret; + + if (msg.msg_flags & MSG_TRUNC) { + errno = ENOSPC; + return -1; + } + if (msg.msg_namelen != sizeof(struct sockaddr_nl)) { + errno = EINVAL; + return -1; + } + return ret; +} + +static int mnl_socket_close(struct mnl_socket *nl) +{ + int ret = close(nl->fd); + free(nl); + return ret; +} + +/* mnlg mini library: */ + +struct mnlg_socket { + struct mnl_socket *nl; + char *buf; + uint16_t id; + uint8_t version; + unsigned int seq; + unsigned int portid; +}; + +static struct nlmsghdr *__mnlg_msg_prepare(struct mnlg_socket *nlg, uint8_t cmd, + uint16_t flags, uint16_t id, + uint8_t version) +{ + struct nlmsghdr *nlh; + struct genlmsghdr *genl; + + nlh = mnl_nlmsg_put_header(nlg->buf); + nlh->nlmsg_type = id; + nlh->nlmsg_flags = flags; + nlg->seq = time(NULL); + nlh->nlmsg_seq = nlg->seq; + + genl = mnl_nlmsg_put_extra_header(nlh, sizeof(struct genlmsghdr)); + genl->cmd = cmd; + genl->version = version; + + return nlh; +} + +static struct nlmsghdr *mnlg_msg_prepare(struct mnlg_socket *nlg, uint8_t cmd, + uint16_t flags) +{ + return __mnlg_msg_prepare(nlg, cmd, flags, nlg->id, nlg->version); +} + +static int mnlg_socket_send(struct mnlg_socket *nlg, const struct nlmsghdr *nlh) +{ + return mnl_socket_sendto(nlg->nl, nlh, nlh->nlmsg_len); +} + +static int mnlg_cb_noop(const struct nlmsghdr *nlh, void *data) +{ + (void)nlh; + (void)data; + return MNL_CB_OK; +} + +static int mnlg_cb_error(const struct nlmsghdr *nlh, void *data) +{ + const struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh); + (void)data; + + if (nlh->nlmsg_len < mnl_nlmsg_size(sizeof(struct nlmsgerr))) { + errno = EBADMSG; + return MNL_CB_ERROR; + } + /* Netlink subsystems returns the errno value with different signess */ + if (err->error < 0) + errno = -err->error; + else + errno = err->error; + + return err->error == 0 ? MNL_CB_STOP : MNL_CB_ERROR; +} + +static int mnlg_cb_stop(const struct nlmsghdr *nlh, void *data) +{ + (void)data; + if (nlh->nlmsg_flags & NLM_F_MULTI && nlh->nlmsg_len == mnl_nlmsg_size(sizeof(int))) { + int error = *(int *)mnl_nlmsg_get_payload(nlh); + /* Netlink subsystems returns the errno value with different signess */ + if (error < 0) + errno = -error; + else + errno = error; + + return error == 0 ? MNL_CB_STOP : MNL_CB_ERROR; + } + return MNL_CB_STOP; +} + +static const mnl_cb_t mnlg_cb_array[] = { + [NLMSG_NOOP] = mnlg_cb_noop, + [NLMSG_ERROR] = mnlg_cb_error, + [NLMSG_DONE] = mnlg_cb_stop, + [NLMSG_OVERRUN] = mnlg_cb_noop, +}; + +static int mnlg_socket_recv_run(struct mnlg_socket *nlg, mnl_cb_t data_cb, void *data) +{ + int err; + + do { + err = mnl_socket_recvfrom(nlg->nl, nlg->buf, + mnl_ideal_socket_buffer_size()); + if (err <= 0) + break; + err = mnl_cb_run2(nlg->buf, err, nlg->seq, nlg->portid, + data_cb, data, mnlg_cb_array, MNL_ARRAY_SIZE(mnlg_cb_array)); + } while (err > 0); + + return err; +} + +static int get_family_id_attr_cb(const struct nlattr *attr, void *data) +{ + const struct nlattr **tb = data; + int type = mnl_attr_get_type(attr); + + if (mnl_attr_type_valid(attr, CTRL_ATTR_MAX) < 0) + return MNL_CB_ERROR; + + if (type == CTRL_ATTR_FAMILY_ID && + mnl_attr_validate(attr, MNL_TYPE_U16) < 0) + return MNL_CB_ERROR; + tb[type] = attr; + return MNL_CB_OK; +} + +static int get_family_id_cb(const struct nlmsghdr *nlh, void *data) +{ + uint16_t *p_id = data; + struct nlattr *tb[CTRL_ATTR_MAX + 1] = { 0 }; + + mnl_attr_parse(nlh, sizeof(struct genlmsghdr), get_family_id_attr_cb, tb); + if (!tb[CTRL_ATTR_FAMILY_ID]) + return MNL_CB_ERROR; + *p_id = mnl_attr_get_u16(tb[CTRL_ATTR_FAMILY_ID]); + return MNL_CB_OK; +} + +static struct mnlg_socket *mnlg_socket_open(const char *family_name, uint8_t version) +{ + struct mnlg_socket *nlg; + struct nlmsghdr *nlh; + int err; + + nlg = malloc(sizeof(*nlg)); + if (!nlg) + return NULL; + nlg->id = 0; + + err = -ENOMEM; + nlg->buf = malloc(mnl_ideal_socket_buffer_size()); + if (!nlg->buf) + goto err_buf_alloc; + + nlg->nl = mnl_socket_open(NETLINK_GENERIC); + if (!nlg->nl) { + err = -errno; + goto err_mnl_socket_open; + } + + if (mnl_socket_bind(nlg->nl, 0, MNL_SOCKET_AUTOPID) < 0) { + err = -errno; + goto err_mnl_socket_bind; + } + + nlg->portid = mnl_socket_get_portid(nlg->nl); + + nlh = __mnlg_msg_prepare(nlg, CTRL_CMD_GETFAMILY, + NLM_F_REQUEST | NLM_F_ACK, GENL_ID_CTRL, 1); + mnl_attr_put_strz(nlh, CTRL_ATTR_FAMILY_NAME, family_name); + + if (mnlg_socket_send(nlg, nlh) < 0) { + err = -errno; + goto err_mnlg_socket_send; + } + + errno = 0; + if (mnlg_socket_recv_run(nlg, get_family_id_cb, &nlg->id) < 0) { + errno = errno == ENOENT ? EPROTONOSUPPORT : errno; + err = errno ? -errno : -ENOSYS; + goto err_mnlg_socket_recv_run; + } + + nlg->version = version; + errno = 0; + return nlg; + +err_mnlg_socket_recv_run: +err_mnlg_socket_send: +err_mnl_socket_bind: + mnl_socket_close(nlg->nl); +err_mnl_socket_open: + free(nlg->buf); +err_buf_alloc: + free(nlg); + errno = -err; + return NULL; +} + +static void mnlg_socket_close(struct mnlg_socket *nlg) +{ + mnl_socket_close(nlg->nl); + free(nlg->buf); + free(nlg); +} + +/* wireguard-specific parts: */ + +struct string_list { + char *buffer; + size_t len; + size_t cap; +}; + +static int string_list_add(struct string_list *list, const char *str) +{ + size_t len = strlen(str) + 1; + + if (len == 1) + return 0; + + if (len >= list->cap - list->len) { + char *new_buffer; + size_t new_cap = list->cap * 2; + + if (new_cap < list->len +len + 1) + new_cap = list->len + len + 1; + new_buffer = realloc(list->buffer, new_cap); + if (!new_buffer) + return -errno; + list->buffer = new_buffer; + list->cap = new_cap; + } + memcpy(list->buffer + list->len, str, len); + list->len += len; + list->buffer[list->len] = '\0'; + return 0; +} + +struct interface { + const char *name; + bool is_wireguard; +}; + +static int parse_linkinfo(const struct nlattr *attr, void *data) +{ + struct interface *interface = data; + + if (mnl_attr_get_type(attr) == IFLA_INFO_KIND && !strcmp(WG_GENL_NAME, mnl_attr_get_str(attr))) + interface->is_wireguard = true; + return MNL_CB_OK; +} + +static int parse_infomsg(const struct nlattr *attr, void *data) +{ + struct interface *interface = data; + + if (mnl_attr_get_type(attr) == IFLA_LINKINFO) + return mnl_attr_parse_nested(attr, parse_linkinfo, data); + else if (mnl_attr_get_type(attr) == IFLA_IFNAME) + interface->name = mnl_attr_get_str(attr); + return MNL_CB_OK; +} + +static int read_devices_cb(const struct nlmsghdr *nlh, void *data) +{ + struct string_list *list = data; + struct interface interface = { 0 }; + int ret; + + ret = mnl_attr_parse(nlh, sizeof(struct ifinfomsg), parse_infomsg, &interface); + if (ret != MNL_CB_OK) + return ret; + if (interface.name && interface.is_wireguard) + ret = string_list_add(list, interface.name); + if (ret < 0) + return ret; + if (nlh->nlmsg_type != NLMSG_DONE) + return MNL_CB_OK + 1; + return MNL_CB_OK; +} + +static int fetch_device_names(struct string_list *list) +{ + struct mnl_socket *nl = NULL; + char *rtnl_buffer = NULL; + size_t message_len; + unsigned int portid, seq; + ssize_t len; + int ret = 0; + struct nlmsghdr *nlh; + struct ifinfomsg *ifm; + + ret = -ENOMEM; + rtnl_buffer = calloc(mnl_ideal_socket_buffer_size(), 1); + if (!rtnl_buffer) + goto cleanup; + + nl = mnl_socket_open(NETLINK_ROUTE); + if (!nl) { + ret = -errno; + goto cleanup; + } + + if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { + ret = -errno; + goto cleanup; + } + + seq = time(NULL); + portid = mnl_socket_get_portid(nl); + nlh = mnl_nlmsg_put_header(rtnl_buffer); + nlh->nlmsg_type = RTM_GETLINK; + nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP; + nlh->nlmsg_seq = seq; + ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm)); + ifm->ifi_family = AF_UNSPEC; + message_len = nlh->nlmsg_len; + + if (mnl_socket_sendto(nl, rtnl_buffer, message_len) < 0) { + ret = -errno; + goto cleanup; + } + +another: + if ((len = mnl_socket_recvfrom(nl, rtnl_buffer, mnl_ideal_socket_buffer_size())) < 0) { + ret = -errno; + goto cleanup; + } + if ((len = mnl_cb_run(rtnl_buffer, len, seq, portid, read_devices_cb, list)) < 0) { + /* Netlink returns NLM_F_DUMP_INTR if the set of all tunnels changed + * during the dump. That's unfortunate, but is pretty common on busy + * systems that are adding and removing tunnels all the time. Rather + * than retrying, potentially indefinitely, we just work with the + * partial results. */ + if (errno != EINTR) { + ret = -errno; + goto cleanup; + } + } + if (len == MNL_CB_OK + 1) + goto another; + ret = 0; + +cleanup: + free(rtnl_buffer); + if (nl) + mnl_socket_close(nl); + return ret; +} + +static int add_del_iface(const char *ifname, bool add) +{ + struct mnl_socket *nl = NULL; + char *rtnl_buffer; + ssize_t len; + int ret; + struct nlmsghdr *nlh; + struct ifinfomsg *ifm; + struct nlattr *nest; + + rtnl_buffer = calloc(mnl_ideal_socket_buffer_size(), 1); + if (!rtnl_buffer) { + ret = -ENOMEM; + goto cleanup; + } + + nl = mnl_socket_open(NETLINK_ROUTE); + if (!nl) { + ret = -errno; + goto cleanup; + } + + if (mnl_socket_bind(nl, 0, MNL_SOCKET_AUTOPID) < 0) { + ret = -errno; + goto cleanup; + } + + nlh = mnl_nlmsg_put_header(rtnl_buffer); + nlh->nlmsg_type = add ? RTM_NEWLINK : RTM_DELLINK; + nlh->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK | (add ? NLM_F_CREATE | NLM_F_EXCL : 0); + nlh->nlmsg_seq = time(NULL); + ifm = mnl_nlmsg_put_extra_header(nlh, sizeof(*ifm)); + ifm->ifi_family = AF_UNSPEC; + mnl_attr_put_strz(nlh, IFLA_IFNAME, ifname); + nest = mnl_attr_nest_start(nlh, IFLA_LINKINFO); + mnl_attr_put_strz(nlh, IFLA_INFO_KIND, WG_GENL_NAME); + mnl_attr_nest_end(nlh, nest); + + if (mnl_socket_sendto(nl, rtnl_buffer, nlh->nlmsg_len) < 0) { + ret = -errno; + goto cleanup; + } + if ((len = mnl_socket_recvfrom(nl, rtnl_buffer, mnl_ideal_socket_buffer_size())) < 0) { + ret = -errno; + goto cleanup; + } + if (mnl_cb_run(rtnl_buffer, len, nlh->nlmsg_seq, mnl_socket_get_portid(nl), NULL, NULL) < 0) { + ret = -errno; + goto cleanup; + } + ret = 0; + +cleanup: + free(rtnl_buffer); + if (nl) + mnl_socket_close(nl); + return ret; +} + +int wg_set_device(wg_device *dev) +{ + int ret = 0; + wg_peer *peer = NULL; + wg_allowedip *allowedip = NULL; + struct nlattr *peers_nest, *peer_nest, *allowedips_nest, *allowedip_nest; + struct nlmsghdr *nlh; + struct mnlg_socket *nlg; + + nlg = mnlg_socket_open(WG_GENL_NAME, WG_GENL_VERSION); + if (!nlg) + return -errno; + +again: + nlh = mnlg_msg_prepare(nlg, WG_CMD_SET_DEVICE, NLM_F_REQUEST | NLM_F_ACK); + mnl_attr_put_strz(nlh, WGDEVICE_A_IFNAME, dev->name); + + if (!peer) { + uint32_t flags = 0; + + if (dev->flags & WGDEVICE_HAS_PRIVATE_KEY) + mnl_attr_put(nlh, WGDEVICE_A_PRIVATE_KEY, sizeof(dev->private_key), dev->private_key); + if (dev->flags & WGDEVICE_HAS_LISTEN_PORT) + mnl_attr_put_u16(nlh, WGDEVICE_A_LISTEN_PORT, dev->listen_port); + if (dev->flags & WGDEVICE_HAS_FWMARK) + mnl_attr_put_u32(nlh, WGDEVICE_A_FWMARK, dev->fwmark); + if (dev->flags & WGDEVICE_REPLACE_PEERS) + flags |= WGDEVICE_F_REPLACE_PEERS; + if (flags) + mnl_attr_put_u32(nlh, WGDEVICE_A_FLAGS, flags); + } + if (!dev->first_peer) + goto send; + peers_nest = peer_nest = allowedips_nest = allowedip_nest = NULL; + peers_nest = mnl_attr_nest_start(nlh, WGDEVICE_A_PEERS); + for (peer = peer ? peer : dev->first_peer; peer; peer = peer->next_peer) { + uint32_t flags = 0; + + peer_nest = mnl_attr_nest_start_check(nlh, mnl_ideal_socket_buffer_size(), 0); + if (!peer_nest) + goto toobig_peers; + if (!mnl_attr_put_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_PUBLIC_KEY, sizeof(peer->public_key), peer->public_key)) + goto toobig_peers; + if (peer->flags & WGPEER_REMOVE_ME) + flags |= WGPEER_F_REMOVE_ME; + if (!allowedip) { + if (peer->flags & WGPEER_REPLACE_ALLOWEDIPS) + flags |= WGPEER_F_REPLACE_ALLOWEDIPS; + if (peer->flags & WGPEER_HAS_PRESHARED_KEY) { + if (!mnl_attr_put_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_PRESHARED_KEY, sizeof(peer->preshared_key), peer->preshared_key)) + goto toobig_peers; + } + if (peer->endpoint.addr.sa_family == AF_INET) { + if (!mnl_attr_put_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_ENDPOINT, sizeof(peer->endpoint.addr4), &peer->endpoint.addr4)) + goto toobig_peers; + } else if (peer->endpoint.addr.sa_family == AF_INET6) { + if (!mnl_attr_put_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_ENDPOINT, sizeof(peer->endpoint.addr6), &peer->endpoint.addr6)) + goto toobig_peers; + } + if (peer->flags & WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL) { + if (!mnl_attr_put_u16_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL, peer->persistent_keepalive_interval)) + goto toobig_peers; + } + } + if (flags) { + if (!mnl_attr_put_u32_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_FLAGS, flags)) + goto toobig_peers; + } + if (peer->first_allowedip) { + if (!allowedip) + allowedip = peer->first_allowedip; + allowedips_nest = mnl_attr_nest_start_check(nlh, mnl_ideal_socket_buffer_size(), WGPEER_A_ALLOWEDIPS); + if (!allowedips_nest) + goto toobig_allowedips; + for (; allowedip; allowedip = allowedip->next_allowedip) { + allowedip_nest = mnl_attr_nest_start_check(nlh, mnl_ideal_socket_buffer_size(), 0); + if (!allowedip_nest) + goto toobig_allowedips; + if (!mnl_attr_put_u16_check(nlh, mnl_ideal_socket_buffer_size(), WGALLOWEDIP_A_FAMILY, allowedip->family)) + goto toobig_allowedips; + if (allowedip->family == AF_INET) { + if (!mnl_attr_put_check(nlh, mnl_ideal_socket_buffer_size(), WGALLOWEDIP_A_IPADDR, sizeof(allowedip->ip4), &allowedip->ip4)) + goto toobig_allowedips; + } else if (allowedip->family == AF_INET6) { + if (!mnl_attr_put_check(nlh, mnl_ideal_socket_buffer_size(), WGALLOWEDIP_A_IPADDR, sizeof(allowedip->ip6), &allowedip->ip6)) + goto toobig_allowedips; + } + if (!mnl_attr_put_u8_check(nlh, mnl_ideal_socket_buffer_size(), WGALLOWEDIP_A_CIDR_MASK, allowedip->cidr)) + goto toobig_allowedips; + mnl_attr_nest_end(nlh, allowedip_nest); + allowedip_nest = NULL; + } + mnl_attr_nest_end(nlh, allowedips_nest); + allowedips_nest = NULL; + } + + mnl_attr_nest_end(nlh, peer_nest); + peer_nest = NULL; + } + mnl_attr_nest_end(nlh, peers_nest); + peers_nest = NULL; + goto send; +toobig_allowedips: + if (allowedip_nest) + mnl_attr_nest_cancel(nlh, allowedip_nest); + if (allowedips_nest) + mnl_attr_nest_end(nlh, allowedips_nest); + mnl_attr_nest_end(nlh, peer_nest); + mnl_attr_nest_end(nlh, peers_nest); + goto send; +toobig_peers: + if (peer_nest) + mnl_attr_nest_cancel(nlh, peer_nest); + mnl_attr_nest_end(nlh, peers_nest); + goto send; +send: + if (mnlg_socket_send(nlg, nlh) < 0) { + ret = -errno; + goto out; + } + errno = 0; + if (mnlg_socket_recv_run(nlg, NULL, NULL) < 0) { + ret = errno ? -errno : -EINVAL; + goto out; + } + if (peer) + goto again; + +out: + mnlg_socket_close(nlg); + errno = -ret; + return ret; +} + +static int parse_allowedip(const struct nlattr *attr, void *data) +{ + wg_allowedip *allowedip = data; + + switch (mnl_attr_get_type(attr)) { + case WGALLOWEDIP_A_UNSPEC: + break; + case WGALLOWEDIP_A_FAMILY: + if (!mnl_attr_validate(attr, MNL_TYPE_U16)) + allowedip->family = mnl_attr_get_u16(attr); + break; + case WGALLOWEDIP_A_IPADDR: + if (mnl_attr_get_payload_len(attr) == sizeof(allowedip->ip4)) + memcpy(&allowedip->ip4, mnl_attr_get_payload(attr), sizeof(allowedip->ip4)); + else if (mnl_attr_get_payload_len(attr) == sizeof(allowedip->ip6)) + memcpy(&allowedip->ip6, mnl_attr_get_payload(attr), sizeof(allowedip->ip6)); + break; + case WGALLOWEDIP_A_CIDR_MASK: + if (!mnl_attr_validate(attr, MNL_TYPE_U8)) + allowedip->cidr = mnl_attr_get_u8(attr); + break; + } + + return MNL_CB_OK; +} + +static int parse_allowedips(const struct nlattr *attr, void *data) +{ + wg_peer *peer = data; + wg_allowedip *new_allowedip = calloc(1, sizeof(wg_allowedip)); + int ret; + + if (!new_allowedip) + return MNL_CB_ERROR; + if (!peer->first_allowedip) + peer->first_allowedip = peer->last_allowedip = new_allowedip; + else { + peer->last_allowedip->next_allowedip = new_allowedip; + peer->last_allowedip = new_allowedip; + } + ret = mnl_attr_parse_nested(attr, parse_allowedip, new_allowedip); + if (!ret) + return ret; + if (!((new_allowedip->family == AF_INET && new_allowedip->cidr <= 32) || (new_allowedip->family == AF_INET6 && new_allowedip->cidr <= 128))) { + errno = EAFNOSUPPORT; + return MNL_CB_ERROR; + } + return MNL_CB_OK; +} + +bool wg_key_is_zero(const wg_key key) +{ + volatile uint8_t acc = 0; + unsigned int i; + + for (i = 0; i < sizeof(wg_key); ++i) { + acc |= key[i]; + __asm__ ("" : "=r" (acc) : "0" (acc)); + } + return 1 & ((acc - 1) >> 8); +} + +static int parse_peer(const struct nlattr *attr, void *data) +{ + wg_peer *peer = data; + + switch (mnl_attr_get_type(attr)) { + case WGPEER_A_UNSPEC: + break; + case WGPEER_A_PUBLIC_KEY: + if (mnl_attr_get_payload_len(attr) == sizeof(peer->public_key)) { + memcpy(peer->public_key, mnl_attr_get_payload(attr), sizeof(peer->public_key)); + peer->flags |= WGPEER_HAS_PUBLIC_KEY; + } + break; + case WGPEER_A_PRESHARED_KEY: + if (mnl_attr_get_payload_len(attr) == sizeof(peer->preshared_key)) { + memcpy(peer->preshared_key, mnl_attr_get_payload(attr), sizeof(peer->preshared_key)); + if (!wg_key_is_zero(peer->preshared_key)) + peer->flags |= WGPEER_HAS_PRESHARED_KEY; + } + break; + case WGPEER_A_ENDPOINT: { + struct sockaddr *addr; + + if (mnl_attr_get_payload_len(attr) < sizeof(*addr)) + break; + addr = mnl_attr_get_payload(attr); + if (addr->sa_family == AF_INET && mnl_attr_get_payload_len(attr) == sizeof(peer->endpoint.addr4)) + memcpy(&peer->endpoint.addr4, addr, sizeof(peer->endpoint.addr4)); + else if (addr->sa_family == AF_INET6 && mnl_attr_get_payload_len(attr) == sizeof(peer->endpoint.addr6)) + memcpy(&peer->endpoint.addr6, addr, sizeof(peer->endpoint.addr6)); + break; + } + case WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL: + if (!mnl_attr_validate(attr, MNL_TYPE_U16)) + peer->persistent_keepalive_interval = mnl_attr_get_u16(attr); + break; + case WGPEER_A_LAST_HANDSHAKE_TIME: + if (mnl_attr_get_payload_len(attr) == sizeof(peer->last_handshake_time)) + memcpy(&peer->last_handshake_time, mnl_attr_get_payload(attr), sizeof(peer->last_handshake_time)); + break; + case WGPEER_A_RX_BYTES: + if (!mnl_attr_validate(attr, MNL_TYPE_U64)) + peer->rx_bytes = mnl_attr_get_u64(attr); + break; + case WGPEER_A_TX_BYTES: + if (!mnl_attr_validate(attr, MNL_TYPE_U64)) + peer->tx_bytes = mnl_attr_get_u64(attr); + break; + case WGPEER_A_ALLOWEDIPS: + return mnl_attr_parse_nested(attr, parse_allowedips, peer); + } + + return MNL_CB_OK; +} + +static int parse_peers(const struct nlattr *attr, void *data) +{ + wg_device *device = data; + wg_peer *new_peer = calloc(1, sizeof(wg_peer)); + int ret; + + if (!new_peer) + return MNL_CB_ERROR; + if (!device->first_peer) + device->first_peer = device->last_peer = new_peer; + else { + device->last_peer->next_peer = new_peer; + device->last_peer = new_peer; + } + ret = mnl_attr_parse_nested(attr, parse_peer, new_peer); + if (!ret) + return ret; + if (!(new_peer->flags & WGPEER_HAS_PUBLIC_KEY)) { + errno = ENXIO; + return MNL_CB_ERROR; + } + return MNL_CB_OK; +} + +static int parse_device(const struct nlattr *attr, void *data) +{ + wg_device *device = data; + + switch (mnl_attr_get_type(attr)) { + case WGDEVICE_A_UNSPEC: + break; + case WGDEVICE_A_IFINDEX: + if (!mnl_attr_validate(attr, MNL_TYPE_U32)) + device->ifindex = mnl_attr_get_u32(attr); + break; + case WGDEVICE_A_IFNAME: + if (!mnl_attr_validate(attr, MNL_TYPE_STRING)) { + strncpy(device->name, mnl_attr_get_str(attr), sizeof(device->name) - 1); + device->name[sizeof(device->name) - 1] = '\0'; + } + break; + case WGDEVICE_A_PRIVATE_KEY: + if (mnl_attr_get_payload_len(attr) == sizeof(device->private_key)) { + memcpy(device->private_key, mnl_attr_get_payload(attr), sizeof(device->private_key)); + device->flags |= WGDEVICE_HAS_PRIVATE_KEY; + } + break; + case WGDEVICE_A_PUBLIC_KEY: + if (mnl_attr_get_payload_len(attr) == sizeof(device->public_key)) { + memcpy(device->public_key, mnl_attr_get_payload(attr), sizeof(device->public_key)); + device->flags |= WGDEVICE_HAS_PUBLIC_KEY; + } + break; + case WGDEVICE_A_LISTEN_PORT: + if (!mnl_attr_validate(attr, MNL_TYPE_U16)) + device->listen_port = mnl_attr_get_u16(attr); + break; + case WGDEVICE_A_FWMARK: + if (!mnl_attr_validate(attr, MNL_TYPE_U32)) + device->fwmark = mnl_attr_get_u32(attr); + break; + case WGDEVICE_A_PEERS: + return mnl_attr_parse_nested(attr, parse_peers, device); + } + + return MNL_CB_OK; +} + +static int read_device_cb(const struct nlmsghdr *nlh, void *data) +{ + return mnl_attr_parse(nlh, sizeof(struct genlmsghdr), parse_device, data); +} + +static void coalesce_peers(wg_device *device) +{ + wg_peer *old_next_peer, *peer = device->first_peer; + + while (peer && peer->next_peer) { + if (memcmp(peer->public_key, peer->next_peer->public_key, sizeof(wg_key))) { + peer = peer->next_peer; + continue; + } + if (!peer->first_allowedip) { + peer->first_allowedip = peer->next_peer->first_allowedip; + peer->last_allowedip = peer->next_peer->last_allowedip; + } else { + peer->last_allowedip->next_allowedip = peer->next_peer->first_allowedip; + peer->last_allowedip = peer->next_peer->last_allowedip; + } + old_next_peer = peer->next_peer; + peer->next_peer = old_next_peer->next_peer; + free(old_next_peer); + } +} + +int wg_get_device(wg_device **device, const char *device_name) +{ + int ret = 0; + struct nlmsghdr *nlh; + struct mnlg_socket *nlg; + +try_again: + *device = calloc(1, sizeof(wg_device)); + if (!*device) + return -errno; + + nlg = mnlg_socket_open(WG_GENL_NAME, WG_GENL_VERSION); + if (!nlg) { + wg_free_device(*device); + *device = NULL; + return -errno; + } + + nlh = mnlg_msg_prepare(nlg, WG_CMD_GET_DEVICE, NLM_F_REQUEST | NLM_F_ACK | NLM_F_DUMP); + mnl_attr_put_strz(nlh, WGDEVICE_A_IFNAME, device_name); + if (mnlg_socket_send(nlg, nlh) < 0) { + ret = -errno; + goto out; + } + errno = 0; + if (mnlg_socket_recv_run(nlg, read_device_cb, *device) < 0) { + ret = errno ? -errno : -EINVAL; + goto out; + } + coalesce_peers(*device); + +out: + if (nlg) + mnlg_socket_close(nlg); + if (ret) { + wg_free_device(*device); + if (ret == -EINTR) + goto try_again; + *device = NULL; + } + errno = -ret; + return ret; +} + +/* first\0second\0third\0forth\0last\0\0 */ +char *wg_list_device_names(void) +{ + struct string_list list = { 0 }; + int ret = fetch_device_names(&list); + + errno = -ret; + if (errno) { + free(list.buffer); + return NULL; + } + return list.buffer ?: strdup("\0"); +} + +int wg_add_device(const char *device_name) +{ + return add_del_iface(device_name, true); +} + +int wg_del_device(const char *device_name) +{ + return add_del_iface(device_name, false); +} + +void wg_free_device(wg_device *dev) +{ + wg_peer *peer, *np; + wg_allowedip *allowedip, *na; + + if (!dev) + return; + for (peer = dev->first_peer, np = peer ? peer->next_peer : NULL; peer; peer = np, np = peer ? peer->next_peer : NULL) { + for (allowedip = peer->first_allowedip, na = allowedip ? allowedip->next_allowedip : NULL; allowedip; allowedip = na, na = allowedip ? allowedip->next_allowedip : NULL) + free(allowedip); + free(peer); + } + free(dev); +} + +static void encode_base64(char dest[static 4], const uint8_t src[static 3]) +{ + const uint8_t input[] = { (src[0] >> 2) & 63, ((src[0] << 4) | (src[1] >> 4)) & 63, ((src[1] << 2) | (src[2] >> 6)) & 63, src[2] & 63 }; + unsigned int i; + + for (i = 0; i < 4; ++i) + dest[i] = input[i] + 'A' + + (((25 - input[i]) >> 8) & 6) + - (((51 - input[i]) >> 8) & 75) + - (((61 - input[i]) >> 8) & 15) + + (((62 - input[i]) >> 8) & 3); + +} + +void wg_key_to_base64(wg_key_b64_string base64, const wg_key key) +{ + unsigned int i; + + for (i = 0; i < 32 / 3; ++i) + encode_base64(&base64[i * 4], &key[i * 3]); + encode_base64(&base64[i * 4], (const uint8_t[]){ key[i * 3 + 0], key[i * 3 + 1], 0 }); + base64[sizeof(wg_key_b64_string) - 2] = '='; + base64[sizeof(wg_key_b64_string) - 1] = '\0'; +} + +static int decode_base64(const char src[static 4]) +{ + int val = 0; + unsigned int i; + + for (i = 0; i < 4; ++i) + val |= (-1 + + ((((('A' - 1) - src[i]) & (src[i] - ('Z' + 1))) >> 8) & (src[i] - 64)) + + ((((('a' - 1) - src[i]) & (src[i] - ('z' + 1))) >> 8) & (src[i] - 70)) + + ((((('0' - 1) - src[i]) & (src[i] - ('9' + 1))) >> 8) & (src[i] + 5)) + + ((((('+' - 1) - src[i]) & (src[i] - ('+' + 1))) >> 8) & 63) + + ((((('/' - 1) - src[i]) & (src[i] - ('/' + 1))) >> 8) & 64) + ) << (18 - 6 * i); + return val; +} + +int wg_key_from_base64(wg_key key, const wg_key_b64_string base64) +{ + unsigned int i; + int val; + volatile uint8_t ret = 0; + + if (strlen(base64) != sizeof(wg_key_b64_string) - 1 || base64[sizeof(wg_key_b64_string) - 2] != '=') { + errno = EINVAL; + goto out; + } + + for (i = 0; i < 32 / 3; ++i) { + val = decode_base64(&base64[i * 4]); + ret |= (uint32_t)val >> 31; + key[i * 3 + 0] = (val >> 16) & 0xff; + key[i * 3 + 1] = (val >> 8) & 0xff; + key[i * 3 + 2] = val & 0xff; + } + val = decode_base64((const char[]){ base64[i * 4 + 0], base64[i * 4 + 1], base64[i * 4 + 2], 'A' }); + ret |= ((uint32_t)val >> 31) | (val & 0xff); + key[i * 3 + 0] = (val >> 16) & 0xff; + key[i * 3 + 1] = (val >> 8) & 0xff; + errno = EINVAL & ~((ret - 1) >> 8); +out: + return -errno; +} + +typedef int64_t fe[16]; + +static __attribute__((noinline)) void memzero_explicit(void *s, size_t count) +{ + memset(s, 0, count); + __asm__ __volatile__("": :"r"(s) :"memory"); +} + +static void carry(fe o) +{ + int i; + + for (i = 0; i < 16; ++i) { + o[(i + 1) % 16] += (i == 15 ? 38 : 1) * (o[i] >> 16); + o[i] &= 0xffff; + } +} + +static void cswap(fe p, fe q, int b) +{ + int i; + int64_t t, c = ~(b - 1); + + for (i = 0; i < 16; ++i) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } + + memzero_explicit(&t, sizeof(t)); + memzero_explicit(&c, sizeof(c)); + memzero_explicit(&b, sizeof(b)); +} + +static void pack(uint8_t *o, const fe n) +{ + int i, j, b; + fe m, t; + + memcpy(t, n, sizeof(t)); + carry(t); + carry(t); + carry(t); + for (j = 0; j < 2; ++j) { + m[0] = t[0] - 0xffed; + for (i = 1; i < 15; ++i) { + m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1); + m[i - 1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1); + b = (m[15] >> 16) & 1; + m[14] &= 0xffff; + cswap(t, m, 1 - b); + } + for (i = 0; i < 16; ++i) { + o[2 * i] = t[i] & 0xff; + o[2 * i + 1] = t[i] >> 8; + } + + memzero_explicit(m, sizeof(m)); + memzero_explicit(t, sizeof(t)); + memzero_explicit(&b, sizeof(b)); +} + +static void add(fe o, const fe a, const fe b) +{ + int i; + + for (i = 0; i < 16; ++i) + o[i] = a[i] + b[i]; +} + +static void subtract(fe o, const fe a, const fe b) +{ + int i; + + for (i = 0; i < 16; ++i) + o[i] = a[i] - b[i]; +} + +static void multmod(fe o, const fe a, const fe b) +{ + int i, j; + int64_t t[31] = { 0 }; + + for (i = 0; i < 16; ++i) { + for (j = 0; j < 16; ++j) + t[i + j] += a[i] * b[j]; + } + for (i = 0; i < 15; ++i) + t[i] += 38 * t[i + 16]; + memcpy(o, t, sizeof(fe)); + carry(o); + carry(o); + + memzero_explicit(t, sizeof(t)); +} + +static void invert(fe o, const fe i) +{ + fe c; + int a; + + memcpy(c, i, sizeof(c)); + for (a = 253; a >= 0; --a) { + multmod(c, c, c); + if (a != 2 && a != 4) + multmod(c, c, i); + } + memcpy(o, c, sizeof(fe)); + + memzero_explicit(c, sizeof(c)); +} + +static void clamp_key(uint8_t *z) +{ + z[31] = (z[31] & 127) | 64; + z[0] &= 248; +} + +void wg_generate_public_key(wg_key public_key, const wg_key private_key) +{ + int i, r; + uint8_t z[32]; + fe a = { 1 }, b = { 9 }, c = { 0 }, d = { 1 }, e, f; + + memcpy(z, private_key, sizeof(z)); + clamp_key(z); + + for (i = 254; i >= 0; --i) { + r = (z[i >> 3] >> (i & 7)) & 1; + cswap(a, b, r); + cswap(c, d, r); + add(e, a, c); + subtract(a, a, c); + add(c, b, d); + subtract(b, b, d); + multmod(d, e, e); + multmod(f, a, a); + multmod(a, c, a); + multmod(c, b, e); + add(e, a, c); + subtract(a, a, c); + multmod(b, a, a); + subtract(c, d, f); + multmod(a, c, (const fe){ 0xdb41, 1 }); + add(a, a, d); + multmod(c, c, a); + multmod(a, d, f); + multmod(d, b, (const fe){ 9 }); + multmod(b, e, e); + cswap(a, b, r); + cswap(c, d, r); + } + invert(c, c); + multmod(a, a, c); + pack(public_key, a); + + memzero_explicit(&r, sizeof(r)); + memzero_explicit(z, sizeof(z)); + memzero_explicit(a, sizeof(a)); + memzero_explicit(b, sizeof(b)); + memzero_explicit(c, sizeof(c)); + memzero_explicit(d, sizeof(d)); + memzero_explicit(e, sizeof(e)); + memzero_explicit(f, sizeof(f)); +} + +void wg_generate_private_key(wg_key private_key) +{ + wg_generate_preshared_key(private_key); + clamp_key(private_key); +} + +void wg_generate_preshared_key(wg_key preshared_key) +{ + ssize_t ret; + size_t i; + int fd; +#if defined(__OpenBSD__) || (defined(__APPLE__) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12) || (defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 25))) + if (!getentropy(preshared_key, sizeof(wg_key))) + return; +#endif +#if defined(__NR_getrandom) && defined(__linux__) + if (syscall(__NR_getrandom, preshared_key, sizeof(wg_key), 0) == sizeof(wg_key)) + return; +#endif + fd = open("/dev/urandom", O_RDONLY); + assert(fd >= 0); + for (i = 0; i < sizeof(wg_key); i += ret) { + ret = read(fd, preshared_key + i, sizeof(wg_key) - i); + assert(ret > 0); + } + close(fd); +} diff --git a/src/wireguard_manager/wireguard.h b/src/wireguard_manager/wireguard.h new file mode 100644 index 0000000..328fcb4 --- /dev/null +++ b/src/wireguard_manager/wireguard.h @@ -0,0 +1,105 @@ +/* SPDX-License-Identifier: LGPL-2.1+ */ +/* + * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. + */ + +#ifndef WIREGUARD_H +#define WIREGUARD_H + +#include +#include +#include +#include +#include +#include + +typedef uint8_t wg_key[32]; +typedef char wg_key_b64_string[((sizeof(wg_key) + 2) / 3) * 4 + 1]; + +/* Cross platform __kernel_timespec */ +struct timespec64 { + int64_t tv_sec; + int64_t tv_nsec; +}; + +typedef struct wg_allowedip { + uint16_t family; + union { + struct in_addr ip4; + struct in6_addr ip6; + }; + uint8_t cidr; + struct wg_allowedip *next_allowedip; +} wg_allowedip; + +enum wg_peer_flags { + WGPEER_REMOVE_ME = 1U << 0, + WGPEER_REPLACE_ALLOWEDIPS = 1U << 1, + WGPEER_HAS_PUBLIC_KEY = 1U << 2, + WGPEER_HAS_PRESHARED_KEY = 1U << 3, + WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL = 1U << 4 +}; + +typedef union wg_endpoint { + struct sockaddr addr; + struct sockaddr_in addr4; + struct sockaddr_in6 addr6; +} wg_endpoint; + +typedef struct wg_peer { + enum wg_peer_flags flags; + + wg_key public_key; + wg_key preshared_key; + + wg_endpoint endpoint; + + struct timespec64 last_handshake_time; + uint64_t rx_bytes, tx_bytes; + uint16_t persistent_keepalive_interval; + + struct wg_allowedip *first_allowedip, *last_allowedip; + struct wg_peer *next_peer; +} wg_peer; + +enum wg_device_flags { + WGDEVICE_REPLACE_PEERS = 1U << 0, + WGDEVICE_HAS_PRIVATE_KEY = 1U << 1, + WGDEVICE_HAS_PUBLIC_KEY = 1U << 2, + WGDEVICE_HAS_LISTEN_PORT = 1U << 3, + WGDEVICE_HAS_FWMARK = 1U << 4 +}; + +typedef struct wg_device { + char name[IFNAMSIZ]; + uint32_t ifindex; + + enum wg_device_flags flags; + + wg_key public_key; + wg_key private_key; + + uint32_t fwmark; + uint16_t listen_port; + + struct wg_peer *first_peer, *last_peer; +} wg_device; + +#define wg_for_each_device_name(__names, __name, __len) for ((__name) = (__names), (__len) = 0; ((__len) = strlen(__name)); (__name) += (__len) + 1) +#define wg_for_each_peer(__dev, __peer) for ((__peer) = (__dev)->first_peer; (__peer); (__peer) = (__peer)->next_peer) +#define wg_for_each_allowedip(__peer, __allowedip) for ((__allowedip) = (__peer)->first_allowedip; (__allowedip); (__allowedip) = (__allowedip)->next_allowedip) + +int wg_set_device(wg_device *dev); +int wg_get_device(wg_device **dev, const char *device_name); +int wg_add_device(const char *device_name); +int wg_del_device(const char *device_name); +void wg_free_device(wg_device *dev); +char *wg_list_device_names(void); /* first\0second\0third\0forth\0last\0\0 */ +void wg_key_to_base64(wg_key_b64_string base64, const wg_key key); +int wg_key_from_base64(wg_key key, const wg_key_b64_string base64); +bool wg_key_is_zero(const wg_key key); +void wg_generate_public_key(wg_key public_key, const wg_key private_key); +void wg_generate_private_key(wg_key private_key); +void wg_generate_preshared_key(wg_key preshared_key); + +#endif diff --git a/src/wireguard_manager/wireguard.rs b/src/wireguard_manager/wireguard.rs new file mode 100644 index 0000000..50c7803 --- /dev/null +++ b/src/wireguard_manager/wireguard.rs @@ -0,0 +1,2437 @@ +/* automatically generated by rust-bindgen 0.70.1 */ +#![allow(warnings)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T + } + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +pub const __GENTOO_NOT_FREESTANDING: u32 = 1; +pub const _STDC_PREDEF_H: u32 = 1; +pub const __STDC_IEC_559__: u32 = 1; +pub const __STDC_IEC_60559_BFP__: u32 = 201404; +pub const __STDC_IEC_559_COMPLEX__: u32 = 1; +pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404; +pub const __STDC_ISO_10646__: u32 = 201706; +pub const _NET_IF_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 __WORDSIZE: u32 = 64; +pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; +pub const __SYSCALL_WORDSIZE: u32 = 64; +pub const __TIMESIZE: u32 = 64; +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 __GLIBC_USE_C2X_STRTOL: u32 = 0; +pub const __GNU_LIBRARY__: u32 = 6; +pub const __GLIBC__: u32 = 2; +pub const __GLIBC_MINOR__: u32 = 39; +pub const _SYS_CDEFS_H: u32 = 1; +pub const __glibc_c99_flexarr_available: u32 = 1; +pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; +pub const __HAVE_GENERIC_SELECTION: u32 = 1; +pub const _SYS_TYPES_H: u32 = 1; +pub const _BITS_TYPES_H: u32 = 1; +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 __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1; +pub const __FD_SETSIZE: u32 = 1024; +pub const _BITS_TIME64_H: u32 = 1; +pub const __clock_t_defined: u32 = 1; +pub const __clockid_t_defined: u32 = 1; +pub const __time_t_defined: u32 = 1; +pub const __timer_t_defined: u32 = 1; +pub const _BITS_STDINT_INTN_H: u32 = 1; +pub const __BIT_TYPES_DEFINED__: u32 = 1; +pub const _ENDIAN_H: u32 = 1; +pub const _BITS_ENDIAN_H: u32 = 1; +pub const __LITTLE_ENDIAN: u32 = 1234; +pub const __BIG_ENDIAN: u32 = 4321; +pub const __PDP_ENDIAN: u32 = 3412; +pub const _BITS_ENDIANNESS_H: u32 = 1; +pub const __BYTE_ORDER: u32 = 1234; +pub const __FLOAT_WORD_ORDER: u32 = 1234; +pub const LITTLE_ENDIAN: u32 = 1234; +pub const BIG_ENDIAN: u32 = 4321; +pub const PDP_ENDIAN: u32 = 3412; +pub const BYTE_ORDER: u32 = 1234; +pub const _BITS_BYTESWAP_H: u32 = 1; +pub const _BITS_UINTN_IDENTITY_H: u32 = 1; +pub const _SYS_SELECT_H: u32 = 1; +pub const __sigset_t_defined: u32 = 1; +pub const __timeval_defined: u32 = 1; +pub const _STRUCT_TIMESPEC: u32 = 1; +pub const FD_SETSIZE: u32 = 1024; +pub const _BITS_PTHREADTYPES_COMMON_H: u32 = 1; +pub const _THREAD_SHARED_TYPES_H: u32 = 1; +pub const _BITS_PTHREADTYPES_ARCH_H: u32 = 1; +pub const __SIZEOF_PTHREAD_MUTEX_T: u32 = 40; +pub const __SIZEOF_PTHREAD_ATTR_T: u32 = 56; +pub const __SIZEOF_PTHREAD_RWLOCK_T: u32 = 56; +pub const __SIZEOF_PTHREAD_BARRIER_T: u32 = 32; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: u32 = 4; +pub const __SIZEOF_PTHREAD_COND_T: u32 = 48; +pub const __SIZEOF_PTHREAD_CONDATTR_T: u32 = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: u32 = 8; +pub const __SIZEOF_PTHREAD_BARRIERATTR_T: u32 = 4; +pub const _THREAD_MUTEX_INTERNAL_H: u32 = 1; +pub const __PTHREAD_MUTEX_HAVE_PREV: u32 = 1; +pub const __have_pthread_attr_t: u32 = 1; +pub const _SYS_SOCKET_H: u32 = 1; +pub const __iovec_defined: u32 = 1; +pub const PF_UNSPEC: u32 = 0; +pub const PF_LOCAL: u32 = 1; +pub const PF_UNIX: u32 = 1; +pub const PF_FILE: u32 = 1; +pub const PF_INET: u32 = 2; +pub const PF_AX25: u32 = 3; +pub const PF_IPX: u32 = 4; +pub const PF_APPLETALK: u32 = 5; +pub const PF_NETROM: u32 = 6; +pub const PF_BRIDGE: u32 = 7; +pub const PF_ATMPVC: u32 = 8; +pub const PF_X25: u32 = 9; +pub const PF_INET6: u32 = 10; +pub const PF_ROSE: u32 = 11; +pub const PF_DECnet: u32 = 12; +pub const PF_NETBEUI: u32 = 13; +pub const PF_SECURITY: u32 = 14; +pub const PF_KEY: u32 = 15; +pub const PF_NETLINK: u32 = 16; +pub const PF_ROUTE: u32 = 16; +pub const PF_PACKET: u32 = 17; +pub const PF_ASH: u32 = 18; +pub const PF_ECONET: u32 = 19; +pub const PF_ATMSVC: u32 = 20; +pub const PF_RDS: u32 = 21; +pub const PF_SNA: u32 = 22; +pub const PF_IRDA: u32 = 23; +pub const PF_PPPOX: u32 = 24; +pub const PF_WANPIPE: u32 = 25; +pub const PF_LLC: u32 = 26; +pub const PF_IB: u32 = 27; +pub const PF_MPLS: u32 = 28; +pub const PF_CAN: u32 = 29; +pub const PF_TIPC: u32 = 30; +pub const PF_BLUETOOTH: u32 = 31; +pub const PF_IUCV: u32 = 32; +pub const PF_RXRPC: u32 = 33; +pub const PF_ISDN: u32 = 34; +pub const PF_PHONET: u32 = 35; +pub const PF_IEEE802154: u32 = 36; +pub const PF_CAIF: u32 = 37; +pub const PF_ALG: u32 = 38; +pub const PF_NFC: u32 = 39; +pub const PF_VSOCK: u32 = 40; +pub const PF_KCM: u32 = 41; +pub const PF_QIPCRTR: u32 = 42; +pub const PF_SMC: u32 = 43; +pub const PF_XDP: u32 = 44; +pub const PF_MCTP: u32 = 45; +pub const PF_MAX: u32 = 46; +pub const AF_UNSPEC: u32 = 0; +pub const AF_LOCAL: u32 = 1; +pub const AF_UNIX: u32 = 1; +pub const AF_FILE: u32 = 1; +pub const AF_INET: u32 = 2; +pub const AF_AX25: u32 = 3; +pub const AF_IPX: u32 = 4; +pub const AF_APPLETALK: u32 = 5; +pub const AF_NETROM: u32 = 6; +pub const AF_BRIDGE: u32 = 7; +pub const AF_ATMPVC: u32 = 8; +pub const AF_X25: u32 = 9; +pub const AF_INET6: u32 = 10; +pub const AF_ROSE: u32 = 11; +pub const AF_DECnet: u32 = 12; +pub const AF_NETBEUI: u32 = 13; +pub const AF_SECURITY: u32 = 14; +pub const AF_KEY: u32 = 15; +pub const AF_NETLINK: u32 = 16; +pub const AF_ROUTE: u32 = 16; +pub const AF_PACKET: u32 = 17; +pub const AF_ASH: u32 = 18; +pub const AF_ECONET: u32 = 19; +pub const AF_ATMSVC: u32 = 20; +pub const AF_RDS: u32 = 21; +pub const AF_SNA: u32 = 22; +pub const AF_IRDA: u32 = 23; +pub const AF_PPPOX: u32 = 24; +pub const AF_WANPIPE: u32 = 25; +pub const AF_LLC: u32 = 26; +pub const AF_IB: u32 = 27; +pub const AF_MPLS: u32 = 28; +pub const AF_CAN: u32 = 29; +pub const AF_TIPC: u32 = 30; +pub const AF_BLUETOOTH: u32 = 31; +pub const AF_IUCV: u32 = 32; +pub const AF_RXRPC: u32 = 33; +pub const AF_ISDN: u32 = 34; +pub const AF_PHONET: u32 = 35; +pub const AF_IEEE802154: u32 = 36; +pub const AF_CAIF: u32 = 37; +pub const AF_ALG: u32 = 38; +pub const AF_NFC: u32 = 39; +pub const AF_VSOCK: u32 = 40; +pub const AF_KCM: u32 = 41; +pub const AF_QIPCRTR: u32 = 42; +pub const AF_SMC: u32 = 43; +pub const AF_XDP: u32 = 44; +pub const AF_MCTP: u32 = 45; +pub const AF_MAX: u32 = 46; +pub const SOL_RAW: u32 = 255; +pub const SOL_DECNET: u32 = 261; +pub const SOL_X25: u32 = 262; +pub const SOL_PACKET: u32 = 263; +pub const SOL_ATM: u32 = 264; +pub const SOL_AAL: u32 = 265; +pub const SOL_IRDA: u32 = 266; +pub const SOL_NETBEUI: u32 = 267; +pub const SOL_LLC: u32 = 268; +pub const SOL_DCCP: u32 = 269; +pub const SOL_NETLINK: u32 = 270; +pub const SOL_TIPC: u32 = 271; +pub const SOL_RXRPC: u32 = 272; +pub const SOL_PPPOL2TP: u32 = 273; +pub const SOL_BLUETOOTH: u32 = 274; +pub const SOL_PNPIPE: u32 = 275; +pub const SOL_RDS: u32 = 276; +pub const SOL_IUCV: u32 = 277; +pub const SOL_CAIF: u32 = 278; +pub const SOL_ALG: u32 = 279; +pub const SOL_NFC: u32 = 280; +pub const SOL_KCM: u32 = 281; +pub const SOL_TLS: u32 = 282; +pub const SOL_XDP: u32 = 283; +pub const SOL_MPTCP: u32 = 284; +pub const SOL_MCTP: u32 = 285; +pub const SOL_SMC: u32 = 286; +pub const SOMAXCONN: u32 = 4096; +pub const _BITS_SOCKADDR_H: u32 = 1; +pub const _SS_SIZE: u32 = 128; +pub const __BITS_PER_LONG: u32 = 64; +pub const __BITS_PER_LONG_LONG: u32 = 64; +pub const FIOSETOWN: u32 = 35073; +pub const SIOCSPGRP: u32 = 35074; +pub const FIOGETOWN: u32 = 35075; +pub const SIOCGPGRP: u32 = 35076; +pub const SIOCATMARK: u32 = 35077; +pub const SIOCGSTAMP_OLD: u32 = 35078; +pub const SIOCGSTAMPNS_OLD: u32 = 35079; +pub const SOL_SOCKET: u32 = 1; +pub const SO_DEBUG: u32 = 1; +pub const SO_REUSEADDR: u32 = 2; +pub const SO_TYPE: u32 = 3; +pub const SO_ERROR: u32 = 4; +pub const SO_DONTROUTE: u32 = 5; +pub const SO_BROADCAST: u32 = 6; +pub const SO_SNDBUF: u32 = 7; +pub const SO_RCVBUF: u32 = 8; +pub const SO_SNDBUFFORCE: u32 = 32; +pub const SO_RCVBUFFORCE: u32 = 33; +pub const SO_KEEPALIVE: u32 = 9; +pub const SO_OOBINLINE: u32 = 10; +pub const SO_NO_CHECK: u32 = 11; +pub const SO_PRIORITY: u32 = 12; +pub const SO_LINGER: u32 = 13; +pub const SO_BSDCOMPAT: u32 = 14; +pub const SO_REUSEPORT: u32 = 15; +pub const SO_PASSCRED: u32 = 16; +pub const SO_PEERCRED: u32 = 17; +pub const SO_RCVLOWAT: u32 = 18; +pub const SO_SNDLOWAT: u32 = 19; +pub const SO_RCVTIMEO_OLD: u32 = 20; +pub const SO_SNDTIMEO_OLD: u32 = 21; +pub const SO_SECURITY_AUTHENTICATION: u32 = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: u32 = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: u32 = 24; +pub const SO_BINDTODEVICE: u32 = 25; +pub const SO_ATTACH_FILTER: u32 = 26; +pub const SO_DETACH_FILTER: u32 = 27; +pub const SO_GET_FILTER: u32 = 26; +pub const SO_PEERNAME: u32 = 28; +pub const SO_ACCEPTCONN: u32 = 30; +pub const SO_PEERSEC: u32 = 31; +pub const SO_PASSSEC: u32 = 34; +pub const SO_MARK: u32 = 36; +pub const SO_PROTOCOL: u32 = 38; +pub const SO_DOMAIN: u32 = 39; +pub const SO_RXQ_OVFL: u32 = 40; +pub const SO_WIFI_STATUS: u32 = 41; +pub const SCM_WIFI_STATUS: u32 = 41; +pub const SO_PEEK_OFF: u32 = 42; +pub const SO_NOFCS: u32 = 43; +pub const SO_LOCK_FILTER: u32 = 44; +pub const SO_SELECT_ERR_QUEUE: u32 = 45; +pub const SO_BUSY_POLL: u32 = 46; +pub const SO_MAX_PACING_RATE: u32 = 47; +pub const SO_BPF_EXTENSIONS: u32 = 48; +pub const SO_INCOMING_CPU: u32 = 49; +pub const SO_ATTACH_BPF: u32 = 50; +pub const SO_DETACH_BPF: u32 = 27; +pub const SO_ATTACH_REUSEPORT_CBPF: u32 = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: u32 = 52; +pub const SO_CNX_ADVICE: u32 = 53; +pub const SCM_TIMESTAMPING_OPT_STATS: u32 = 54; +pub const SO_MEMINFO: u32 = 55; +pub const SO_INCOMING_NAPI_ID: u32 = 56; +pub const SO_COOKIE: u32 = 57; +pub const SCM_TIMESTAMPING_PKTINFO: u32 = 58; +pub const SO_PEERGROUPS: u32 = 59; +pub const SO_ZEROCOPY: u32 = 60; +pub const SO_TXTIME: u32 = 61; +pub const SCM_TXTIME: u32 = 61; +pub const SO_BINDTOIFINDEX: u32 = 62; +pub const SO_TIMESTAMP_OLD: u32 = 29; +pub const SO_TIMESTAMPNS_OLD: u32 = 35; +pub const SO_TIMESTAMPING_OLD: u32 = 37; +pub const SO_TIMESTAMP_NEW: u32 = 63; +pub const SO_TIMESTAMPNS_NEW: u32 = 64; +pub const SO_TIMESTAMPING_NEW: u32 = 65; +pub const SO_RCVTIMEO_NEW: u32 = 66; +pub const SO_SNDTIMEO_NEW: u32 = 67; +pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; +pub const SO_PREFER_BUSY_POLL: u32 = 69; +pub const SO_BUSY_POLL_BUDGET: u32 = 70; +pub const SO_NETNS_COOKIE: u32 = 71; +pub const SO_BUF_LOCK: u32 = 72; +pub const SO_RESERVE_MEM: u32 = 73; +pub const SO_TXREHASH: u32 = 74; +pub const SO_RCVMARK: u32 = 75; +pub const SO_PASSPIDFD: u32 = 76; +pub const SO_PEERPIDFD: u32 = 77; +pub const SO_TIMESTAMP: u32 = 29; +pub const SO_TIMESTAMPNS: u32 = 35; +pub const SO_TIMESTAMPING: u32 = 37; +pub const SO_RCVTIMEO: u32 = 20; +pub const SO_SNDTIMEO: u32 = 21; +pub const SCM_TIMESTAMP: u32 = 29; +pub const SCM_TIMESTAMPNS: u32 = 35; +pub const SCM_TIMESTAMPING: u32 = 37; +pub const __osockaddr_defined: u32 = 1; +pub const IF_NAMESIZE: u32 = 16; +pub const IFHWADDRLEN: u32 = 6; +pub const IFNAMSIZ: u32 = 16; +pub const _NETINET_IN_H: u32 = 1; +pub const _BITS_STDINT_UINTN_H: u32 = 1; +pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; +pub const IP_OPTIONS: u32 = 4; +pub const IP_HDRINCL: u32 = 3; +pub const IP_TOS: u32 = 1; +pub const IP_TTL: u32 = 2; +pub const IP_RECVOPTS: u32 = 6; +pub const IP_RETOPTS: u32 = 7; +pub const IP_MULTICAST_IF: u32 = 32; +pub const IP_MULTICAST_TTL: u32 = 33; +pub const IP_MULTICAST_LOOP: u32 = 34; +pub const IP_ADD_MEMBERSHIP: u32 = 35; +pub const IP_DROP_MEMBERSHIP: u32 = 36; +pub const IP_UNBLOCK_SOURCE: u32 = 37; +pub const IP_BLOCK_SOURCE: u32 = 38; +pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; +pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; +pub const IP_MSFILTER: u32 = 41; +pub const MCAST_JOIN_GROUP: u32 = 42; +pub const MCAST_BLOCK_SOURCE: u32 = 43; +pub const MCAST_UNBLOCK_SOURCE: u32 = 44; +pub const MCAST_LEAVE_GROUP: u32 = 45; +pub const MCAST_JOIN_SOURCE_GROUP: u32 = 46; +pub const MCAST_LEAVE_SOURCE_GROUP: u32 = 47; +pub const MCAST_MSFILTER: u32 = 48; +pub const IP_MULTICAST_ALL: u32 = 49; +pub const IP_UNICAST_IF: u32 = 50; +pub const MCAST_EXCLUDE: u32 = 0; +pub const MCAST_INCLUDE: u32 = 1; +pub const IP_ROUTER_ALERT: u32 = 5; +pub const IP_PKTINFO: u32 = 8; +pub const IP_PKTOPTIONS: u32 = 9; +pub const IP_PMTUDISC: u32 = 10; +pub const IP_MTU_DISCOVER: u32 = 10; +pub const IP_RECVERR: u32 = 11; +pub const IP_RECVTTL: u32 = 12; +pub const IP_RECVTOS: u32 = 13; +pub const IP_MTU: u32 = 14; +pub const IP_FREEBIND: u32 = 15; +pub const IP_IPSEC_POLICY: u32 = 16; +pub const IP_XFRM_POLICY: u32 = 17; +pub const IP_PASSSEC: u32 = 18; +pub const IP_TRANSPARENT: u32 = 19; +pub const IP_ORIGDSTADDR: u32 = 20; +pub const IP_RECVORIGDSTADDR: u32 = 20; +pub const IP_MINTTL: u32 = 21; +pub const IP_NODEFRAG: u32 = 22; +pub const IP_CHECKSUM: u32 = 23; +pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; +pub const IP_RECVFRAGSIZE: u32 = 25; +pub const IP_RECVERR_RFC4884: u32 = 26; +pub const IP_PMTUDISC_DONT: u32 = 0; +pub const IP_PMTUDISC_WANT: u32 = 1; +pub const IP_PMTUDISC_DO: u32 = 2; +pub const IP_PMTUDISC_PROBE: u32 = 3; +pub const IP_PMTUDISC_INTERFACE: u32 = 4; +pub const IP_PMTUDISC_OMIT: u32 = 5; +pub const IP_LOCAL_PORT_RANGE: u32 = 51; +pub const IP_PROTOCOL: u32 = 52; +pub const SOL_IP: u32 = 0; +pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; +pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; +pub const IP_MAX_MEMBERSHIPS: u32 = 20; +pub const IPV6_ADDRFORM: u32 = 1; +pub const IPV6_2292PKTINFO: u32 = 2; +pub const IPV6_2292HOPOPTS: u32 = 3; +pub const IPV6_2292DSTOPTS: u32 = 4; +pub const IPV6_2292RTHDR: u32 = 5; +pub const IPV6_2292PKTOPTIONS: u32 = 6; +pub const IPV6_CHECKSUM: u32 = 7; +pub const IPV6_2292HOPLIMIT: u32 = 8; +pub const IPV6_NEXTHOP: u32 = 9; +pub const IPV6_AUTHHDR: u32 = 10; +pub const IPV6_UNICAST_HOPS: u32 = 16; +pub const IPV6_MULTICAST_IF: u32 = 17; +pub const IPV6_MULTICAST_HOPS: u32 = 18; +pub const IPV6_MULTICAST_LOOP: u32 = 19; +pub const IPV6_JOIN_GROUP: u32 = 20; +pub const IPV6_LEAVE_GROUP: u32 = 21; +pub const IPV6_ROUTER_ALERT: u32 = 22; +pub const IPV6_MTU_DISCOVER: u32 = 23; +pub const IPV6_MTU: u32 = 24; +pub const IPV6_RECVERR: u32 = 25; +pub const IPV6_V6ONLY: u32 = 26; +pub const IPV6_JOIN_ANYCAST: u32 = 27; +pub const IPV6_LEAVE_ANYCAST: u32 = 28; +pub const IPV6_MULTICAST_ALL: u32 = 29; +pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; +pub const IPV6_RECVERR_RFC4884: u32 = 31; +pub const IPV6_IPSEC_POLICY: u32 = 34; +pub const IPV6_XFRM_POLICY: u32 = 35; +pub const IPV6_HDRINCL: u32 = 36; +pub const IPV6_RECVPKTINFO: u32 = 49; +pub const IPV6_PKTINFO: u32 = 50; +pub const IPV6_RECVHOPLIMIT: u32 = 51; +pub const IPV6_HOPLIMIT: u32 = 52; +pub const IPV6_RECVHOPOPTS: u32 = 53; +pub const IPV6_HOPOPTS: u32 = 54; +pub const IPV6_RTHDRDSTOPTS: u32 = 55; +pub const IPV6_RECVRTHDR: u32 = 56; +pub const IPV6_RTHDR: u32 = 57; +pub const IPV6_RECVDSTOPTS: u32 = 58; +pub const IPV6_DSTOPTS: u32 = 59; +pub const IPV6_RECVPATHMTU: u32 = 60; +pub const IPV6_PATHMTU: u32 = 61; +pub const IPV6_DONTFRAG: u32 = 62; +pub const IPV6_RECVTCLASS: u32 = 66; +pub const IPV6_TCLASS: u32 = 67; +pub const IPV6_AUTOFLOWLABEL: u32 = 70; +pub const IPV6_ADDR_PREFERENCES: u32 = 72; +pub const IPV6_MINHOPCOUNT: u32 = 73; +pub const IPV6_ORIGDSTADDR: u32 = 74; +pub const IPV6_RECVORIGDSTADDR: u32 = 74; +pub const IPV6_TRANSPARENT: u32 = 75; +pub const IPV6_UNICAST_IF: u32 = 76; +pub const IPV6_RECVFRAGSIZE: u32 = 77; +pub const IPV6_FREEBIND: u32 = 78; +pub const IPV6_ADD_MEMBERSHIP: u32 = 20; +pub const IPV6_DROP_MEMBERSHIP: u32 = 21; +pub const IPV6_RXHOPOPTS: u32 = 54; +pub const IPV6_RXDSTOPTS: u32 = 59; +pub const IPV6_PMTUDISC_DONT: u32 = 0; +pub const IPV6_PMTUDISC_WANT: u32 = 1; +pub const IPV6_PMTUDISC_DO: u32 = 2; +pub const IPV6_PMTUDISC_PROBE: u32 = 3; +pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; +pub const IPV6_PMTUDISC_OMIT: u32 = 5; +pub const SOL_IPV6: u32 = 41; +pub const SOL_ICMPV6: u32 = 58; +pub const IPV6_RTHDR_LOOSE: u32 = 0; +pub const IPV6_RTHDR_STRICT: u32 = 1; +pub const IPV6_RTHDR_TYPE_0: u32 = 0; +pub const IN_CLASSA_NET: u32 = 4278190080; +pub const IN_CLASSA_NSHIFT: u32 = 24; +pub const IN_CLASSA_HOST: u32 = 16777215; +pub const IN_CLASSA_MAX: u32 = 128; +pub const IN_CLASSB_NET: u32 = 4294901760; +pub const IN_CLASSB_NSHIFT: u32 = 16; +pub const IN_CLASSB_HOST: u32 = 65535; +pub const IN_CLASSB_MAX: u32 = 65536; +pub const IN_CLASSC_NET: u32 = 4294967040; +pub const IN_CLASSC_NSHIFT: u32 = 8; +pub const IN_CLASSC_HOST: u32 = 255; +pub const IN_LOOPBACKNET: u32 = 127; +pub const INET_ADDRSTRLEN: u32 = 16; +pub const INET6_ADDRSTRLEN: u32 = 46; +pub const _TIME_H: u32 = 1; +pub const _BITS_TIME_H: u32 = 1; +pub const CLOCK_REALTIME: u32 = 0; +pub const CLOCK_MONOTONIC: u32 = 1; +pub const CLOCK_PROCESS_CPUTIME_ID: u32 = 2; +pub const CLOCK_THREAD_CPUTIME_ID: u32 = 3; +pub const CLOCK_MONOTONIC_RAW: u32 = 4; +pub const CLOCK_REALTIME_COARSE: u32 = 5; +pub const CLOCK_MONOTONIC_COARSE: u32 = 6; +pub const CLOCK_BOOTTIME: u32 = 7; +pub const CLOCK_REALTIME_ALARM: u32 = 8; +pub const CLOCK_BOOTTIME_ALARM: u32 = 9; +pub const CLOCK_TAI: u32 = 11; +pub const TIMER_ABSTIME: u32 = 1; +pub const __struct_tm_defined: u32 = 1; +pub const __itimerspec_defined: u32 = 1; +pub const _BITS_TYPES_LOCALE_T_H: u32 = 1; +pub const _BITS_TYPES___LOCALE_T_H: u32 = 1; +pub const TIME_UTC: u32 = 1; +pub const _STDINT_H: 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_EXT: 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_WCHAR_H: u32 = 1; +pub const _BITS_STDINT_LEAST_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 __bool_true_false_are_defined: u32 = 1; +pub const true_: u32 = 1; +pub const false_: u32 = 0; +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 __suseconds64_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 u_char = __u_char; +pub type u_short = __u_short; +pub type u_int = __u_int; +pub type u_long = __u_long; +pub type quad_t = __quad_t; +pub type u_quad_t = __u_quad_t; +pub type fsid_t = __fsid_t; +pub type loff_t = __loff_t; +pub type ino_t = __ino_t; +pub type dev_t = __dev_t; +pub type gid_t = __gid_t; +pub type mode_t = __mode_t; +pub type nlink_t = __nlink_t; +pub type uid_t = __uid_t; +pub type off_t = __off_t; +pub type pid_t = __pid_t; +pub type id_t = __id_t; +pub type daddr_t = __daddr_t; +pub type caddr_t = __caddr_t; +pub type key_t = __key_t; +pub type clock_t = __clock_t; +pub type clockid_t = __clockid_t; +pub type time_t = __time_t; +pub type timer_t = __timer_t; +pub type ulong = ::std::os::raw::c_ulong; +pub type ushort = ::std::os::raw::c_ushort; +pub type uint = ::std::os::raw::c_uint; +pub type u_int8_t = __uint8_t; +pub type u_int16_t = __uint16_t; +pub type u_int32_t = __uint32_t; +pub type u_int64_t = __uint64_t; +pub type register_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __sigset_t"][::std::mem::size_of::<__sigset_t>() - 128usize]; + ["Alignment of __sigset_t"][::std::mem::align_of::<__sigset_t>() - 8usize]; + ["Offset of field: __sigset_t::__val"][::std::mem::offset_of!(__sigset_t, __val) - 0usize]; +}; +pub type sigset_t = __sigset_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of timeval"][::std::mem::size_of::() - 16usize]; + ["Alignment of timeval"][::std::mem::align_of::() - 8usize]; + ["Offset of field: timeval::tv_sec"][::std::mem::offset_of!(timeval, tv_sec) - 0usize]; + ["Offset of field: timeval::tv_usec"][::std::mem::offset_of!(timeval, tv_usec) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of timespec"][::std::mem::size_of::() - 16usize]; + ["Alignment of timespec"][::std::mem::align_of::() - 8usize]; + ["Offset of field: timespec::tv_sec"][::std::mem::offset_of!(timespec, tv_sec) - 0usize]; + ["Offset of field: timespec::tv_nsec"][::std::mem::offset_of!(timespec, tv_nsec) - 8usize]; +}; +pub type suseconds_t = __suseconds_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of fd_set"][::std::mem::size_of::() - 128usize]; + ["Alignment of fd_set"][::std::mem::align_of::() - 8usize]; + ["Offset of field: fd_set::__fds_bits"][::std::mem::offset_of!(fd_set, __fds_bits) - 0usize]; +}; +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +pub type blksize_t = __blksize_t; +pub type blkcnt_t = __blkcnt_t; +pub type fsblkcnt_t = __fsblkcnt_t; +pub type fsfilcnt_t = __fsfilcnt_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub union __atomic_wide_counter { + pub __value64: ::std::os::raw::c_ulonglong, + pub __value32: __atomic_wide_counter__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __atomic_wide_counter__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __atomic_wide_counter__bindgen_ty_1"] + [::std::mem::size_of::<__atomic_wide_counter__bindgen_ty_1>() - 8usize]; + ["Alignment of __atomic_wide_counter__bindgen_ty_1"] + [::std::mem::align_of::<__atomic_wide_counter__bindgen_ty_1>() - 4usize]; + ["Offset of field: __atomic_wide_counter__bindgen_ty_1::__low"] + [::std::mem::offset_of!(__atomic_wide_counter__bindgen_ty_1, __low) - 0usize]; + ["Offset of field: __atomic_wide_counter__bindgen_ty_1::__high"] + [::std::mem::offset_of!(__atomic_wide_counter__bindgen_ty_1, __high) - 4usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __atomic_wide_counter"][::std::mem::size_of::<__atomic_wide_counter>() - 8usize]; + ["Alignment of __atomic_wide_counter"] + [::std::mem::align_of::<__atomic_wide_counter>() - 8usize]; + ["Offset of field: __atomic_wide_counter::__value64"] + [::std::mem::offset_of!(__atomic_wide_counter, __value64) - 0usize]; + ["Offset of field: __atomic_wide_counter::__value32"] + [::std::mem::offset_of!(__atomic_wide_counter, __value32) - 0usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_list { + pub __prev: *mut __pthread_internal_list, + pub __next: *mut __pthread_internal_list, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_internal_list"][::std::mem::size_of::<__pthread_internal_list>() - 16usize]; + ["Alignment of __pthread_internal_list"] + [::std::mem::align_of::<__pthread_internal_list>() - 8usize]; + ["Offset of field: __pthread_internal_list::__prev"] + [::std::mem::offset_of!(__pthread_internal_list, __prev) - 0usize]; + ["Offset of field: __pthread_internal_list::__next"] + [::std::mem::offset_of!(__pthread_internal_list, __next) - 8usize]; +}; +pub type __pthread_list_t = __pthread_internal_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_slist { + pub __next: *mut __pthread_internal_slist, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_internal_slist"] + [::std::mem::size_of::<__pthread_internal_slist>() - 8usize]; + ["Alignment of __pthread_internal_slist"] + [::std::mem::align_of::<__pthread_internal_slist>() - 8usize]; + ["Offset of field: __pthread_internal_slist::__next"] + [::std::mem::offset_of!(__pthread_internal_slist, __next) - 0usize]; +}; +pub type __pthread_slist_t = __pthread_internal_slist; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_mutex_s { + pub __lock: ::std::os::raw::c_int, + pub __count: ::std::os::raw::c_uint, + pub __owner: ::std::os::raw::c_int, + pub __nusers: ::std::os::raw::c_uint, + pub __kind: ::std::os::raw::c_int, + pub __spins: ::std::os::raw::c_short, + pub __elision: ::std::os::raw::c_short, + pub __list: __pthread_list_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_mutex_s"][::std::mem::size_of::<__pthread_mutex_s>() - 40usize]; + ["Alignment of __pthread_mutex_s"][::std::mem::align_of::<__pthread_mutex_s>() - 8usize]; + ["Offset of field: __pthread_mutex_s::__lock"] + [::std::mem::offset_of!(__pthread_mutex_s, __lock) - 0usize]; + ["Offset of field: __pthread_mutex_s::__count"] + [::std::mem::offset_of!(__pthread_mutex_s, __count) - 4usize]; + ["Offset of field: __pthread_mutex_s::__owner"] + [::std::mem::offset_of!(__pthread_mutex_s, __owner) - 8usize]; + ["Offset of field: __pthread_mutex_s::__nusers"] + [::std::mem::offset_of!(__pthread_mutex_s, __nusers) - 12usize]; + ["Offset of field: __pthread_mutex_s::__kind"] + [::std::mem::offset_of!(__pthread_mutex_s, __kind) - 16usize]; + ["Offset of field: __pthread_mutex_s::__spins"] + [::std::mem::offset_of!(__pthread_mutex_s, __spins) - 20usize]; + ["Offset of field: __pthread_mutex_s::__elision"] + [::std::mem::offset_of!(__pthread_mutex_s, __elision) - 22usize]; + ["Offset of field: __pthread_mutex_s::__list"] + [::std::mem::offset_of!(__pthread_mutex_s, __list) - 24usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_rwlock_arch_t { + pub __readers: ::std::os::raw::c_uint, + pub __writers: ::std::os::raw::c_uint, + pub __wrphase_futex: ::std::os::raw::c_uint, + pub __writers_futex: ::std::os::raw::c_uint, + pub __pad3: ::std::os::raw::c_uint, + pub __pad4: ::std::os::raw::c_uint, + pub __cur_writer: ::std::os::raw::c_int, + pub __shared: ::std::os::raw::c_int, + pub __rwelision: ::std::os::raw::c_schar, + pub __pad1: [::std::os::raw::c_uchar; 7usize], + pub __pad2: ::std::os::raw::c_ulong, + pub __flags: ::std::os::raw::c_uint, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_rwlock_arch_t"][::std::mem::size_of::<__pthread_rwlock_arch_t>() - 56usize]; + ["Alignment of __pthread_rwlock_arch_t"] + [::std::mem::align_of::<__pthread_rwlock_arch_t>() - 8usize]; + ["Offset of field: __pthread_rwlock_arch_t::__readers"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __readers) - 0usize]; + ["Offset of field: __pthread_rwlock_arch_t::__writers"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __writers) - 4usize]; + ["Offset of field: __pthread_rwlock_arch_t::__wrphase_futex"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __wrphase_futex) - 8usize]; + ["Offset of field: __pthread_rwlock_arch_t::__writers_futex"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __writers_futex) - 12usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad3"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad3) - 16usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad4"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad4) - 20usize]; + ["Offset of field: __pthread_rwlock_arch_t::__cur_writer"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __cur_writer) - 24usize]; + ["Offset of field: __pthread_rwlock_arch_t::__shared"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __shared) - 28usize]; + ["Offset of field: __pthread_rwlock_arch_t::__rwelision"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __rwelision) - 32usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad1"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad1) - 33usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad2"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad2) - 40usize]; + ["Offset of field: __pthread_rwlock_arch_t::__flags"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __flags) - 48usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __pthread_cond_s { + pub __wseq: __atomic_wide_counter, + pub __g1_start: __atomic_wide_counter, + pub __g_refs: [::std::os::raw::c_uint; 2usize], + pub __g_size: [::std::os::raw::c_uint; 2usize], + pub __g1_orig_size: ::std::os::raw::c_uint, + pub __wrefs: ::std::os::raw::c_uint, + pub __g_signals: [::std::os::raw::c_uint; 2usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_cond_s"][::std::mem::size_of::<__pthread_cond_s>() - 48usize]; + ["Alignment of __pthread_cond_s"][::std::mem::align_of::<__pthread_cond_s>() - 8usize]; + ["Offset of field: __pthread_cond_s::__wseq"] + [::std::mem::offset_of!(__pthread_cond_s, __wseq) - 0usize]; + ["Offset of field: __pthread_cond_s::__g1_start"] + [::std::mem::offset_of!(__pthread_cond_s, __g1_start) - 8usize]; + ["Offset of field: __pthread_cond_s::__g_refs"] + [::std::mem::offset_of!(__pthread_cond_s, __g_refs) - 16usize]; + ["Offset of field: __pthread_cond_s::__g_size"] + [::std::mem::offset_of!(__pthread_cond_s, __g_size) - 24usize]; + ["Offset of field: __pthread_cond_s::__g1_orig_size"] + [::std::mem::offset_of!(__pthread_cond_s, __g1_orig_size) - 32usize]; + ["Offset of field: __pthread_cond_s::__wrefs"] + [::std::mem::offset_of!(__pthread_cond_s, __wrefs) - 36usize]; + ["Offset of field: __pthread_cond_s::__g_signals"] + [::std::mem::offset_of!(__pthread_cond_s, __g_signals) - 40usize]; +}; +pub type __tss_t = ::std::os::raw::c_uint; +pub type __thrd_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __once_flag { + pub __data: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __once_flag"][::std::mem::size_of::<__once_flag>() - 4usize]; + ["Alignment of __once_flag"][::std::mem::align_of::<__once_flag>() - 4usize]; + ["Offset of field: __once_flag::__data"][::std::mem::offset_of!(__once_flag, __data) - 0usize]; +}; +pub type pthread_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutexattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_mutexattr_t"][::std::mem::size_of::() - 4usize]; + ["Alignment of pthread_mutexattr_t"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pthread_mutexattr_t::__size"] + [::std::mem::offset_of!(pthread_mutexattr_t, __size) - 0usize]; + ["Offset of field: pthread_mutexattr_t::__align"] + [::std::mem::offset_of!(pthread_mutexattr_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_condattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_condattr_t"][::std::mem::size_of::() - 4usize]; + ["Alignment of pthread_condattr_t"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pthread_condattr_t::__size"] + [::std::mem::offset_of!(pthread_condattr_t, __size) - 0usize]; + ["Offset of field: pthread_condattr_t::__align"] + [::std::mem::offset_of!(pthread_condattr_t, __align) - 0usize]; +}; +pub type pthread_key_t = ::std::os::raw::c_uint; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_attr_t { + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_attr_t"][::std::mem::size_of::() - 56usize]; + ["Alignment of pthread_attr_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_attr_t::__size"] + [::std::mem::offset_of!(pthread_attr_t, __size) - 0usize]; + ["Offset of field: pthread_attr_t::__align"] + [::std::mem::offset_of!(pthread_attr_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutex_t { + pub __data: __pthread_mutex_s, + pub __size: [::std::os::raw::c_char; 40usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_mutex_t"][::std::mem::size_of::() - 40usize]; + ["Alignment of pthread_mutex_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_mutex_t::__data"] + [::std::mem::offset_of!(pthread_mutex_t, __data) - 0usize]; + ["Offset of field: pthread_mutex_t::__size"] + [::std::mem::offset_of!(pthread_mutex_t, __size) - 0usize]; + ["Offset of field: pthread_mutex_t::__align"] + [::std::mem::offset_of!(pthread_mutex_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_cond_t { + pub __data: __pthread_cond_s, + pub __size: [::std::os::raw::c_char; 48usize], + pub __align: ::std::os::raw::c_longlong, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_cond_t"][::std::mem::size_of::() - 48usize]; + ["Alignment of pthread_cond_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_cond_t::__data"] + [::std::mem::offset_of!(pthread_cond_t, __data) - 0usize]; + ["Offset of field: pthread_cond_t::__size"] + [::std::mem::offset_of!(pthread_cond_t, __size) - 0usize]; + ["Offset of field: pthread_cond_t::__align"] + [::std::mem::offset_of!(pthread_cond_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlock_t { + pub __data: __pthread_rwlock_arch_t, + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_rwlock_t"][::std::mem::size_of::() - 56usize]; + ["Alignment of pthread_rwlock_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_rwlock_t::__data"] + [::std::mem::offset_of!(pthread_rwlock_t, __data) - 0usize]; + ["Offset of field: pthread_rwlock_t::__size"] + [::std::mem::offset_of!(pthread_rwlock_t, __size) - 0usize]; + ["Offset of field: pthread_rwlock_t::__align"] + [::std::mem::offset_of!(pthread_rwlock_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlockattr_t { + pub __size: [::std::os::raw::c_char; 8usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_rwlockattr_t"][::std::mem::size_of::() - 8usize]; + ["Alignment of pthread_rwlockattr_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_rwlockattr_t::__size"] + [::std::mem::offset_of!(pthread_rwlockattr_t, __size) - 0usize]; + ["Offset of field: pthread_rwlockattr_t::__align"] + [::std::mem::offset_of!(pthread_rwlockattr_t, __align) - 0usize]; +}; +pub type pthread_spinlock_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrier_t { + pub __size: [::std::os::raw::c_char; 32usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_barrier_t"][::std::mem::size_of::() - 32usize]; + ["Alignment of pthread_barrier_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_barrier_t::__size"] + [::std::mem::offset_of!(pthread_barrier_t, __size) - 0usize]; + ["Offset of field: pthread_barrier_t::__align"] + [::std::mem::offset_of!(pthread_barrier_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrierattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_barrierattr_t"][::std::mem::size_of::() - 4usize]; + ["Alignment of pthread_barrierattr_t"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pthread_barrierattr_t::__size"] + [::std::mem::offset_of!(pthread_barrierattr_t, __size) - 0usize]; + ["Offset of field: pthread_barrierattr_t::__align"] + [::std::mem::offset_of!(pthread_barrierattr_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: usize, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of iovec"][::std::mem::size_of::() - 16usize]; + ["Alignment of iovec"][::std::mem::align_of::() - 8usize]; + ["Offset of field: iovec::iov_base"][::std::mem::offset_of!(iovec, iov_base) - 0usize]; + ["Offset of field: iovec::iov_len"][::std::mem::offset_of!(iovec, iov_len) - 8usize]; +}; +pub type socklen_t = __socklen_t; +pub const __socket_type_SOCK_STREAM: __socket_type = 1; +pub const __socket_type_SOCK_DGRAM: __socket_type = 2; +pub const __socket_type_SOCK_RAW: __socket_type = 3; +pub const __socket_type_SOCK_RDM: __socket_type = 4; +pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; +pub const __socket_type_SOCK_DCCP: __socket_type = 6; +pub const __socket_type_SOCK_PACKET: __socket_type = 10; +pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; +pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; +pub type __socket_type = ::std::os::raw::c_uint; +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr"][::std::mem::size_of::() - 16usize]; + ["Alignment of sockaddr"][::std::mem::align_of::() - 2usize]; + ["Offset of field: sockaddr::sa_family"][::std::mem::offset_of!(sockaddr, sa_family) - 0usize]; + ["Offset of field: sockaddr::sa_data"][::std::mem::offset_of!(sockaddr, sa_data) - 2usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: sa_family_t, + pub __ss_padding: [::std::os::raw::c_char; 118usize], + pub __ss_align: ::std::os::raw::c_ulong, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr_storage"][::std::mem::size_of::() - 128usize]; + ["Alignment of sockaddr_storage"][::std::mem::align_of::() - 8usize]; + ["Offset of field: sockaddr_storage::ss_family"] + [::std::mem::offset_of!(sockaddr_storage, ss_family) - 0usize]; + ["Offset of field: sockaddr_storage::__ss_padding"] + [::std::mem::offset_of!(sockaddr_storage, __ss_padding) - 2usize]; + ["Offset of field: sockaddr_storage::__ss_align"] + [::std::mem::offset_of!(sockaddr_storage, __ss_align) - 120usize]; +}; +pub const MSG_OOB: _bindgen_ty_1 = 1; +pub const MSG_PEEK: _bindgen_ty_1 = 2; +pub const MSG_DONTROUTE: _bindgen_ty_1 = 4; +pub const MSG_CTRUNC: _bindgen_ty_1 = 8; +pub const MSG_PROXY: _bindgen_ty_1 = 16; +pub const MSG_TRUNC: _bindgen_ty_1 = 32; +pub const MSG_DONTWAIT: _bindgen_ty_1 = 64; +pub const MSG_EOR: _bindgen_ty_1 = 128; +pub const MSG_WAITALL: _bindgen_ty_1 = 256; +pub const MSG_FIN: _bindgen_ty_1 = 512; +pub const MSG_SYN: _bindgen_ty_1 = 1024; +pub const MSG_CONFIRM: _bindgen_ty_1 = 2048; +pub const MSG_RST: _bindgen_ty_1 = 4096; +pub const MSG_ERRQUEUE: _bindgen_ty_1 = 8192; +pub const MSG_NOSIGNAL: _bindgen_ty_1 = 16384; +pub const MSG_MORE: _bindgen_ty_1 = 32768; +pub const MSG_WAITFORONE: _bindgen_ty_1 = 65536; +pub const MSG_BATCH: _bindgen_ty_1 = 262144; +pub const MSG_ZEROCOPY: _bindgen_ty_1 = 67108864; +pub const MSG_FASTOPEN: _bindgen_ty_1 = 536870912; +pub const MSG_CMSG_CLOEXEC: _bindgen_ty_1 = 1073741824; +pub type _bindgen_ty_1 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of msghdr"][::std::mem::size_of::() - 56usize]; + ["Alignment of msghdr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: msghdr::msg_name"][::std::mem::offset_of!(msghdr, msg_name) - 0usize]; + ["Offset of field: msghdr::msg_namelen"][::std::mem::offset_of!(msghdr, msg_namelen) - 8usize]; + ["Offset of field: msghdr::msg_iov"][::std::mem::offset_of!(msghdr, msg_iov) - 16usize]; + ["Offset of field: msghdr::msg_iovlen"][::std::mem::offset_of!(msghdr, msg_iovlen) - 24usize]; + ["Offset of field: msghdr::msg_control"][::std::mem::offset_of!(msghdr, msg_control) - 32usize]; + ["Offset of field: msghdr::msg_controllen"] + [::std::mem::offset_of!(msghdr, msg_controllen) - 40usize]; + ["Offset of field: msghdr::msg_flags"][::std::mem::offset_of!(msghdr, msg_flags) - 48usize]; +}; +#[repr(C)] +#[derive(Debug)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, + pub __cmsg_data: __IncompleteArrayField<::std::os::raw::c_uchar>, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of cmsghdr"][::std::mem::size_of::() - 16usize]; + ["Alignment of cmsghdr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: cmsghdr::cmsg_len"][::std::mem::offset_of!(cmsghdr, cmsg_len) - 0usize]; + ["Offset of field: cmsghdr::cmsg_level"][::std::mem::offset_of!(cmsghdr, cmsg_level) - 8usize]; + ["Offset of field: cmsghdr::cmsg_type"][::std::mem::offset_of!(cmsghdr, cmsg_type) - 12usize]; + ["Offset of field: cmsghdr::__cmsg_data"] + [::std::mem::offset_of!(cmsghdr, __cmsg_data) - 16usize]; +}; +extern "C" { + pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +pub const SCM_RIGHTS: _bindgen_ty_2 = 1; +pub type _bindgen_ty_2 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __kernel_fd_set"][::std::mem::size_of::<__kernel_fd_set>() - 128usize]; + ["Alignment of __kernel_fd_set"][::std::mem::align_of::<__kernel_fd_set>() - 8usize]; + ["Offset of field: __kernel_fd_set::fds_bits"] + [::std::mem::offset_of!(__kernel_fd_set, fds_bits) - 0usize]; +}; +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __kernel_fsid_t"][::std::mem::size_of::<__kernel_fsid_t>() - 8usize]; + ["Alignment of __kernel_fsid_t"][::std::mem::align_of::<__kernel_fsid_t>() - 4usize]; + ["Offset of field: __kernel_fsid_t::val"] + [::std::mem::offset_of!(__kernel_fsid_t, val) - 0usize]; +}; +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of linger"][::std::mem::size_of::() - 8usize]; + ["Alignment of linger"][::std::mem::align_of::() - 4usize]; + ["Offset of field: linger::l_onoff"][::std::mem::offset_of!(linger, l_onoff) - 0usize]; + ["Offset of field: linger::l_linger"][::std::mem::offset_of!(linger, l_linger) - 4usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct osockaddr { + pub sa_family: ::std::os::raw::c_ushort, + pub sa_data: [::std::os::raw::c_uchar; 14usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of osockaddr"][::std::mem::size_of::() - 16usize]; + ["Alignment of osockaddr"][::std::mem::align_of::() - 2usize]; + ["Offset of field: osockaddr::sa_family"] + [::std::mem::offset_of!(osockaddr, sa_family) - 0usize]; + ["Offset of field: osockaddr::sa_data"][::std::mem::offset_of!(osockaddr, sa_data) - 2usize]; +}; +pub const SHUT_RD: _bindgen_ty_3 = 0; +pub const SHUT_WR: _bindgen_ty_3 = 1; +pub const SHUT_RDWR: _bindgen_ty_3 = 2; +pub type _bindgen_ty_3 = ::std::os::raw::c_uint; +extern "C" { + pub fn socket( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_len: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> isize; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __message: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __message: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *mut ::std::os::raw::c_void, + __optlen: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *const ::std::os::raw::c_void, + __optlen: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen(__fd: ::std::os::raw::c_int, __n: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sockatmark(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isfdtype( + __fd: ::std::os::raw::c_int, + __fdtype: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct if_nameindex { + pub if_index: ::std::os::raw::c_uint, + pub if_name: *mut ::std::os::raw::c_char, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of if_nameindex"][::std::mem::size_of::() - 16usize]; + ["Alignment of if_nameindex"][::std::mem::align_of::() - 8usize]; + ["Offset of field: if_nameindex::if_index"] + [::std::mem::offset_of!(if_nameindex, if_index) - 0usize]; + ["Offset of field: if_nameindex::if_name"] + [::std::mem::offset_of!(if_nameindex, if_name) - 8usize]; +}; +pub const IFF_UP: _bindgen_ty_4 = 1; +pub const IFF_BROADCAST: _bindgen_ty_4 = 2; +pub const IFF_DEBUG: _bindgen_ty_4 = 4; +pub const IFF_LOOPBACK: _bindgen_ty_4 = 8; +pub const IFF_POINTOPOINT: _bindgen_ty_4 = 16; +pub const IFF_NOTRAILERS: _bindgen_ty_4 = 32; +pub const IFF_RUNNING: _bindgen_ty_4 = 64; +pub const IFF_NOARP: _bindgen_ty_4 = 128; +pub const IFF_PROMISC: _bindgen_ty_4 = 256; +pub const IFF_ALLMULTI: _bindgen_ty_4 = 512; +pub const IFF_MASTER: _bindgen_ty_4 = 1024; +pub const IFF_SLAVE: _bindgen_ty_4 = 2048; +pub const IFF_MULTICAST: _bindgen_ty_4 = 4096; +pub const IFF_PORTSEL: _bindgen_ty_4 = 8192; +pub const IFF_AUTOMEDIA: _bindgen_ty_4 = 16384; +pub const IFF_DYNAMIC: _bindgen_ty_4 = 32768; +pub type _bindgen_ty_4 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ifaddr { + pub ifa_addr: sockaddr, + pub ifa_ifu: ifaddr__bindgen_ty_1, + pub ifa_ifp: *mut iface, + pub ifa_next: *mut ifaddr, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifaddr__bindgen_ty_1 { + pub ifu_broadaddr: sockaddr, + pub ifu_dstaddr: sockaddr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifaddr__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of ifaddr__bindgen_ty_1"][::std::mem::align_of::() - 2usize]; + ["Offset of field: ifaddr__bindgen_ty_1::ifu_broadaddr"] + [::std::mem::offset_of!(ifaddr__bindgen_ty_1, ifu_broadaddr) - 0usize]; + ["Offset of field: ifaddr__bindgen_ty_1::ifu_dstaddr"] + [::std::mem::offset_of!(ifaddr__bindgen_ty_1, ifu_dstaddr) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifaddr"][::std::mem::size_of::() - 48usize]; + ["Alignment of ifaddr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifaddr::ifa_addr"][::std::mem::offset_of!(ifaddr, ifa_addr) - 0usize]; + ["Offset of field: ifaddr::ifa_ifu"][::std::mem::offset_of!(ifaddr, ifa_ifu) - 16usize]; + ["Offset of field: ifaddr::ifa_ifp"][::std::mem::offset_of!(ifaddr, ifa_ifp) - 32usize]; + ["Offset of field: ifaddr::ifa_next"][::std::mem::offset_of!(ifaddr, ifa_next) - 40usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ifmap { + pub mem_start: ::std::os::raw::c_ulong, + pub mem_end: ::std::os::raw::c_ulong, + pub base_addr: ::std::os::raw::c_ushort, + pub irq: ::std::os::raw::c_uchar, + pub dma: ::std::os::raw::c_uchar, + pub port: ::std::os::raw::c_uchar, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifmap"][::std::mem::size_of::() - 24usize]; + ["Alignment of ifmap"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifmap::mem_start"][::std::mem::offset_of!(ifmap, mem_start) - 0usize]; + ["Offset of field: ifmap::mem_end"][::std::mem::offset_of!(ifmap, mem_end) - 8usize]; + ["Offset of field: ifmap::base_addr"][::std::mem::offset_of!(ifmap, base_addr) - 16usize]; + ["Offset of field: ifmap::irq"][::std::mem::offset_of!(ifmap, irq) - 18usize]; + ["Offset of field: ifmap::dma"][::std::mem::offset_of!(ifmap, dma) - 19usize]; + ["Offset of field: ifmap::port"][::std::mem::offset_of!(ifmap, port) - 20usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ifreq { + pub ifr_ifrn: ifreq__bindgen_ty_1, + pub ifr_ifru: ifreq__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifreq__bindgen_ty_1 { + pub ifrn_name: [::std::os::raw::c_char; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifreq__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of ifreq__bindgen_ty_1"][::std::mem::align_of::() - 1usize]; + ["Offset of field: ifreq__bindgen_ty_1::ifrn_name"] + [::std::mem::offset_of!(ifreq__bindgen_ty_1, ifrn_name) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifreq__bindgen_ty_2 { + pub ifru_addr: sockaddr, + pub ifru_dstaddr: sockaddr, + pub ifru_broadaddr: sockaddr, + pub ifru_netmask: sockaddr, + pub ifru_hwaddr: sockaddr, + pub ifru_flags: ::std::os::raw::c_short, + pub ifru_ivalue: ::std::os::raw::c_int, + pub ifru_mtu: ::std::os::raw::c_int, + pub ifru_map: ifmap, + pub ifru_slave: [::std::os::raw::c_char; 16usize], + pub ifru_newname: [::std::os::raw::c_char; 16usize], + pub ifru_data: __caddr_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifreq__bindgen_ty_2"][::std::mem::size_of::() - 24usize]; + ["Alignment of ifreq__bindgen_ty_2"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_addr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_addr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_dstaddr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_dstaddr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_broadaddr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_broadaddr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_netmask"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_netmask) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_hwaddr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_hwaddr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_flags"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_flags) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_ivalue"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_ivalue) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_mtu"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_mtu) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_map"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_map) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_slave"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_slave) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_newname"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_newname) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_data"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_data) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifreq"][::std::mem::size_of::() - 40usize]; + ["Alignment of ifreq"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifreq::ifr_ifrn"][::std::mem::offset_of!(ifreq, ifr_ifrn) - 0usize]; + ["Offset of field: ifreq::ifr_ifru"][::std::mem::offset_of!(ifreq, ifr_ifru) - 16usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ifconf { + pub ifc_len: ::std::os::raw::c_int, + pub ifc_ifcu: ifconf__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifconf__bindgen_ty_1 { + pub ifcu_buf: __caddr_t, + pub ifcu_req: *mut ifreq, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifconf__bindgen_ty_1"][::std::mem::size_of::() - 8usize]; + ["Alignment of ifconf__bindgen_ty_1"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifconf__bindgen_ty_1::ifcu_buf"] + [::std::mem::offset_of!(ifconf__bindgen_ty_1, ifcu_buf) - 0usize]; + ["Offset of field: ifconf__bindgen_ty_1::ifcu_req"] + [::std::mem::offset_of!(ifconf__bindgen_ty_1, ifcu_req) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifconf"][::std::mem::size_of::() - 16usize]; + ["Alignment of ifconf"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifconf::ifc_len"][::std::mem::offset_of!(ifconf, ifc_len) - 0usize]; + ["Offset of field: ifconf::ifc_ifcu"][::std::mem::offset_of!(ifconf, ifc_ifcu) - 8usize]; +}; +extern "C" { + pub fn if_nametoindex(__ifname: *const ::std::os::raw::c_char) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn if_indextoname( + __ifindex: ::std::os::raw::c_uint, + __ifname: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn if_nameindex() -> *mut if_nameindex; +} +extern "C" { + pub fn if_freenameindex(__ptr: *mut if_nameindex); +} +pub type in_addr_t = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_addr { + pub s_addr: in_addr_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in_addr"][::std::mem::size_of::() - 4usize]; + ["Alignment of in_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in_addr::s_addr"][::std::mem::offset_of!(in_addr, s_addr) - 0usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_opts { + pub ip_dst: in_addr, + pub ip_opts: [::std::os::raw::c_char; 40usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_opts"][::std::mem::size_of::() - 44usize]; + ["Alignment of ip_opts"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_opts::ip_dst"][::std::mem::offset_of!(ip_opts, ip_dst) - 0usize]; + ["Offset of field: ip_opts::ip_opts"][::std::mem::offset_of!(ip_opts, ip_opts) - 4usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_pktinfo { + pub ipi_ifindex: ::std::os::raw::c_int, + pub ipi_spec_dst: in_addr, + pub ipi_addr: in_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in_pktinfo"][::std::mem::size_of::() - 12usize]; + ["Alignment of in_pktinfo"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in_pktinfo::ipi_ifindex"] + [::std::mem::offset_of!(in_pktinfo, ipi_ifindex) - 0usize]; + ["Offset of field: in_pktinfo::ipi_spec_dst"] + [::std::mem::offset_of!(in_pktinfo, ipi_spec_dst) - 4usize]; + ["Offset of field: in_pktinfo::ipi_addr"] + [::std::mem::offset_of!(in_pktinfo, ipi_addr) - 8usize]; +}; +pub const IPPROTO_IP: _bindgen_ty_5 = 0; +pub const IPPROTO_ICMP: _bindgen_ty_5 = 1; +pub const IPPROTO_IGMP: _bindgen_ty_5 = 2; +pub const IPPROTO_IPIP: _bindgen_ty_5 = 4; +pub const IPPROTO_TCP: _bindgen_ty_5 = 6; +pub const IPPROTO_EGP: _bindgen_ty_5 = 8; +pub const IPPROTO_PUP: _bindgen_ty_5 = 12; +pub const IPPROTO_UDP: _bindgen_ty_5 = 17; +pub const IPPROTO_IDP: _bindgen_ty_5 = 22; +pub const IPPROTO_TP: _bindgen_ty_5 = 29; +pub const IPPROTO_DCCP: _bindgen_ty_5 = 33; +pub const IPPROTO_IPV6: _bindgen_ty_5 = 41; +pub const IPPROTO_RSVP: _bindgen_ty_5 = 46; +pub const IPPROTO_GRE: _bindgen_ty_5 = 47; +pub const IPPROTO_ESP: _bindgen_ty_5 = 50; +pub const IPPROTO_AH: _bindgen_ty_5 = 51; +pub const IPPROTO_MTP: _bindgen_ty_5 = 92; +pub const IPPROTO_BEETPH: _bindgen_ty_5 = 94; +pub const IPPROTO_ENCAP: _bindgen_ty_5 = 98; +pub const IPPROTO_PIM: _bindgen_ty_5 = 103; +pub const IPPROTO_COMP: _bindgen_ty_5 = 108; +pub const IPPROTO_L2TP: _bindgen_ty_5 = 115; +pub const IPPROTO_SCTP: _bindgen_ty_5 = 132; +pub const IPPROTO_UDPLITE: _bindgen_ty_5 = 136; +pub const IPPROTO_MPLS: _bindgen_ty_5 = 137; +pub const IPPROTO_ETHERNET: _bindgen_ty_5 = 143; +pub const IPPROTO_RAW: _bindgen_ty_5 = 255; +pub const IPPROTO_MPTCP: _bindgen_ty_5 = 262; +pub const IPPROTO_MAX: _bindgen_ty_5 = 263; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; +pub const IPPROTO_HOPOPTS: _bindgen_ty_6 = 0; +pub const IPPROTO_ROUTING: _bindgen_ty_6 = 43; +pub const IPPROTO_FRAGMENT: _bindgen_ty_6 = 44; +pub const IPPROTO_ICMPV6: _bindgen_ty_6 = 58; +pub const IPPROTO_NONE: _bindgen_ty_6 = 59; +pub const IPPROTO_DSTOPTS: _bindgen_ty_6 = 60; +pub const IPPROTO_MH: _bindgen_ty_6 = 135; +pub type _bindgen_ty_6 = ::std::os::raw::c_uint; +pub type in_port_t = u16; +pub const IPPORT_ECHO: _bindgen_ty_7 = 7; +pub const IPPORT_DISCARD: _bindgen_ty_7 = 9; +pub const IPPORT_SYSTAT: _bindgen_ty_7 = 11; +pub const IPPORT_DAYTIME: _bindgen_ty_7 = 13; +pub const IPPORT_NETSTAT: _bindgen_ty_7 = 15; +pub const IPPORT_FTP: _bindgen_ty_7 = 21; +pub const IPPORT_TELNET: _bindgen_ty_7 = 23; +pub const IPPORT_SMTP: _bindgen_ty_7 = 25; +pub const IPPORT_TIMESERVER: _bindgen_ty_7 = 37; +pub const IPPORT_NAMESERVER: _bindgen_ty_7 = 42; +pub const IPPORT_WHOIS: _bindgen_ty_7 = 43; +pub const IPPORT_MTP: _bindgen_ty_7 = 57; +pub const IPPORT_TFTP: _bindgen_ty_7 = 69; +pub const IPPORT_RJE: _bindgen_ty_7 = 77; +pub const IPPORT_FINGER: _bindgen_ty_7 = 79; +pub const IPPORT_TTYLINK: _bindgen_ty_7 = 87; +pub const IPPORT_SUPDUP: _bindgen_ty_7 = 95; +pub const IPPORT_EXECSERVER: _bindgen_ty_7 = 512; +pub const IPPORT_LOGINSERVER: _bindgen_ty_7 = 513; +pub const IPPORT_CMDSERVER: _bindgen_ty_7 = 514; +pub const IPPORT_EFSSERVER: _bindgen_ty_7 = 520; +pub const IPPORT_BIFFUDP: _bindgen_ty_7 = 512; +pub const IPPORT_WHOSERVER: _bindgen_ty_7 = 513; +pub const IPPORT_ROUTESERVER: _bindgen_ty_7 = 520; +pub const IPPORT_RESERVED: _bindgen_ty_7 = 1024; +pub const IPPORT_USERRESERVED: _bindgen_ty_7 = 5000; +pub type _bindgen_ty_7 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct in6_addr { + pub __in6_u: in6_addr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union in6_addr__bindgen_ty_1 { + pub __u6_addr8: [u8; 16usize], + pub __u6_addr16: [u16; 8usize], + pub __u6_addr32: [u32; 4usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in6_addr__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of in6_addr__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr8"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr8) - 0usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr16"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr16) - 0usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr32"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr32) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in6_addr"][::std::mem::size_of::() - 16usize]; + ["Alignment of in6_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in6_addr::__in6_u"][::std::mem::offset_of!(in6_addr, __in6_u) - 0usize]; +}; +extern "C" { + pub static in6addr_any: in6_addr; +} +extern "C" { + pub static in6addr_loopback: in6_addr; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [::std::os::raw::c_uchar; 8usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr_in"][::std::mem::size_of::() - 16usize]; + ["Alignment of sockaddr_in"][::std::mem::align_of::() - 4usize]; + ["Offset of field: sockaddr_in::sin_family"] + [::std::mem::offset_of!(sockaddr_in, sin_family) - 0usize]; + ["Offset of field: sockaddr_in::sin_port"] + [::std::mem::offset_of!(sockaddr_in, sin_port) - 2usize]; + ["Offset of field: sockaddr_in::sin_addr"] + [::std::mem::offset_of!(sockaddr_in, sin_addr) - 4usize]; + ["Offset of field: sockaddr_in::sin_zero"] + [::std::mem::offset_of!(sockaddr_in, sin_zero) - 8usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: in6_addr, + pub sin6_scope_id: u32, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr_in6"][::std::mem::size_of::() - 28usize]; + ["Alignment of sockaddr_in6"][::std::mem::align_of::() - 4usize]; + ["Offset of field: sockaddr_in6::sin6_family"] + [::std::mem::offset_of!(sockaddr_in6, sin6_family) - 0usize]; + ["Offset of field: sockaddr_in6::sin6_port"] + [::std::mem::offset_of!(sockaddr_in6, sin6_port) - 2usize]; + ["Offset of field: sockaddr_in6::sin6_flowinfo"] + [::std::mem::offset_of!(sockaddr_in6, sin6_flowinfo) - 4usize]; + ["Offset of field: sockaddr_in6::sin6_addr"] + [::std::mem::offset_of!(sockaddr_in6, sin6_addr) - 8usize]; + ["Offset of field: sockaddr_in6::sin6_scope_id"] + [::std::mem::offset_of!(sockaddr_in6, sin6_scope_id) - 24usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_mreq"][::std::mem::size_of::() - 8usize]; + ["Alignment of ip_mreq"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_mreq::imr_multiaddr"] + [::std::mem::offset_of!(ip_mreq, imr_multiaddr) - 0usize]; + ["Offset of field: ip_mreq::imr_interface"] + [::std::mem::offset_of!(ip_mreq, imr_interface) - 4usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreqn { + pub imr_multiaddr: in_addr, + pub imr_address: in_addr, + pub imr_ifindex: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_mreqn"][::std::mem::size_of::() - 12usize]; + ["Alignment of ip_mreqn"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_mreqn::imr_multiaddr"] + [::std::mem::offset_of!(ip_mreqn, imr_multiaddr) - 0usize]; + ["Offset of field: ip_mreqn::imr_address"] + [::std::mem::offset_of!(ip_mreqn, imr_address) - 4usize]; + ["Offset of field: ip_mreqn::imr_ifindex"] + [::std::mem::offset_of!(ip_mreqn, imr_ifindex) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq_source { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + pub imr_sourceaddr: in_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_mreq_source"][::std::mem::size_of::() - 12usize]; + ["Alignment of ip_mreq_source"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_mreq_source::imr_multiaddr"] + [::std::mem::offset_of!(ip_mreq_source, imr_multiaddr) - 0usize]; + ["Offset of field: ip_mreq_source::imr_interface"] + [::std::mem::offset_of!(ip_mreq_source, imr_interface) - 4usize]; + ["Offset of field: ip_mreq_source::imr_sourceaddr"] + [::std::mem::offset_of!(ip_mreq_source, imr_sourceaddr) - 8usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ipv6_mreq { + pub ipv6mr_multiaddr: in6_addr, + pub ipv6mr_interface: ::std::os::raw::c_uint, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ipv6_mreq"][::std::mem::size_of::() - 20usize]; + ["Alignment of ipv6_mreq"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ipv6_mreq::ipv6mr_multiaddr"] + [::std::mem::offset_of!(ipv6_mreq, ipv6mr_multiaddr) - 0usize]; + ["Offset of field: ipv6_mreq::ipv6mr_interface"] + [::std::mem::offset_of!(ipv6_mreq, ipv6mr_interface) - 16usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct group_req { + pub gr_interface: u32, + pub gr_group: sockaddr_storage, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of group_req"][::std::mem::size_of::() - 136usize]; + ["Alignment of group_req"][::std::mem::align_of::() - 8usize]; + ["Offset of field: group_req::gr_interface"] + [::std::mem::offset_of!(group_req, gr_interface) - 0usize]; + ["Offset of field: group_req::gr_group"][::std::mem::offset_of!(group_req, gr_group) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: sockaddr_storage, + pub gsr_source: sockaddr_storage, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of group_source_req"][::std::mem::size_of::() - 264usize]; + ["Alignment of group_source_req"][::std::mem::align_of::() - 8usize]; + ["Offset of field: group_source_req::gsr_interface"] + [::std::mem::offset_of!(group_source_req, gsr_interface) - 0usize]; + ["Offset of field: group_source_req::gsr_group"] + [::std::mem::offset_of!(group_source_req, gsr_group) - 8usize]; + ["Offset of field: group_source_req::gsr_source"] + [::std::mem::offset_of!(group_source_req, gsr_source) - 136usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_msfilter { + pub imsf_multiaddr: in_addr, + pub imsf_interface: in_addr, + pub imsf_fmode: u32, + pub imsf_numsrc: u32, + pub imsf_slist: [in_addr; 1usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_msfilter"][::std::mem::size_of::() - 20usize]; + ["Alignment of ip_msfilter"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_msfilter::imsf_multiaddr"] + [::std::mem::offset_of!(ip_msfilter, imsf_multiaddr) - 0usize]; + ["Offset of field: ip_msfilter::imsf_interface"] + [::std::mem::offset_of!(ip_msfilter, imsf_interface) - 4usize]; + ["Offset of field: ip_msfilter::imsf_fmode"] + [::std::mem::offset_of!(ip_msfilter, imsf_fmode) - 8usize]; + ["Offset of field: ip_msfilter::imsf_numsrc"] + [::std::mem::offset_of!(ip_msfilter, imsf_numsrc) - 12usize]; + ["Offset of field: ip_msfilter::imsf_slist"] + [::std::mem::offset_of!(ip_msfilter, imsf_slist) - 16usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct group_filter { + pub gf_interface: u32, + pub gf_group: sockaddr_storage, + pub gf_fmode: u32, + pub gf_numsrc: u32, + pub gf_slist: [sockaddr_storage; 1usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of group_filter"][::std::mem::size_of::() - 272usize]; + ["Alignment of group_filter"][::std::mem::align_of::() - 8usize]; + ["Offset of field: group_filter::gf_interface"] + [::std::mem::offset_of!(group_filter, gf_interface) - 0usize]; + ["Offset of field: group_filter::gf_group"] + [::std::mem::offset_of!(group_filter, gf_group) - 8usize]; + ["Offset of field: group_filter::gf_fmode"] + [::std::mem::offset_of!(group_filter, gf_fmode) - 136usize]; + ["Offset of field: group_filter::gf_numsrc"] + [::std::mem::offset_of!(group_filter, gf_numsrc) - 140usize]; + ["Offset of field: group_filter::gf_slist"] + [::std::mem::offset_of!(group_filter, gf_slist) - 144usize]; +}; +extern "C" { + pub fn ntohl(__netlong: u32) -> u32; +} +extern "C" { + pub fn ntohs(__netshort: u16) -> u16; +} +extern "C" { + pub fn htonl(__hostlong: u32) -> u32; +} +extern "C" { + pub fn htons(__hostshort: u16) -> u16; +} +extern "C" { + pub fn bindresvport( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bindresvport6( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in6, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of tm"][::std::mem::size_of::() - 56usize]; + ["Alignment of tm"][::std::mem::align_of::() - 8usize]; + ["Offset of field: tm::tm_sec"][::std::mem::offset_of!(tm, tm_sec) - 0usize]; + ["Offset of field: tm::tm_min"][::std::mem::offset_of!(tm, tm_min) - 4usize]; + ["Offset of field: tm::tm_hour"][::std::mem::offset_of!(tm, tm_hour) - 8usize]; + ["Offset of field: tm::tm_mday"][::std::mem::offset_of!(tm, tm_mday) - 12usize]; + ["Offset of field: tm::tm_mon"][::std::mem::offset_of!(tm, tm_mon) - 16usize]; + ["Offset of field: tm::tm_year"][::std::mem::offset_of!(tm, tm_year) - 20usize]; + ["Offset of field: tm::tm_wday"][::std::mem::offset_of!(tm, tm_wday) - 24usize]; + ["Offset of field: tm::tm_yday"][::std::mem::offset_of!(tm, tm_yday) - 28usize]; + ["Offset of field: tm::tm_isdst"][::std::mem::offset_of!(tm, tm_isdst) - 32usize]; + ["Offset of field: tm::tm_gmtoff"][::std::mem::offset_of!(tm, tm_gmtoff) - 40usize]; + ["Offset of field: tm::tm_zone"][::std::mem::offset_of!(tm, tm_zone) - 48usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of itimerspec"][::std::mem::size_of::() - 32usize]; + ["Alignment of itimerspec"][::std::mem::align_of::() - 8usize]; + ["Offset of field: itimerspec::it_interval"] + [::std::mem::offset_of!(itimerspec, it_interval) - 0usize]; + ["Offset of field: itimerspec::it_value"] + [::std::mem::offset_of!(itimerspec, it_value) - 16usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __locale_struct"][::std::mem::size_of::<__locale_struct>() - 232usize]; + ["Alignment of __locale_struct"][::std::mem::align_of::<__locale_struct>() - 8usize]; + ["Offset of field: __locale_struct::__locales"] + [::std::mem::offset_of!(__locale_struct, __locales) - 0usize]; + ["Offset of field: __locale_struct::__ctype_b"] + [::std::mem::offset_of!(__locale_struct, __ctype_b) - 104usize]; + ["Offset of field: __locale_struct::__ctype_tolower"] + [::std::mem::offset_of!(__locale_struct, __ctype_tolower) - 112usize]; + ["Offset of field: __locale_struct::__ctype_toupper"] + [::std::mem::offset_of!(__locale_struct, __ctype_toupper) - 120usize]; + ["Offset of field: __locale_struct::__names"] + [::std::mem::offset_of!(__locale_struct, __names) - 128usize]; +}; +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub static mut __tzname: [*mut ::std::os::raw::c_char; 2usize]; +} +extern "C" { + pub static mut __daylight: ::std::os::raw::c_int; +} +extern "C" { + pub static mut __timezone: ::std::os::raw::c_long; +} +extern "C" { + pub static mut tzname: [*mut ::std::os::raw::c_char; 2usize]; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub static mut daylight: ::std::os::raw::c_int; +} +extern "C" { + pub static mut timezone: ::std::os::raw::c_long; +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::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 wg_key = [u8; 32usize]; +pub type wg_key_b64_string = [::std::os::raw::c_char; 45usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec64 { + pub tv_sec: i64, + pub tv_nsec: i64, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of timespec64"][::std::mem::size_of::() - 16usize]; + ["Alignment of timespec64"][::std::mem::align_of::() - 8usize]; + ["Offset of field: timespec64::tv_sec"][::std::mem::offset_of!(timespec64, tv_sec) - 0usize]; + ["Offset of field: timespec64::tv_nsec"][::std::mem::offset_of!(timespec64, tv_nsec) - 8usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct wg_allowedip { + pub family: u16, + pub __bindgen_anon_1: wg_allowedip__bindgen_ty_1, + pub cidr: u8, + pub next_allowedip: *mut wg_allowedip, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union wg_allowedip__bindgen_ty_1 { + pub ip4: in_addr, + pub ip6: in6_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_allowedip__bindgen_ty_1"] + [::std::mem::size_of::() - 16usize]; + ["Alignment of wg_allowedip__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: wg_allowedip__bindgen_ty_1::ip4"] + [::std::mem::offset_of!(wg_allowedip__bindgen_ty_1, ip4) - 0usize]; + ["Offset of field: wg_allowedip__bindgen_ty_1::ip6"] + [::std::mem::offset_of!(wg_allowedip__bindgen_ty_1, ip6) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_allowedip"][::std::mem::size_of::() - 32usize]; + ["Alignment of wg_allowedip"][::std::mem::align_of::() - 8usize]; + ["Offset of field: wg_allowedip::family"] + [::std::mem::offset_of!(wg_allowedip, family) - 0usize]; + ["Offset of field: wg_allowedip::cidr"][::std::mem::offset_of!(wg_allowedip, cidr) - 20usize]; + ["Offset of field: wg_allowedip::next_allowedip"] + [::std::mem::offset_of!(wg_allowedip, next_allowedip) - 24usize]; +}; +pub const wg_peer_flags_WGPEER_REMOVE_ME: wg_peer_flags = 1; +pub const wg_peer_flags_WGPEER_REPLACE_ALLOWEDIPS: wg_peer_flags = 2; +pub const wg_peer_flags_WGPEER_HAS_PUBLIC_KEY: wg_peer_flags = 4; +pub const wg_peer_flags_WGPEER_HAS_PRESHARED_KEY: wg_peer_flags = 8; +pub const wg_peer_flags_WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL: wg_peer_flags = 16; +pub type wg_peer_flags = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub union wg_endpoint { + pub addr: sockaddr, + pub addr4: sockaddr_in, + pub addr6: sockaddr_in6, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_endpoint"][::std::mem::size_of::() - 28usize]; + ["Alignment of wg_endpoint"][::std::mem::align_of::() - 4usize]; + ["Offset of field: wg_endpoint::addr"][::std::mem::offset_of!(wg_endpoint, addr) - 0usize]; + ["Offset of field: wg_endpoint::addr4"][::std::mem::offset_of!(wg_endpoint, addr4) - 0usize]; + ["Offset of field: wg_endpoint::addr6"][::std::mem::offset_of!(wg_endpoint, addr6) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct wg_peer { + pub flags: wg_peer_flags, + pub public_key: wg_key, + pub preshared_key: wg_key, + pub endpoint: wg_endpoint, + pub last_handshake_time: timespec64, + pub rx_bytes: u64, + pub tx_bytes: u64, + pub persistent_keepalive_interval: u16, + pub first_allowedip: *mut wg_allowedip, + pub last_allowedip: *mut wg_allowedip, + pub next_peer: *mut wg_peer, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_peer"][::std::mem::size_of::() - 160usize]; + ["Alignment of wg_peer"][::std::mem::align_of::() - 8usize]; + ["Offset of field: wg_peer::flags"][::std::mem::offset_of!(wg_peer, flags) - 0usize]; + ["Offset of field: wg_peer::public_key"][::std::mem::offset_of!(wg_peer, public_key) - 4usize]; + ["Offset of field: wg_peer::preshared_key"] + [::std::mem::offset_of!(wg_peer, preshared_key) - 36usize]; + ["Offset of field: wg_peer::endpoint"][::std::mem::offset_of!(wg_peer, endpoint) - 68usize]; + ["Offset of field: wg_peer::last_handshake_time"] + [::std::mem::offset_of!(wg_peer, last_handshake_time) - 96usize]; + ["Offset of field: wg_peer::rx_bytes"][::std::mem::offset_of!(wg_peer, rx_bytes) - 112usize]; + ["Offset of field: wg_peer::tx_bytes"][::std::mem::offset_of!(wg_peer, tx_bytes) - 120usize]; + ["Offset of field: wg_peer::persistent_keepalive_interval"] + [::std::mem::offset_of!(wg_peer, persistent_keepalive_interval) - 128usize]; + ["Offset of field: wg_peer::first_allowedip"] + [::std::mem::offset_of!(wg_peer, first_allowedip) - 136usize]; + ["Offset of field: wg_peer::last_allowedip"] + [::std::mem::offset_of!(wg_peer, last_allowedip) - 144usize]; + ["Offset of field: wg_peer::next_peer"][::std::mem::offset_of!(wg_peer, next_peer) - 152usize]; +}; +pub const wg_device_flags_WGDEVICE_REPLACE_PEERS: wg_device_flags = 1; +pub const wg_device_flags_WGDEVICE_HAS_PRIVATE_KEY: wg_device_flags = 2; +pub const wg_device_flags_WGDEVICE_HAS_PUBLIC_KEY: wg_device_flags = 4; +pub const wg_device_flags_WGDEVICE_HAS_LISTEN_PORT: wg_device_flags = 8; +pub const wg_device_flags_WGDEVICE_HAS_FWMARK: wg_device_flags = 16; +pub type wg_device_flags = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct wg_device { + pub name: [::std::os::raw::c_char; 16usize], + pub ifindex: u32, + pub flags: wg_device_flags, + pub public_key: wg_key, + pub private_key: wg_key, + pub fwmark: u32, + pub listen_port: u16, + pub first_peer: *mut wg_peer, + pub last_peer: *mut wg_peer, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_device"][::std::mem::size_of::() - 112usize]; + ["Alignment of wg_device"][::std::mem::align_of::() - 8usize]; + ["Offset of field: wg_device::name"][::std::mem::offset_of!(wg_device, name) - 0usize]; + ["Offset of field: wg_device::ifindex"][::std::mem::offset_of!(wg_device, ifindex) - 16usize]; + ["Offset of field: wg_device::flags"][::std::mem::offset_of!(wg_device, flags) - 20usize]; + ["Offset of field: wg_device::public_key"] + [::std::mem::offset_of!(wg_device, public_key) - 24usize]; + ["Offset of field: wg_device::private_key"] + [::std::mem::offset_of!(wg_device, private_key) - 56usize]; + ["Offset of field: wg_device::fwmark"][::std::mem::offset_of!(wg_device, fwmark) - 88usize]; + ["Offset of field: wg_device::listen_port"] + [::std::mem::offset_of!(wg_device, listen_port) - 92usize]; + ["Offset of field: wg_device::first_peer"] + [::std::mem::offset_of!(wg_device, first_peer) - 96usize]; + ["Offset of field: wg_device::last_peer"] + [::std::mem::offset_of!(wg_device, last_peer) - 104usize]; +}; +extern "C" { + pub fn wg_set_device(dev: *mut wg_device) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_get_device( + dev: *mut *mut wg_device, + device_name: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_add_device(device_name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_del_device(device_name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_free_device(dev: *mut wg_device); +} +extern "C" { + pub fn wg_list_device_names() -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn wg_key_to_base64(base64: *mut ::std::os::raw::c_char, key: *const u8); +} +extern "C" { + pub fn wg_key_from_base64( + key: *mut u8, + base64: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_key_is_zero(key: *const u8) -> bool; +} +extern "C" { + pub fn wg_generate_public_key(public_key: *mut u8, private_key: *const u8); +} +extern "C" { + pub fn wg_generate_private_key(private_key: *mut u8); +} +extern "C" { + pub fn wg_generate_preshared_key(preshared_key: *mut u8); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iface { + pub _address: u8, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +} + diff --git a/src/wireguard_manager/wireguard_wrapper.c b/src/wireguard_manager/wireguard_wrapper.c new file mode 100644 index 0000000..f57a5e9 --- /dev/null +++ b/src/wireguard_manager/wireguard_wrapper.c @@ -0,0 +1,133 @@ +#include "wireguard_wrapper.h" +#include +#include +#include +#include +#include +#include + +void generate_default_ipv4(wg_allowedip *ip); +void generate_default_ipv6(wg_allowedip *ip); +wg_endpoint generate_endponit(char *ip, unsigned short port); + +wg_peer generate_new_peer(wg_key *pub_key, char *ip, unsigned short port) { + wg_allowedip *ipv4, *ipv6; + ipv4 = malloc (sizeof (wg_allowedip)); + ipv6 = malloc (sizeof (wg_allowedip)); + generate_default_ipv4(ipv4); + generate_default_ipv6(ipv6); + ipv4->next_allowedip = ipv6; + + wg_peer new_peer = { + .flags = WGPEER_HAS_PUBLIC_KEY | WGPEER_REPLACE_ALLOWEDIPS, + //.public_key = pub_key, + .first_allowedip = ipv4, + .last_allowedip = ipv6, + .endpoint = generate_endponit (ip, port), + }; + + strcpy(new_peer.public_key, pub_key); + + return new_peer; +} + +wg_device generate_new_device(wg_key *priv_key, + char device_name[IFNAMSIZ], + unsigned short port, + wg_peer peer) +{ + wg_device new_device = { + //.private_key = priv_key, + .listen_port = port, + .flags = WGDEVICE_HAS_PRIVATE_KEY | WGDEVICE_HAS_LISTEN_PORT, + .first_peer = &peer, + .last_peer = &peer, + }; + strcpy(new_device.name, device_name); + strcpy(new_device.private_key, priv_key); + printf("str2: %s\n",new_device.name); + wg_key_b64_string key, key2; + wg_key_to_base64(key, new_device.first_peer->public_key); + printf("str2: %s\n",key); + wg_key_to_base64(key2, new_device.private_key); + printf("str3: %s\n",key2); + return new_device; +} + +wg_endpoint generate_endponit(char *ip, unsigned short port) { + struct in_addr ipv4; + inet_pton (AF_INET, ip, &ipv4); + struct sockaddr_in address ={ + .sin_family = AF_INET, + .sin_port = port, + .sin_addr = ipv4, + }; + + wg_endpoint ret = { + .addr4 = address, + }; + + return ret; +} + +void generate_default_ipv4(wg_allowedip *ip) { + struct in_addr ipv4; + inet_pton (AF_INET, "0.0.0.0", &ipv4); + + *ip = (struct wg_allowedip) { + .family = AF_INET, + .ip4 = ipv4, + }; +} + +void generate_default_ipv6(wg_allowedip *ip) { + struct in6_addr ipv6; + inet_pton (AF_INET6, "::0", &ipv6); + *ip = (struct wg_allowedip) { + .family = AF_INET6, + .ip6 = ipv6, + }; +} + +void clean_device(wg_peer *peer) { + free(peer->first_allowedip); + free(peer->last_allowedip); +} + +void list_devices(void) +{ + char *device_names, *device_name; + size_t len; + + device_names = wg_list_device_names(); + if (!device_names) { + perror("Unable to get device names"); + exit(1); + } + wg_for_each_device_name(device_names, device_name, len) { + wg_device *device; + wg_peer *peer; + wg_key_b64_string key; + + if (wg_get_device(&device, device_name) < 0) { + perror("Unable to get device"); + continue; + } + if (device->flags & WGDEVICE_HAS_PUBLIC_KEY) { + wg_key_to_base64(key, device->public_key); + printf("%s has public key %s\n", device_name, key); + } else + printf("%s has no public key\n", device_name); + wg_for_each_peer(device, peer) { + wg_key_to_base64(key, peer->public_key); + printf(" - peer %s\n", key); + } + wg_free_device(device); + } + free(device_names); +} + +int it_works() { + list_devices(); + return 5; +} diff --git a/src/wireguard_manager/wireguard_wrapper.h b/src/wireguard_manager/wireguard_wrapper.h new file mode 100644 index 0000000..eff1d34 --- /dev/null +++ b/src/wireguard_manager/wireguard_wrapper.h @@ -0,0 +1,10 @@ +#include "wireguard.h" +wg_peer generate_new_peer(wg_key *pub_key, + char *ip, + unsigned short port); +wg_device generate_new_device(wg_key *priv_key, + char device_name[IFNAMSIZ], + unsigned short port, + wg_peer peer); +int it_works(); +void clean_device(wg_peer *peer); diff --git a/src/wireguard_manager/wireguard_wrapper.rs b/src/wireguard_manager/wireguard_wrapper.rs new file mode 100644 index 0000000..e2e18b4 --- /dev/null +++ b/src/wireguard_manager/wireguard_wrapper.rs @@ -0,0 +1,2457 @@ +/* automatically generated by rust-bindgen 0.70.1 */ +#![allow(warnings)] + +#[repr(C)] +#[derive(Default)] +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); +impl __IncompleteArrayField { + #[inline] + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) + } + #[inline] + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T + } + #[inline] + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T + } + #[inline] + pub unsafe fn as_slice(&self, len: usize) -> &[T] { + ::std::slice::from_raw_parts(self.as_ptr(), len) + } + #[inline] + pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { + ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) + } +} +impl ::std::fmt::Debug for __IncompleteArrayField { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + fmt.write_str("__IncompleteArrayField") + } +} +pub const __GENTOO_NOT_FREESTANDING: u32 = 1; +pub const _STDC_PREDEF_H: u32 = 1; +pub const __STDC_IEC_559__: u32 = 1; +pub const __STDC_IEC_60559_BFP__: u32 = 201404; +pub const __STDC_IEC_559_COMPLEX__: u32 = 1; +pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404; +pub const __STDC_ISO_10646__: u32 = 201706; +pub const _NET_IF_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 __WORDSIZE: u32 = 64; +pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; +pub const __SYSCALL_WORDSIZE: u32 = 64; +pub const __TIMESIZE: u32 = 64; +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 __GLIBC_USE_C2X_STRTOL: u32 = 0; +pub const __GNU_LIBRARY__: u32 = 6; +pub const __GLIBC__: u32 = 2; +pub const __GLIBC_MINOR__: u32 = 39; +pub const _SYS_CDEFS_H: u32 = 1; +pub const __glibc_c99_flexarr_available: u32 = 1; +pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0; +pub const __HAVE_GENERIC_SELECTION: u32 = 1; +pub const _SYS_TYPES_H: u32 = 1; +pub const _BITS_TYPES_H: u32 = 1; +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 __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1; +pub const __FD_SETSIZE: u32 = 1024; +pub const _BITS_TIME64_H: u32 = 1; +pub const __clock_t_defined: u32 = 1; +pub const __clockid_t_defined: u32 = 1; +pub const __time_t_defined: u32 = 1; +pub const __timer_t_defined: u32 = 1; +pub const _BITS_STDINT_INTN_H: u32 = 1; +pub const __BIT_TYPES_DEFINED__: u32 = 1; +pub const _ENDIAN_H: u32 = 1; +pub const _BITS_ENDIAN_H: u32 = 1; +pub const __LITTLE_ENDIAN: u32 = 1234; +pub const __BIG_ENDIAN: u32 = 4321; +pub const __PDP_ENDIAN: u32 = 3412; +pub const _BITS_ENDIANNESS_H: u32 = 1; +pub const __BYTE_ORDER: u32 = 1234; +pub const __FLOAT_WORD_ORDER: u32 = 1234; +pub const LITTLE_ENDIAN: u32 = 1234; +pub const BIG_ENDIAN: u32 = 4321; +pub const PDP_ENDIAN: u32 = 3412; +pub const BYTE_ORDER: u32 = 1234; +pub const _BITS_BYTESWAP_H: u32 = 1; +pub const _BITS_UINTN_IDENTITY_H: u32 = 1; +pub const _SYS_SELECT_H: u32 = 1; +pub const __sigset_t_defined: u32 = 1; +pub const __timeval_defined: u32 = 1; +pub const _STRUCT_TIMESPEC: u32 = 1; +pub const FD_SETSIZE: u32 = 1024; +pub const _BITS_PTHREADTYPES_COMMON_H: u32 = 1; +pub const _THREAD_SHARED_TYPES_H: u32 = 1; +pub const _BITS_PTHREADTYPES_ARCH_H: u32 = 1; +pub const __SIZEOF_PTHREAD_MUTEX_T: u32 = 40; +pub const __SIZEOF_PTHREAD_ATTR_T: u32 = 56; +pub const __SIZEOF_PTHREAD_RWLOCK_T: u32 = 56; +pub const __SIZEOF_PTHREAD_BARRIER_T: u32 = 32; +pub const __SIZEOF_PTHREAD_MUTEXATTR_T: u32 = 4; +pub const __SIZEOF_PTHREAD_COND_T: u32 = 48; +pub const __SIZEOF_PTHREAD_CONDATTR_T: u32 = 4; +pub const __SIZEOF_PTHREAD_RWLOCKATTR_T: u32 = 8; +pub const __SIZEOF_PTHREAD_BARRIERATTR_T: u32 = 4; +pub const _THREAD_MUTEX_INTERNAL_H: u32 = 1; +pub const __PTHREAD_MUTEX_HAVE_PREV: u32 = 1; +pub const __have_pthread_attr_t: u32 = 1; +pub const _SYS_SOCKET_H: u32 = 1; +pub const __iovec_defined: u32 = 1; +pub const PF_UNSPEC: u32 = 0; +pub const PF_LOCAL: u32 = 1; +pub const PF_UNIX: u32 = 1; +pub const PF_FILE: u32 = 1; +pub const PF_INET: u32 = 2; +pub const PF_AX25: u32 = 3; +pub const PF_IPX: u32 = 4; +pub const PF_APPLETALK: u32 = 5; +pub const PF_NETROM: u32 = 6; +pub const PF_BRIDGE: u32 = 7; +pub const PF_ATMPVC: u32 = 8; +pub const PF_X25: u32 = 9; +pub const PF_INET6: u32 = 10; +pub const PF_ROSE: u32 = 11; +pub const PF_DECnet: u32 = 12; +pub const PF_NETBEUI: u32 = 13; +pub const PF_SECURITY: u32 = 14; +pub const PF_KEY: u32 = 15; +pub const PF_NETLINK: u32 = 16; +pub const PF_ROUTE: u32 = 16; +pub const PF_PACKET: u32 = 17; +pub const PF_ASH: u32 = 18; +pub const PF_ECONET: u32 = 19; +pub const PF_ATMSVC: u32 = 20; +pub const PF_RDS: u32 = 21; +pub const PF_SNA: u32 = 22; +pub const PF_IRDA: u32 = 23; +pub const PF_PPPOX: u32 = 24; +pub const PF_WANPIPE: u32 = 25; +pub const PF_LLC: u32 = 26; +pub const PF_IB: u32 = 27; +pub const PF_MPLS: u32 = 28; +pub const PF_CAN: u32 = 29; +pub const PF_TIPC: u32 = 30; +pub const PF_BLUETOOTH: u32 = 31; +pub const PF_IUCV: u32 = 32; +pub const PF_RXRPC: u32 = 33; +pub const PF_ISDN: u32 = 34; +pub const PF_PHONET: u32 = 35; +pub const PF_IEEE802154: u32 = 36; +pub const PF_CAIF: u32 = 37; +pub const PF_ALG: u32 = 38; +pub const PF_NFC: u32 = 39; +pub const PF_VSOCK: u32 = 40; +pub const PF_KCM: u32 = 41; +pub const PF_QIPCRTR: u32 = 42; +pub const PF_SMC: u32 = 43; +pub const PF_XDP: u32 = 44; +pub const PF_MCTP: u32 = 45; +pub const PF_MAX: u32 = 46; +pub const AF_UNSPEC: u32 = 0; +pub const AF_LOCAL: u32 = 1; +pub const AF_UNIX: u32 = 1; +pub const AF_FILE: u32 = 1; +pub const AF_INET: u32 = 2; +pub const AF_AX25: u32 = 3; +pub const AF_IPX: u32 = 4; +pub const AF_APPLETALK: u32 = 5; +pub const AF_NETROM: u32 = 6; +pub const AF_BRIDGE: u32 = 7; +pub const AF_ATMPVC: u32 = 8; +pub const AF_X25: u32 = 9; +pub const AF_INET6: u32 = 10; +pub const AF_ROSE: u32 = 11; +pub const AF_DECnet: u32 = 12; +pub const AF_NETBEUI: u32 = 13; +pub const AF_SECURITY: u32 = 14; +pub const AF_KEY: u32 = 15; +pub const AF_NETLINK: u32 = 16; +pub const AF_ROUTE: u32 = 16; +pub const AF_PACKET: u32 = 17; +pub const AF_ASH: u32 = 18; +pub const AF_ECONET: u32 = 19; +pub const AF_ATMSVC: u32 = 20; +pub const AF_RDS: u32 = 21; +pub const AF_SNA: u32 = 22; +pub const AF_IRDA: u32 = 23; +pub const AF_PPPOX: u32 = 24; +pub const AF_WANPIPE: u32 = 25; +pub const AF_LLC: u32 = 26; +pub const AF_IB: u32 = 27; +pub const AF_MPLS: u32 = 28; +pub const AF_CAN: u32 = 29; +pub const AF_TIPC: u32 = 30; +pub const AF_BLUETOOTH: u32 = 31; +pub const AF_IUCV: u32 = 32; +pub const AF_RXRPC: u32 = 33; +pub const AF_ISDN: u32 = 34; +pub const AF_PHONET: u32 = 35; +pub const AF_IEEE802154: u32 = 36; +pub const AF_CAIF: u32 = 37; +pub const AF_ALG: u32 = 38; +pub const AF_NFC: u32 = 39; +pub const AF_VSOCK: u32 = 40; +pub const AF_KCM: u32 = 41; +pub const AF_QIPCRTR: u32 = 42; +pub const AF_SMC: u32 = 43; +pub const AF_XDP: u32 = 44; +pub const AF_MCTP: u32 = 45; +pub const AF_MAX: u32 = 46; +pub const SOL_RAW: u32 = 255; +pub const SOL_DECNET: u32 = 261; +pub const SOL_X25: u32 = 262; +pub const SOL_PACKET: u32 = 263; +pub const SOL_ATM: u32 = 264; +pub const SOL_AAL: u32 = 265; +pub const SOL_IRDA: u32 = 266; +pub const SOL_NETBEUI: u32 = 267; +pub const SOL_LLC: u32 = 268; +pub const SOL_DCCP: u32 = 269; +pub const SOL_NETLINK: u32 = 270; +pub const SOL_TIPC: u32 = 271; +pub const SOL_RXRPC: u32 = 272; +pub const SOL_PPPOL2TP: u32 = 273; +pub const SOL_BLUETOOTH: u32 = 274; +pub const SOL_PNPIPE: u32 = 275; +pub const SOL_RDS: u32 = 276; +pub const SOL_IUCV: u32 = 277; +pub const SOL_CAIF: u32 = 278; +pub const SOL_ALG: u32 = 279; +pub const SOL_NFC: u32 = 280; +pub const SOL_KCM: u32 = 281; +pub const SOL_TLS: u32 = 282; +pub const SOL_XDP: u32 = 283; +pub const SOL_MPTCP: u32 = 284; +pub const SOL_MCTP: u32 = 285; +pub const SOL_SMC: u32 = 286; +pub const SOMAXCONN: u32 = 4096; +pub const _BITS_SOCKADDR_H: u32 = 1; +pub const _SS_SIZE: u32 = 128; +pub const __BITS_PER_LONG: u32 = 64; +pub const __BITS_PER_LONG_LONG: u32 = 64; +pub const FIOSETOWN: u32 = 35073; +pub const SIOCSPGRP: u32 = 35074; +pub const FIOGETOWN: u32 = 35075; +pub const SIOCGPGRP: u32 = 35076; +pub const SIOCATMARK: u32 = 35077; +pub const SIOCGSTAMP_OLD: u32 = 35078; +pub const SIOCGSTAMPNS_OLD: u32 = 35079; +pub const SOL_SOCKET: u32 = 1; +pub const SO_DEBUG: u32 = 1; +pub const SO_REUSEADDR: u32 = 2; +pub const SO_TYPE: u32 = 3; +pub const SO_ERROR: u32 = 4; +pub const SO_DONTROUTE: u32 = 5; +pub const SO_BROADCAST: u32 = 6; +pub const SO_SNDBUF: u32 = 7; +pub const SO_RCVBUF: u32 = 8; +pub const SO_SNDBUFFORCE: u32 = 32; +pub const SO_RCVBUFFORCE: u32 = 33; +pub const SO_KEEPALIVE: u32 = 9; +pub const SO_OOBINLINE: u32 = 10; +pub const SO_NO_CHECK: u32 = 11; +pub const SO_PRIORITY: u32 = 12; +pub const SO_LINGER: u32 = 13; +pub const SO_BSDCOMPAT: u32 = 14; +pub const SO_REUSEPORT: u32 = 15; +pub const SO_PASSCRED: u32 = 16; +pub const SO_PEERCRED: u32 = 17; +pub const SO_RCVLOWAT: u32 = 18; +pub const SO_SNDLOWAT: u32 = 19; +pub const SO_RCVTIMEO_OLD: u32 = 20; +pub const SO_SNDTIMEO_OLD: u32 = 21; +pub const SO_SECURITY_AUTHENTICATION: u32 = 22; +pub const SO_SECURITY_ENCRYPTION_TRANSPORT: u32 = 23; +pub const SO_SECURITY_ENCRYPTION_NETWORK: u32 = 24; +pub const SO_BINDTODEVICE: u32 = 25; +pub const SO_ATTACH_FILTER: u32 = 26; +pub const SO_DETACH_FILTER: u32 = 27; +pub const SO_GET_FILTER: u32 = 26; +pub const SO_PEERNAME: u32 = 28; +pub const SO_ACCEPTCONN: u32 = 30; +pub const SO_PEERSEC: u32 = 31; +pub const SO_PASSSEC: u32 = 34; +pub const SO_MARK: u32 = 36; +pub const SO_PROTOCOL: u32 = 38; +pub const SO_DOMAIN: u32 = 39; +pub const SO_RXQ_OVFL: u32 = 40; +pub const SO_WIFI_STATUS: u32 = 41; +pub const SCM_WIFI_STATUS: u32 = 41; +pub const SO_PEEK_OFF: u32 = 42; +pub const SO_NOFCS: u32 = 43; +pub const SO_LOCK_FILTER: u32 = 44; +pub const SO_SELECT_ERR_QUEUE: u32 = 45; +pub const SO_BUSY_POLL: u32 = 46; +pub const SO_MAX_PACING_RATE: u32 = 47; +pub const SO_BPF_EXTENSIONS: u32 = 48; +pub const SO_INCOMING_CPU: u32 = 49; +pub const SO_ATTACH_BPF: u32 = 50; +pub const SO_DETACH_BPF: u32 = 27; +pub const SO_ATTACH_REUSEPORT_CBPF: u32 = 51; +pub const SO_ATTACH_REUSEPORT_EBPF: u32 = 52; +pub const SO_CNX_ADVICE: u32 = 53; +pub const SCM_TIMESTAMPING_OPT_STATS: u32 = 54; +pub const SO_MEMINFO: u32 = 55; +pub const SO_INCOMING_NAPI_ID: u32 = 56; +pub const SO_COOKIE: u32 = 57; +pub const SCM_TIMESTAMPING_PKTINFO: u32 = 58; +pub const SO_PEERGROUPS: u32 = 59; +pub const SO_ZEROCOPY: u32 = 60; +pub const SO_TXTIME: u32 = 61; +pub const SCM_TXTIME: u32 = 61; +pub const SO_BINDTOIFINDEX: u32 = 62; +pub const SO_TIMESTAMP_OLD: u32 = 29; +pub const SO_TIMESTAMPNS_OLD: u32 = 35; +pub const SO_TIMESTAMPING_OLD: u32 = 37; +pub const SO_TIMESTAMP_NEW: u32 = 63; +pub const SO_TIMESTAMPNS_NEW: u32 = 64; +pub const SO_TIMESTAMPING_NEW: u32 = 65; +pub const SO_RCVTIMEO_NEW: u32 = 66; +pub const SO_SNDTIMEO_NEW: u32 = 67; +pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; +pub const SO_PREFER_BUSY_POLL: u32 = 69; +pub const SO_BUSY_POLL_BUDGET: u32 = 70; +pub const SO_NETNS_COOKIE: u32 = 71; +pub const SO_BUF_LOCK: u32 = 72; +pub const SO_RESERVE_MEM: u32 = 73; +pub const SO_TXREHASH: u32 = 74; +pub const SO_RCVMARK: u32 = 75; +pub const SO_PASSPIDFD: u32 = 76; +pub const SO_PEERPIDFD: u32 = 77; +pub const SO_TIMESTAMP: u32 = 29; +pub const SO_TIMESTAMPNS: u32 = 35; +pub const SO_TIMESTAMPING: u32 = 37; +pub const SO_RCVTIMEO: u32 = 20; +pub const SO_SNDTIMEO: u32 = 21; +pub const SCM_TIMESTAMP: u32 = 29; +pub const SCM_TIMESTAMPNS: u32 = 35; +pub const SCM_TIMESTAMPING: u32 = 37; +pub const __osockaddr_defined: u32 = 1; +pub const IF_NAMESIZE: u32 = 16; +pub const IFHWADDRLEN: u32 = 6; +pub const IFNAMSIZ: u32 = 16; +pub const _NETINET_IN_H: u32 = 1; +pub const _BITS_STDINT_UINTN_H: u32 = 1; +pub const __USE_KERNEL_IPV6_DEFS: u32 = 0; +pub const IP_OPTIONS: u32 = 4; +pub const IP_HDRINCL: u32 = 3; +pub const IP_TOS: u32 = 1; +pub const IP_TTL: u32 = 2; +pub const IP_RECVOPTS: u32 = 6; +pub const IP_RETOPTS: u32 = 7; +pub const IP_MULTICAST_IF: u32 = 32; +pub const IP_MULTICAST_TTL: u32 = 33; +pub const IP_MULTICAST_LOOP: u32 = 34; +pub const IP_ADD_MEMBERSHIP: u32 = 35; +pub const IP_DROP_MEMBERSHIP: u32 = 36; +pub const IP_UNBLOCK_SOURCE: u32 = 37; +pub const IP_BLOCK_SOURCE: u32 = 38; +pub const IP_ADD_SOURCE_MEMBERSHIP: u32 = 39; +pub const IP_DROP_SOURCE_MEMBERSHIP: u32 = 40; +pub const IP_MSFILTER: u32 = 41; +pub const MCAST_JOIN_GROUP: u32 = 42; +pub const MCAST_BLOCK_SOURCE: u32 = 43; +pub const MCAST_UNBLOCK_SOURCE: u32 = 44; +pub const MCAST_LEAVE_GROUP: u32 = 45; +pub const MCAST_JOIN_SOURCE_GROUP: u32 = 46; +pub const MCAST_LEAVE_SOURCE_GROUP: u32 = 47; +pub const MCAST_MSFILTER: u32 = 48; +pub const IP_MULTICAST_ALL: u32 = 49; +pub const IP_UNICAST_IF: u32 = 50; +pub const MCAST_EXCLUDE: u32 = 0; +pub const MCAST_INCLUDE: u32 = 1; +pub const IP_ROUTER_ALERT: u32 = 5; +pub const IP_PKTINFO: u32 = 8; +pub const IP_PKTOPTIONS: u32 = 9; +pub const IP_PMTUDISC: u32 = 10; +pub const IP_MTU_DISCOVER: u32 = 10; +pub const IP_RECVERR: u32 = 11; +pub const IP_RECVTTL: u32 = 12; +pub const IP_RECVTOS: u32 = 13; +pub const IP_MTU: u32 = 14; +pub const IP_FREEBIND: u32 = 15; +pub const IP_IPSEC_POLICY: u32 = 16; +pub const IP_XFRM_POLICY: u32 = 17; +pub const IP_PASSSEC: u32 = 18; +pub const IP_TRANSPARENT: u32 = 19; +pub const IP_ORIGDSTADDR: u32 = 20; +pub const IP_RECVORIGDSTADDR: u32 = 20; +pub const IP_MINTTL: u32 = 21; +pub const IP_NODEFRAG: u32 = 22; +pub const IP_CHECKSUM: u32 = 23; +pub const IP_BIND_ADDRESS_NO_PORT: u32 = 24; +pub const IP_RECVFRAGSIZE: u32 = 25; +pub const IP_RECVERR_RFC4884: u32 = 26; +pub const IP_PMTUDISC_DONT: u32 = 0; +pub const IP_PMTUDISC_WANT: u32 = 1; +pub const IP_PMTUDISC_DO: u32 = 2; +pub const IP_PMTUDISC_PROBE: u32 = 3; +pub const IP_PMTUDISC_INTERFACE: u32 = 4; +pub const IP_PMTUDISC_OMIT: u32 = 5; +pub const IP_LOCAL_PORT_RANGE: u32 = 51; +pub const IP_PROTOCOL: u32 = 52; +pub const SOL_IP: u32 = 0; +pub const IP_DEFAULT_MULTICAST_TTL: u32 = 1; +pub const IP_DEFAULT_MULTICAST_LOOP: u32 = 1; +pub const IP_MAX_MEMBERSHIPS: u32 = 20; +pub const IPV6_ADDRFORM: u32 = 1; +pub const IPV6_2292PKTINFO: u32 = 2; +pub const IPV6_2292HOPOPTS: u32 = 3; +pub const IPV6_2292DSTOPTS: u32 = 4; +pub const IPV6_2292RTHDR: u32 = 5; +pub const IPV6_2292PKTOPTIONS: u32 = 6; +pub const IPV6_CHECKSUM: u32 = 7; +pub const IPV6_2292HOPLIMIT: u32 = 8; +pub const IPV6_NEXTHOP: u32 = 9; +pub const IPV6_AUTHHDR: u32 = 10; +pub const IPV6_UNICAST_HOPS: u32 = 16; +pub const IPV6_MULTICAST_IF: u32 = 17; +pub const IPV6_MULTICAST_HOPS: u32 = 18; +pub const IPV6_MULTICAST_LOOP: u32 = 19; +pub const IPV6_JOIN_GROUP: u32 = 20; +pub const IPV6_LEAVE_GROUP: u32 = 21; +pub const IPV6_ROUTER_ALERT: u32 = 22; +pub const IPV6_MTU_DISCOVER: u32 = 23; +pub const IPV6_MTU: u32 = 24; +pub const IPV6_RECVERR: u32 = 25; +pub const IPV6_V6ONLY: u32 = 26; +pub const IPV6_JOIN_ANYCAST: u32 = 27; +pub const IPV6_LEAVE_ANYCAST: u32 = 28; +pub const IPV6_MULTICAST_ALL: u32 = 29; +pub const IPV6_ROUTER_ALERT_ISOLATE: u32 = 30; +pub const IPV6_RECVERR_RFC4884: u32 = 31; +pub const IPV6_IPSEC_POLICY: u32 = 34; +pub const IPV6_XFRM_POLICY: u32 = 35; +pub const IPV6_HDRINCL: u32 = 36; +pub const IPV6_RECVPKTINFO: u32 = 49; +pub const IPV6_PKTINFO: u32 = 50; +pub const IPV6_RECVHOPLIMIT: u32 = 51; +pub const IPV6_HOPLIMIT: u32 = 52; +pub const IPV6_RECVHOPOPTS: u32 = 53; +pub const IPV6_HOPOPTS: u32 = 54; +pub const IPV6_RTHDRDSTOPTS: u32 = 55; +pub const IPV6_RECVRTHDR: u32 = 56; +pub const IPV6_RTHDR: u32 = 57; +pub const IPV6_RECVDSTOPTS: u32 = 58; +pub const IPV6_DSTOPTS: u32 = 59; +pub const IPV6_RECVPATHMTU: u32 = 60; +pub const IPV6_PATHMTU: u32 = 61; +pub const IPV6_DONTFRAG: u32 = 62; +pub const IPV6_RECVTCLASS: u32 = 66; +pub const IPV6_TCLASS: u32 = 67; +pub const IPV6_AUTOFLOWLABEL: u32 = 70; +pub const IPV6_ADDR_PREFERENCES: u32 = 72; +pub const IPV6_MINHOPCOUNT: u32 = 73; +pub const IPV6_ORIGDSTADDR: u32 = 74; +pub const IPV6_RECVORIGDSTADDR: u32 = 74; +pub const IPV6_TRANSPARENT: u32 = 75; +pub const IPV6_UNICAST_IF: u32 = 76; +pub const IPV6_RECVFRAGSIZE: u32 = 77; +pub const IPV6_FREEBIND: u32 = 78; +pub const IPV6_ADD_MEMBERSHIP: u32 = 20; +pub const IPV6_DROP_MEMBERSHIP: u32 = 21; +pub const IPV6_RXHOPOPTS: u32 = 54; +pub const IPV6_RXDSTOPTS: u32 = 59; +pub const IPV6_PMTUDISC_DONT: u32 = 0; +pub const IPV6_PMTUDISC_WANT: u32 = 1; +pub const IPV6_PMTUDISC_DO: u32 = 2; +pub const IPV6_PMTUDISC_PROBE: u32 = 3; +pub const IPV6_PMTUDISC_INTERFACE: u32 = 4; +pub const IPV6_PMTUDISC_OMIT: u32 = 5; +pub const SOL_IPV6: u32 = 41; +pub const SOL_ICMPV6: u32 = 58; +pub const IPV6_RTHDR_LOOSE: u32 = 0; +pub const IPV6_RTHDR_STRICT: u32 = 1; +pub const IPV6_RTHDR_TYPE_0: u32 = 0; +pub const IN_CLASSA_NET: u32 = 4278190080; +pub const IN_CLASSA_NSHIFT: u32 = 24; +pub const IN_CLASSA_HOST: u32 = 16777215; +pub const IN_CLASSA_MAX: u32 = 128; +pub const IN_CLASSB_NET: u32 = 4294901760; +pub const IN_CLASSB_NSHIFT: u32 = 16; +pub const IN_CLASSB_HOST: u32 = 65535; +pub const IN_CLASSB_MAX: u32 = 65536; +pub const IN_CLASSC_NET: u32 = 4294967040; +pub const IN_CLASSC_NSHIFT: u32 = 8; +pub const IN_CLASSC_HOST: u32 = 255; +pub const IN_LOOPBACKNET: u32 = 127; +pub const INET_ADDRSTRLEN: u32 = 16; +pub const INET6_ADDRSTRLEN: u32 = 46; +pub const _TIME_H: u32 = 1; +pub const _BITS_TIME_H: u32 = 1; +pub const CLOCK_REALTIME: u32 = 0; +pub const CLOCK_MONOTONIC: u32 = 1; +pub const CLOCK_PROCESS_CPUTIME_ID: u32 = 2; +pub const CLOCK_THREAD_CPUTIME_ID: u32 = 3; +pub const CLOCK_MONOTONIC_RAW: u32 = 4; +pub const CLOCK_REALTIME_COARSE: u32 = 5; +pub const CLOCK_MONOTONIC_COARSE: u32 = 6; +pub const CLOCK_BOOTTIME: u32 = 7; +pub const CLOCK_REALTIME_ALARM: u32 = 8; +pub const CLOCK_BOOTTIME_ALARM: u32 = 9; +pub const CLOCK_TAI: u32 = 11; +pub const TIMER_ABSTIME: u32 = 1; +pub const __struct_tm_defined: u32 = 1; +pub const __itimerspec_defined: u32 = 1; +pub const _BITS_TYPES_LOCALE_T_H: u32 = 1; +pub const _BITS_TYPES___LOCALE_T_H: u32 = 1; +pub const TIME_UTC: u32 = 1; +pub const _STDINT_H: 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_EXT: 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_WCHAR_H: u32 = 1; +pub const _BITS_STDINT_LEAST_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 __bool_true_false_are_defined: u32 = 1; +pub const true_: u32 = 1; +pub const false_: u32 = 0; +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 __suseconds64_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 u_char = __u_char; +pub type u_short = __u_short; +pub type u_int = __u_int; +pub type u_long = __u_long; +pub type quad_t = __quad_t; +pub type u_quad_t = __u_quad_t; +pub type fsid_t = __fsid_t; +pub type loff_t = __loff_t; +pub type ino_t = __ino_t; +pub type dev_t = __dev_t; +pub type gid_t = __gid_t; +pub type mode_t = __mode_t; +pub type nlink_t = __nlink_t; +pub type uid_t = __uid_t; +pub type off_t = __off_t; +pub type pid_t = __pid_t; +pub type id_t = __id_t; +pub type daddr_t = __daddr_t; +pub type caddr_t = __caddr_t; +pub type key_t = __key_t; +pub type clock_t = __clock_t; +pub type clockid_t = __clockid_t; +pub type time_t = __time_t; +pub type timer_t = __timer_t; +pub type ulong = ::std::os::raw::c_ulong; +pub type ushort = ::std::os::raw::c_ushort; +pub type uint = ::std::os::raw::c_uint; +pub type u_int8_t = __uint8_t; +pub type u_int16_t = __uint16_t; +pub type u_int32_t = __uint32_t; +pub type u_int64_t = __uint64_t; +pub type register_t = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __sigset_t { + pub __val: [::std::os::raw::c_ulong; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __sigset_t"][::std::mem::size_of::<__sigset_t>() - 128usize]; + ["Alignment of __sigset_t"][::std::mem::align_of::<__sigset_t>() - 8usize]; + ["Offset of field: __sigset_t::__val"][::std::mem::offset_of!(__sigset_t, __val) - 0usize]; +}; +pub type sigset_t = __sigset_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timeval { + pub tv_sec: __time_t, + pub tv_usec: __suseconds_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of timeval"][::std::mem::size_of::() - 16usize]; + ["Alignment of timeval"][::std::mem::align_of::() - 8usize]; + ["Offset of field: timeval::tv_sec"][::std::mem::offset_of!(timeval, tv_sec) - 0usize]; + ["Offset of field: timeval::tv_usec"][::std::mem::offset_of!(timeval, tv_usec) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec { + pub tv_sec: __time_t, + pub tv_nsec: __syscall_slong_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of timespec"][::std::mem::size_of::() - 16usize]; + ["Alignment of timespec"][::std::mem::align_of::() - 8usize]; + ["Offset of field: timespec::tv_sec"][::std::mem::offset_of!(timespec, tv_sec) - 0usize]; + ["Offset of field: timespec::tv_nsec"][::std::mem::offset_of!(timespec, tv_nsec) - 8usize]; +}; +pub type suseconds_t = __suseconds_t; +pub type __fd_mask = ::std::os::raw::c_long; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct fd_set { + pub __fds_bits: [__fd_mask; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of fd_set"][::std::mem::size_of::() - 128usize]; + ["Alignment of fd_set"][::std::mem::align_of::() - 8usize]; + ["Offset of field: fd_set::__fds_bits"][::std::mem::offset_of!(fd_set, __fds_bits) - 0usize]; +}; +pub type fd_mask = __fd_mask; +extern "C" { + pub fn select( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *mut timeval, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn pselect( + __nfds: ::std::os::raw::c_int, + __readfds: *mut fd_set, + __writefds: *mut fd_set, + __exceptfds: *mut fd_set, + __timeout: *const timespec, + __sigmask: *const __sigset_t, + ) -> ::std::os::raw::c_int; +} +pub type blksize_t = __blksize_t; +pub type blkcnt_t = __blkcnt_t; +pub type fsblkcnt_t = __fsblkcnt_t; +pub type fsfilcnt_t = __fsfilcnt_t; +#[repr(C)] +#[derive(Copy, Clone)] +pub union __atomic_wide_counter { + pub __value64: ::std::os::raw::c_ulonglong, + pub __value32: __atomic_wide_counter__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __atomic_wide_counter__bindgen_ty_1 { + pub __low: ::std::os::raw::c_uint, + pub __high: ::std::os::raw::c_uint, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __atomic_wide_counter__bindgen_ty_1"] + [::std::mem::size_of::<__atomic_wide_counter__bindgen_ty_1>() - 8usize]; + ["Alignment of __atomic_wide_counter__bindgen_ty_1"] + [::std::mem::align_of::<__atomic_wide_counter__bindgen_ty_1>() - 4usize]; + ["Offset of field: __atomic_wide_counter__bindgen_ty_1::__low"] + [::std::mem::offset_of!(__atomic_wide_counter__bindgen_ty_1, __low) - 0usize]; + ["Offset of field: __atomic_wide_counter__bindgen_ty_1::__high"] + [::std::mem::offset_of!(__atomic_wide_counter__bindgen_ty_1, __high) - 4usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __atomic_wide_counter"][::std::mem::size_of::<__atomic_wide_counter>() - 8usize]; + ["Alignment of __atomic_wide_counter"] + [::std::mem::align_of::<__atomic_wide_counter>() - 8usize]; + ["Offset of field: __atomic_wide_counter::__value64"] + [::std::mem::offset_of!(__atomic_wide_counter, __value64) - 0usize]; + ["Offset of field: __atomic_wide_counter::__value32"] + [::std::mem::offset_of!(__atomic_wide_counter, __value32) - 0usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_list { + pub __prev: *mut __pthread_internal_list, + pub __next: *mut __pthread_internal_list, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_internal_list"][::std::mem::size_of::<__pthread_internal_list>() - 16usize]; + ["Alignment of __pthread_internal_list"] + [::std::mem::align_of::<__pthread_internal_list>() - 8usize]; + ["Offset of field: __pthread_internal_list::__prev"] + [::std::mem::offset_of!(__pthread_internal_list, __prev) - 0usize]; + ["Offset of field: __pthread_internal_list::__next"] + [::std::mem::offset_of!(__pthread_internal_list, __next) - 8usize]; +}; +pub type __pthread_list_t = __pthread_internal_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_internal_slist { + pub __next: *mut __pthread_internal_slist, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_internal_slist"] + [::std::mem::size_of::<__pthread_internal_slist>() - 8usize]; + ["Alignment of __pthread_internal_slist"] + [::std::mem::align_of::<__pthread_internal_slist>() - 8usize]; + ["Offset of field: __pthread_internal_slist::__next"] + [::std::mem::offset_of!(__pthread_internal_slist, __next) - 0usize]; +}; +pub type __pthread_slist_t = __pthread_internal_slist; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_mutex_s { + pub __lock: ::std::os::raw::c_int, + pub __count: ::std::os::raw::c_uint, + pub __owner: ::std::os::raw::c_int, + pub __nusers: ::std::os::raw::c_uint, + pub __kind: ::std::os::raw::c_int, + pub __spins: ::std::os::raw::c_short, + pub __elision: ::std::os::raw::c_short, + pub __list: __pthread_list_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_mutex_s"][::std::mem::size_of::<__pthread_mutex_s>() - 40usize]; + ["Alignment of __pthread_mutex_s"][::std::mem::align_of::<__pthread_mutex_s>() - 8usize]; + ["Offset of field: __pthread_mutex_s::__lock"] + [::std::mem::offset_of!(__pthread_mutex_s, __lock) - 0usize]; + ["Offset of field: __pthread_mutex_s::__count"] + [::std::mem::offset_of!(__pthread_mutex_s, __count) - 4usize]; + ["Offset of field: __pthread_mutex_s::__owner"] + [::std::mem::offset_of!(__pthread_mutex_s, __owner) - 8usize]; + ["Offset of field: __pthread_mutex_s::__nusers"] + [::std::mem::offset_of!(__pthread_mutex_s, __nusers) - 12usize]; + ["Offset of field: __pthread_mutex_s::__kind"] + [::std::mem::offset_of!(__pthread_mutex_s, __kind) - 16usize]; + ["Offset of field: __pthread_mutex_s::__spins"] + [::std::mem::offset_of!(__pthread_mutex_s, __spins) - 20usize]; + ["Offset of field: __pthread_mutex_s::__elision"] + [::std::mem::offset_of!(__pthread_mutex_s, __elision) - 22usize]; + ["Offset of field: __pthread_mutex_s::__list"] + [::std::mem::offset_of!(__pthread_mutex_s, __list) - 24usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __pthread_rwlock_arch_t { + pub __readers: ::std::os::raw::c_uint, + pub __writers: ::std::os::raw::c_uint, + pub __wrphase_futex: ::std::os::raw::c_uint, + pub __writers_futex: ::std::os::raw::c_uint, + pub __pad3: ::std::os::raw::c_uint, + pub __pad4: ::std::os::raw::c_uint, + pub __cur_writer: ::std::os::raw::c_int, + pub __shared: ::std::os::raw::c_int, + pub __rwelision: ::std::os::raw::c_schar, + pub __pad1: [::std::os::raw::c_uchar; 7usize], + pub __pad2: ::std::os::raw::c_ulong, + pub __flags: ::std::os::raw::c_uint, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_rwlock_arch_t"][::std::mem::size_of::<__pthread_rwlock_arch_t>() - 56usize]; + ["Alignment of __pthread_rwlock_arch_t"] + [::std::mem::align_of::<__pthread_rwlock_arch_t>() - 8usize]; + ["Offset of field: __pthread_rwlock_arch_t::__readers"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __readers) - 0usize]; + ["Offset of field: __pthread_rwlock_arch_t::__writers"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __writers) - 4usize]; + ["Offset of field: __pthread_rwlock_arch_t::__wrphase_futex"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __wrphase_futex) - 8usize]; + ["Offset of field: __pthread_rwlock_arch_t::__writers_futex"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __writers_futex) - 12usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad3"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad3) - 16usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad4"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad4) - 20usize]; + ["Offset of field: __pthread_rwlock_arch_t::__cur_writer"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __cur_writer) - 24usize]; + ["Offset of field: __pthread_rwlock_arch_t::__shared"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __shared) - 28usize]; + ["Offset of field: __pthread_rwlock_arch_t::__rwelision"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __rwelision) - 32usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad1"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad1) - 33usize]; + ["Offset of field: __pthread_rwlock_arch_t::__pad2"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __pad2) - 40usize]; + ["Offset of field: __pthread_rwlock_arch_t::__flags"] + [::std::mem::offset_of!(__pthread_rwlock_arch_t, __flags) - 48usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct __pthread_cond_s { + pub __wseq: __atomic_wide_counter, + pub __g1_start: __atomic_wide_counter, + pub __g_refs: [::std::os::raw::c_uint; 2usize], + pub __g_size: [::std::os::raw::c_uint; 2usize], + pub __g1_orig_size: ::std::os::raw::c_uint, + pub __wrefs: ::std::os::raw::c_uint, + pub __g_signals: [::std::os::raw::c_uint; 2usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __pthread_cond_s"][::std::mem::size_of::<__pthread_cond_s>() - 48usize]; + ["Alignment of __pthread_cond_s"][::std::mem::align_of::<__pthread_cond_s>() - 8usize]; + ["Offset of field: __pthread_cond_s::__wseq"] + [::std::mem::offset_of!(__pthread_cond_s, __wseq) - 0usize]; + ["Offset of field: __pthread_cond_s::__g1_start"] + [::std::mem::offset_of!(__pthread_cond_s, __g1_start) - 8usize]; + ["Offset of field: __pthread_cond_s::__g_refs"] + [::std::mem::offset_of!(__pthread_cond_s, __g_refs) - 16usize]; + ["Offset of field: __pthread_cond_s::__g_size"] + [::std::mem::offset_of!(__pthread_cond_s, __g_size) - 24usize]; + ["Offset of field: __pthread_cond_s::__g1_orig_size"] + [::std::mem::offset_of!(__pthread_cond_s, __g1_orig_size) - 32usize]; + ["Offset of field: __pthread_cond_s::__wrefs"] + [::std::mem::offset_of!(__pthread_cond_s, __wrefs) - 36usize]; + ["Offset of field: __pthread_cond_s::__g_signals"] + [::std::mem::offset_of!(__pthread_cond_s, __g_signals) - 40usize]; +}; +pub type __tss_t = ::std::os::raw::c_uint; +pub type __thrd_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __once_flag { + pub __data: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __once_flag"][::std::mem::size_of::<__once_flag>() - 4usize]; + ["Alignment of __once_flag"][::std::mem::align_of::<__once_flag>() - 4usize]; + ["Offset of field: __once_flag::__data"][::std::mem::offset_of!(__once_flag, __data) - 0usize]; +}; +pub type pthread_t = ::std::os::raw::c_ulong; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutexattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_mutexattr_t"][::std::mem::size_of::() - 4usize]; + ["Alignment of pthread_mutexattr_t"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pthread_mutexattr_t::__size"] + [::std::mem::offset_of!(pthread_mutexattr_t, __size) - 0usize]; + ["Offset of field: pthread_mutexattr_t::__align"] + [::std::mem::offset_of!(pthread_mutexattr_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_condattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_condattr_t"][::std::mem::size_of::() - 4usize]; + ["Alignment of pthread_condattr_t"][::std::mem::align_of::() - 4usize]; + ["Offset of field: pthread_condattr_t::__size"] + [::std::mem::offset_of!(pthread_condattr_t, __size) - 0usize]; + ["Offset of field: pthread_condattr_t::__align"] + [::std::mem::offset_of!(pthread_condattr_t, __align) - 0usize]; +}; +pub type pthread_key_t = ::std::os::raw::c_uint; +pub type pthread_once_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_attr_t { + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_attr_t"][::std::mem::size_of::() - 56usize]; + ["Alignment of pthread_attr_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_attr_t::__size"] + [::std::mem::offset_of!(pthread_attr_t, __size) - 0usize]; + ["Offset of field: pthread_attr_t::__align"] + [::std::mem::offset_of!(pthread_attr_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_mutex_t { + pub __data: __pthread_mutex_s, + pub __size: [::std::os::raw::c_char; 40usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_mutex_t"][::std::mem::size_of::() - 40usize]; + ["Alignment of pthread_mutex_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_mutex_t::__data"] + [::std::mem::offset_of!(pthread_mutex_t, __data) - 0usize]; + ["Offset of field: pthread_mutex_t::__size"] + [::std::mem::offset_of!(pthread_mutex_t, __size) - 0usize]; + ["Offset of field: pthread_mutex_t::__align"] + [::std::mem::offset_of!(pthread_mutex_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_cond_t { + pub __data: __pthread_cond_s, + pub __size: [::std::os::raw::c_char; 48usize], + pub __align: ::std::os::raw::c_longlong, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_cond_t"][::std::mem::size_of::() - 48usize]; + ["Alignment of pthread_cond_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_cond_t::__data"] + [::std::mem::offset_of!(pthread_cond_t, __data) - 0usize]; + ["Offset of field: pthread_cond_t::__size"] + [::std::mem::offset_of!(pthread_cond_t, __size) - 0usize]; + ["Offset of field: pthread_cond_t::__align"] + [::std::mem::offset_of!(pthread_cond_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlock_t { + pub __data: __pthread_rwlock_arch_t, + pub __size: [::std::os::raw::c_char; 56usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_rwlock_t"][::std::mem::size_of::() - 56usize]; + ["Alignment of pthread_rwlock_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_rwlock_t::__data"] + [::std::mem::offset_of!(pthread_rwlock_t, __data) - 0usize]; + ["Offset of field: pthread_rwlock_t::__size"] + [::std::mem::offset_of!(pthread_rwlock_t, __size) - 0usize]; + ["Offset of field: pthread_rwlock_t::__align"] + [::std::mem::offset_of!(pthread_rwlock_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_rwlockattr_t { + pub __size: [::std::os::raw::c_char; 8usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_rwlockattr_t"][::std::mem::size_of::() - 8usize]; + ["Alignment of pthread_rwlockattr_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_rwlockattr_t::__size"] + [::std::mem::offset_of!(pthread_rwlockattr_t, __size) - 0usize]; + ["Offset of field: pthread_rwlockattr_t::__align"] + [::std::mem::offset_of!(pthread_rwlockattr_t, __align) - 0usize]; +}; +pub type pthread_spinlock_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrier_t { + pub __size: [::std::os::raw::c_char; 32usize], + pub __align: ::std::os::raw::c_long, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_barrier_t"][::std::mem::size_of::() - 32usize]; + ["Alignment of pthread_barrier_t"][::std::mem::align_of::() - 8usize]; + ["Offset of field: pthread_barrier_t::__size"] + [::std::mem::offset_of!(pthread_barrier_t, __size) - 0usize]; + ["Offset of field: pthread_barrier_t::__align"] + [::std::mem::offset_of!(pthread_barrier_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union pthread_barrierattr_t { + pub __size: [::std::os::raw::c_char; 4usize], + pub __align: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of pthread_barrierattr_t"][::std::mem::size_of::() - 4usize]; + ["Alignment of pthread_barrierattr_t"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: pthread_barrierattr_t::__size"] + [::std::mem::offset_of!(pthread_barrierattr_t, __size) - 0usize]; + ["Offset of field: pthread_barrierattr_t::__align"] + [::std::mem::offset_of!(pthread_barrierattr_t, __align) - 0usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iovec { + pub iov_base: *mut ::std::os::raw::c_void, + pub iov_len: usize, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of iovec"][::std::mem::size_of::() - 16usize]; + ["Alignment of iovec"][::std::mem::align_of::() - 8usize]; + ["Offset of field: iovec::iov_base"][::std::mem::offset_of!(iovec, iov_base) - 0usize]; + ["Offset of field: iovec::iov_len"][::std::mem::offset_of!(iovec, iov_len) - 8usize]; +}; +pub type socklen_t = __socklen_t; +pub const __socket_type_SOCK_STREAM: __socket_type = 1; +pub const __socket_type_SOCK_DGRAM: __socket_type = 2; +pub const __socket_type_SOCK_RAW: __socket_type = 3; +pub const __socket_type_SOCK_RDM: __socket_type = 4; +pub const __socket_type_SOCK_SEQPACKET: __socket_type = 5; +pub const __socket_type_SOCK_DCCP: __socket_type = 6; +pub const __socket_type_SOCK_PACKET: __socket_type = 10; +pub const __socket_type_SOCK_CLOEXEC: __socket_type = 524288; +pub const __socket_type_SOCK_NONBLOCK: __socket_type = 2048; +pub type __socket_type = ::std::os::raw::c_uint; +pub type sa_family_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr { + pub sa_family: sa_family_t, + pub sa_data: [::std::os::raw::c_char; 14usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr"][::std::mem::size_of::() - 16usize]; + ["Alignment of sockaddr"][::std::mem::align_of::() - 2usize]; + ["Offset of field: sockaddr::sa_family"][::std::mem::offset_of!(sockaddr, sa_family) - 0usize]; + ["Offset of field: sockaddr::sa_data"][::std::mem::offset_of!(sockaddr, sa_data) - 2usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr_storage { + pub ss_family: sa_family_t, + pub __ss_padding: [::std::os::raw::c_char; 118usize], + pub __ss_align: ::std::os::raw::c_ulong, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr_storage"][::std::mem::size_of::() - 128usize]; + ["Alignment of sockaddr_storage"][::std::mem::align_of::() - 8usize]; + ["Offset of field: sockaddr_storage::ss_family"] + [::std::mem::offset_of!(sockaddr_storage, ss_family) - 0usize]; + ["Offset of field: sockaddr_storage::__ss_padding"] + [::std::mem::offset_of!(sockaddr_storage, __ss_padding) - 2usize]; + ["Offset of field: sockaddr_storage::__ss_align"] + [::std::mem::offset_of!(sockaddr_storage, __ss_align) - 120usize]; +}; +pub const MSG_OOB: _bindgen_ty_1 = 1; +pub const MSG_PEEK: _bindgen_ty_1 = 2; +pub const MSG_DONTROUTE: _bindgen_ty_1 = 4; +pub const MSG_CTRUNC: _bindgen_ty_1 = 8; +pub const MSG_PROXY: _bindgen_ty_1 = 16; +pub const MSG_TRUNC: _bindgen_ty_1 = 32; +pub const MSG_DONTWAIT: _bindgen_ty_1 = 64; +pub const MSG_EOR: _bindgen_ty_1 = 128; +pub const MSG_WAITALL: _bindgen_ty_1 = 256; +pub const MSG_FIN: _bindgen_ty_1 = 512; +pub const MSG_SYN: _bindgen_ty_1 = 1024; +pub const MSG_CONFIRM: _bindgen_ty_1 = 2048; +pub const MSG_RST: _bindgen_ty_1 = 4096; +pub const MSG_ERRQUEUE: _bindgen_ty_1 = 8192; +pub const MSG_NOSIGNAL: _bindgen_ty_1 = 16384; +pub const MSG_MORE: _bindgen_ty_1 = 32768; +pub const MSG_WAITFORONE: _bindgen_ty_1 = 65536; +pub const MSG_BATCH: _bindgen_ty_1 = 262144; +pub const MSG_ZEROCOPY: _bindgen_ty_1 = 67108864; +pub const MSG_FASTOPEN: _bindgen_ty_1 = 536870912; +pub const MSG_CMSG_CLOEXEC: _bindgen_ty_1 = 1073741824; +pub type _bindgen_ty_1 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct msghdr { + pub msg_name: *mut ::std::os::raw::c_void, + pub msg_namelen: socklen_t, + pub msg_iov: *mut iovec, + pub msg_iovlen: usize, + pub msg_control: *mut ::std::os::raw::c_void, + pub msg_controllen: usize, + pub msg_flags: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of msghdr"][::std::mem::size_of::() - 56usize]; + ["Alignment of msghdr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: msghdr::msg_name"][::std::mem::offset_of!(msghdr, msg_name) - 0usize]; + ["Offset of field: msghdr::msg_namelen"][::std::mem::offset_of!(msghdr, msg_namelen) - 8usize]; + ["Offset of field: msghdr::msg_iov"][::std::mem::offset_of!(msghdr, msg_iov) - 16usize]; + ["Offset of field: msghdr::msg_iovlen"][::std::mem::offset_of!(msghdr, msg_iovlen) - 24usize]; + ["Offset of field: msghdr::msg_control"][::std::mem::offset_of!(msghdr, msg_control) - 32usize]; + ["Offset of field: msghdr::msg_controllen"] + [::std::mem::offset_of!(msghdr, msg_controllen) - 40usize]; + ["Offset of field: msghdr::msg_flags"][::std::mem::offset_of!(msghdr, msg_flags) - 48usize]; +}; +#[repr(C)] +#[derive(Debug)] +pub struct cmsghdr { + pub cmsg_len: usize, + pub cmsg_level: ::std::os::raw::c_int, + pub cmsg_type: ::std::os::raw::c_int, + pub __cmsg_data: __IncompleteArrayField<::std::os::raw::c_uchar>, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of cmsghdr"][::std::mem::size_of::() - 16usize]; + ["Alignment of cmsghdr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: cmsghdr::cmsg_len"][::std::mem::offset_of!(cmsghdr, cmsg_len) - 0usize]; + ["Offset of field: cmsghdr::cmsg_level"][::std::mem::offset_of!(cmsghdr, cmsg_level) - 8usize]; + ["Offset of field: cmsghdr::cmsg_type"][::std::mem::offset_of!(cmsghdr, cmsg_type) - 12usize]; + ["Offset of field: cmsghdr::__cmsg_data"] + [::std::mem::offset_of!(cmsghdr, __cmsg_data) - 16usize]; +}; +extern "C" { + pub fn __cmsg_nxthdr(__mhdr: *mut msghdr, __cmsg: *mut cmsghdr) -> *mut cmsghdr; +} +pub const SCM_RIGHTS: _bindgen_ty_2 = 1; +pub type _bindgen_ty_2 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fd_set { + pub fds_bits: [::std::os::raw::c_ulong; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __kernel_fd_set"][::std::mem::size_of::<__kernel_fd_set>() - 128usize]; + ["Alignment of __kernel_fd_set"][::std::mem::align_of::<__kernel_fd_set>() - 8usize]; + ["Offset of field: __kernel_fd_set::fds_bits"] + [::std::mem::offset_of!(__kernel_fd_set, fds_bits) - 0usize]; +}; +pub type __kernel_sighandler_t = + ::std::option::Option; +pub type __kernel_key_t = ::std::os::raw::c_int; +pub type __kernel_mqd_t = ::std::os::raw::c_int; +pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; +pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; +pub type __kernel_long_t = ::std::os::raw::c_long; +pub type __kernel_ulong_t = ::std::os::raw::c_ulong; +pub type __kernel_ino_t = __kernel_ulong_t; +pub type __kernel_mode_t = ::std::os::raw::c_uint; +pub type __kernel_pid_t = ::std::os::raw::c_int; +pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; +pub type __kernel_uid_t = ::std::os::raw::c_uint; +pub type __kernel_gid_t = ::std::os::raw::c_uint; +pub type __kernel_suseconds_t = __kernel_long_t; +pub type __kernel_daddr_t = ::std::os::raw::c_int; +pub type __kernel_uid32_t = ::std::os::raw::c_uint; +pub type __kernel_gid32_t = ::std::os::raw::c_uint; +pub type __kernel_size_t = __kernel_ulong_t; +pub type __kernel_ssize_t = __kernel_long_t; +pub type __kernel_ptrdiff_t = __kernel_long_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __kernel_fsid_t { + pub val: [::std::os::raw::c_int; 2usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __kernel_fsid_t"][::std::mem::size_of::<__kernel_fsid_t>() - 8usize]; + ["Alignment of __kernel_fsid_t"][::std::mem::align_of::<__kernel_fsid_t>() - 4usize]; + ["Offset of field: __kernel_fsid_t::val"] + [::std::mem::offset_of!(__kernel_fsid_t, val) - 0usize]; +}; +pub type __kernel_off_t = __kernel_long_t; +pub type __kernel_loff_t = ::std::os::raw::c_longlong; +pub type __kernel_old_time_t = __kernel_long_t; +pub type __kernel_time_t = __kernel_long_t; +pub type __kernel_time64_t = ::std::os::raw::c_longlong; +pub type __kernel_clock_t = __kernel_long_t; +pub type __kernel_timer_t = ::std::os::raw::c_int; +pub type __kernel_clockid_t = ::std::os::raw::c_int; +pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; +pub type __kernel_uid16_t = ::std::os::raw::c_ushort; +pub type __kernel_gid16_t = ::std::os::raw::c_ushort; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct linger { + pub l_onoff: ::std::os::raw::c_int, + pub l_linger: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of linger"][::std::mem::size_of::() - 8usize]; + ["Alignment of linger"][::std::mem::align_of::() - 4usize]; + ["Offset of field: linger::l_onoff"][::std::mem::offset_of!(linger, l_onoff) - 0usize]; + ["Offset of field: linger::l_linger"][::std::mem::offset_of!(linger, l_linger) - 4usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct osockaddr { + pub sa_family: ::std::os::raw::c_ushort, + pub sa_data: [::std::os::raw::c_uchar; 14usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of osockaddr"][::std::mem::size_of::() - 16usize]; + ["Alignment of osockaddr"][::std::mem::align_of::() - 2usize]; + ["Offset of field: osockaddr::sa_family"] + [::std::mem::offset_of!(osockaddr, sa_family) - 0usize]; + ["Offset of field: osockaddr::sa_data"][::std::mem::offset_of!(osockaddr, sa_data) - 2usize]; +}; +pub const SHUT_RD: _bindgen_ty_3 = 0; +pub const SHUT_WR: _bindgen_ty_3 = 1; +pub const SHUT_RDWR: _bindgen_ty_3 = 2; +pub type _bindgen_ty_3 = ::std::os::raw::c_uint; +extern "C" { + pub fn socket( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn socketpair( + __domain: ::std::os::raw::c_int, + __type: ::std::os::raw::c_int, + __protocol: ::std::os::raw::c_int, + __fds: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bind( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getsockname( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn connect( + __fd: ::std::os::raw::c_int, + __addr: *const sockaddr, + __len: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn getpeername( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn send( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recv( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn sendto( + __fd: ::std::os::raw::c_int, + __buf: *const ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *const sockaddr, + __addr_len: socklen_t, + ) -> isize; +} +extern "C" { + pub fn recvfrom( + __fd: ::std::os::raw::c_int, + __buf: *mut ::std::os::raw::c_void, + __n: usize, + __flags: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> isize; +} +extern "C" { + pub fn sendmsg( + __fd: ::std::os::raw::c_int, + __message: *const msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn recvmsg( + __fd: ::std::os::raw::c_int, + __message: *mut msghdr, + __flags: ::std::os::raw::c_int, + ) -> isize; +} +extern "C" { + pub fn getsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *mut ::std::os::raw::c_void, + __optlen: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn setsockopt( + __fd: ::std::os::raw::c_int, + __level: ::std::os::raw::c_int, + __optname: ::std::os::raw::c_int, + __optval: *const ::std::os::raw::c_void, + __optlen: socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn listen(__fd: ::std::os::raw::c_int, __n: ::std::os::raw::c_int) + -> ::std::os::raw::c_int; +} +extern "C" { + pub fn accept( + __fd: ::std::os::raw::c_int, + __addr: *mut sockaddr, + __addr_len: *mut socklen_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn shutdown( + __fd: ::std::os::raw::c_int, + __how: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn sockatmark(__fd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn isfdtype( + __fd: ::std::os::raw::c_int, + __fdtype: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct if_nameindex { + pub if_index: ::std::os::raw::c_uint, + pub if_name: *mut ::std::os::raw::c_char, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of if_nameindex"][::std::mem::size_of::() - 16usize]; + ["Alignment of if_nameindex"][::std::mem::align_of::() - 8usize]; + ["Offset of field: if_nameindex::if_index"] + [::std::mem::offset_of!(if_nameindex, if_index) - 0usize]; + ["Offset of field: if_nameindex::if_name"] + [::std::mem::offset_of!(if_nameindex, if_name) - 8usize]; +}; +pub const IFF_UP: _bindgen_ty_4 = 1; +pub const IFF_BROADCAST: _bindgen_ty_4 = 2; +pub const IFF_DEBUG: _bindgen_ty_4 = 4; +pub const IFF_LOOPBACK: _bindgen_ty_4 = 8; +pub const IFF_POINTOPOINT: _bindgen_ty_4 = 16; +pub const IFF_NOTRAILERS: _bindgen_ty_4 = 32; +pub const IFF_RUNNING: _bindgen_ty_4 = 64; +pub const IFF_NOARP: _bindgen_ty_4 = 128; +pub const IFF_PROMISC: _bindgen_ty_4 = 256; +pub const IFF_ALLMULTI: _bindgen_ty_4 = 512; +pub const IFF_MASTER: _bindgen_ty_4 = 1024; +pub const IFF_SLAVE: _bindgen_ty_4 = 2048; +pub const IFF_MULTICAST: _bindgen_ty_4 = 4096; +pub const IFF_PORTSEL: _bindgen_ty_4 = 8192; +pub const IFF_AUTOMEDIA: _bindgen_ty_4 = 16384; +pub const IFF_DYNAMIC: _bindgen_ty_4 = 32768; +pub type _bindgen_ty_4 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ifaddr { + pub ifa_addr: sockaddr, + pub ifa_ifu: ifaddr__bindgen_ty_1, + pub ifa_ifp: *mut iface, + pub ifa_next: *mut ifaddr, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifaddr__bindgen_ty_1 { + pub ifu_broadaddr: sockaddr, + pub ifu_dstaddr: sockaddr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifaddr__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of ifaddr__bindgen_ty_1"][::std::mem::align_of::() - 2usize]; + ["Offset of field: ifaddr__bindgen_ty_1::ifu_broadaddr"] + [::std::mem::offset_of!(ifaddr__bindgen_ty_1, ifu_broadaddr) - 0usize]; + ["Offset of field: ifaddr__bindgen_ty_1::ifu_dstaddr"] + [::std::mem::offset_of!(ifaddr__bindgen_ty_1, ifu_dstaddr) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifaddr"][::std::mem::size_of::() - 48usize]; + ["Alignment of ifaddr"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifaddr::ifa_addr"][::std::mem::offset_of!(ifaddr, ifa_addr) - 0usize]; + ["Offset of field: ifaddr::ifa_ifu"][::std::mem::offset_of!(ifaddr, ifa_ifu) - 16usize]; + ["Offset of field: ifaddr::ifa_ifp"][::std::mem::offset_of!(ifaddr, ifa_ifp) - 32usize]; + ["Offset of field: ifaddr::ifa_next"][::std::mem::offset_of!(ifaddr, ifa_next) - 40usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ifmap { + pub mem_start: ::std::os::raw::c_ulong, + pub mem_end: ::std::os::raw::c_ulong, + pub base_addr: ::std::os::raw::c_ushort, + pub irq: ::std::os::raw::c_uchar, + pub dma: ::std::os::raw::c_uchar, + pub port: ::std::os::raw::c_uchar, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifmap"][::std::mem::size_of::() - 24usize]; + ["Alignment of ifmap"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifmap::mem_start"][::std::mem::offset_of!(ifmap, mem_start) - 0usize]; + ["Offset of field: ifmap::mem_end"][::std::mem::offset_of!(ifmap, mem_end) - 8usize]; + ["Offset of field: ifmap::base_addr"][::std::mem::offset_of!(ifmap, base_addr) - 16usize]; + ["Offset of field: ifmap::irq"][::std::mem::offset_of!(ifmap, irq) - 18usize]; + ["Offset of field: ifmap::dma"][::std::mem::offset_of!(ifmap, dma) - 19usize]; + ["Offset of field: ifmap::port"][::std::mem::offset_of!(ifmap, port) - 20usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ifreq { + pub ifr_ifrn: ifreq__bindgen_ty_1, + pub ifr_ifru: ifreq__bindgen_ty_2, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifreq__bindgen_ty_1 { + pub ifrn_name: [::std::os::raw::c_char; 16usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifreq__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of ifreq__bindgen_ty_1"][::std::mem::align_of::() - 1usize]; + ["Offset of field: ifreq__bindgen_ty_1::ifrn_name"] + [::std::mem::offset_of!(ifreq__bindgen_ty_1, ifrn_name) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifreq__bindgen_ty_2 { + pub ifru_addr: sockaddr, + pub ifru_dstaddr: sockaddr, + pub ifru_broadaddr: sockaddr, + pub ifru_netmask: sockaddr, + pub ifru_hwaddr: sockaddr, + pub ifru_flags: ::std::os::raw::c_short, + pub ifru_ivalue: ::std::os::raw::c_int, + pub ifru_mtu: ::std::os::raw::c_int, + pub ifru_map: ifmap, + pub ifru_slave: [::std::os::raw::c_char; 16usize], + pub ifru_newname: [::std::os::raw::c_char; 16usize], + pub ifru_data: __caddr_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifreq__bindgen_ty_2"][::std::mem::size_of::() - 24usize]; + ["Alignment of ifreq__bindgen_ty_2"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_addr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_addr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_dstaddr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_dstaddr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_broadaddr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_broadaddr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_netmask"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_netmask) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_hwaddr"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_hwaddr) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_flags"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_flags) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_ivalue"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_ivalue) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_mtu"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_mtu) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_map"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_map) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_slave"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_slave) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_newname"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_newname) - 0usize]; + ["Offset of field: ifreq__bindgen_ty_2::ifru_data"] + [::std::mem::offset_of!(ifreq__bindgen_ty_2, ifru_data) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifreq"][::std::mem::size_of::() - 40usize]; + ["Alignment of ifreq"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifreq::ifr_ifrn"][::std::mem::offset_of!(ifreq, ifr_ifrn) - 0usize]; + ["Offset of field: ifreq::ifr_ifru"][::std::mem::offset_of!(ifreq, ifr_ifru) - 16usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ifconf { + pub ifc_len: ::std::os::raw::c_int, + pub ifc_ifcu: ifconf__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union ifconf__bindgen_ty_1 { + pub ifcu_buf: __caddr_t, + pub ifcu_req: *mut ifreq, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifconf__bindgen_ty_1"][::std::mem::size_of::() - 8usize]; + ["Alignment of ifconf__bindgen_ty_1"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifconf__bindgen_ty_1::ifcu_buf"] + [::std::mem::offset_of!(ifconf__bindgen_ty_1, ifcu_buf) - 0usize]; + ["Offset of field: ifconf__bindgen_ty_1::ifcu_req"] + [::std::mem::offset_of!(ifconf__bindgen_ty_1, ifcu_req) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ifconf"][::std::mem::size_of::() - 16usize]; + ["Alignment of ifconf"][::std::mem::align_of::() - 8usize]; + ["Offset of field: ifconf::ifc_len"][::std::mem::offset_of!(ifconf, ifc_len) - 0usize]; + ["Offset of field: ifconf::ifc_ifcu"][::std::mem::offset_of!(ifconf, ifc_ifcu) - 8usize]; +}; +extern "C" { + pub fn if_nametoindex(__ifname: *const ::std::os::raw::c_char) -> ::std::os::raw::c_uint; +} +extern "C" { + pub fn if_indextoname( + __ifindex: ::std::os::raw::c_uint, + __ifname: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn if_nameindex() -> *mut if_nameindex; +} +extern "C" { + pub fn if_freenameindex(__ptr: *mut if_nameindex); +} +pub type in_addr_t = u32; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_addr { + pub s_addr: in_addr_t, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in_addr"][::std::mem::size_of::() - 4usize]; + ["Alignment of in_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in_addr::s_addr"][::std::mem::offset_of!(in_addr, s_addr) - 0usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_opts { + pub ip_dst: in_addr, + pub ip_opts: [::std::os::raw::c_char; 40usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_opts"][::std::mem::size_of::() - 44usize]; + ["Alignment of ip_opts"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_opts::ip_dst"][::std::mem::offset_of!(ip_opts, ip_dst) - 0usize]; + ["Offset of field: ip_opts::ip_opts"][::std::mem::offset_of!(ip_opts, ip_opts) - 4usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct in_pktinfo { + pub ipi_ifindex: ::std::os::raw::c_int, + pub ipi_spec_dst: in_addr, + pub ipi_addr: in_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in_pktinfo"][::std::mem::size_of::() - 12usize]; + ["Alignment of in_pktinfo"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in_pktinfo::ipi_ifindex"] + [::std::mem::offset_of!(in_pktinfo, ipi_ifindex) - 0usize]; + ["Offset of field: in_pktinfo::ipi_spec_dst"] + [::std::mem::offset_of!(in_pktinfo, ipi_spec_dst) - 4usize]; + ["Offset of field: in_pktinfo::ipi_addr"] + [::std::mem::offset_of!(in_pktinfo, ipi_addr) - 8usize]; +}; +pub const IPPROTO_IP: _bindgen_ty_5 = 0; +pub const IPPROTO_ICMP: _bindgen_ty_5 = 1; +pub const IPPROTO_IGMP: _bindgen_ty_5 = 2; +pub const IPPROTO_IPIP: _bindgen_ty_5 = 4; +pub const IPPROTO_TCP: _bindgen_ty_5 = 6; +pub const IPPROTO_EGP: _bindgen_ty_5 = 8; +pub const IPPROTO_PUP: _bindgen_ty_5 = 12; +pub const IPPROTO_UDP: _bindgen_ty_5 = 17; +pub const IPPROTO_IDP: _bindgen_ty_5 = 22; +pub const IPPROTO_TP: _bindgen_ty_5 = 29; +pub const IPPROTO_DCCP: _bindgen_ty_5 = 33; +pub const IPPROTO_IPV6: _bindgen_ty_5 = 41; +pub const IPPROTO_RSVP: _bindgen_ty_5 = 46; +pub const IPPROTO_GRE: _bindgen_ty_5 = 47; +pub const IPPROTO_ESP: _bindgen_ty_5 = 50; +pub const IPPROTO_AH: _bindgen_ty_5 = 51; +pub const IPPROTO_MTP: _bindgen_ty_5 = 92; +pub const IPPROTO_BEETPH: _bindgen_ty_5 = 94; +pub const IPPROTO_ENCAP: _bindgen_ty_5 = 98; +pub const IPPROTO_PIM: _bindgen_ty_5 = 103; +pub const IPPROTO_COMP: _bindgen_ty_5 = 108; +pub const IPPROTO_L2TP: _bindgen_ty_5 = 115; +pub const IPPROTO_SCTP: _bindgen_ty_5 = 132; +pub const IPPROTO_UDPLITE: _bindgen_ty_5 = 136; +pub const IPPROTO_MPLS: _bindgen_ty_5 = 137; +pub const IPPROTO_ETHERNET: _bindgen_ty_5 = 143; +pub const IPPROTO_RAW: _bindgen_ty_5 = 255; +pub const IPPROTO_MPTCP: _bindgen_ty_5 = 262; +pub const IPPROTO_MAX: _bindgen_ty_5 = 263; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; +pub const IPPROTO_HOPOPTS: _bindgen_ty_6 = 0; +pub const IPPROTO_ROUTING: _bindgen_ty_6 = 43; +pub const IPPROTO_FRAGMENT: _bindgen_ty_6 = 44; +pub const IPPROTO_ICMPV6: _bindgen_ty_6 = 58; +pub const IPPROTO_NONE: _bindgen_ty_6 = 59; +pub const IPPROTO_DSTOPTS: _bindgen_ty_6 = 60; +pub const IPPROTO_MH: _bindgen_ty_6 = 135; +pub type _bindgen_ty_6 = ::std::os::raw::c_uint; +pub type in_port_t = u16; +pub const IPPORT_ECHO: _bindgen_ty_7 = 7; +pub const IPPORT_DISCARD: _bindgen_ty_7 = 9; +pub const IPPORT_SYSTAT: _bindgen_ty_7 = 11; +pub const IPPORT_DAYTIME: _bindgen_ty_7 = 13; +pub const IPPORT_NETSTAT: _bindgen_ty_7 = 15; +pub const IPPORT_FTP: _bindgen_ty_7 = 21; +pub const IPPORT_TELNET: _bindgen_ty_7 = 23; +pub const IPPORT_SMTP: _bindgen_ty_7 = 25; +pub const IPPORT_TIMESERVER: _bindgen_ty_7 = 37; +pub const IPPORT_NAMESERVER: _bindgen_ty_7 = 42; +pub const IPPORT_WHOIS: _bindgen_ty_7 = 43; +pub const IPPORT_MTP: _bindgen_ty_7 = 57; +pub const IPPORT_TFTP: _bindgen_ty_7 = 69; +pub const IPPORT_RJE: _bindgen_ty_7 = 77; +pub const IPPORT_FINGER: _bindgen_ty_7 = 79; +pub const IPPORT_TTYLINK: _bindgen_ty_7 = 87; +pub const IPPORT_SUPDUP: _bindgen_ty_7 = 95; +pub const IPPORT_EXECSERVER: _bindgen_ty_7 = 512; +pub const IPPORT_LOGINSERVER: _bindgen_ty_7 = 513; +pub const IPPORT_CMDSERVER: _bindgen_ty_7 = 514; +pub const IPPORT_EFSSERVER: _bindgen_ty_7 = 520; +pub const IPPORT_BIFFUDP: _bindgen_ty_7 = 512; +pub const IPPORT_WHOSERVER: _bindgen_ty_7 = 513; +pub const IPPORT_ROUTESERVER: _bindgen_ty_7 = 520; +pub const IPPORT_RESERVED: _bindgen_ty_7 = 1024; +pub const IPPORT_USERRESERVED: _bindgen_ty_7 = 5000; +pub type _bindgen_ty_7 = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct in6_addr { + pub __in6_u: in6_addr__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union in6_addr__bindgen_ty_1 { + pub __u6_addr8: [u8; 16usize], + pub __u6_addr16: [u16; 8usize], + pub __u6_addr32: [u32; 4usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in6_addr__bindgen_ty_1"][::std::mem::size_of::() - 16usize]; + ["Alignment of in6_addr__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr8"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr8) - 0usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr16"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr16) - 0usize]; + ["Offset of field: in6_addr__bindgen_ty_1::__u6_addr32"] + [::std::mem::offset_of!(in6_addr__bindgen_ty_1, __u6_addr32) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of in6_addr"][::std::mem::size_of::() - 16usize]; + ["Alignment of in6_addr"][::std::mem::align_of::() - 4usize]; + ["Offset of field: in6_addr::__in6_u"][::std::mem::offset_of!(in6_addr, __in6_u) - 0usize]; +}; +extern "C" { + pub static in6addr_any: in6_addr; +} +extern "C" { + pub static in6addr_loopback: in6_addr; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sockaddr_in { + pub sin_family: sa_family_t, + pub sin_port: in_port_t, + pub sin_addr: in_addr, + pub sin_zero: [::std::os::raw::c_uchar; 8usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr_in"][::std::mem::size_of::() - 16usize]; + ["Alignment of sockaddr_in"][::std::mem::align_of::() - 4usize]; + ["Offset of field: sockaddr_in::sin_family"] + [::std::mem::offset_of!(sockaddr_in, sin_family) - 0usize]; + ["Offset of field: sockaddr_in::sin_port"] + [::std::mem::offset_of!(sockaddr_in, sin_port) - 2usize]; + ["Offset of field: sockaddr_in::sin_addr"] + [::std::mem::offset_of!(sockaddr_in, sin_addr) - 4usize]; + ["Offset of field: sockaddr_in::sin_zero"] + [::std::mem::offset_of!(sockaddr_in, sin_zero) - 8usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct sockaddr_in6 { + pub sin6_family: sa_family_t, + pub sin6_port: in_port_t, + pub sin6_flowinfo: u32, + pub sin6_addr: in6_addr, + pub sin6_scope_id: u32, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of sockaddr_in6"][::std::mem::size_of::() - 28usize]; + ["Alignment of sockaddr_in6"][::std::mem::align_of::() - 4usize]; + ["Offset of field: sockaddr_in6::sin6_family"] + [::std::mem::offset_of!(sockaddr_in6, sin6_family) - 0usize]; + ["Offset of field: sockaddr_in6::sin6_port"] + [::std::mem::offset_of!(sockaddr_in6, sin6_port) - 2usize]; + ["Offset of field: sockaddr_in6::sin6_flowinfo"] + [::std::mem::offset_of!(sockaddr_in6, sin6_flowinfo) - 4usize]; + ["Offset of field: sockaddr_in6::sin6_addr"] + [::std::mem::offset_of!(sockaddr_in6, sin6_addr) - 8usize]; + ["Offset of field: sockaddr_in6::sin6_scope_id"] + [::std::mem::offset_of!(sockaddr_in6, sin6_scope_id) - 24usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_mreq"][::std::mem::size_of::() - 8usize]; + ["Alignment of ip_mreq"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_mreq::imr_multiaddr"] + [::std::mem::offset_of!(ip_mreq, imr_multiaddr) - 0usize]; + ["Offset of field: ip_mreq::imr_interface"] + [::std::mem::offset_of!(ip_mreq, imr_interface) - 4usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreqn { + pub imr_multiaddr: in_addr, + pub imr_address: in_addr, + pub imr_ifindex: ::std::os::raw::c_int, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_mreqn"][::std::mem::size_of::() - 12usize]; + ["Alignment of ip_mreqn"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_mreqn::imr_multiaddr"] + [::std::mem::offset_of!(ip_mreqn, imr_multiaddr) - 0usize]; + ["Offset of field: ip_mreqn::imr_address"] + [::std::mem::offset_of!(ip_mreqn, imr_address) - 4usize]; + ["Offset of field: ip_mreqn::imr_ifindex"] + [::std::mem::offset_of!(ip_mreqn, imr_ifindex) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_mreq_source { + pub imr_multiaddr: in_addr, + pub imr_interface: in_addr, + pub imr_sourceaddr: in_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_mreq_source"][::std::mem::size_of::() - 12usize]; + ["Alignment of ip_mreq_source"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_mreq_source::imr_multiaddr"] + [::std::mem::offset_of!(ip_mreq_source, imr_multiaddr) - 0usize]; + ["Offset of field: ip_mreq_source::imr_interface"] + [::std::mem::offset_of!(ip_mreq_source, imr_interface) - 4usize]; + ["Offset of field: ip_mreq_source::imr_sourceaddr"] + [::std::mem::offset_of!(ip_mreq_source, imr_sourceaddr) - 8usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct ipv6_mreq { + pub ipv6mr_multiaddr: in6_addr, + pub ipv6mr_interface: ::std::os::raw::c_uint, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ipv6_mreq"][::std::mem::size_of::() - 20usize]; + ["Alignment of ipv6_mreq"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ipv6_mreq::ipv6mr_multiaddr"] + [::std::mem::offset_of!(ipv6_mreq, ipv6mr_multiaddr) - 0usize]; + ["Offset of field: ipv6_mreq::ipv6mr_interface"] + [::std::mem::offset_of!(ipv6_mreq, ipv6mr_interface) - 16usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct group_req { + pub gr_interface: u32, + pub gr_group: sockaddr_storage, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of group_req"][::std::mem::size_of::() - 136usize]; + ["Alignment of group_req"][::std::mem::align_of::() - 8usize]; + ["Offset of field: group_req::gr_interface"] + [::std::mem::offset_of!(group_req, gr_interface) - 0usize]; + ["Offset of field: group_req::gr_group"][::std::mem::offset_of!(group_req, gr_group) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct group_source_req { + pub gsr_interface: u32, + pub gsr_group: sockaddr_storage, + pub gsr_source: sockaddr_storage, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of group_source_req"][::std::mem::size_of::() - 264usize]; + ["Alignment of group_source_req"][::std::mem::align_of::() - 8usize]; + ["Offset of field: group_source_req::gsr_interface"] + [::std::mem::offset_of!(group_source_req, gsr_interface) - 0usize]; + ["Offset of field: group_source_req::gsr_group"] + [::std::mem::offset_of!(group_source_req, gsr_group) - 8usize]; + ["Offset of field: group_source_req::gsr_source"] + [::std::mem::offset_of!(group_source_req, gsr_source) - 136usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ip_msfilter { + pub imsf_multiaddr: in_addr, + pub imsf_interface: in_addr, + pub imsf_fmode: u32, + pub imsf_numsrc: u32, + pub imsf_slist: [in_addr; 1usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of ip_msfilter"][::std::mem::size_of::() - 20usize]; + ["Alignment of ip_msfilter"][::std::mem::align_of::() - 4usize]; + ["Offset of field: ip_msfilter::imsf_multiaddr"] + [::std::mem::offset_of!(ip_msfilter, imsf_multiaddr) - 0usize]; + ["Offset of field: ip_msfilter::imsf_interface"] + [::std::mem::offset_of!(ip_msfilter, imsf_interface) - 4usize]; + ["Offset of field: ip_msfilter::imsf_fmode"] + [::std::mem::offset_of!(ip_msfilter, imsf_fmode) - 8usize]; + ["Offset of field: ip_msfilter::imsf_numsrc"] + [::std::mem::offset_of!(ip_msfilter, imsf_numsrc) - 12usize]; + ["Offset of field: ip_msfilter::imsf_slist"] + [::std::mem::offset_of!(ip_msfilter, imsf_slist) - 16usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct group_filter { + pub gf_interface: u32, + pub gf_group: sockaddr_storage, + pub gf_fmode: u32, + pub gf_numsrc: u32, + pub gf_slist: [sockaddr_storage; 1usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of group_filter"][::std::mem::size_of::() - 272usize]; + ["Alignment of group_filter"][::std::mem::align_of::() - 8usize]; + ["Offset of field: group_filter::gf_interface"] + [::std::mem::offset_of!(group_filter, gf_interface) - 0usize]; + ["Offset of field: group_filter::gf_group"] + [::std::mem::offset_of!(group_filter, gf_group) - 8usize]; + ["Offset of field: group_filter::gf_fmode"] + [::std::mem::offset_of!(group_filter, gf_fmode) - 136usize]; + ["Offset of field: group_filter::gf_numsrc"] + [::std::mem::offset_of!(group_filter, gf_numsrc) - 140usize]; + ["Offset of field: group_filter::gf_slist"] + [::std::mem::offset_of!(group_filter, gf_slist) - 144usize]; +}; +extern "C" { + pub fn ntohl(__netlong: u32) -> u32; +} +extern "C" { + pub fn ntohs(__netshort: u16) -> u16; +} +extern "C" { + pub fn htonl(__hostlong: u32) -> u32; +} +extern "C" { + pub fn htons(__hostshort: u16) -> u16; +} +extern "C" { + pub fn bindresvport( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn bindresvport6( + __sockfd: ::std::os::raw::c_int, + __sock_in: *mut sockaddr_in6, + ) -> ::std::os::raw::c_int; +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct tm { + pub tm_sec: ::std::os::raw::c_int, + pub tm_min: ::std::os::raw::c_int, + pub tm_hour: ::std::os::raw::c_int, + pub tm_mday: ::std::os::raw::c_int, + pub tm_mon: ::std::os::raw::c_int, + pub tm_year: ::std::os::raw::c_int, + pub tm_wday: ::std::os::raw::c_int, + pub tm_yday: ::std::os::raw::c_int, + pub tm_isdst: ::std::os::raw::c_int, + pub tm_gmtoff: ::std::os::raw::c_long, + pub tm_zone: *const ::std::os::raw::c_char, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of tm"][::std::mem::size_of::() - 56usize]; + ["Alignment of tm"][::std::mem::align_of::() - 8usize]; + ["Offset of field: tm::tm_sec"][::std::mem::offset_of!(tm, tm_sec) - 0usize]; + ["Offset of field: tm::tm_min"][::std::mem::offset_of!(tm, tm_min) - 4usize]; + ["Offset of field: tm::tm_hour"][::std::mem::offset_of!(tm, tm_hour) - 8usize]; + ["Offset of field: tm::tm_mday"][::std::mem::offset_of!(tm, tm_mday) - 12usize]; + ["Offset of field: tm::tm_mon"][::std::mem::offset_of!(tm, tm_mon) - 16usize]; + ["Offset of field: tm::tm_year"][::std::mem::offset_of!(tm, tm_year) - 20usize]; + ["Offset of field: tm::tm_wday"][::std::mem::offset_of!(tm, tm_wday) - 24usize]; + ["Offset of field: tm::tm_yday"][::std::mem::offset_of!(tm, tm_yday) - 28usize]; + ["Offset of field: tm::tm_isdst"][::std::mem::offset_of!(tm, tm_isdst) - 32usize]; + ["Offset of field: tm::tm_gmtoff"][::std::mem::offset_of!(tm, tm_gmtoff) - 40usize]; + ["Offset of field: tm::tm_zone"][::std::mem::offset_of!(tm, tm_zone) - 48usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct itimerspec { + pub it_interval: timespec, + pub it_value: timespec, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of itimerspec"][::std::mem::size_of::() - 32usize]; + ["Alignment of itimerspec"][::std::mem::align_of::() - 8usize]; + ["Offset of field: itimerspec::it_interval"] + [::std::mem::offset_of!(itimerspec, it_interval) - 0usize]; + ["Offset of field: itimerspec::it_value"] + [::std::mem::offset_of!(itimerspec, it_value) - 16usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sigevent { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_struct { + pub __locales: [*mut __locale_data; 13usize], + pub __ctype_b: *const ::std::os::raw::c_ushort, + pub __ctype_tolower: *const ::std::os::raw::c_int, + pub __ctype_toupper: *const ::std::os::raw::c_int, + pub __names: [*const ::std::os::raw::c_char; 13usize], +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of __locale_struct"][::std::mem::size_of::<__locale_struct>() - 232usize]; + ["Alignment of __locale_struct"][::std::mem::align_of::<__locale_struct>() - 8usize]; + ["Offset of field: __locale_struct::__locales"] + [::std::mem::offset_of!(__locale_struct, __locales) - 0usize]; + ["Offset of field: __locale_struct::__ctype_b"] + [::std::mem::offset_of!(__locale_struct, __ctype_b) - 104usize]; + ["Offset of field: __locale_struct::__ctype_tolower"] + [::std::mem::offset_of!(__locale_struct, __ctype_tolower) - 112usize]; + ["Offset of field: __locale_struct::__ctype_toupper"] + [::std::mem::offset_of!(__locale_struct, __ctype_toupper) - 120usize]; + ["Offset of field: __locale_struct::__names"] + [::std::mem::offset_of!(__locale_struct, __names) - 128usize]; +}; +pub type __locale_t = *mut __locale_struct; +pub type locale_t = __locale_t; +extern "C" { + pub fn clock() -> clock_t; +} +extern "C" { + pub fn time(__timer: *mut time_t) -> time_t; +} +extern "C" { + pub fn difftime(__time1: time_t, __time0: time_t) -> f64; +} +extern "C" { + pub fn mktime(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn strftime( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + ) -> usize; +} +extern "C" { + pub fn strftime_l( + __s: *mut ::std::os::raw::c_char, + __maxsize: usize, + __format: *const ::std::os::raw::c_char, + __tp: *const tm, + __loc: locale_t, + ) -> usize; +} +extern "C" { + pub fn gmtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn localtime(__timer: *const time_t) -> *mut tm; +} +extern "C" { + pub fn gmtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn localtime_r(__timer: *const time_t, __tp: *mut tm) -> *mut tm; +} +extern "C" { + pub fn asctime(__tp: *const tm) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime(__timer: *const time_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn asctime_r( + __tp: *const tm, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn ctime_r( + __timer: *const time_t, + __buf: *mut ::std::os::raw::c_char, + ) -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub static mut __tzname: [*mut ::std::os::raw::c_char; 2usize]; +} +extern "C" { + pub static mut __daylight: ::std::os::raw::c_int; +} +extern "C" { + pub static mut __timezone: ::std::os::raw::c_long; +} +extern "C" { + pub static mut tzname: [*mut ::std::os::raw::c_char; 2usize]; +} +extern "C" { + pub fn tzset(); +} +extern "C" { + pub static mut daylight: ::std::os::raw::c_int; +} +extern "C" { + pub static mut timezone: ::std::os::raw::c_long; +} +extern "C" { + pub fn timegm(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn timelocal(__tp: *mut tm) -> time_t; +} +extern "C" { + pub fn dysize(__year: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn nanosleep( + __requested_time: *const timespec, + __remaining: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getres(__clock_id: clockid_t, __res: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_settime(__clock_id: clockid_t, __tp: *const timespec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_nanosleep( + __clock_id: clockid_t, + __flags: ::std::os::raw::c_int, + __req: *const timespec, + __rem: *mut timespec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clock_getcpuclockid(__pid: pid_t, __clock_id: *mut clockid_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_create( + __clock_id: clockid_t, + __evp: *mut sigevent, + __timerid: *mut timer_t, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_delete(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_settime( + __timerid: timer_t, + __flags: ::std::os::raw::c_int, + __value: *const itimerspec, + __ovalue: *mut itimerspec, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_gettime(__timerid: timer_t, __value: *mut itimerspec) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timer_getoverrun(__timerid: timer_t) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn timespec_get( + __ts: *mut timespec, + __base: ::std::os::raw::c_int, + ) -> ::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 wg_key = [u8; 32usize]; +pub type wg_key_b64_string = [::std::os::raw::c_char; 45usize]; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct timespec64 { + pub tv_sec: i64, + pub tv_nsec: i64, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of timespec64"][::std::mem::size_of::() - 16usize]; + ["Alignment of timespec64"][::std::mem::align_of::() - 8usize]; + ["Offset of field: timespec64::tv_sec"][::std::mem::offset_of!(timespec64, tv_sec) - 0usize]; + ["Offset of field: timespec64::tv_nsec"][::std::mem::offset_of!(timespec64, tv_nsec) - 8usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct wg_allowedip { + pub family: u16, + pub __bindgen_anon_1: wg_allowedip__bindgen_ty_1, + pub cidr: u8, + pub next_allowedip: *mut wg_allowedip, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union wg_allowedip__bindgen_ty_1 { + pub ip4: in_addr, + pub ip6: in6_addr, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_allowedip__bindgen_ty_1"] + [::std::mem::size_of::() - 16usize]; + ["Alignment of wg_allowedip__bindgen_ty_1"] + [::std::mem::align_of::() - 4usize]; + ["Offset of field: wg_allowedip__bindgen_ty_1::ip4"] + [::std::mem::offset_of!(wg_allowedip__bindgen_ty_1, ip4) - 0usize]; + ["Offset of field: wg_allowedip__bindgen_ty_1::ip6"] + [::std::mem::offset_of!(wg_allowedip__bindgen_ty_1, ip6) - 0usize]; +}; +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_allowedip"][::std::mem::size_of::() - 32usize]; + ["Alignment of wg_allowedip"][::std::mem::align_of::() - 8usize]; + ["Offset of field: wg_allowedip::family"] + [::std::mem::offset_of!(wg_allowedip, family) - 0usize]; + ["Offset of field: wg_allowedip::cidr"][::std::mem::offset_of!(wg_allowedip, cidr) - 20usize]; + ["Offset of field: wg_allowedip::next_allowedip"] + [::std::mem::offset_of!(wg_allowedip, next_allowedip) - 24usize]; +}; +pub const wg_peer_flags_WGPEER_REMOVE_ME: wg_peer_flags = 1; +pub const wg_peer_flags_WGPEER_REPLACE_ALLOWEDIPS: wg_peer_flags = 2; +pub const wg_peer_flags_WGPEER_HAS_PUBLIC_KEY: wg_peer_flags = 4; +pub const wg_peer_flags_WGPEER_HAS_PRESHARED_KEY: wg_peer_flags = 8; +pub const wg_peer_flags_WGPEER_HAS_PERSISTENT_KEEPALIVE_INTERVAL: wg_peer_flags = 16; +pub type wg_peer_flags = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Copy, Clone)] +pub union wg_endpoint { + pub addr: sockaddr, + pub addr4: sockaddr_in, + pub addr6: sockaddr_in6, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_endpoint"][::std::mem::size_of::() - 28usize]; + ["Alignment of wg_endpoint"][::std::mem::align_of::() - 4usize]; + ["Offset of field: wg_endpoint::addr"][::std::mem::offset_of!(wg_endpoint, addr) - 0usize]; + ["Offset of field: wg_endpoint::addr4"][::std::mem::offset_of!(wg_endpoint, addr4) - 0usize]; + ["Offset of field: wg_endpoint::addr6"][::std::mem::offset_of!(wg_endpoint, addr6) - 0usize]; +}; +#[repr(C)] +#[derive(Copy, Clone)] +pub struct wg_peer { + pub flags: wg_peer_flags, + pub public_key: wg_key, + pub preshared_key: wg_key, + pub endpoint: wg_endpoint, + pub last_handshake_time: timespec64, + pub rx_bytes: u64, + pub tx_bytes: u64, + pub persistent_keepalive_interval: u16, + pub first_allowedip: *mut wg_allowedip, + pub last_allowedip: *mut wg_allowedip, + pub next_peer: *mut wg_peer, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_peer"][::std::mem::size_of::() - 160usize]; + ["Alignment of wg_peer"][::std::mem::align_of::() - 8usize]; + ["Offset of field: wg_peer::flags"][::std::mem::offset_of!(wg_peer, flags) - 0usize]; + ["Offset of field: wg_peer::public_key"][::std::mem::offset_of!(wg_peer, public_key) - 4usize]; + ["Offset of field: wg_peer::preshared_key"] + [::std::mem::offset_of!(wg_peer, preshared_key) - 36usize]; + ["Offset of field: wg_peer::endpoint"][::std::mem::offset_of!(wg_peer, endpoint) - 68usize]; + ["Offset of field: wg_peer::last_handshake_time"] + [::std::mem::offset_of!(wg_peer, last_handshake_time) - 96usize]; + ["Offset of field: wg_peer::rx_bytes"][::std::mem::offset_of!(wg_peer, rx_bytes) - 112usize]; + ["Offset of field: wg_peer::tx_bytes"][::std::mem::offset_of!(wg_peer, tx_bytes) - 120usize]; + ["Offset of field: wg_peer::persistent_keepalive_interval"] + [::std::mem::offset_of!(wg_peer, persistent_keepalive_interval) - 128usize]; + ["Offset of field: wg_peer::first_allowedip"] + [::std::mem::offset_of!(wg_peer, first_allowedip) - 136usize]; + ["Offset of field: wg_peer::last_allowedip"] + [::std::mem::offset_of!(wg_peer, last_allowedip) - 144usize]; + ["Offset of field: wg_peer::next_peer"][::std::mem::offset_of!(wg_peer, next_peer) - 152usize]; +}; +pub const wg_device_flags_WGDEVICE_REPLACE_PEERS: wg_device_flags = 1; +pub const wg_device_flags_WGDEVICE_HAS_PRIVATE_KEY: wg_device_flags = 2; +pub const wg_device_flags_WGDEVICE_HAS_PUBLIC_KEY: wg_device_flags = 4; +pub const wg_device_flags_WGDEVICE_HAS_LISTEN_PORT: wg_device_flags = 8; +pub const wg_device_flags_WGDEVICE_HAS_FWMARK: wg_device_flags = 16; +pub type wg_device_flags = ::std::os::raw::c_uint; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct wg_device { + pub name: [::std::os::raw::c_char; 16usize], + pub ifindex: u32, + pub flags: wg_device_flags, + pub public_key: wg_key, + pub private_key: wg_key, + pub fwmark: u32, + pub listen_port: u16, + pub first_peer: *mut wg_peer, + pub last_peer: *mut wg_peer, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of wg_device"][::std::mem::size_of::() - 112usize]; + ["Alignment of wg_device"][::std::mem::align_of::() - 8usize]; + ["Offset of field: wg_device::name"][::std::mem::offset_of!(wg_device, name) - 0usize]; + ["Offset of field: wg_device::ifindex"][::std::mem::offset_of!(wg_device, ifindex) - 16usize]; + ["Offset of field: wg_device::flags"][::std::mem::offset_of!(wg_device, flags) - 20usize]; + ["Offset of field: wg_device::public_key"] + [::std::mem::offset_of!(wg_device, public_key) - 24usize]; + ["Offset of field: wg_device::private_key"] + [::std::mem::offset_of!(wg_device, private_key) - 56usize]; + ["Offset of field: wg_device::fwmark"][::std::mem::offset_of!(wg_device, fwmark) - 88usize]; + ["Offset of field: wg_device::listen_port"] + [::std::mem::offset_of!(wg_device, listen_port) - 92usize]; + ["Offset of field: wg_device::first_peer"] + [::std::mem::offset_of!(wg_device, first_peer) - 96usize]; + ["Offset of field: wg_device::last_peer"] + [::std::mem::offset_of!(wg_device, last_peer) - 104usize]; +}; +extern "C" { + pub fn wg_set_device(dev: *mut wg_device) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_get_device( + dev: *mut *mut wg_device, + device_name: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_add_device(device_name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_del_device(device_name: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_free_device(dev: *mut wg_device); +} +extern "C" { + pub fn wg_list_device_names() -> *mut ::std::os::raw::c_char; +} +extern "C" { + pub fn wg_key_to_base64(base64: *mut ::std::os::raw::c_char, key: *const u8); +} +extern "C" { + pub fn wg_key_from_base64( + key: *mut u8, + base64: *const ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +extern "C" { + pub fn wg_key_is_zero(key: *const u8) -> bool; +} +extern "C" { + pub fn wg_generate_public_key(public_key: *mut u8, private_key: *const u8); +} +extern "C" { + pub fn wg_generate_private_key(private_key: *mut u8); +} +extern "C" { + pub fn wg_generate_preshared_key(preshared_key: *mut u8); +} +extern "C" { + pub fn generate_new_peer( + pub_key: *mut wg_key, + ip: *mut ::std::os::raw::c_char, + port: ::std::os::raw::c_ushort, + ) -> wg_peer; +} +extern "C" { + pub fn generate_new_device( + priv_key: *mut wg_key, + device_name: *mut ::std::os::raw::c_char, + port: ::std::os::raw::c_ushort, + peer: wg_peer, + ) -> wg_device; +} +extern "C" { + pub fn it_works() -> ::std::os::raw::c_int; +} +extern "C" { + pub fn clean_device(peer: *mut wg_peer); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct iface { + pub _address: u8, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct __locale_data { + pub _address: u8, +}