1#![allow(non_camel_case_types, non_snake_case)]
3use c_types::fd_set;
4use c_types::hostent;
5use c_types::in_addr;
6use c_types::iovec;
7use c_types::sockaddr;
8use c_types::socklen_t;
9pub use libc::timeval;
10
11#[cfg(target_os = "android")]
12use jni_sys;
13
14#[cfg(windows)]
15pub type ares_socket_t = ::std::os::windows::io::RawSocket;
16#[cfg(unix)]
17pub type ares_socket_t = ::std::os::unix::io::RawFd;
18
19pub type ares_socklen_t = socklen_t;
20pub type ares_ssize_t = isize;
21#[repr(u32)]
22#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
23pub enum ares_status_t {
24 ARES_SUCCESS = 0,
25 ARES_ENODATA = 1,
26 ARES_EFORMERR = 2,
27 ARES_ESERVFAIL = 3,
28 ARES_ENOTFOUND = 4,
29 ARES_ENOTIMP = 5,
30 ARES_EREFUSED = 6,
31 ARES_EBADQUERY = 7,
32 ARES_EBADNAME = 8,
33 ARES_EBADFAMILY = 9,
34 ARES_EBADRESP = 10,
35 ARES_ECONNREFUSED = 11,
36 ARES_ETIMEOUT = 12,
37 ARES_EOF = 13,
38 ARES_EFILE = 14,
39 ARES_ENOMEM = 15,
40 ARES_EDESTRUCTION = 16,
41 ARES_EBADSTR = 17,
42 ARES_EBADFLAGS = 18,
43 ARES_ENONAME = 19,
44 ARES_EBADHINTS = 20,
45 ARES_ENOTINITIALIZED = 21,
46 ARES_ELOADIPHLPAPI = 22,
47 ARES_EADDRGETNETWORKPARAMS = 23,
48 ARES_ECANCELLED = 24,
49 ARES_ESERVICE = 25,
50 ARES_ENOSERVER = 26,
51}
52#[repr(u32)]
53#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
54pub enum ares_bool_t {
55 ARES_FALSE = 0,
56 ARES_TRUE = 1,
57}
58#[repr(u32)]
59#[doc = " Values for ARES_OPT_EVENT_THREAD"]
60#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
61pub enum ares_evsys_t {
62 #[doc = " Default (best choice) event system"]
63 ARES_EVSYS_DEFAULT = 0,
64 #[doc = " Win32 IOCP/AFD_POLL event system"]
65 ARES_EVSYS_WIN32 = 1,
66 #[doc = " Linux epoll"]
67 ARES_EVSYS_EPOLL = 2,
68 #[doc = " BSD/MacOS kqueue"]
69 ARES_EVSYS_KQUEUE = 3,
70 #[doc = " POSIX poll()"]
71 ARES_EVSYS_POLL = 4,
72 #[doc = " last fallback on Unix-like systems, select()"]
73 ARES_EVSYS_SELECT = 5,
74}
75pub type ares_sock_state_cb = ::core::option::Option<
76 unsafe extern "C" fn(
77 data: *mut ::core::ffi::c_void,
78 socket_fd: ares_socket_t,
79 readable: ::core::ffi::c_int,
80 writable: ::core::ffi::c_int,
81 ),
82>;
83#[repr(C)]
84#[derive(Debug)]
85pub struct apattern {
86 _unused: [u8; 0],
87}
88#[repr(C)]
89#[derive(Debug, Copy, Clone)]
90pub struct ares_server_failover_options {
91 pub retry_chance: ::core::ffi::c_ushort,
92 pub retry_delay: usize,
93}
94#[repr(C)]
95#[derive(Debug, Copy, Clone)]
96pub struct ares_options {
97 pub flags: ::core::ffi::c_int,
98 pub timeout: ::core::ffi::c_int,
99 pub tries: ::core::ffi::c_int,
100 pub ndots: ::core::ffi::c_int,
101 pub udp_port: ::core::ffi::c_ushort,
102 pub tcp_port: ::core::ffi::c_ushort,
103 pub socket_send_buffer_size: ::core::ffi::c_int,
104 pub socket_receive_buffer_size: ::core::ffi::c_int,
105 pub servers: *mut in_addr,
106 pub nservers: ::core::ffi::c_int,
107 pub domains: *mut *mut ::core::ffi::c_char,
108 pub ndomains: ::core::ffi::c_int,
109 pub lookups: *mut ::core::ffi::c_char,
110 pub sock_state_cb: ares_sock_state_cb,
111 pub sock_state_cb_data: *mut ::core::ffi::c_void,
112 pub sortlist: *mut apattern,
113 pub nsort: ::core::ffi::c_int,
114 pub ednspsz: ::core::ffi::c_int,
115 pub resolvconf_path: *mut ::core::ffi::c_char,
116 #[cfg(cares1_19)]
117 pub hosts_path: *mut ::core::ffi::c_char,
118 #[cfg(cares1_20)]
119 pub udp_max_queries: ::core::ffi::c_int,
120 #[cfg(cares1_22)]
121 pub maxtimeout: ::core::ffi::c_int,
122 #[cfg(cares1_23)]
123 pub qcache_max_ttl: ::core::ffi::c_uint,
124 #[cfg(cares1_26)]
125 pub evsys: ares_evsys_t,
126 #[cfg(cares1_29)]
127 pub server_failover_opts: ares_server_failover_options,
128}
129#[repr(C)]
130#[derive(Debug)]
131pub struct ares_channeldata {
132 _unused: [u8; 0],
133}
134pub type ares_channel = *mut ares_channeldata;
135pub type ares_channel_t = ares_channeldata;
136#[repr(C)]
137#[derive(Copy, Clone)]
138pub struct ares_in6_addr {
139 pub _S6_un: ares_in6_addr__bindgen_ty_1,
140}
141#[repr(C)]
142#[derive(Copy, Clone)]
143pub union ares_in6_addr__bindgen_ty_1 {
144 pub _S6_u8: [::core::ffi::c_uchar; 16usize],
145}
146#[repr(C)]
147#[derive(Copy, Clone)]
148pub struct ares_addr {
149 pub family: ::core::ffi::c_int,
150 pub addr: ares_addr__bindgen_ty_1,
151}
152#[repr(C)]
153#[derive(Copy, Clone)]
154pub union ares_addr__bindgen_ty_1 {
155 pub addr4: in_addr,
156 pub addr6: ares_in6_addr,
157}
158impl ares_dns_rec_type_t {
159 #[doc = "< Host address."]
160 pub const ARES_REC_TYPE_A: ares_dns_rec_type_t = ares_dns_rec_type_t(1);
161 #[doc = "< Authoritative server."]
162 pub const ARES_REC_TYPE_NS: ares_dns_rec_type_t = ares_dns_rec_type_t(2);
163 #[doc = "< Canonical name."]
164 pub const ARES_REC_TYPE_CNAME: ares_dns_rec_type_t = ares_dns_rec_type_t(5);
165 #[doc = "< Start of authority zone."]
166 pub const ARES_REC_TYPE_SOA: ares_dns_rec_type_t = ares_dns_rec_type_t(6);
167 #[doc = "< Domain name pointer."]
168 pub const ARES_REC_TYPE_PTR: ares_dns_rec_type_t = ares_dns_rec_type_t(12);
169 #[doc = "< Host information."]
170 pub const ARES_REC_TYPE_HINFO: ares_dns_rec_type_t = ares_dns_rec_type_t(13);
171 #[doc = "< Mail routing information."]
172 pub const ARES_REC_TYPE_MX: ares_dns_rec_type_t = ares_dns_rec_type_t(15);
173 #[doc = "< Text strings."]
174 pub const ARES_REC_TYPE_TXT: ares_dns_rec_type_t = ares_dns_rec_type_t(16);
175 #[doc = "< RFC 2535 / RFC 2931. SIG Record"]
176 pub const ARES_REC_TYPE_SIG: ares_dns_rec_type_t = ares_dns_rec_type_t(24);
177 #[doc = "< RFC 3596. Ip6 Address."]
178 pub const ARES_REC_TYPE_AAAA: ares_dns_rec_type_t = ares_dns_rec_type_t(28);
179 #[doc = "< RFC 2782. Server Selection."]
180 pub const ARES_REC_TYPE_SRV: ares_dns_rec_type_t = ares_dns_rec_type_t(33);
181 #[doc = "< RFC 3403. Naming Authority Pointer"]
182 pub const ARES_REC_TYPE_NAPTR: ares_dns_rec_type_t = ares_dns_rec_type_t(35);
183 #[doc = "< RFC 6891. EDNS0 option (meta-RR)"]
184 pub const ARES_REC_TYPE_OPT: ares_dns_rec_type_t = ares_dns_rec_type_t(41);
185 #[doc = "< RFC 6698. DNS-Based Authentication of Named\n Entities (DANE) Transport Layer Security\n (TLS) Protocol: TLSA"]
186 pub const ARES_REC_TYPE_TLSA: ares_dns_rec_type_t = ares_dns_rec_type_t(52);
187 #[doc = "< RFC 9460. General Purpose Service Binding"]
188 pub const ARES_REC_TYPE_SVCB: ares_dns_rec_type_t = ares_dns_rec_type_t(64);
189 #[doc = "< RFC 9460. Service Binding type for use with\n HTTPS"]
190 pub const ARES_REC_TYPE_HTTPS: ares_dns_rec_type_t = ares_dns_rec_type_t(65);
191 #[doc = "< Wildcard match. Not response RR."]
192 pub const ARES_REC_TYPE_ANY: ares_dns_rec_type_t = ares_dns_rec_type_t(255);
193 #[doc = "< RFC 7553. Uniform Resource Identifier"]
194 pub const ARES_REC_TYPE_URI: ares_dns_rec_type_t = ares_dns_rec_type_t(256);
195 #[doc = "< RFC 6844. Certification Authority\n Authorization."]
196 pub const ARES_REC_TYPE_CAA: ares_dns_rec_type_t = ares_dns_rec_type_t(257);
197 #[doc = "< Used as an indicator that the RR record\n is not parsed, but provided in wire\n format"]
198 pub const ARES_REC_TYPE_RAW_RR: ares_dns_rec_type_t = ares_dns_rec_type_t(65536);
199}
200#[repr(transparent)]
201#[doc = " DNS Record types handled by c-ares. Some record types may only be valid\n on requests (e.g. ARES_REC_TYPE_ANY), and some may only be valid on\n responses"]
202#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
203pub struct ares_dns_rec_type_t(pub ::core::ffi::c_uint);
204impl ares_dns_class_t {
205 #[doc = "< Internet"]
206 pub const ARES_CLASS_IN: ares_dns_class_t = ares_dns_class_t(1);
207 #[doc = "< CHAOS"]
208 pub const ARES_CLASS_CHAOS: ares_dns_class_t = ares_dns_class_t(3);
209 #[doc = "< Hesiod [Dyer 87]"]
210 pub const ARES_CLASS_HESIOD: ares_dns_class_t = ares_dns_class_t(4);
211 #[doc = "< typo from older c-ares version for Hesiod"]
212 pub const ARES_CLASS_HESOID: ares_dns_class_t = ares_dns_class_t(4);
213 #[doc = "< RFC 2136"]
214 pub const ARES_CLASS_NONE: ares_dns_class_t = ares_dns_class_t(254);
215 #[doc = "< Any class (requests only)"]
216 pub const ARES_CLASS_ANY: ares_dns_class_t = ares_dns_class_t(255);
217}
218#[repr(transparent)]
219#[doc = " DNS Classes for requests and responses."]
220#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
221pub struct ares_dns_class_t(pub ::core::ffi::c_uint);
222#[repr(u32)]
223#[doc = " DNS RR Section type"]
224#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
225pub enum ares_dns_section_t {
226 #[doc = "< Answer section"]
227 ARES_SECTION_ANSWER = 1,
228 #[doc = "< Authority section"]
229 ARES_SECTION_AUTHORITY = 2,
230 #[doc = "< Additional information section"]
231 ARES_SECTION_ADDITIONAL = 3,
232}
233#[repr(u32)]
234#[doc = " DNS Header opcodes"]
235#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
236pub enum ares_dns_opcode_t {
237 #[doc = "< Standard query"]
238 ARES_OPCODE_QUERY = 0,
239 #[doc = "< Inverse query. Obsolete."]
240 ARES_OPCODE_IQUERY = 1,
241 #[doc = "< Name server status query"]
242 ARES_OPCODE_STATUS = 2,
243 #[doc = "< Zone change notification (RFC 1996)"]
244 ARES_OPCODE_NOTIFY = 4,
245 #[doc = "< Zone update message (RFC2136)"]
246 ARES_OPCODE_UPDATE = 5,
247}
248#[repr(u32)]
249#[doc = " DNS Header flags"]
250#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
251pub enum ares_dns_flags_t {
252 #[doc = "< QR. If set, is a response"]
253 ARES_FLAG_QR = 1,
254 #[doc = "< Authoritative Answer. If set, is authoritative"]
255 ARES_FLAG_AA = 2,
256 #[doc = "< Truncation. If set, is truncated response"]
257 ARES_FLAG_TC = 4,
258 #[doc = "< Recursion Desired. If set, recursion is desired"]
259 ARES_FLAG_RD = 8,
260 #[doc = "< Recursion Available. If set, server supports\n recursion"]
261 ARES_FLAG_RA = 16,
262 #[doc = "< RFC 2065. Authentic Data bit indicates in a\n response that the data included has been verified by\n the server providing it"]
263 ARES_FLAG_AD = 32,
264 #[doc = "< RFC 2065. Checking Disabled bit indicates in a\n query that non-verified data is acceptable to the\n resolver sending the query."]
265 ARES_FLAG_CD = 64,
266}
267#[repr(u32)]
268#[doc = " DNS Response Codes from server"]
269#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
270pub enum ares_dns_rcode_t {
271 #[doc = "< Success"]
272 ARES_RCODE_NOERROR = 0,
273 #[doc = "< Format error. The name server was unable\n to interpret the query."]
274 ARES_RCODE_FORMERR = 1,
275 #[doc = "< Server Failure. The name server was\n unable to process this query due to a\n problem with the nameserver"]
276 ARES_RCODE_SERVFAIL = 2,
277 #[doc = "< Name Error. Meaningful only for\n responses from an authoritative name\n server, this code signifies that the\n domain name referenced in the query does\n not exist."]
278 ARES_RCODE_NXDOMAIN = 3,
279 #[doc = "< Not implemented. The name server does\n not support the requested kind of\n query"]
280 ARES_RCODE_NOTIMP = 4,
281 #[doc = "< Refused. The name server refuses to\n perform the specified operation for\n policy reasons."]
282 ARES_RCODE_REFUSED = 5,
283 #[doc = "< RFC 2136. Some name that ought not to\n exist, does exist."]
284 ARES_RCODE_YXDOMAIN = 6,
285 #[doc = "< RFC 2136. Some RRset that ought to not\n exist, does exist."]
286 ARES_RCODE_YXRRSET = 7,
287 #[doc = "< RFC 2136. Some RRset that ought to exist,\n does not exist."]
288 ARES_RCODE_NXRRSET = 8,
289 #[doc = "< RFC 2136. The server is not authoritative\n for the zone named in the Zone section."]
290 ARES_RCODE_NOTAUTH = 9,
291 #[doc = "< RFC 2136. A name used in the Prerequisite\n or Update Section is not within the zone\n denoted by the Zone Section."]
292 ARES_RCODE_NOTZONE = 10,
293 #[doc = "< RFC 8409. DSO-TYPE Not implemented"]
294 ARES_RCODE_DSOTYPEI = 11,
295 #[doc = "< RFC 8945. TSIG Signature Failure"]
296 ARES_RCODE_BADSIG = 16,
297 #[doc = "< RFC 8945. Key not recognized."]
298 ARES_RCODE_BADKEY = 17,
299 #[doc = "< RFC 8945. Signature out of time window."]
300 ARES_RCODE_BADTIME = 18,
301 #[doc = "< RFC 2930. Bad TKEY Mode"]
302 ARES_RCODE_BADMODE = 19,
303 #[doc = "< RFC 2930. Duplicate Key Name"]
304 ARES_RCODE_BADNAME = 20,
305 #[doc = "< RFC 2930. Algorithm not supported"]
306 ARES_RCODE_BADALG = 21,
307 #[doc = "< RFC 8945. Bad Truncation"]
308 ARES_RCODE_BADTRUNC = 22,
309 #[doc = "< RFC 7873. Bad/missing Server Cookie"]
310 ARES_RCODE_BADCOOKIE = 23,
311}
312#[repr(u32)]
313#[doc = " Data types used"]
314#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
315pub enum ares_dns_datatype_t {
316 #[doc = "< struct in_addr * type"]
317 ARES_DATATYPE_INADDR = 1,
318 #[doc = "< struct ares_in6_addr * type"]
319 ARES_DATATYPE_INADDR6 = 2,
320 #[doc = "< 8bit unsigned integer"]
321 ARES_DATATYPE_U8 = 3,
322 #[doc = "< 16bit unsigned integer"]
323 ARES_DATATYPE_U16 = 4,
324 #[doc = "< 32bit unsigned integer"]
325 ARES_DATATYPE_U32 = 5,
326 #[doc = "< Null-terminated string of a domain name"]
327 ARES_DATATYPE_NAME = 6,
328 #[doc = "< Null-terminated string"]
329 ARES_DATATYPE_STR = 7,
330 #[doc = "< Binary data"]
331 ARES_DATATYPE_BIN = 8,
332 #[doc = "< Officially defined as binary data, but likely\n printable. Guaranteed to have a NULL\n terminator for convenience (not included in\n length)"]
333 ARES_DATATYPE_BINP = 9,
334 #[doc = "< Array of options. 16bit identifier, BIN\n data."]
335 ARES_DATATYPE_OPT = 10,
336 #[doc = "< Array of binary data, likely printable.\n Guaranteed to have a NULL terminator for\n convenience (not included in length)"]
337 ARES_DATATYPE_ABINP = 11,
338}
339#[repr(u32)]
340#[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"]
341#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
342pub enum ares_dns_rr_key_t {
343 #[doc = " A Record. Address. Datatype: INADDR"]
344 ARES_RR_A_ADDR = 101,
345 #[doc = " NS Record. Name. Datatype: NAME"]
346 ARES_RR_NS_NSDNAME = 201,
347 #[doc = " CNAME Record. CName. Datatype: NAME"]
348 ARES_RR_CNAME_CNAME = 501,
349 #[doc = " SOA Record. MNAME, Primary Source of Data. Datatype: NAME"]
350 ARES_RR_SOA_MNAME = 601,
351 #[doc = " SOA Record. RNAME, Mailbox of person responsible. Datatype: NAME"]
352 ARES_RR_SOA_RNAME = 602,
353 #[doc = " SOA Record. Serial, version. Datatype: U32"]
354 ARES_RR_SOA_SERIAL = 603,
355 #[doc = " SOA Record. Refresh, zone refersh interval. Datatype: U32"]
356 ARES_RR_SOA_REFRESH = 604,
357 #[doc = " SOA Record. Retry, failed refresh retry interval. Datatype: U32"]
358 ARES_RR_SOA_RETRY = 605,
359 #[doc = " SOA Record. Expire, upper limit on authority. Datatype: U32"]
360 ARES_RR_SOA_EXPIRE = 606,
361 #[doc = " SOA Record. Minimum, RR TTL. Datatype: U32"]
362 ARES_RR_SOA_MINIMUM = 607,
363 #[doc = " PTR Record. DNAME, pointer domain. Datatype: NAME"]
364 ARES_RR_PTR_DNAME = 1201,
365 #[doc = " HINFO Record. CPU. Datatype: STR"]
366 ARES_RR_HINFO_CPU = 1301,
367 #[doc = " HINFO Record. OS. Datatype: STR"]
368 ARES_RR_HINFO_OS = 1302,
369 #[doc = " MX Record. Preference. Datatype: U16"]
370 ARES_RR_MX_PREFERENCE = 1501,
371 #[doc = " MX Record. Exchange, domain. Datatype: NAME"]
372 ARES_RR_MX_EXCHANGE = 1502,
373 #[doc = " TXT Record. Data. Datatype: ABINP"]
374 ARES_RR_TXT_DATA = 1601,
375 #[doc = " SIG Record. Type Covered. Datatype: U16"]
376 ARES_RR_SIG_TYPE_COVERED = 2401,
377 #[doc = " SIG Record. Algorithm. Datatype: U8"]
378 ARES_RR_SIG_ALGORITHM = 2402,
379 #[doc = " SIG Record. Labels. Datatype: U8"]
380 ARES_RR_SIG_LABELS = 2403,
381 #[doc = " SIG Record. Original TTL. Datatype: U32"]
382 ARES_RR_SIG_ORIGINAL_TTL = 2404,
383 #[doc = " SIG Record. Signature Expiration. Datatype: U32"]
384 ARES_RR_SIG_EXPIRATION = 2405,
385 #[doc = " SIG Record. Signature Inception. Datatype: U32"]
386 ARES_RR_SIG_INCEPTION = 2406,
387 #[doc = " SIG Record. Key Tag. Datatype: U16"]
388 ARES_RR_SIG_KEY_TAG = 2407,
389 #[doc = " SIG Record. Signers Name. Datatype: NAME"]
390 ARES_RR_SIG_SIGNERS_NAME = 2408,
391 #[doc = " SIG Record. Signature. Datatype: BIN"]
392 ARES_RR_SIG_SIGNATURE = 2409,
393 #[doc = " AAAA Record. Address. Datatype: INADDR6"]
394 ARES_RR_AAAA_ADDR = 2801,
395 #[doc = " SRV Record. Priority. Datatype: U16"]
396 ARES_RR_SRV_PRIORITY = 3302,
397 #[doc = " SRV Record. Weight. Datatype: U16"]
398 ARES_RR_SRV_WEIGHT = 3303,
399 #[doc = " SRV Record. Port. Datatype: U16"]
400 ARES_RR_SRV_PORT = 3304,
401 #[doc = " SRV Record. Target domain. Datatype: NAME"]
402 ARES_RR_SRV_TARGET = 3305,
403 #[doc = " NAPTR Record. Order. Datatype: U16"]
404 ARES_RR_NAPTR_ORDER = 3501,
405 #[doc = " NAPTR Record. Preference. Datatype: U16"]
406 ARES_RR_NAPTR_PREFERENCE = 3502,
407 #[doc = " NAPTR Record. Flags. Datatype: STR"]
408 ARES_RR_NAPTR_FLAGS = 3503,
409 #[doc = " NAPTR Record. Services. Datatype: STR"]
410 ARES_RR_NAPTR_SERVICES = 3504,
411 #[doc = " NAPTR Record. Regexp. Datatype: STR"]
412 ARES_RR_NAPTR_REGEXP = 3505,
413 #[doc = " NAPTR Record. Replacement. Datatype: NAME"]
414 ARES_RR_NAPTR_REPLACEMENT = 3506,
415 #[doc = " OPT Record. UDP Size. Datatype: U16"]
416 ARES_RR_OPT_UDP_SIZE = 4101,
417 #[doc = " OPT Record. Version. Datatype: U8"]
418 ARES_RR_OPT_VERSION = 4103,
419 #[doc = " OPT Record. Flags. Datatype: U16"]
420 ARES_RR_OPT_FLAGS = 4104,
421 #[doc = " OPT Record. Options. Datatype: OPT"]
422 ARES_RR_OPT_OPTIONS = 4105,
423 #[doc = " TLSA Record. Certificate Usage. Datatype: U8"]
424 ARES_RR_TLSA_CERT_USAGE = 5201,
425 #[doc = " TLSA Record. Selector. Datatype: U8"]
426 ARES_RR_TLSA_SELECTOR = 5202,
427 #[doc = " TLSA Record. Matching Type. Datatype: U8"]
428 ARES_RR_TLSA_MATCH = 5203,
429 #[doc = " TLSA Record. Certificate Association Data. Datatype: BIN"]
430 ARES_RR_TLSA_DATA = 5204,
431 #[doc = " SVCB Record. SvcPriority. Datatype: U16"]
432 ARES_RR_SVCB_PRIORITY = 6401,
433 #[doc = " SVCB Record. TargetName. Datatype: NAME"]
434 ARES_RR_SVCB_TARGET = 6402,
435 #[doc = " SVCB Record. SvcParams. Datatype: OPT"]
436 ARES_RR_SVCB_PARAMS = 6403,
437 #[doc = " HTTPS Record. SvcPriority. Datatype: U16"]
438 ARES_RR_HTTPS_PRIORITY = 6501,
439 #[doc = " HTTPS Record. TargetName. Datatype: NAME"]
440 ARES_RR_HTTPS_TARGET = 6502,
441 #[doc = " HTTPS Record. SvcParams. Datatype: OPT"]
442 ARES_RR_HTTPS_PARAMS = 6503,
443 #[doc = " URI Record. Priority. Datatype: U16"]
444 ARES_RR_URI_PRIORITY = 25601,
445 #[doc = " URI Record. Weight. Datatype: U16"]
446 ARES_RR_URI_WEIGHT = 25602,
447 #[doc = " URI Record. Target domain. Datatype: NAME"]
448 ARES_RR_URI_TARGET = 25603,
449 #[doc = " CAA Record. Critical flag. Datatype: U8"]
450 ARES_RR_CAA_CRITICAL = 25701,
451 #[doc = " CAA Record. Tag/Property. Datatype: STR"]
452 ARES_RR_CAA_TAG = 25702,
453 #[doc = " CAA Record. Value. Datatype: BINP"]
454 ARES_RR_CAA_VALUE = 25703,
455 #[doc = " RAW Record. RR Type. Datatype: U16"]
456 ARES_RR_RAW_RR_TYPE = 6553601,
457 #[doc = " RAW Record. RR Data. Datatype: BIN"]
458 ARES_RR_RAW_RR_DATA = 6553602,
459}
460#[repr(u32)]
461#[doc = " TLSA Record ARES_RR_TLSA_CERT_USAGE known values"]
462#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
463pub enum ares_tlsa_usage_t {
464 #[doc = " Certificate Usage 0. CA Constraint."]
465 ARES_TLSA_USAGE_CA = 0,
466 #[doc = " Certificate Usage 1. Service Certificate Constraint."]
467 ARES_TLSA_USAGE_SERVICE = 1,
468 #[doc = " Certificate Usage 2. Trust Anchor Assertion."]
469 ARES_TLSA_USAGE_TRUSTANCHOR = 2,
470 #[doc = " Certificate Usage 3. Domain-issued certificate."]
471 ARES_TLSA_USAGE_DOMAIN = 3,
472}
473#[repr(u32)]
474#[doc = " TLSA Record ARES_RR_TLSA_SELECTOR known values"]
475#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
476pub enum ares_tlsa_selector_t {
477 #[doc = " Full Certificate"]
478 ARES_TLSA_SELECTOR_FULL = 0,
479 #[doc = " DER-encoded SubjectPublicKeyInfo"]
480 ARES_TLSA_SELECTOR_SUBJPUBKEYINFO = 1,
481}
482#[repr(u32)]
483#[doc = " TLSA Record ARES_RR_TLSA_MATCH known values"]
484#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
485pub enum ares_tlsa_match_t {
486 #[doc = " Exact match"]
487 ARES_TLSA_MATCH_EXACT = 0,
488 #[doc = " Sha256 match"]
489 ARES_TLSA_MATCH_SHA256 = 1,
490 #[doc = " Sha512 match"]
491 ARES_TLSA_MATCH_SHA512 = 2,
492}
493#[repr(u32)]
494#[doc = " SVCB (and HTTPS) RR known parameters"]
495#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
496pub enum ares_svcb_param_t {
497 #[doc = " Mandatory keys in this RR (RFC 9460 Section 8)"]
498 ARES_SVCB_PARAM_MANDATORY = 0,
499 #[doc = " Additional supported protocols (RFC 9460 Section 7.1)"]
500 ARES_SVCB_PARAM_ALPN = 1,
501 #[doc = " No support for default protocol (RFC 9460 Section 7.1)"]
502 ARES_SVCB_PARAM_NO_DEFAULT_ALPN = 2,
503 #[doc = " Port for alternative endpoint (RFC 9460 Section 7.2)"]
504 ARES_SVCB_PARAM_PORT = 3,
505 #[doc = " IPv4 address hints (RFC 9460 Section 7.3)"]
506 ARES_SVCB_PARAM_IPV4HINT = 4,
507 #[doc = " RESERVED (held for Encrypted ClientHello)"]
508 ARES_SVCB_PARAM_ECH = 5,
509 #[doc = " IPv6 address hints (RFC 9460 Section 7.3)"]
510 ARES_SVCB_PARAM_IPV6HINT = 6,
511}
512#[repr(u32)]
513#[doc = " OPT RR known parameters"]
514#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
515pub enum ares_opt_param_t {
516 #[doc = " RFC 8764. Apple's DNS Long-Lived Queries Protocol"]
517 ARES_OPT_PARAM_LLQ = 1,
518 #[doc = " http://files.dns-sd.org/draft-sekar-dns-ul.txt: Update Lease"]
519 ARES_OPT_PARAM_UL = 2,
520 #[doc = " RFC 5001. Name Server Identification"]
521 ARES_OPT_PARAM_NSID = 3,
522 #[doc = " RFC 6975. DNSSEC Algorithm Understood"]
523 ARES_OPT_PARAM_DAU = 5,
524 #[doc = " RFC 6975. DS Hash Understood"]
525 ARES_OPT_PARAM_DHU = 6,
526 #[doc = " RFC 6975. NSEC3 Hash Understood"]
527 ARES_OPT_PARAM_N3U = 7,
528 #[doc = " RFC 7871. Client Subnet"]
529 ARES_OPT_PARAM_EDNS_CLIENT_SUBNET = 8,
530 #[doc = " RFC 7314. Expire Timer"]
531 ARES_OPT_PARAM_EDNS_EXPIRE = 9,
532 #[doc = " RFC 7873. Client and Server Cookies"]
533 ARES_OPT_PARAM_COOKIE = 10,
534 #[doc = " RFC 7828. TCP Keepalive timeout"]
535 ARES_OPT_PARAM_EDNS_TCP_KEEPALIVE = 11,
536 #[doc = " RFC 7830. Padding"]
537 ARES_OPT_PARAM_PADDING = 12,
538 #[doc = " RFC 7901. Chain query requests"]
539 ARES_OPT_PARAM_CHAIN = 13,
540 #[doc = " RFC 8145. Signaling Trust Anchor Knowledge in DNSSEC"]
541 ARES_OPT_PARAM_EDNS_KEY_TAG = 14,
542 #[doc = " RFC 8914. Extended ERROR code and message"]
543 ARES_OPT_PARAM_EXTENDED_DNS_ERROR = 15,
544}
545#[repr(u32)]
546#[doc = " Data type for option records for keys like ARES_RR_OPT_OPTIONS and\n ARES_RR_HTTPS_PARAMS returned by ares_dns_opt_get_datatype()"]
547#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
548pub enum ares_dns_opt_datatype_t {
549 #[doc = " No value allowed for this option"]
550 ARES_OPT_DATATYPE_NONE = 1,
551 #[doc = " List of strings, each prefixed with a single octet representing the length"]
552 ARES_OPT_DATATYPE_STR_LIST = 2,
553 #[doc = " List of 8bit integers, concatenated"]
554 ARES_OPT_DATATYPE_U8_LIST = 3,
555 #[doc = " 16bit integer in network byte order"]
556 ARES_OPT_DATATYPE_U16 = 4,
557 #[doc = " list of 16bit integer in network byte order, concatenated."]
558 ARES_OPT_DATATYPE_U16_LIST = 5,
559 #[doc = " 32bit integer in network byte order"]
560 ARES_OPT_DATATYPE_U32 = 6,
561 #[doc = " list 32bit integer in network byte order, concatenated"]
562 ARES_OPT_DATATYPE_U32_LIST = 7,
563 #[doc = " List of ipv4 addresses in network byte order, concatenated"]
564 ARES_OPT_DATATYPE_INADDR4_LIST = 8,
565 #[doc = " List of ipv6 addresses in network byte order, concatenated"]
566 ARES_OPT_DATATYPE_INADDR6_LIST = 9,
567 #[doc = " Binary Data"]
568 ARES_OPT_DATATYPE_BIN = 10,
569 #[doc = " DNS Domain Name Format"]
570 ARES_OPT_DATATYPE_NAME = 11,
571}
572#[repr(u32)]
573#[doc = " Data type for flags to ares_dns_parse()"]
574#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
575pub enum ares_dns_parse_flags_t {
576 #[doc = " Parse Answers from RFC 1035 that allow name compression as RAW"]
577 ARES_DNS_PARSE_AN_BASE_RAW = 1,
578 #[doc = " Parse Authority from RFC 1035 that allow name compression as RAW"]
579 ARES_DNS_PARSE_NS_BASE_RAW = 2,
580 #[doc = " Parse Additional from RFC 1035 that allow name compression as RAW"]
581 ARES_DNS_PARSE_AR_BASE_RAW = 4,
582 #[doc = " Parse Answers from later RFCs (no name compression) RAW"]
583 ARES_DNS_PARSE_AN_EXT_RAW = 8,
584 #[doc = " Parse Authority from later RFCs (no name compression) as RAW"]
585 ARES_DNS_PARSE_NS_EXT_RAW = 16,
586 #[doc = " Parse Additional from later RFCs (no name compression) as RAW"]
587 ARES_DNS_PARSE_AR_EXT_RAW = 32,
588}
589unsafe extern "C" {
590 #[doc = " String representation of DNS Record Type\n\n \\param[in] type DNS Record Type\n \\return string"]
591 pub fn ares_dns_rec_type_tostr(type_: ares_dns_rec_type_t) -> *const ::core::ffi::c_char;
592}
593unsafe extern "C" {
594 #[doc = " String representation of DNS Class\n\n \\param[in] qclass DNS Class\n \\return string"]
595 pub fn ares_dns_class_tostr(qclass: ares_dns_class_t) -> *const ::core::ffi::c_char;
596}
597unsafe extern "C" {
598 #[doc = " String representation of DNS OpCode\n\n \\param[in] opcode DNS OpCode\n \\return string"]
599 pub fn ares_dns_opcode_tostr(opcode: ares_dns_opcode_t) -> *const ::core::ffi::c_char;
600}
601unsafe extern "C" {
602 #[doc = " String representation of DNS Resource Record Parameter\n\n \\param[in] key DNS Resource Record parameter\n \\return string"]
603 pub fn ares_dns_rr_key_tostr(key: ares_dns_rr_key_t) -> *const ::core::ffi::c_char;
604}
605unsafe extern "C" {
606 #[doc = " String representation of DNS Resource Record section\n\n \\param[in] section Section\n \\return string"]
607 pub fn ares_dns_section_tostr(section: ares_dns_section_t) -> *const ::core::ffi::c_char;
608}
609unsafe extern "C" {
610 #[doc = " Convert DNS class name as string to ares_dns_class_t\n\n \\param[out] qclass Pointer passed by reference to write class\n \\param[in] str String to convert\n \\return ARES_TRUE on success"]
611 pub fn ares_dns_class_fromstr(
612 qclass: *mut ares_dns_class_t,
613 str_: *const ::core::ffi::c_char,
614 ) -> ares_bool_t;
615}
616unsafe extern "C" {
617 #[doc = " Convert DNS record type as string to ares_dns_rec_type_t\n\n \\param[out] qtype Pointer passed by reference to write record type\n \\param[in] str String to convert\n \\return ARES_TRUE on success"]
618 pub fn ares_dns_rec_type_fromstr(
619 qtype: *mut ares_dns_rec_type_t,
620 str_: *const ::core::ffi::c_char,
621 ) -> ares_bool_t;
622}
623unsafe extern "C" {
624 #[doc = " Convert DNS response code as string to from ares_dns_rcode_t\n\n \\param[in] rcode Response code to convert\n \\return ARES_TRUE on success"]
625 pub fn ares_dns_rcode_tostr(rcode: ares_dns_rcode_t) -> *const ::core::ffi::c_char;
626}
627unsafe extern "C" {
628 #[doc = " Convert any valid ip address (ipv4 or ipv6) into struct ares_addr and\n return the starting pointer of the network byte order address and the\n length of the address (4 or 16).\n\n \\param[in] ipaddr ASCII string form of the ip address\n \\param[in,out] addr Must set \"family\" member to one of AF_UNSPEC,\n AF_INET, AF_INET6 on input.\n \\param[out] out_len Length of binary form address\n \\return Pointer to start of binary address or NULL on error."]
629 pub fn ares_dns_pton(
630 ipaddr: *const ::core::ffi::c_char,
631 addr: *mut ares_addr,
632 out_len: *mut usize,
633 ) -> *const ::core::ffi::c_void;
634}
635unsafe extern "C" {
636 #[doc = " Convert an ip address into the PTR format for in-addr.arpa or in6.arpa\n\n \\param[in] addr properly filled address structure\n \\return String representing PTR, use ares_free_string() to free"]
637 pub fn ares_dns_addr_to_ptr(addr: *const ares_addr) -> *mut ::core::ffi::c_char;
638}
639unsafe extern "C" {
640 #[doc = " The options/parameters extensions to some RRs can be somewhat opaque, this\n is a helper to return the best match for a datatype for interpreting the\n option record.\n\n \\param[in] key Key associated with options/parameters\n \\param[in] opt Option Key/Parameter\n \\return Datatype"]
641 pub fn ares_dns_opt_get_datatype(
642 key: ares_dns_rr_key_t,
643 opt: ::core::ffi::c_ushort,
644 ) -> ares_dns_opt_datatype_t;
645}
646unsafe extern "C" {
647 #[doc = " The options/parameters extensions to some RRs can be somewhat opaque, this\n is a helper to return the name if the option is known.\n\n \\param[in] key Key associated with options/parameters\n \\param[in] opt Option Key/Parameter\n \\return name, or NULL if not known."]
648 pub fn ares_dns_opt_get_name(
649 key: ares_dns_rr_key_t,
650 opt: ::core::ffi::c_ushort,
651 ) -> *const ::core::ffi::c_char;
652}
653unsafe extern "C" {
654 #[doc = " Retrieve a list of Resource Record keys that can be set or retrieved for\n the Resource record type.\n\n \\param[in] type Record Type\n \\param[out] cnt Number of keys returned\n \\return array of keys associated with Resource Record"]
655 pub fn ares_dns_rr_get_keys(
656 type_: ares_dns_rec_type_t,
657 cnt: *mut usize,
658 ) -> *const ares_dns_rr_key_t;
659}
660unsafe extern "C" {
661 #[doc = " Retrieve the datatype associated with a Resource Record key.\n\n \\param[in] key Resource Record Key\n \\return datatype"]
662 pub fn ares_dns_rr_key_datatype(key: ares_dns_rr_key_t) -> ares_dns_datatype_t;
663}
664unsafe extern "C" {
665 #[doc = " Retrieve the DNS Resource Record type associated with a Resource Record key.\n\n \\param[in] key Resource Record Key\n \\return DNS Resource Record Type"]
666 pub fn ares_dns_rr_key_to_rec_type(key: ares_dns_rr_key_t) -> ares_dns_rec_type_t;
667}
668#[doc = " Opaque data type representing a DNS RR (Resource Record)"]
669#[repr(C)]
670#[derive(Debug)]
671pub struct ares_dns_rr {
672 _unused: [u8; 0],
673}
674#[doc = " Typedef for opaque data type representing a DNS RR (Resource Record)"]
675pub type ares_dns_rr_t = ares_dns_rr;
676#[doc = " Opaque data type representing a DNS Query Data QD Packet"]
677#[repr(C)]
678#[derive(Debug)]
679pub struct ares_dns_qd {
680 _unused: [u8; 0],
681}
682#[doc = " Typedef for opaque data type representing a DNS Query Data QD Packet"]
683pub type ares_dns_qd_t = ares_dns_qd;
684#[doc = " Opaque data type representing a DNS Packet"]
685#[repr(C)]
686#[derive(Debug)]
687pub struct ares_dns_record {
688 _unused: [u8; 0],
689}
690#[doc = " Typedef for opaque data type representing a DNS Packet"]
691pub type ares_dns_record_t = ares_dns_record;
692unsafe extern "C" {
693 #[doc = " Create a new DNS record object\n\n \\param[out] dnsrec Pointer passed by reference for a newly allocated\n record object. Must be ares_dns_record_destroy()'d by\n caller.\n \\param[in] id DNS Query ID. If structuring a new query to be sent\n with ares_send(), this value should be zero.\n \\param[in] flags DNS Flags from \\ares_dns_flags_t\n \\param[in] opcode DNS OpCode (typically ARES_OPCODE_QUERY)\n \\param[in] rcode DNS RCode\n \\return ARES_SUCCESS on success"]
694 pub fn ares_dns_record_create(
695 dnsrec: *mut *mut ares_dns_record_t,
696 id: ::core::ffi::c_ushort,
697 flags: ::core::ffi::c_ushort,
698 opcode: ares_dns_opcode_t,
699 rcode: ares_dns_rcode_t,
700 ) -> ares_status_t;
701}
702unsafe extern "C" {
703 #[doc = " Destroy a DNS record object\n\n \\param[in] dnsrec Initialized record object"]
704 pub fn ares_dns_record_destroy(dnsrec: *mut ares_dns_record_t);
705}
706unsafe extern "C" {
707 #[doc = " Get the DNS Query ID\n\n \\param[in] dnsrec Initialized record object\n \\return DNS query id"]
708 pub fn ares_dns_record_get_id(dnsrec: *const ares_dns_record_t) -> ::core::ffi::c_ushort;
709}
710unsafe extern "C" {
711 #[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"]
712 pub fn ares_dns_record_set_id(
713 dnsrec: *mut ares_dns_record_t,
714 id: ::core::ffi::c_ushort,
715 ) -> ares_bool_t;
716}
717unsafe extern "C" {
718 #[doc = " Get the DNS Record Flags\n\n \\param[in] dnsrec Initialized record object\n \\return One or more \\ares_dns_flags_t"]
719 pub fn ares_dns_record_get_flags(dnsrec: *const ares_dns_record_t) -> ::core::ffi::c_ushort;
720}
721unsafe extern "C" {
722 #[doc = " Get the DNS Record OpCode\n\n \\param[in] dnsrec Initialized record object\n \\return opcode"]
723 pub fn ares_dns_record_get_opcode(dnsrec: *const ares_dns_record_t) -> ares_dns_opcode_t;
724}
725unsafe extern "C" {
726 #[doc = " Get the DNS Record RCode\n\n \\param[in] dnsrec Initialized record object\n \\return rcode"]
727 pub fn ares_dns_record_get_rcode(dnsrec: *const ares_dns_record_t) -> ares_dns_rcode_t;
728}
729unsafe extern "C" {
730 #[doc = " Add a query to the DNS Record. Typically a record will have only 1\n query. Most DNS servers will reject queries with more than 1 question.\n\n \\param[in] dnsrec Initialized record object\n \\param[in] name Name/Hostname of request\n \\param[in] qtype Type of query\n \\param[in] qclass Class of query (typically ARES_CLASS_IN)\n \\return ARES_SUCCESS on success"]
731 pub fn ares_dns_record_query_add(
732 dnsrec: *mut ares_dns_record_t,
733 name: *const ::core::ffi::c_char,
734 qtype: ares_dns_rec_type_t,
735 qclass: ares_dns_class_t,
736 ) -> ares_status_t;
737}
738unsafe extern "C" {
739 #[doc = " Replace the question name with a new name. This may be used when performing\n a search with aliases.\n\n Note that this will invalidate the name pointer returned from\n ares_dns_record_query_get().\n\n \\param[in] dnsrec Initialized record object\n \\param[in] idx Index of question (typically 0)\n \\param[in] name Name to use as replacement.\n \\return ARES_SUCCESS on success"]
740 pub fn ares_dns_record_query_set_name(
741 dnsrec: *mut ares_dns_record_t,
742 idx: usize,
743 name: *const ::core::ffi::c_char,
744 ) -> ares_status_t;
745}
746unsafe extern "C" {
747 #[doc = " Replace the question type with a different type. This may be used when\n needing to query more than one address class (e.g. A and AAAA)\n\n \\param[in] dnsrec Initialized record object\n \\param[in] idx Index of question (typically 0)\n \\param[in] qtype Record Type to use as replacement.\n \\return ARES_SUCCESS on success"]
748 pub fn ares_dns_record_query_set_type(
749 dnsrec: *mut ares_dns_record_t,
750 idx: usize,
751 qtype: ares_dns_rec_type_t,
752 ) -> ares_status_t;
753}
754unsafe extern "C" {
755 #[doc = " Get the count of queries in the DNS Record\n\n \\param[in] dnsrec Initialized record object\n \\return count of queries"]
756 pub fn ares_dns_record_query_cnt(dnsrec: *const ares_dns_record_t) -> usize;
757}
758unsafe extern "C" {
759 #[doc = " Get the data about the query at the provided index.\n\n \\param[in] dnsrec Initialized record object\n \\param[in] idx Index of query\n \\param[out] name Optional. Returns name, may pass NULL if not desired.\n This pointer will be invalided by any call to\n ares_dns_record_query_set_name().\n \\param[out] qtype Optional. Returns record type, may pass NULL.\n \\param[out] qclass Optional. Returns class, may pass NULL.\n \\return ARES_SUCCESS on success"]
760 pub fn ares_dns_record_query_get(
761 dnsrec: *const ares_dns_record_t,
762 idx: usize,
763 name: *mut *const ::core::ffi::c_char,
764 qtype: *mut ares_dns_rec_type_t,
765 qclass: *mut ares_dns_class_t,
766 ) -> ares_status_t;
767}
768unsafe extern "C" {
769 #[doc = " Get the count of Resource Records in the provided section\n\n \\param[in] dnsrec Initialized record object\n \\param[in] sect Section. ARES_SECTION_ANSWER is most used.\n \\return count of resource records."]
770 pub fn ares_dns_record_rr_cnt(
771 dnsrec: *const ares_dns_record_t,
772 sect: ares_dns_section_t,
773 ) -> usize;
774}
775unsafe extern "C" {
776 #[doc = " Add a Resource Record to the DNS Record.\n\n \\param[out] rr_out Pointer to created resource record. This pointer\n is owned by the DNS record itself, this is just made\n available to facilitate adding RR-specific fields.\n \\param[in] dnsrec Initialized record object\n \\param[in] sect Section to add resource record to\n \\param[in] name Resource Record name/hostname\n \\param[in] type Record Type\n \\param[in] rclass Class\n \\param[in] ttl TTL\n \\return ARES_SUCCESS on success"]
777 pub fn ares_dns_record_rr_add(
778 rr_out: *mut *mut ares_dns_rr_t,
779 dnsrec: *mut ares_dns_record_t,
780 sect: ares_dns_section_t,
781 name: *const ::core::ffi::c_char,
782 type_: ares_dns_rec_type_t,
783 rclass: ares_dns_class_t,
784 ttl: ::core::ffi::c_uint,
785 ) -> ares_status_t;
786}
787unsafe extern "C" {
788 #[doc = " Fetch a writable resource record based on the section and index.\n\n \\param[in] dnsrec Initialized record object\n \\param[in] sect Section for resource record\n \\param[in] idx Index of resource record in section\n \\return NULL on misuse, otherwise a writable pointer to the resource record"]
789 pub fn ares_dns_record_rr_get(
790 dnsrec: *mut ares_dns_record_t,
791 sect: ares_dns_section_t,
792 idx: usize,
793 ) -> *mut ares_dns_rr_t;
794}
795unsafe extern "C" {
796 #[doc = " Fetch a non-writeable resource record based on the section and index.\n\n \\param[in] dnsrec Initialized record object\n \\param[in] sect Section for resource record\n \\param[in] idx Index of resource record in section\n \\return NULL on misuse, otherwise a const pointer to the resource record"]
797 pub fn ares_dns_record_rr_get_const(
798 dnsrec: *const ares_dns_record_t,
799 sect: ares_dns_section_t,
800 idx: usize,
801 ) -> *const ares_dns_rr_t;
802}
803unsafe extern "C" {
804 #[doc = " Remove the resource record based on the section and index\n\n \\param[in] dnsrec Initialized record object\n \\param[in] sect Section for resource record\n \\param[in] idx Index of resource record in section\n \\return ARES_SUCCESS on success, otherwise an error code."]
805 pub fn ares_dns_record_rr_del(
806 dnsrec: *mut ares_dns_record_t,
807 sect: ares_dns_section_t,
808 idx: usize,
809 ) -> ares_status_t;
810}
811unsafe extern "C" {
812 #[doc = " Retrieve the resource record Name/Hostname\n\n \\param[in] rr Pointer to resource record\n \\return Name"]
813 pub fn ares_dns_rr_get_name(rr: *const ares_dns_rr_t) -> *const ::core::ffi::c_char;
814}
815unsafe extern "C" {
816 #[doc = " Retrieve the resource record type\n\n \\param[in] rr Pointer to resource record\n \\return type"]
817 pub fn ares_dns_rr_get_type(rr: *const ares_dns_rr_t) -> ares_dns_rec_type_t;
818}
819unsafe extern "C" {
820 #[doc = " Retrieve the resource record class\n\n \\param[in] rr Pointer to resource record\n \\return class"]
821 pub fn ares_dns_rr_get_class(rr: *const ares_dns_rr_t) -> ares_dns_class_t;
822}
823unsafe extern "C" {
824 #[doc = " Retrieve the resource record TTL\n\n \\param[in] rr Pointer to resource record\n \\return TTL"]
825 pub fn ares_dns_rr_get_ttl(rr: *const ares_dns_rr_t) -> ::core::ffi::c_uint;
826}
827unsafe extern "C" {
828 #[doc = " Set ipv4 address data type for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_INADDR\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] addr Pointer to ipv4 address to use.\n \\return ARES_SUCCESS on success"]
829 pub fn ares_dns_rr_set_addr(
830 dns_rr: *mut ares_dns_rr_t,
831 key: ares_dns_rr_key_t,
832 addr: *const in_addr,
833 ) -> ares_status_t;
834}
835unsafe extern "C" {
836 #[doc = " Set ipv6 address data type for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_INADDR6\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] addr Pointer to ipv6 address to use.\n \\return ARES_SUCCESS on success"]
837 pub fn ares_dns_rr_set_addr6(
838 dns_rr: *mut ares_dns_rr_t,
839 key: ares_dns_rr_key_t,
840 addr: *const ares_in6_addr,
841 ) -> ares_status_t;
842}
843unsafe extern "C" {
844 #[doc = " Set string data for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_STR or ARES_DATATYPE_NAME.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] val Pointer to string to set.\n \\return ARES_SUCCESS on success"]
845 pub fn ares_dns_rr_set_str(
846 dns_rr: *mut ares_dns_rr_t,
847 key: ares_dns_rr_key_t,
848 val: *const ::core::ffi::c_char,
849 ) -> ares_status_t;
850}
851unsafe extern "C" {
852 #[doc = " Set 8bit unsigned integer for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_U8\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] val 8bit unsigned integer\n \\return ARES_SUCCESS on success"]
853 pub fn ares_dns_rr_set_u8(
854 dns_rr: *mut ares_dns_rr_t,
855 key: ares_dns_rr_key_t,
856 val: ::core::ffi::c_uchar,
857 ) -> ares_status_t;
858}
859unsafe extern "C" {
860 #[doc = " Set 16bit unsigned integer for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_U16\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] val 16bit unsigned integer\n \\return ARES_SUCCESS on success"]
861 pub fn ares_dns_rr_set_u16(
862 dns_rr: *mut ares_dns_rr_t,
863 key: ares_dns_rr_key_t,
864 val: ::core::ffi::c_ushort,
865 ) -> ares_status_t;
866}
867unsafe extern "C" {
868 #[doc = " Set 32bit unsigned integer for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_U32\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] val 32bit unsigned integer\n \\return ARES_SUCCESS on success"]
869 pub fn ares_dns_rr_set_u32(
870 dns_rr: *mut ares_dns_rr_t,
871 key: ares_dns_rr_key_t,
872 val: ::core::ffi::c_uint,
873 ) -> ares_status_t;
874}
875unsafe extern "C" {
876 #[doc = " Set binary (BIN or BINP) data for specified resource record and key. Can\n only be used on keys with datatype ARES_DATATYPE_BIN or ARES_DATATYPE_BINP.\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"]
877 pub fn ares_dns_rr_set_bin(
878 dns_rr: *mut ares_dns_rr_t,
879 key: ares_dns_rr_key_t,
880 val: *const ::core::ffi::c_uchar,
881 len: usize,
882 ) -> ares_status_t;
883}
884unsafe extern "C" {
885 #[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"]
886 pub fn ares_dns_rr_add_abin(
887 dns_rr: *mut ares_dns_rr_t,
888 key: ares_dns_rr_key_t,
889 val: *const ::core::ffi::c_uchar,
890 len: usize,
891 ) -> ares_status_t;
892}
893unsafe extern "C" {
894 #[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"]
895 pub fn ares_dns_rr_del_abin(
896 dns_rr: *mut ares_dns_rr_t,
897 key: ares_dns_rr_key_t,
898 idx: usize,
899 ) -> ares_status_t;
900}
901unsafe extern "C" {
902 #[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"]
903 pub fn ares_dns_rr_set_opt(
904 dns_rr: *mut ares_dns_rr_t,
905 key: ares_dns_rr_key_t,
906 opt: ::core::ffi::c_ushort,
907 val: *const ::core::ffi::c_uchar,
908 val_len: usize,
909 ) -> ares_status_t;
910}
911unsafe extern "C" {
912 #[doc = " Delete the option for the RR by id\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 \\return ARES_SUCCESS if removed, ARES_ENOTFOUND if not found"]
913 pub fn ares_dns_rr_del_opt_byid(
914 dns_rr: *mut ares_dns_rr_t,
915 key: ares_dns_rr_key_t,
916 opt: ::core::ffi::c_ushort,
917 ) -> ares_status_t;
918}
919unsafe extern "C" {
920 #[doc = " Retrieve a pointer to the ipv4 address. Can only be used on keys with\n datatype ARES_DATATYPE_INADDR.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return pointer to ipv4 address or NULL on error"]
921 pub fn ares_dns_rr_get_addr(
922 dns_rr: *const ares_dns_rr_t,
923 key: ares_dns_rr_key_t,
924 ) -> *const in_addr;
925}
926unsafe extern "C" {
927 #[doc = " Retrieve a pointer to the ipv6 address. Can only be used on keys with\n datatype ARES_DATATYPE_INADDR6.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return pointer to ipv6 address or NULL on error"]
928 pub fn ares_dns_rr_get_addr6(
929 dns_rr: *const ares_dns_rr_t,
930 key: ares_dns_rr_key_t,
931 ) -> *const ares_in6_addr;
932}
933unsafe extern "C" {
934 #[doc = " Retrieve a pointer to the string. Can only be used on keys with\n datatype ARES_DATATYPE_STR and ARES_DATATYPE_NAME.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return pointer string or NULL on error"]
935 pub fn ares_dns_rr_get_str(
936 dns_rr: *const ares_dns_rr_t,
937 key: ares_dns_rr_key_t,
938 ) -> *const ::core::ffi::c_char;
939}
940unsafe extern "C" {
941 #[doc = " Retrieve an 8bit unsigned integer. Can only be used on keys with\n datatype ARES_DATATYPE_U8.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return 8bit unsigned integer"]
942 pub fn ares_dns_rr_get_u8(
943 dns_rr: *const ares_dns_rr_t,
944 key: ares_dns_rr_key_t,
945 ) -> ::core::ffi::c_uchar;
946}
947unsafe extern "C" {
948 #[doc = " Retrieve an 16bit unsigned integer. Can only be used on keys with\n datatype ARES_DATATYPE_U16.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return 16bit unsigned integer"]
949 pub fn ares_dns_rr_get_u16(
950 dns_rr: *const ares_dns_rr_t,
951 key: ares_dns_rr_key_t,
952 ) -> ::core::ffi::c_ushort;
953}
954unsafe extern "C" {
955 #[doc = " Retrieve an 32bit unsigned integer. Can only be used on keys with\n datatype ARES_DATATYPE_U32.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\return 32bit unsigned integer"]
956 pub fn ares_dns_rr_get_u32(
957 dns_rr: *const ares_dns_rr_t,
958 key: ares_dns_rr_key_t,
959 ) -> ::core::ffi::c_uint;
960}
961unsafe extern "C" {
962 #[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"]
963 pub fn ares_dns_rr_get_bin(
964 dns_rr: *const ares_dns_rr_t,
965 key: ares_dns_rr_key_t,
966 len: *mut usize,
967 ) -> *const ::core::ffi::c_uchar;
968}
969unsafe extern "C" {
970 #[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"]
971 pub fn ares_dns_rr_get_abin_cnt(dns_rr: *const ares_dns_rr_t, key: ares_dns_rr_key_t) -> usize;
972}
973unsafe extern "C" {
974 #[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"]
975 pub fn ares_dns_rr_get_abin(
976 dns_rr: *const ares_dns_rr_t,
977 key: ares_dns_rr_key_t,
978 idx: usize,
979 len: *mut usize,
980 ) -> *const ::core::ffi::c_uchar;
981}
982unsafe extern "C" {
983 #[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."]
984 pub fn ares_dns_rr_get_opt_cnt(dns_rr: *const ares_dns_rr_t, key: ares_dns_rr_key_t) -> usize;
985}
986unsafe extern "C" {
987 #[doc = " Retrieve the option for the RR by index.\n\n \\param[in] dns_rr Pointer to resource record\n \\param[in] key DNS Resource Record Key\n \\param[in] idx Index of option record\n \\param[out] val Optional. Pointer passed by reference to hold value.\n Options may not have values. Value if returned is\n guaranteed to be NULL terminated, however in most\n cases it is not printable.\n \\param[out] val_len Optional. Pointer passed by reference to hold value\n length.\n \\return option key/id on success, 65535 on misuse."]
988 pub fn ares_dns_rr_get_opt(
989 dns_rr: *const ares_dns_rr_t,
990 key: ares_dns_rr_key_t,
991 idx: usize,
992 val: *mut *const ::core::ffi::c_uchar,
993 val_len: *mut usize,
994 ) -> ::core::ffi::c_ushort;
995}
996unsafe extern "C" {
997 #[doc = " Retrieve the option for the RR by the option key/id.\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 (this is not the index).\n \\param[out] val Optional. Pointer passed by reference to hold value.\n Options may not have values. Value if returned is\n guaranteed to be NULL terminated, however in most cases\n it is not printable.\n \\param[out] val_len Optional. Pointer passed by reference to hold value\n length.\n \\return ARES_TRUE on success, ARES_FALSE on misuse."]
998 pub fn ares_dns_rr_get_opt_byid(
999 dns_rr: *const ares_dns_rr_t,
1000 key: ares_dns_rr_key_t,
1001 opt: ::core::ffi::c_ushort,
1002 val: *mut *const ::core::ffi::c_uchar,
1003 val_len: *mut usize,
1004 ) -> ares_bool_t;
1005}
1006unsafe extern "C" {
1007 #[doc = " Parse a complete DNS message.\n\n \\param[in] buf pointer to bytes to be parsed\n \\param[in] buf_len Length of buf provided\n \\param[in] flags Flags dictating how the message should be parsed.\n \\param[out] dnsrec Pointer passed by reference for a new DNS record object\n that must be ares_dns_record_destroy()'d by caller.\n \\return ARES_SUCCESS on success"]
1008 pub fn ares_dns_parse(
1009 buf: *const ::core::ffi::c_uchar,
1010 buf_len: usize,
1011 flags: ::core::ffi::c_uint,
1012 dnsrec: *mut *mut ares_dns_record_t,
1013 ) -> ares_status_t;
1014}
1015unsafe extern "C" {
1016 #[doc = " Write a complete DNS message\n\n \\param[in] dnsrec Pointer to initialized and filled DNS record object.\n \\param[out] buf Pointer passed by reference to be filled in with with\n DNS message. Must be ares_free_string()'d by caller.\n \\param[out] buf_len Length of returned buffer containing DNS message.\n \\return ARES_SUCCESS on success"]
1017 pub fn ares_dns_write(
1018 dnsrec: *const ares_dns_record_t,
1019 buf: *mut *mut ::core::ffi::c_uchar,
1020 buf_len: *mut usize,
1021 ) -> ares_status_t;
1022}
1023unsafe extern "C" {
1024 #[doc = " Duplicate a complete DNS message. This does not copy internal members\n (such as the ttl decrement capability).\n\n \\param[in] dnsrec Pointer to initialized and filled DNS record object.\n \\return duplicated DNS record object, or NULL on out of memory."]
1025 pub fn ares_dns_record_duplicate(dnsrec: *const ares_dns_record_t) -> *mut ares_dns_record_t;
1026}
1027pub type ares_callback = ::core::option::Option<
1028 unsafe extern "C" fn(
1029 arg: *mut ::core::ffi::c_void,
1030 status: ::core::ffi::c_int,
1031 timeouts: ::core::ffi::c_int,
1032 abuf: *const ::core::ffi::c_uchar,
1033 alen: ::core::ffi::c_int,
1034 ),
1035>;
1036pub type ares_callback_dnsrec = ::core::option::Option<
1037 unsafe extern "C" fn(
1038 arg: *mut ::core::ffi::c_void,
1039 status: ares_status_t,
1040 timeouts: usize,
1041 dnsrec: *const ares_dns_record_t,
1042 ),
1043>;
1044pub type ares_host_callback = ::core::option::Option<
1045 unsafe extern "C" fn(
1046 arg: *mut ::core::ffi::c_void,
1047 status: ::core::ffi::c_int,
1048 timeouts: ::core::ffi::c_int,
1049 hostent: *const hostent,
1050 ),
1051>;
1052pub type ares_nameinfo_callback = ::core::option::Option<
1053 unsafe extern "C" fn(
1054 arg: *mut ::core::ffi::c_void,
1055 status: ::core::ffi::c_int,
1056 timeouts: ::core::ffi::c_int,
1057 node: *const ::core::ffi::c_char,
1058 service: *const ::core::ffi::c_char,
1059 ),
1060>;
1061pub type ares_sock_create_callback = ::core::option::Option<
1062 unsafe extern "C" fn(
1063 socket_fd: ares_socket_t,
1064 type_: ::core::ffi::c_int,
1065 data: *mut ::core::ffi::c_void,
1066 ) -> ::core::ffi::c_int,
1067>;
1068pub type ares_sock_config_callback = ::core::option::Option<
1069 unsafe extern "C" fn(
1070 socket_fd: ares_socket_t,
1071 type_: ::core::ffi::c_int,
1072 data: *mut ::core::ffi::c_void,
1073 ) -> ::core::ffi::c_int,
1074>;
1075pub type ares_addrinfo_callback = ::core::option::Option<
1076 unsafe extern "C" fn(
1077 arg: *mut ::core::ffi::c_void,
1078 status: ::core::ffi::c_int,
1079 timeouts: ::core::ffi::c_int,
1080 res: *mut ares_addrinfo,
1081 ),
1082>;
1083pub type ares_server_state_callback = ::core::option::Option<
1084 unsafe extern "C" fn(
1085 server_string: *const ::core::ffi::c_char,
1086 success: ares_bool_t,
1087 flags: ::core::ffi::c_int,
1088 data: *mut ::core::ffi::c_void,
1089 ),
1090>;
1091pub type ares_pending_write_cb =
1092 ::core::option::Option<unsafe extern "C" fn(data: *mut ::core::ffi::c_void)>;
1093unsafe extern "C" {
1094 pub fn ares_library_init(flags: ::core::ffi::c_int) -> ::core::ffi::c_int;
1095}
1096unsafe extern "C" {
1097 pub fn ares_library_init_mem(
1098 flags: ::core::ffi::c_int,
1099 amalloc: ::core::option::Option<
1100 unsafe extern "C" fn(size: usize) -> *mut ::core::ffi::c_void,
1101 >,
1102 afree: ::core::option::Option<unsafe extern "C" fn(ptr: *mut ::core::ffi::c_void)>,
1103 arealloc: ::core::option::Option<
1104 unsafe extern "C" fn(
1105 ptr: *mut ::core::ffi::c_void,
1106 size: usize,
1107 ) -> *mut ::core::ffi::c_void,
1108 >,
1109 ) -> ::core::ffi::c_int;
1110}
1111unsafe extern "C" {
1112 pub fn ares_library_initialized() -> ::core::ffi::c_int;
1113}
1114unsafe extern "C" {
1115 pub fn ares_library_cleanup();
1116}
1117unsafe extern "C" {
1118 pub fn ares_version(version: *mut ::core::ffi::c_int) -> *const ::core::ffi::c_char;
1119}
1120unsafe extern "C" {
1121 pub fn ares_init(channelptr: *mut *mut ares_channel_t) -> ::core::ffi::c_int;
1122}
1123unsafe extern "C" {
1124 pub fn ares_init_options(
1125 channelptr: *mut *mut ares_channel_t,
1126 options: *const ares_options,
1127 optmask: ::core::ffi::c_int,
1128 ) -> ::core::ffi::c_int;
1129}
1130unsafe extern "C" {
1131 pub fn ares_save_options(
1132 channel: *const ares_channel_t,
1133 options: *mut ares_options,
1134 optmask: *mut ::core::ffi::c_int,
1135 ) -> ::core::ffi::c_int;
1136}
1137unsafe extern "C" {
1138 pub fn ares_destroy_options(options: *mut ares_options);
1139}
1140unsafe extern "C" {
1141 pub fn ares_dup(
1142 dest: *mut *mut ares_channel_t,
1143 src: *const ares_channel_t,
1144 ) -> ::core::ffi::c_int;
1145}
1146unsafe extern "C" {
1147 pub fn ares_reinit(channel: *mut ares_channel_t) -> ares_status_t;
1148}
1149unsafe extern "C" {
1150 pub fn ares_destroy(channel: *mut ares_channel_t);
1151}
1152unsafe extern "C" {
1153 pub fn ares_cancel(channel: *mut ares_channel_t);
1154}
1155unsafe extern "C" {
1156 pub fn ares_set_local_ip4(channel: *mut ares_channel_t, local_ip: ::core::ffi::c_uint);
1157}
1158unsafe extern "C" {
1159 pub fn ares_set_local_ip6(channel: *mut ares_channel_t, local_ip6: *const ::core::ffi::c_uchar);
1160}
1161unsafe extern "C" {
1162 pub fn ares_set_local_dev(
1163 channel: *mut ares_channel_t,
1164 local_dev_name: *const ::core::ffi::c_char,
1165 );
1166}
1167unsafe extern "C" {
1168 pub fn ares_set_socket_callback(
1169 channel: *mut ares_channel_t,
1170 callback: ares_sock_create_callback,
1171 user_data: *mut ::core::ffi::c_void,
1172 );
1173}
1174unsafe extern "C" {
1175 pub fn ares_set_socket_configure_callback(
1176 channel: *mut ares_channel_t,
1177 callback: ares_sock_config_callback,
1178 user_data: *mut ::core::ffi::c_void,
1179 );
1180}
1181unsafe extern "C" {
1182 pub fn ares_set_server_state_callback(
1183 channel: *mut ares_channel_t,
1184 callback: ares_server_state_callback,
1185 user_data: *mut ::core::ffi::c_void,
1186 );
1187}
1188unsafe extern "C" {
1189 pub fn ares_set_pending_write_cb(
1190 channel: *mut ares_channel_t,
1191 callback: ares_pending_write_cb,
1192 user_data: *mut ::core::ffi::c_void,
1193 );
1194}
1195unsafe extern "C" {
1196 pub fn ares_process_pending_write(channel: *mut ares_channel_t);
1197}
1198unsafe extern "C" {
1199 pub fn ares_set_sortlist(
1200 channel: *mut ares_channel_t,
1201 sortstr: *const ::core::ffi::c_char,
1202 ) -> ::core::ffi::c_int;
1203}
1204unsafe extern "C" {
1205 pub fn ares_getaddrinfo(
1206 channel: *mut ares_channel_t,
1207 node: *const ::core::ffi::c_char,
1208 service: *const ::core::ffi::c_char,
1209 hints: *const ares_addrinfo_hints,
1210 callback: ares_addrinfo_callback,
1211 arg: *mut ::core::ffi::c_void,
1212 );
1213}
1214unsafe extern "C" {
1215 pub fn ares_freeaddrinfo(ai: *mut ares_addrinfo);
1216}
1217#[repr(C)]
1218#[derive(Debug, Copy, Clone)]
1219pub struct ares_socket_functions {
1220 pub asocket: ::core::option::Option<
1221 unsafe extern "C" fn(
1222 arg1: ::core::ffi::c_int,
1223 arg2: ::core::ffi::c_int,
1224 arg3: ::core::ffi::c_int,
1225 arg4: *mut ::core::ffi::c_void,
1226 ) -> ares_socket_t,
1227 >,
1228 pub aclose: ::core::option::Option<
1229 unsafe extern "C" fn(
1230 arg1: ares_socket_t,
1231 arg2: *mut ::core::ffi::c_void,
1232 ) -> ::core::ffi::c_int,
1233 >,
1234 pub aconnect: ::core::option::Option<
1235 unsafe extern "C" fn(
1236 arg1: ares_socket_t,
1237 arg2: *const sockaddr,
1238 arg3: ares_socklen_t,
1239 arg4: *mut ::core::ffi::c_void,
1240 ) -> ::core::ffi::c_int,
1241 >,
1242 pub arecvfrom: ::core::option::Option<
1243 unsafe extern "C" fn(
1244 arg1: ares_socket_t,
1245 arg2: *mut ::core::ffi::c_void,
1246 arg3: usize,
1247 arg4: ::core::ffi::c_int,
1248 arg5: *mut sockaddr,
1249 arg6: *mut ares_socklen_t,
1250 arg7: *mut ::core::ffi::c_void,
1251 ) -> ares_ssize_t,
1252 >,
1253 pub asendv: ::core::option::Option<
1254 unsafe extern "C" fn(
1255 arg1: ares_socket_t,
1256 arg2: *const iovec,
1257 arg3: ::core::ffi::c_int,
1258 arg4: *mut ::core::ffi::c_void,
1259 ) -> ares_ssize_t,
1260 >,
1261}
1262unsafe extern "C" {
1263 pub fn ares_set_socket_functions(
1264 channel: *mut ares_channel_t,
1265 funcs: *const ares_socket_functions,
1266 user_data: *mut ::core::ffi::c_void,
1267 );
1268}
1269#[repr(u32)]
1270#[doc = " Flags defining behavior of socket functions"]
1271#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1272pub enum ares_sockfunc_flags_t {
1273 #[doc = " Strongly recommended to create sockets as non-blocking and set this\n flag"]
1274 ARES_SOCKFUNC_FLAG_NONBLOCKING = 1,
1275}
1276#[repr(u32)]
1277#[doc = " Socket options in request to asetsockopt() in struct\n ares_socket_functions_ex"]
1278#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1279pub enum ares_socket_opt_t {
1280 #[doc = " Set the send buffer size. Value is a pointer to an int. (SO_SNDBUF)"]
1281 ARES_SOCKET_OPT_SENDBUF_SIZE = 0,
1282 #[doc = " Set the recv buffer size. Value is a pointer to an int. (SO_RCVBUF)"]
1283 ARES_SOCKET_OPT_RECVBUF_SIZE = 1,
1284 #[doc = " Set the network interface to use as the source for communication.\n Value is a C string. (SO_BINDTODEVICE)"]
1285 ARES_SOCKET_OPT_BIND_DEVICE = 2,
1286 #[doc = " Enable TCP Fast Open. Value is a pointer to an ares_bool_t. On some\n systems this could be a no-op if it is known it is on by default and\n return success. Other systems may be a no-op if known the system does\n not support the feature and returns failure with errno set to ENOSYS or\n WSASetLastError(WSAEOPNOTSUPP)."]
1287 ARES_SOCKET_OPT_TCP_FASTOPEN = 3,
1288}
1289#[repr(u32)]
1290#[doc = " Flags for behavior during connect"]
1291#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1292pub enum ares_socket_connect_flags_t {
1293 #[doc = " Connect using TCP Fast Open"]
1294 ARES_SOCKET_CONN_TCP_FASTOPEN = 1,
1295}
1296#[repr(u32)]
1297#[doc = " Flags for behavior during bind"]
1298#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1299pub enum ares_socket_bind_flags_t {
1300 #[doc = " Bind is for a TCP connection"]
1301 ARES_SOCKET_BIND_TCP = 1,
1302 #[doc = " Bind is for a client connection, not server"]
1303 ARES_SOCKET_BIND_CLIENT = 2,
1304}
1305#[doc = " Socket functions to call rather than using OS-native functions"]
1306#[repr(C)]
1307#[derive(Debug, Copy, Clone)]
1308pub struct ares_socket_functions_ex {
1309 #[doc = " ABI Version: must be \"1\""]
1310 pub version: ::core::ffi::c_uint,
1311 #[doc = " Flags indicating behavior of the subsystem. One or more\n ares_sockfunc_flags_t"]
1312 pub flags: ::core::ffi::c_uint,
1313 #[doc = " REQUIRED. Create a new socket file descriptor. The file descriptor must\n be opened in non-blocking mode (so that reads and writes never block).\n Recommended other options would be to disable signals on write errors\n (SO_NOSIGPIPE), Disable the Nagle algorithm on SOCK_STREAM (TCP_NODELAY),\n and to automatically close file descriptors on exec (FD_CLOEXEC).\n\n \\param[in] domain Socket domain. Valid values are AF_INET, AF_INET6.\n \\param[in] type Socket type. Valid values are SOCK_STREAM (tcp) and\n SOCK_DGRAM (udp).\n \\param[in] protocol In general this should be ignored, may be passed as\n 0 (use as default for type), or may be IPPROTO_UDP\n or IPPROTO_TCP.\n \\param[in] user_data Pointer provided to ares_set_socket_functions_ex().\n \\return ARES_SOCKET_BAD on error, or socket file descriptor on success.\n On error, it is expected to set errno (or WSASetLastError()) to an\n appropriate reason code such as EAFNOSUPPORT / WSAAFNOSUPPORT."]
1314 pub asocket: ::core::option::Option<
1315 unsafe extern "C" fn(
1316 domain: ::core::ffi::c_int,
1317 type_: ::core::ffi::c_int,
1318 protocol: ::core::ffi::c_int,
1319 user_data: *mut ::core::ffi::c_void,
1320 ) -> ares_socket_t,
1321 >,
1322 #[doc = " REQUIRED. Close a socket file descriptor.\n \\param[in] sock Socket file descriptor returned from asocket.\n \\param[in] user_data Pointer provided to ares_set_socket_functions_ex().\n \\return 0 on success. On failure, should set errno (or WSASetLastError)\n to an appropriate code such as EBADF / WSAEBADF"]
1323 pub aclose: ::core::option::Option<
1324 unsafe extern "C" fn(
1325 sock: ares_socket_t,
1326 user_data: *mut ::core::ffi::c_void,
1327 ) -> ::core::ffi::c_int,
1328 >,
1329 #[doc = " REQUIRED. Set socket option. This shares a similar syntax to the BSD\n setsockopt() call, however we use our own options. The value is typically\n a pointer to the desired value and each option has its own data type it\n will express in the documentation.\n\n \\param[in] sock Socket file descriptor returned from asocket.\n \\param[in] opt Option to set.\n \\param[in] val Pointer to value for option.\n \\param[in] val_size Size of value.\n \\param[in] user_data Pointer provided to\n ares_set_socket_functions_ex().\n \\return Return 0 on success, otherwise -1 should be returned with an\n appropriate errno (or WSASetLastError()) set. If error is ENOSYS /\n WSAEOPNOTSUPP an error will not be propagated as it will take it\n to mean it is an intentional decision to not support the feature."]
1330 pub asetsockopt: ::core::option::Option<
1331 unsafe extern "C" fn(
1332 sock: ares_socket_t,
1333 opt: ares_socket_opt_t,
1334 val: *const ::core::ffi::c_void,
1335 val_size: ares_socklen_t,
1336 user_data: *mut ::core::ffi::c_void,
1337 ) -> ::core::ffi::c_int,
1338 >,
1339 #[doc = " REQUIRED. Connect to the remote using the supplied address. For UDP\n sockets this will bind the file descriptor to only send and receive packets\n from the remote address provided.\n\n \\param[in] sock Socket file descriptor returned from asocket.\n \\param[in] address Address to connect to\n \\param[in] address_len Size of address structure passed\n \\param[in] flags One or more ares_socket_connect_flags_t\n \\param[in] user_data Pointer provided to\n ares_set_socket_functions_ex().\n \\return Return 0 upon successful establishement, otherwise -1 should be\n returned with an appropriate errno (or WSASetLastError()) set. It\n is generally expected that most TCP connections (not using TCP Fast Open)\n will return -1 with an error of EINPROGRESS / WSAEINPROGRESS due to the\n non-blocking nature of the connection. It is then the responsibility of\n the implementation to notify of writability on the socket to indicate the\n connection has succeeded (or readability on failure to retrieve the\n appropriate error)."]
1340 pub aconnect: ::core::option::Option<
1341 unsafe extern "C" fn(
1342 sock: ares_socket_t,
1343 address: *const sockaddr,
1344 address_len: ares_socklen_t,
1345 flags: ::core::ffi::c_uint,
1346 user_data: *mut ::core::ffi::c_void,
1347 ) -> ::core::ffi::c_int,
1348 >,
1349 #[doc = " REQUIRED. Attempt to read data from the remote.\n\n \\param[in] sock Socket file descriptor returned from asocket.\n \\param[in,out] buffer Allocated buffer to place data read from\n socket.\n \\param[in] length Size of buffer\n \\param[in] flags Unused, always 0.\n \\param[in,out] address Buffer to hold address data was received from.\n May be NULL if address not desired.\n \\param[in,out] address_len Input size of address buffer, output actual\n written size. Must be NULL if address is NULL.\n \\param[in] user_data Pointer provided to\n ares_set_socket_functions_ex().\n \\return -1 on error with appropriate errno (or WSASetLastError()) set,\n such as EWOULDBLOCK / EAGAIN / WSAEWOULDBLOCK, or ECONNRESET /\n WSAECONNRESET."]
1350 pub arecvfrom: ::core::option::Option<
1351 unsafe extern "C" fn(
1352 sock: ares_socket_t,
1353 buffer: *mut ::core::ffi::c_void,
1354 length: usize,
1355 flags: ::core::ffi::c_int,
1356 address: *mut sockaddr,
1357 address_len: *mut ares_socklen_t,
1358 user_data: *mut ::core::ffi::c_void,
1359 ) -> ares_ssize_t,
1360 >,
1361 #[doc = " REQUIRED. Attempt to send data to the remote. Optional address may be\n specified which may be useful on unbound UDP sockets (though currently not\n used), and TCP FastOpen where the connection is delayed until first write.\n\n \\param[in] sock Socket file descriptor returned from asocket.\n \\param[in] buffer Containing data to place onto wire.\n \\param[in] length Size of buffer\n \\param[in] flags Flags for writing. Currently only used flag is\n MSG_NOSIGNAL if the host OS has such a flag. In\n general flags can be ignored.\n \\param[in] address Buffer containing address to send data to. May\n be NULL.\n \\param[in,out] address_len Size of address buffer. Must be 0 if address\n is NULL.\n \\param[in] user_data Pointer provided to\n ares_set_socket_functions_ex().\n \\return Number of bytes written. -1 on error with appropriate errno (or\n WSASetLastError()) set."]
1362 pub asendto: ::core::option::Option<
1363 unsafe extern "C" fn(
1364 sock: ares_socket_t,
1365 buffer: *const ::core::ffi::c_void,
1366 length: usize,
1367 flags: ::core::ffi::c_int,
1368 address: *const sockaddr,
1369 address_len: ares_socklen_t,
1370 user_data: *mut ::core::ffi::c_void,
1371 ) -> ares_ssize_t,
1372 >,
1373 #[doc = " Optional. Retrieve the local address of the socket.\n\n \\param[in] sock Socket file descriptor returned from asocket\n \\param[in,out] address Buffer to hold address\n \\param[in,out] address_len Size of address buffer on input, written size\n on output.\n \\param[in] user_data Pointer provided to\n ares_set_socket_functions_ex().\n \\return 0 on success. -1 on error with an appropriate errno (or\n WSASetLastError()) set."]
1374 pub agetsockname: ::core::option::Option<
1375 unsafe extern "C" fn(
1376 sock: ares_socket_t,
1377 address: *mut sockaddr,
1378 address_len: *mut ares_socklen_t,
1379 user_data: *mut ::core::ffi::c_void,
1380 ) -> ::core::ffi::c_int,
1381 >,
1382 #[doc = " Optional. Bind the socket to an address. This can be used for client\n connections to bind the source address for packets before connect, or\n for server connections to bind to an address and port before listening.\n Currently c-ares only supports client connections.\n\n \\param[in] sock Socket file descriptor returned from asocket\n \\param[in] flags ares_socket_bind_flags_t flags.\n \\param[in] address Buffer containing address.\n \\param[in] address_len Size of address buffer.\n \\param[in] user_data Pointer provided to\n ares_set_socket_functions_ex().\n \\return 0 on success. -1 on error with an appropriate errno (or\n WSASetLastError()) set."]
1383 pub abind: ::core::option::Option<
1384 unsafe extern "C" fn(
1385 sock: ares_socket_t,
1386 flags: ::core::ffi::c_uint,
1387 address: *const sockaddr,
1388 address_len: socklen_t,
1389 user_data: *mut ::core::ffi::c_void,
1390 ) -> ::core::ffi::c_int,
1391 >,
1392 pub aif_nametoindex: ::core::option::Option<
1393 unsafe extern "C" fn(
1394 ifname: *const ::core::ffi::c_char,
1395 user_data: *mut ::core::ffi::c_void,
1396 ) -> ::core::ffi::c_uint,
1397 >,
1398 pub aif_indextoname: ::core::option::Option<
1399 unsafe extern "C" fn(
1400 ifindex: ::core::ffi::c_uint,
1401 ifname_buf: *mut ::core::ffi::c_char,
1402 ifname_buf_len: usize,
1403 user_data: *mut ::core::ffi::c_void,
1404 ) -> *const ::core::ffi::c_char,
1405 >,
1406}
1407unsafe extern "C" {
1408 #[doc = " Override the native socket functions for the OS with the provided set.\n An optional user data thunk may be specified which will be passed to\n each registered callback. Replaces ares_set_socket_functions().\n\n \\param[in] channel An initialized c-ares channel.\n \\param[in] funcs Structure registering the implementations for the\n various functions. See the structure definition.\n This will be duplicated and does not need to exist\n past the life of this call.\n \\param[in] user_data User data thunk which will be passed to each call of\n the registered callbacks.\n \\return ARES_SUCCESS on success, or another error code such as ARES_EFORMERR\n on misuse."]
1409 pub fn ares_set_socket_functions_ex(
1410 channel: *mut ares_channel_t,
1411 funcs: *const ares_socket_functions_ex,
1412 user_data: *mut ::core::ffi::c_void,
1413 ) -> ares_status_t;
1414}
1415unsafe extern "C" {
1416 pub fn ares_send(
1417 channel: *mut ares_channel_t,
1418 qbuf: *const ::core::ffi::c_uchar,
1419 qlen: ::core::ffi::c_int,
1420 callback: ares_callback,
1421 arg: *mut ::core::ffi::c_void,
1422 );
1423}
1424unsafe extern "C" {
1425 #[doc = " Send a DNS query as an ares_dns_record_t with a callback containing the\n parsed DNS record.\n\n \\param[in] channel Pointer to channel on which queries will be sent.\n \\param[in] dnsrec DNS Record to send\n \\param[in] callback Callback function invoked on completion or failure of\n the query sequence.\n \\param[in] arg Additional argument passed to the callback function.\n \\param[out] qid Query ID\n \\return One of the c-ares status codes."]
1426 pub fn ares_send_dnsrec(
1427 channel: *mut ares_channel_t,
1428 dnsrec: *const ares_dns_record_t,
1429 callback: ares_callback_dnsrec,
1430 arg: *mut ::core::ffi::c_void,
1431 qid: *mut ::core::ffi::c_ushort,
1432 ) -> ares_status_t;
1433}
1434unsafe extern "C" {
1435 pub fn ares_query(
1436 channel: *mut ares_channel_t,
1437 name: *const ::core::ffi::c_char,
1438 dnsclass: ::core::ffi::c_int,
1439 type_: ::core::ffi::c_int,
1440 callback: ares_callback,
1441 arg: *mut ::core::ffi::c_void,
1442 );
1443}
1444unsafe extern "C" {
1445 #[doc = " Perform a DNS query with a callback containing the parsed DNS record.\n\n \\param[in] channel Pointer to channel on which queries will be sent.\n \\param[in] name Query name\n \\param[in] dnsclass DNS Class\n \\param[in] type DNS Record Type\n \\param[in] callback Callback function invoked on completion or failure of\n the query sequence.\n \\param[in] arg Additional argument passed to the callback function.\n \\param[out] qid Query ID\n \\return One of the c-ares status codes."]
1446 pub fn ares_query_dnsrec(
1447 channel: *mut ares_channel_t,
1448 name: *const ::core::ffi::c_char,
1449 dnsclass: ares_dns_class_t,
1450 type_: ares_dns_rec_type_t,
1451 callback: ares_callback_dnsrec,
1452 arg: *mut ::core::ffi::c_void,
1453 qid: *mut ::core::ffi::c_ushort,
1454 ) -> ares_status_t;
1455}
1456unsafe extern "C" {
1457 pub fn ares_search(
1458 channel: *mut ares_channel_t,
1459 name: *const ::core::ffi::c_char,
1460 dnsclass: ::core::ffi::c_int,
1461 type_: ::core::ffi::c_int,
1462 callback: ares_callback,
1463 arg: *mut ::core::ffi::c_void,
1464 );
1465}
1466unsafe extern "C" {
1467 #[doc = " Search for a complete DNS message.\n\n \\param[in] channel Pointer to channel on which queries will be sent.\n \\param[in] dnsrec Pointer to initialized and filled DNS record object.\n \\param[in] callback Callback function invoked on completion or failure of\n the query sequence.\n \\param[in] arg Additional argument passed to the callback function.\n \\return One of the c-ares status codes. In all cases, except\n ARES_EFORMERR due to misuse, this error code will also be sent\n to the provided callback."]
1468 pub fn ares_search_dnsrec(
1469 channel: *mut ares_channel_t,
1470 dnsrec: *const ares_dns_record_t,
1471 callback: ares_callback_dnsrec,
1472 arg: *mut ::core::ffi::c_void,
1473 ) -> ares_status_t;
1474}
1475unsafe extern "C" {
1476 pub fn ares_gethostbyname(
1477 channel: *mut ares_channel_t,
1478 name: *const ::core::ffi::c_char,
1479 family: ::core::ffi::c_int,
1480 callback: ares_host_callback,
1481 arg: *mut ::core::ffi::c_void,
1482 );
1483}
1484unsafe extern "C" {
1485 pub fn ares_gethostbyname_file(
1486 channel: *mut ares_channel_t,
1487 name: *const ::core::ffi::c_char,
1488 family: ::core::ffi::c_int,
1489 host: *mut *mut hostent,
1490 ) -> ::core::ffi::c_int;
1491}
1492unsafe extern "C" {
1493 pub fn ares_gethostbyaddr(
1494 channel: *mut ares_channel_t,
1495 addr: *const ::core::ffi::c_void,
1496 addrlen: ::core::ffi::c_int,
1497 family: ::core::ffi::c_int,
1498 callback: ares_host_callback,
1499 arg: *mut ::core::ffi::c_void,
1500 );
1501}
1502unsafe extern "C" {
1503 pub fn ares_getnameinfo(
1504 channel: *mut ares_channel_t,
1505 sa: *const sockaddr,
1506 salen: ares_socklen_t,
1507 flags: ::core::ffi::c_int,
1508 callback: ares_nameinfo_callback,
1509 arg: *mut ::core::ffi::c_void,
1510 );
1511}
1512unsafe extern "C" {
1513 pub fn ares_fds(
1514 channel: *const ares_channel_t,
1515 read_fds: *mut fd_set,
1516 write_fds: *mut fd_set,
1517 ) -> ::core::ffi::c_int;
1518}
1519unsafe extern "C" {
1520 pub fn ares_getsock(
1521 channel: *const ares_channel_t,
1522 socks: *mut ares_socket_t,
1523 numsocks: ::core::ffi::c_int,
1524 ) -> ::core::ffi::c_int;
1525}
1526unsafe extern "C" {
1527 pub fn ares_timeout(
1528 channel: *const ares_channel_t,
1529 maxtv: *mut timeval,
1530 tv: *mut timeval,
1531 ) -> *mut timeval;
1532}
1533unsafe extern "C" {
1534 pub fn ares_process(
1535 channel: *mut ares_channel_t,
1536 read_fds: *mut fd_set,
1537 write_fds: *mut fd_set,
1538 );
1539}
1540#[repr(u32)]
1541#[doc = " Events used by ares_fd_events_t"]
1542#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1543pub enum ares_fd_eventflag_t {
1544 #[doc = "< No events"]
1545 ARES_FD_EVENT_NONE = 0,
1546 #[doc = "< Read event (including disconnect/error)"]
1547 ARES_FD_EVENT_READ = 1,
1548 #[doc = "< Write event"]
1549 ARES_FD_EVENT_WRITE = 2,
1550}
1551#[doc = " Type holding a file descriptor and mask of events, used by\n ares_process_fds()"]
1552#[repr(C)]
1553pub struct ares_fd_events_t {
1554 #[doc = "< File descriptor"]
1555 pub fd: ares_socket_t,
1556 #[doc = "< Mask of ares_fd_eventflag_t"]
1557 pub events: ::core::ffi::c_uint,
1558}
1559#[repr(u32)]
1560#[doc = " Flags used by ares_process_fds()"]
1561#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
1562pub enum ares_process_flag_t {
1563 #[doc = "< No flag value"]
1564 ARES_PROCESS_FLAG_NONE = 0,
1565 #[doc = "< skip any processing unrelated to\n the file descriptor events passed\n in"]
1566 ARES_PROCESS_FLAG_SKIP_NON_FD = 1,
1567}
1568unsafe extern "C" {
1569 #[doc = " Process events on multiple file descriptors based on the event mask\n associated with each file descriptor. Recommended over calling\n ares_process_fd() multiple times since it would trigger additional logic\n such as timeout processing on each call.\n\n \\param[in] channel Initialized ares channel\n \\param[in] events Array of file descriptors with events. May be NULL if\n no events, but may have timeouts to process.\n \\param[in] nevents Number of elements in the events array. May be 0 if\n no events, but may have timeouts to process.\n \\param[in] flags Flags to alter behavior of the process command.\n \\return ARES_ENOMEM on out of memory, ARES_EFORMERR on misuse,\n otherwise ARES_SUCCESS"]
1570 pub fn ares_process_fds(
1571 channel: *mut ares_channel_t,
1572 events: *const ares_fd_events_t,
1573 nevents: usize,
1574 flags: ::core::ffi::c_uint,
1575 ) -> ares_status_t;
1576}
1577unsafe extern "C" {
1578 pub fn ares_process_fd(
1579 channel: *mut ares_channel_t,
1580 read_fd: ares_socket_t,
1581 write_fd: ares_socket_t,
1582 );
1583}
1584unsafe extern "C" {
1585 pub fn ares_create_query(
1586 name: *const ::core::ffi::c_char,
1587 dnsclass: ::core::ffi::c_int,
1588 type_: ::core::ffi::c_int,
1589 id: ::core::ffi::c_ushort,
1590 rd: ::core::ffi::c_int,
1591 buf: *mut *mut ::core::ffi::c_uchar,
1592 buflen: *mut ::core::ffi::c_int,
1593 max_udp_size: ::core::ffi::c_int,
1594 ) -> ::core::ffi::c_int;
1595}
1596unsafe extern "C" {
1597 pub fn ares_mkquery(
1598 name: *const ::core::ffi::c_char,
1599 dnsclass: ::core::ffi::c_int,
1600 type_: ::core::ffi::c_int,
1601 id: ::core::ffi::c_ushort,
1602 rd: ::core::ffi::c_int,
1603 buf: *mut *mut ::core::ffi::c_uchar,
1604 buflen: *mut ::core::ffi::c_int,
1605 ) -> ::core::ffi::c_int;
1606}
1607unsafe extern "C" {
1608 pub fn ares_expand_name(
1609 encoded: *const ::core::ffi::c_uchar,
1610 abuf: *const ::core::ffi::c_uchar,
1611 alen: ::core::ffi::c_int,
1612 s: *mut *mut ::core::ffi::c_char,
1613 enclen: *mut ::core::ffi::c_long,
1614 ) -> ::core::ffi::c_int;
1615}
1616unsafe extern "C" {
1617 pub fn ares_expand_string(
1618 encoded: *const ::core::ffi::c_uchar,
1619 abuf: *const ::core::ffi::c_uchar,
1620 alen: ::core::ffi::c_int,
1621 s: *mut *mut ::core::ffi::c_uchar,
1622 enclen: *mut ::core::ffi::c_long,
1623 ) -> ::core::ffi::c_int;
1624}
1625#[repr(C)]
1626#[derive(Copy, Clone)]
1627pub struct ares_addrttl {
1628 pub ipaddr: in_addr,
1629 pub ttl: ::core::ffi::c_int,
1630}
1631impl ::std::fmt::Debug for ares_addrttl {
1632 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1633 write!(f, "ares_addrttl {{ ipaddr: union, ttl: {:?} }}", self.ttl)
1634 }
1635}
1636#[repr(C)]
1637#[derive(Copy, Clone)]
1638pub struct ares_addr6ttl {
1639 pub ip6addr: ares_in6_addr,
1640 pub ttl: ::core::ffi::c_int,
1641}
1642impl ::std::fmt::Debug for ares_addr6ttl {
1643 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
1644 write!(f, "ares_addr6ttl {{ ip6addr: union, ttl: {:?} }}", self.ttl)
1645 }
1646}
1647#[repr(C)]
1648#[derive(Debug, Copy, Clone)]
1649pub struct ares_caa_reply {
1650 pub next: *mut ares_caa_reply,
1651 pub critical: ::core::ffi::c_int,
1652 pub property: *mut ::core::ffi::c_uchar,
1653 pub plength: usize,
1654 pub value: *mut ::core::ffi::c_uchar,
1655 pub length: usize,
1656}
1657#[repr(C)]
1658#[derive(Debug, Copy, Clone)]
1659pub struct ares_srv_reply {
1660 pub next: *mut ares_srv_reply,
1661 pub host: *mut ::core::ffi::c_char,
1662 pub priority: ::core::ffi::c_ushort,
1663 pub weight: ::core::ffi::c_ushort,
1664 pub port: ::core::ffi::c_ushort,
1665}
1666#[repr(C)]
1667#[derive(Debug, Copy, Clone)]
1668pub struct ares_mx_reply {
1669 pub next: *mut ares_mx_reply,
1670 pub host: *mut ::core::ffi::c_char,
1671 pub priority: ::core::ffi::c_ushort,
1672}
1673#[repr(C)]
1674#[derive(Debug, Copy, Clone)]
1675pub struct ares_txt_reply {
1676 pub next: *mut ares_txt_reply,
1677 pub txt: *mut ::core::ffi::c_uchar,
1678 pub length: usize,
1679}
1680#[repr(C)]
1681#[derive(Debug, Copy, Clone)]
1682pub struct ares_txt_ext {
1683 pub next: *mut ares_txt_ext,
1684 pub txt: *mut ::core::ffi::c_uchar,
1685 pub length: usize,
1686 pub record_start: ::core::ffi::c_uchar,
1687}
1688#[repr(C)]
1689#[derive(Debug, Copy, Clone)]
1690pub struct ares_naptr_reply {
1691 pub next: *mut ares_naptr_reply,
1692 pub flags: *mut ::core::ffi::c_uchar,
1693 pub service: *mut ::core::ffi::c_uchar,
1694 pub regexp: *mut ::core::ffi::c_uchar,
1695 pub replacement: *mut ::core::ffi::c_char,
1696 pub order: ::core::ffi::c_ushort,
1697 pub preference: ::core::ffi::c_ushort,
1698}
1699#[repr(C)]
1700#[derive(Debug, Copy, Clone)]
1701pub struct ares_soa_reply {
1702 pub nsname: *mut ::core::ffi::c_char,
1703 pub hostmaster: *mut ::core::ffi::c_char,
1704 pub serial: ::core::ffi::c_uint,
1705 pub refresh: ::core::ffi::c_uint,
1706 pub retry: ::core::ffi::c_uint,
1707 pub expire: ::core::ffi::c_uint,
1708 pub minttl: ::core::ffi::c_uint,
1709}
1710#[repr(C)]
1711#[derive(Debug, Copy, Clone)]
1712pub struct ares_uri_reply {
1713 pub next: *mut ares_uri_reply,
1714 pub priority: ::core::ffi::c_ushort,
1715 pub weight: ::core::ffi::c_ushort,
1716 pub uri: *mut ::core::ffi::c_char,
1717 pub ttl: ::core::ffi::c_int,
1718}
1719#[repr(C)]
1720pub struct ares_addrinfo_node {
1721 pub ai_ttl: ::core::ffi::c_int,
1722 pub ai_flags: ::core::ffi::c_int,
1723 pub ai_family: ::core::ffi::c_int,
1724 pub ai_socktype: ::core::ffi::c_int,
1725 pub ai_protocol: ::core::ffi::c_int,
1726 pub ai_addrlen: ares_socklen_t,
1727 pub ai_addr: *mut sockaddr,
1728 pub ai_next: *mut ares_addrinfo_node,
1729}
1730#[repr(C)]
1731#[derive(Debug, Copy, Clone)]
1732pub struct ares_addrinfo_cname {
1733 pub ttl: ::core::ffi::c_int,
1734 pub alias: *mut ::core::ffi::c_char,
1735 pub name: *mut ::core::ffi::c_char,
1736 pub next: *mut ares_addrinfo_cname,
1737}
1738#[repr(C)]
1739#[derive(Debug, Copy, Clone)]
1740pub struct ares_addrinfo {
1741 pub cnames: *mut ares_addrinfo_cname,
1742 pub nodes: *mut ares_addrinfo_node,
1743 pub name: *mut ::core::ffi::c_char,
1744}
1745#[repr(C)]
1746#[derive(Debug, Copy, Clone)]
1747pub struct ares_addrinfo_hints {
1748 pub ai_flags: ::core::ffi::c_int,
1749 pub ai_family: ::core::ffi::c_int,
1750 pub ai_socktype: ::core::ffi::c_int,
1751 pub ai_protocol: ::core::ffi::c_int,
1752}
1753unsafe extern "C" {
1754 pub fn ares_parse_a_reply(
1755 abuf: *const ::core::ffi::c_uchar,
1756 alen: ::core::ffi::c_int,
1757 host: *mut *mut hostent,
1758 addrttls: *mut ares_addrttl,
1759 naddrttls: *mut ::core::ffi::c_int,
1760 ) -> ::core::ffi::c_int;
1761}
1762unsafe extern "C" {
1763 pub fn ares_parse_aaaa_reply(
1764 abuf: *const ::core::ffi::c_uchar,
1765 alen: ::core::ffi::c_int,
1766 host: *mut *mut hostent,
1767 addrttls: *mut ares_addr6ttl,
1768 naddrttls: *mut ::core::ffi::c_int,
1769 ) -> ::core::ffi::c_int;
1770}
1771unsafe extern "C" {
1772 pub fn ares_parse_caa_reply(
1773 abuf: *const ::core::ffi::c_uchar,
1774 alen: ::core::ffi::c_int,
1775 caa_out: *mut *mut ares_caa_reply,
1776 ) -> ::core::ffi::c_int;
1777}
1778unsafe extern "C" {
1779 pub fn ares_parse_ptr_reply(
1780 abuf: *const ::core::ffi::c_uchar,
1781 alen: ::core::ffi::c_int,
1782 addr: *const ::core::ffi::c_void,
1783 addrlen: ::core::ffi::c_int,
1784 family: ::core::ffi::c_int,
1785 host: *mut *mut hostent,
1786 ) -> ::core::ffi::c_int;
1787}
1788unsafe extern "C" {
1789 pub fn ares_parse_ns_reply(
1790 abuf: *const ::core::ffi::c_uchar,
1791 alen: ::core::ffi::c_int,
1792 host: *mut *mut hostent,
1793 ) -> ::core::ffi::c_int;
1794}
1795unsafe extern "C" {
1796 pub fn ares_parse_srv_reply(
1797 abuf: *const ::core::ffi::c_uchar,
1798 alen: ::core::ffi::c_int,
1799 srv_out: *mut *mut ares_srv_reply,
1800 ) -> ::core::ffi::c_int;
1801}
1802unsafe extern "C" {
1803 pub fn ares_parse_mx_reply(
1804 abuf: *const ::core::ffi::c_uchar,
1805 alen: ::core::ffi::c_int,
1806 mx_out: *mut *mut ares_mx_reply,
1807 ) -> ::core::ffi::c_int;
1808}
1809unsafe extern "C" {
1810 pub fn ares_parse_txt_reply(
1811 abuf: *const ::core::ffi::c_uchar,
1812 alen: ::core::ffi::c_int,
1813 txt_out: *mut *mut ares_txt_reply,
1814 ) -> ::core::ffi::c_int;
1815}
1816unsafe extern "C" {
1817 pub fn ares_parse_txt_reply_ext(
1818 abuf: *const ::core::ffi::c_uchar,
1819 alen: ::core::ffi::c_int,
1820 txt_out: *mut *mut ares_txt_ext,
1821 ) -> ::core::ffi::c_int;
1822}
1823unsafe extern "C" {
1824 pub fn ares_parse_naptr_reply(
1825 abuf: *const ::core::ffi::c_uchar,
1826 alen: ::core::ffi::c_int,
1827 naptr_out: *mut *mut ares_naptr_reply,
1828 ) -> ::core::ffi::c_int;
1829}
1830unsafe extern "C" {
1831 pub fn ares_parse_soa_reply(
1832 abuf: *const ::core::ffi::c_uchar,
1833 alen: ::core::ffi::c_int,
1834 soa_out: *mut *mut ares_soa_reply,
1835 ) -> ::core::ffi::c_int;
1836}
1837unsafe extern "C" {
1838 pub fn ares_parse_uri_reply(
1839 abuf: *const ::core::ffi::c_uchar,
1840 alen: ::core::ffi::c_int,
1841 uri_out: *mut *mut ares_uri_reply,
1842 ) -> ::core::ffi::c_int;
1843}
1844unsafe extern "C" {
1845 pub fn ares_free_string(str_: *mut ::core::ffi::c_void);
1846}
1847unsafe extern "C" {
1848 pub fn ares_free_hostent(host: *mut hostent);
1849}
1850unsafe extern "C" {
1851 pub fn ares_free_data(dataptr: *mut ::core::ffi::c_void);
1852}
1853unsafe extern "C" {
1854 pub fn ares_strerror(code: ::core::ffi::c_int) -> *const ::core::ffi::c_char;
1855}
1856#[repr(C)]
1857#[derive(Copy, Clone)]
1858pub struct ares_addr_node {
1859 pub next: *mut ares_addr_node,
1860 pub family: ::core::ffi::c_int,
1861 pub addr: ares_addr_node__bindgen_ty_1,
1862}
1863#[repr(C)]
1864#[derive(Copy, Clone)]
1865pub union ares_addr_node__bindgen_ty_1 {
1866 pub addr4: in_addr,
1867 pub addr6: ares_in6_addr,
1868}
1869#[repr(C)]
1870#[derive(Copy, Clone)]
1871pub struct ares_addr_port_node {
1872 pub next: *mut ares_addr_port_node,
1873 pub family: ::core::ffi::c_int,
1874 pub addr: ares_addr_port_node__bindgen_ty_1,
1875 pub udp_port: ::core::ffi::c_int,
1876 pub tcp_port: ::core::ffi::c_int,
1877}
1878#[repr(C)]
1879#[derive(Copy, Clone)]
1880pub union ares_addr_port_node__bindgen_ty_1 {
1881 pub addr4: in_addr,
1882 pub addr6: ares_in6_addr,
1883}
1884unsafe extern "C" {
1885 pub fn ares_set_servers(
1886 channel: *mut ares_channel_t,
1887 servers: *const ares_addr_node,
1888 ) -> ::core::ffi::c_int;
1889}
1890unsafe extern "C" {
1891 pub fn ares_set_servers_ports(
1892 channel: *mut ares_channel_t,
1893 servers: *const ares_addr_port_node,
1894 ) -> ::core::ffi::c_int;
1895}
1896unsafe extern "C" {
1897 pub fn ares_set_servers_csv(
1898 channel: *mut ares_channel_t,
1899 servers: *const ::core::ffi::c_char,
1900 ) -> ::core::ffi::c_int;
1901}
1902unsafe extern "C" {
1903 pub fn ares_set_servers_ports_csv(
1904 channel: *mut ares_channel_t,
1905 servers: *const ::core::ffi::c_char,
1906 ) -> ::core::ffi::c_int;
1907}
1908unsafe extern "C" {
1909 pub fn ares_get_servers_csv(channel: *const ares_channel_t) -> *mut ::core::ffi::c_char;
1910}
1911unsafe extern "C" {
1912 pub fn ares_get_servers(
1913 channel: *const ares_channel_t,
1914 servers: *mut *mut ares_addr_node,
1915 ) -> ::core::ffi::c_int;
1916}
1917unsafe extern "C" {
1918 pub fn ares_get_servers_ports(
1919 channel: *const ares_channel_t,
1920 servers: *mut *mut ares_addr_port_node,
1921 ) -> ::core::ffi::c_int;
1922}
1923unsafe extern "C" {
1924 pub fn ares_inet_ntop(
1925 af: ::core::ffi::c_int,
1926 src: *const ::core::ffi::c_void,
1927 dst: *mut ::core::ffi::c_char,
1928 size: ares_socklen_t,
1929 ) -> *const ::core::ffi::c_char;
1930}
1931unsafe extern "C" {
1932 pub fn ares_inet_pton(
1933 af: ::core::ffi::c_int,
1934 src: *const ::core::ffi::c_char,
1935 dst: *mut ::core::ffi::c_void,
1936 ) -> ::core::ffi::c_int;
1937}
1938unsafe extern "C" {
1939 #[doc = " Whether or not the c-ares library was built with threadsafety\n\n \\return ARES_TRUE if built with threadsafety, ARES_FALSE if not"]
1940 pub fn ares_threadsafety() -> ares_bool_t;
1941}
1942unsafe extern "C" {
1943 #[doc = " Block until notified that there are no longer any queries in queue, or\n the specified timeout has expired.\n\n \\param[in] channel Initialized ares channel\n \\param[in] timeout_ms Number of milliseconds to wait for the queue to be\n empty. -1 for Infinite.\n \\return ARES_ENOTIMP if not built with threading support, ARES_ETIMEOUT\n if requested timeout expires, ARES_SUCCESS when queue is empty."]
1944 pub fn ares_queue_wait_empty(
1945 channel: *mut ares_channel_t,
1946 timeout_ms: ::core::ffi::c_int,
1947 ) -> ares_status_t;
1948}
1949unsafe extern "C" {
1950 #[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"]
1951 pub fn ares_queue_active_queries(channel: *const ares_channel_t) -> usize;
1952}
1953#[cfg(target_os = "android")]
1954extern "C" {
1955 pub fn ares_library_init_jvm(jvm: *mut jni_sys::JavaVM);
1956}
1957#[cfg(target_os = "android")]
1958extern "C" {
1959 pub fn ares_library_init_android(connectivity_manager: jni_sys::jobject) -> ::core::ffi::c_int;
1960}
1961#[cfg(target_os = "android")]
1962extern "C" {
1963 pub fn ares_library_android_initialized() -> ::core::ffi::c_int;
1964}