diff --git a/c-ares-sys/CHANGELOG.md b/c-ares-sys/CHANGELOG.md index a4c757803..0770876fd 100644 --- a/c-ares-sys/CHANGELOG.md +++ b/c-ares-sys/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 9.5.0 (3 July 2024) + +- c-ares 1.32.0 + ## 9.4.0 (18 June 2024) - c-ares 1.31.0 diff --git a/c-ares-sys/Cargo.toml b/c-ares-sys/Cargo.toml index 834426126..ebc264514 100644 --- a/c-ares-sys/Cargo.toml +++ b/c-ares-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "c-ares-sys" license = "MIT" -version = "9.4.0" +version = "9.5.0" authors = ["David Hotham"] build = "build/main.rs" links = "cares" diff --git a/c-ares-sys/c-ares b/c-ares-sys/c-ares index 5899e96ec..4b653744b 160000 --- a/c-ares-sys/c-ares +++ b/c-ares-sys/c-ares @@ -1 +1 @@ -Subproject commit 5899e96ec9d846480545af46fdb7aa392db55f74 +Subproject commit 4b653744b4026373536a16a2a9f3c4af642664ef diff --git a/c-ares-sys/ffi.patch b/c-ares-sys/ffi.patch index 5036a4fa5..8d71811c2 100644 --- a/c-ares-sys/ffi.patch +++ b/c-ares-sys/ffi.patch @@ -1,5 +1,5 @@ ---- src/ffi.rs.orig 2024-06-07 18:30:42.815463862 +0100 -+++ src/ffi.rs 2024-06-07 18:30:42.835463835 +0100 +--- src/ffi.rs.orig 2024-07-03 18:33:52.918501780 +0100 ++++ src/ffi.rs 2024-07-03 18:35:50.388502992 +0100 @@ -1,13 +1,24 @@ /* automatically generated by rust-bindgen 0.69.4 */ +#![allow(non_camel_case_types, non_snake_case)] @@ -19,14 +19,14 @@ +#[cfg(unix)] +pub type ares_socket_t = ::std::os::unix::io::RawFd; - pub type ares_socklen_t = socklen_t; - pub type ares_ssize_t = isize; -pub type in_addr_t = u32; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct in_addr { - pub s_addr: in_addr_t, -} + pub type ares_socklen_t = socklen_t; + pub type ares_ssize_t = isize; + #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -51,7 +51,7 @@ pub server_failover_opts: ares_server_failover_options, } #[repr(C)] -@@ -1471,6 +1489,7 @@ +@@ -1510,6 +1528,7 @@ pub struct ares_addrinfo { pub cnames: *mut ares_addrinfo_cname, pub nodes: *mut ares_addrinfo_node, @@ -59,7 +59,7 @@ pub name: *mut ::std::os::raw::c_char, } #[repr(C)] -@@ -1681,3 +1700,17 @@ +@@ -1720,3 +1739,17 @@ #[doc = " Retrieve the total number of active queries pending answers from servers.\n Some c-ares requests may spawn multiple queries, such as ares_getaddrinfo()\n when using AF_UNSPEC, which will be reflected in this number.\n\n \\param[in] channel Initialized ares channel\n \\return Number of active queries to servers"] pub fn ares_queue_active_queries(channel: *const ares_channel_t) -> usize; } diff --git a/c-ares-sys/generate-constants.pl b/c-ares-sys/generate-constants.pl index 1cc9d3d7e..d71d0665f 100755 --- a/c-ares-sys/generate-constants.pl +++ b/c-ares-sys/generate-constants.pl @@ -12,6 +12,11 @@ sub print_values { my $value = $2; $value =~ s/^\(//; $value =~ s/\)$//; + + if ($flag =~ /\p{Lowercase}/) { + print "#[allow(non_upper_case_globals)]\n" + } + if ($value =~ /1 << 0/) { # Sidestep clippy's "identity_op" warning print "pub const $flag: c_int = 1;\n"; diff --git a/c-ares-sys/src/constants.rs b/c-ares-sys/src/constants.rs index 187382286..773a4f158 100644 --- a/c-ares-sys/src/constants.rs +++ b/c-ares-sys/src/constants.rs @@ -17,6 +17,8 @@ pub const ARES_FLAG_NOALIASES: c_int = 1 << 6; pub const ARES_FLAG_NOCHECKRESP: c_int = 1 << 7; pub const ARES_FLAG_EDNS: c_int = 1 << 8; pub const ARES_FLAG_NO_DFLT_SVR: c_int = 1 << 9; +#[allow(non_upper_case_globals)] +pub const ARES_FLAG_DNS0x20: c_int = 1 << 10; // Option mask values pub const ARES_OPT_FLAGS: c_int = 1; diff --git a/c-ares-sys/src/ffi.rs b/c-ares-sys/src/ffi.rs index c4ff85abd..77930859d 100644 --- a/c-ares-sys/src/ffi.rs +++ b/c-ares-sys/src/ffi.rs @@ -331,6 +331,8 @@ pub enum ares_dns_datatype_t { ARES_DATATYPE_BINP = 9, #[doc = "< Array of options. 16bit identifier, BIN\n data."] ARES_DATATYPE_OPT = 10, + #[doc = "< Array of binary data, likely printable.\n Guaranteed to have a NULL terminator for\n convenience (not included in length)"] + ARES_DATATYPE_ABINP = 11, } #[repr(u32)] #[doc = " Keys used for all RR Types. We take the record type and multiply by 100\n to ensure we have a proper offset between keys so we can keep these sorted"] @@ -366,7 +368,7 @@ pub enum ares_dns_rr_key_t { ARES_RR_MX_PREFERENCE = 1501, #[doc = " MX Record. Exchange, domain. Datatype: NAME"] ARES_RR_MX_EXCHANGE = 1502, - #[doc = " TXT Record. Data. Datatype: BINP"] + #[doc = " TXT Record. Data. Datatype: ABINP"] ARES_RR_TXT_DATA = 1601, #[doc = " SIG Record. Type Covered. Datatype: U16"] ARES_RR_SIG_TYPE_COVERED = 2401, @@ -703,6 +705,13 @@ extern "C" { #[doc = " Get the DNS Query ID\n\n \\param[in] dnsrec Initialized record object\n \\return DNS query id"] pub fn ares_dns_record_get_id(dnsrec: *const ares_dns_record_t) -> ::std::os::raw::c_ushort; } +extern "C" { + #[doc = " Overwrite the DNS query id\n\n \\param[in] dnsrec Initialized record object\n \\param[in] id DNS query id\n \\return ARES_TRUE on success, ARES_FALSE on usage error"] + pub fn ares_dns_record_set_id( + dnsrec: *mut ares_dns_record_t, + id: ::std::os::raw::c_ushort, + ) -> ares_bool_t; +} extern "C" { #[doc = " Get the DNS Record Flags\n\n \\param[in] dnsrec Initialized record object\n \\return One or more \\ares_dns_flags_t"] pub fn ares_dns_record_get_flags(dnsrec: *const ares_dns_record_t) -> ::std::os::raw::c_ushort; @@ -870,6 +879,23 @@ extern "C" { len: usize, ) -> ares_status_t; } +extern "C" { + #[doc = " Add binary array value (ABINP) data for specified resource record and key.\n Can only be used on keys with datatype ARES_DATATYPE_ABINP. The value will\n Be added as the last element in the array.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] val Pointer to binary data.\n \\param[in] len Length of binary data\n \\return ARES_SUCCESS on success"] + pub fn ares_dns_rr_add_abin( + dns_rr: *mut ares_dns_rr_t, + key: ares_dns_rr_key_t, + val: *const ::std::os::raw::c_uchar, + len: usize, + ) -> ares_status_t; +} +extern "C" { + #[doc = " Delete binary array value (ABINP) data for specified resource record and\n key by specified index. Can only be used on keys with datatype\n ARES_DATATYPE_ABINP. The value at the index will be deleted.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] idx Index to delete\n \\return ARES_SUCCESS on success"] + pub fn ares_dns_rr_del_abin( + dns_rr: *mut ares_dns_rr_t, + key: ares_dns_rr_key_t, + idx: usize, + ) -> ares_status_t; +} extern "C" { #[doc = " Set the option for the RR\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] opt Option record key id.\n \\param[out] val Optional. Value to associate with option.\n \\param[out] val_len Length of value passed.\n \\return ARES_SUCCESS on success"] pub fn ares_dns_rr_set_opt( @@ -923,13 +949,26 @@ extern "C" { ) -> ::std::os::raw::c_uint; } extern "C" { - #[doc = " Retrieve a pointer to the binary data. Can only be used on keys with\n datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP. If BINP, the data is\n guaranteed to have a NULL terminator which is NOT included in the length.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[out] len Length of binary data returned\n \\return pointer binary data or NULL on error"] + #[doc = " Retrieve a pointer to the binary data. Can only be used on keys with\n datatype ARES_DATATYPE_BIN, ARES_DATATYPE_BINP, or ARES_DATATYPE_ABINP.\n If BINP or ABINP, the data is guaranteed to have a NULL terminator which\n is NOT included in the length.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[out] len Length of binary data returned\n \\return pointer binary data or NULL on error"] pub fn ares_dns_rr_get_bin( dns_rr: *const ares_dns_rr_t, key: ares_dns_rr_key_t, len: *mut usize, ) -> *const ::std::os::raw::c_uchar; } +extern "C" { + #[doc = " Retrieve the count of the array of stored binary values. Can only be used on\n keys with datatype ARES_DATATYPE_ABINP.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return count of values"] + pub fn ares_dns_rr_get_abin_cnt(dns_rr: *const ares_dns_rr_t, key: ares_dns_rr_key_t) -> usize; +} +extern "C" { + #[doc = " Retrieve a pointer to the binary array data from the specified index. Can\n only be used on keys with datatype ARES_DATATYPE_ABINP. If ABINP, the data\n is guaranteed to have a NULL terminator which is NOT included in the length.\n If want all array membersconcatenated, may use ares_dns_rr_get_bin()\n instead.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] idx Index of value to retrieve\n \\param[out] len Length of binary data returned\n \\return pointer binary data or NULL on error"] + pub fn ares_dns_rr_get_abin( + dns_rr: *const ares_dns_rr_t, + key: ares_dns_rr_key_t, + idx: usize, + len: *mut usize, + ) -> *const ::std::os::raw::c_uchar; +} extern "C" { #[doc = " Retrieve the number of options stored for the RR.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return count, or 0 if none."] pub fn ares_dns_rr_get_opt_cnt(dns_rr: *const ares_dns_rr_t, key: ares_dns_rr_key_t) -> usize;