2 .\" Copyright 1998 by the Massachusetts Institute of Technology.
4 .\" Permission to use, copy, modify, and distribute this
5 .\" software and its documentation for any purpose and without
6 .\" fee is hereby granted, provided that the above copyright
7 .\" notice appear in all copies and that both that copyright
8 .\" notice and this permission notice appear in supporting
9 .\" documentation, and that the name of M.I.T. not be used in
10 .\" advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission.
12 .\" M.I.T. makes no representations about the suitability of
13 .\" this software for any purpose. It is provided "as is"
14 .\" without express or implied warranty.
16 .TH ARES_QUERY 3 "24 July 1998"
18 ares_query \- Initiate a single-question DNS query
23 .B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
24 .B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
26 .B void ares_query(ares_channel \fIchannel\fP, const char *\fIname\fP,
27 .B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
33 function initiates a single-question DNS query on the name service
38 gives the query name as a NUL-terminated C string of period-separated
39 labels optionally ending with a period; periods and backslashes within
40 a label must be escaped with a backslash. The parameters
44 give the class and type of the query using the values defined in
45 .BR <arpa/nameser.h> .
46 When the query is complete or has failed, the ares library will invoke
48 Completion or failure of the query may happen immediately, or may
49 happen during a later call to
62 indicates whether the query succeeded and, if not, how it failed. It
63 may have any of the following values:
66 The query completed successfully.
69 The query completed but contains no answers.
72 The query completed but the server claims that the query was
76 The query completed but the server claims to have experienced a
77 failure. (This code can only occur if the
78 .B ARES_FLAG_NOCHECKRESP
79 flag was specified at channel initialization time; otherwise, such
80 responses are ignored at the
85 The query completed but the queried-for domain name was not found.
88 The query completed but the server does not implement the operation
89 requested by the query. (This code can only occur if the
90 .B ARES_FLAG_NOCHECKRESP
91 flag was specified at channel initialization time; otherwise, such
92 responses are ignored at the
97 The query completed but the server refused the query. (This code can
99 .B ARES_FLAG_NOCHECKRESP
100 flag was specified at channel initialization time; otherwise, such
101 responses are ignored at the
108 could not be encoded as a domain name, either because it contained a
109 zero-length label or because it contained a label of more than 63
113 No name servers responded within the timeout period.
116 No name servers could be contacted.
119 Memory was exhausted.
122 The query was cancelled.
125 The name service channel
127 is being destroyed; the query will not be completed.
129 The callback argument
131 reports how many times a query timed out during the execution of the
134 If the query completed (even if there was something wrong with it, as
135 indicated by some of the above error codes), the callback argument
137 points to a result buffer of length
139 If the query did not complete,
147 Greg Hudson, MIT Information Systems
149 Copyright 1998 by the Massachusetts Institute of Technology.