1ARES_QUERY(3) Library Functions Manual ARES_QUERY(3)
2
3
4
6 ares_query - Initiate a single-question DNS query
7
9 #include <ares.h>
10
11 typedef void (*ares_callback)(void *arg, int status,
12 int timeouts, unsigned char *abuf, int alen)
13
14 void ares_query(ares_channel channel, const char *name,
15 int dnsclass, int type, ares_callback callback,
16 void *arg)
17
19 The ares_query function initiates a single-question DNS query on the
20 name service channel identified by channel. The parameter name gives
21 the query name as a NUL-terminated C string of period-separated labels
22 optionally ending with a period; periods and backslashes within a label
23 must be escaped with a backslash. The parameters dnsclass and type
24 give the class and type of the query using the values defined in
25 <arpa/nameser.h>. When the query is complete or has failed, the ares
26 library will invoke callback. Completion or failure of the query may
27 happen immediately, or may happen during a later call to
28 ares_process(3) or ares_destroy(3).
29
30 The callback argument arg is copied from the ares_query argument arg.
31 The callback argument status indicates whether the query succeeded and,
32 if not, how it failed. It may have any of the following values:
33
34 ARES_SUCCESS The query completed successfully.
35
36 ARES_ENODATA The query completed but contains no answers.
37
38 ARES_EFORMERR The query completed but the server claims that the
39 query was malformatted.
40
41 ARES_ESERVFAIL The query completed but the server claims to have
42 experienced a failure. (This code can only occur if
43 the ARES_FLAG_NOCHECKRESP flag was specified at
44 channel initialization time; otherwise, such
45 responses are ignored at the ares_send(3) level.)
46
47 ARES_ENOTFOUND The query completed but the queried-for domain name
48 was not found.
49
50 ARES_ENOTIMP The query completed but the server does not imple‐
51 ment the operation requested by the query. (This
52 code can only occur if the ARES_FLAG_NOCHECKRESP
53 flag was specified at channel initialization time;
54 otherwise, such responses are ignored at the
55 ares_send(3) level.)
56
57 ARES_EREFUSED The query completed but the server refused the
58 query. (This code can only occur if the
59 ARES_FLAG_NOCHECKRESP flag was specified at channel
60 initialization time; otherwise, such responses are
61 ignored at the ares_send(3) level.)
62
63 ARES_EBADNAME The query name name could not be encoded as a domain
64 name, either because it contained a zero-length
65 label or because it contained a label of more than
66 63 characters.
67
68 ARES_ETIMEOUT No name servers responded within the timeout period.
69
70 ARES_ECONNREFUSED No name servers could be contacted.
71
72 ARES_ENOMEM Memory was exhausted.
73
74 ARES_EDESTRUCTION The name service channel channel is being destroyed;
75 the query will not be completed.
76
77 The callback argument timeouts reports how many times a query timed out
78 during the execution of the given request.
79
80 If the query completed (even if there was something wrong with it, as
81 indicated by some of the above error codes), the callback argument abuf
82 points to a result buffer of length alen. If the query did not com‐
83 plete, abuf will be NULL and alen will be 0.
84
86 ares_process(3)
87
89 Greg Hudson, MIT Information Systems
90 Copyright 1998 by the Massachusetts Institute of Technology.
91
92
93
94 24 July 1998 ARES_QUERY(3)