Skip to content

Commit

Permalink
c-ares 1.32 (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Jul 3, 2024
1 parent f874aed commit f27cab9
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 10 deletions.
4 changes: 4 additions & 0 deletions c-ares-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion c-ares-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion c-ares-sys/c-ares
Submodule c-ares updated 158 files
12 changes: 6 additions & 6 deletions c-ares-sys/ffi.patch
Original file line number Diff line number Diff line change
@@ -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)]
Expand All @@ -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)]
Expand All @@ -51,15 +51,15 @@
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,
+ #[cfg(cares1_18)]
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;
}
Expand Down
5 changes: 5 additions & 0 deletions c-ares-sys/generate-constants.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 2 additions & 0 deletions c-ares-sys/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
43 changes: 41 additions & 2 deletions c-ares-sys/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f27cab9

Please sign in to comment.