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