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