1 | .\" $Id: ares_query.3,v 1.2 2000-09-21 19:15:56 ghudson Exp $ |
---|
2 | .\" |
---|
3 | .\" Copyright 1998 by the Massachusetts Institute of Technology. |
---|
4 | .\" |
---|
5 | .\" Permission to use, copy, modify, and distribute this |
---|
6 | .\" software and its documentation for any purpose and without |
---|
7 | .\" fee is hereby granted, provided that the above copyright |
---|
8 | .\" notice appear in all copies and that both that copyright |
---|
9 | .\" notice and this permission notice appear in supporting |
---|
10 | .\" documentation, and that the name of M.I.T. not be used in |
---|
11 | .\" advertising or publicity pertaining to distribution of the |
---|
12 | .\" software without specific, written prior permission. |
---|
13 | .\" M.I.T. makes no representations about the suitability of |
---|
14 | .\" this software for any purpose. It is provided "as is" |
---|
15 | .\" without express or implied warranty. |
---|
16 | .\" |
---|
17 | .TH ARES_QUERY 3 "24 July 1998" |
---|
18 | .SH NAME |
---|
19 | ares_query \- Initiate a single-question DNS query |
---|
20 | .SH SYNOPSIS |
---|
21 | .nf |
---|
22 | .B #include <ares.h> |
---|
23 | .PP |
---|
24 | .B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP, |
---|
25 | .B unsigned char *\fIabuf\fP, int \fIalen\fP) |
---|
26 | .PP |
---|
27 | .B void ares_query(ares_channel \fIchannel\fP, const char *\fIname\fP, |
---|
28 | .B int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP, |
---|
29 | .B void *\fIarg\fP) |
---|
30 | .fi |
---|
31 | .SH DESCRIPTION |
---|
32 | The |
---|
33 | .B ares_query |
---|
34 | function initiates a single-question DNS query on the name service |
---|
35 | channel identified by |
---|
36 | .IR channel . |
---|
37 | The parameter |
---|
38 | .I name |
---|
39 | gives the query name as a NUL-terminated C string of period-separated |
---|
40 | labels optionally ending with a period; periods and backslashes within |
---|
41 | a label must be escaped with a backslash. The parameters |
---|
42 | .I dnsclass |
---|
43 | and |
---|
44 | .I type |
---|
45 | give the class and type of the query using the values defined in |
---|
46 | .BR <arpa/nameser.h> . |
---|
47 | When the query is complete or has failed, the ares library will invoke |
---|
48 | .IR callback . |
---|
49 | Completion or failure of the query may happen immediately, or may |
---|
50 | happen during a later call to |
---|
51 | .BR ares_process (3) |
---|
52 | or |
---|
53 | .BR ares_destroy (3). |
---|
54 | .PP |
---|
55 | The callback argument |
---|
56 | .I arg |
---|
57 | is copied from the |
---|
58 | .B ares_query |
---|
59 | argument |
---|
60 | .IR arg . |
---|
61 | The callback argument |
---|
62 | .I status |
---|
63 | indicates whether the query succeeded and, if not, how it failed. It |
---|
64 | may have any of the following values: |
---|
65 | .TP 19 |
---|
66 | .B ARES_SUCCESS |
---|
67 | The query completed successfully. |
---|
68 | .TP 19 |
---|
69 | .B ARES_ENODATA |
---|
70 | The query completed but contains no answers. |
---|
71 | .TP 19 |
---|
72 | .B ARES_EFORMERR |
---|
73 | The query completed but the server claims that the query was |
---|
74 | malformatted. |
---|
75 | .TP 19 |
---|
76 | .B ARES_ESERVFAIL |
---|
77 | The query completed but the server claims to have experienced a |
---|
78 | failure. (This code can only occur if the |
---|
79 | .B ARES_FLAG_NOCHECKRESP |
---|
80 | flag was specified at channel initialization time; otherwise, such |
---|
81 | responses are ignored at the |
---|
82 | .BR ares_send (3) |
---|
83 | level.) |
---|
84 | .TP 19 |
---|
85 | .B ARES_ENOTFOUND |
---|
86 | The query completed but the queried-for domain name was not found. |
---|
87 | .TP 19 |
---|
88 | .B ARES_ENOTIMP |
---|
89 | The query completed but the server does not implement the operation |
---|
90 | requested by the query. (This code can only occur if the |
---|
91 | .B ARES_FLAG_NOCHECKRESP |
---|
92 | flag was specified at channel initialization time; otherwise, such |
---|
93 | responses are ignored at the |
---|
94 | .BR ares_send (3) |
---|
95 | level.) |
---|
96 | .TP 19 |
---|
97 | .B ARES_EREFUSED |
---|
98 | The query completed but the server refused the query. (This code can |
---|
99 | only occur if the |
---|
100 | .B ARES_FLAG_NOCHECKRESP |
---|
101 | flag was specified at channel initialization time; otherwise, such |
---|
102 | responses are ignored at the |
---|
103 | .BR ares_send (3) |
---|
104 | level.) |
---|
105 | .TP 19 |
---|
106 | .B ARES_EBADNAME |
---|
107 | The query name |
---|
108 | .I name |
---|
109 | could not be encoded as a domain name, either because it contained a |
---|
110 | zero-length label or because it contained a label of more than 63 |
---|
111 | characters. |
---|
112 | .TP 19 |
---|
113 | .B ARES_ETIMEOUT |
---|
114 | No name servers responded within the timeout period. |
---|
115 | .TP 19 |
---|
116 | .B ARES_ECONNREFUSED |
---|
117 | No name servers could be contacted. |
---|
118 | .TP 19 |
---|
119 | .B ARES_ENOMEM |
---|
120 | Memory was exhausted. |
---|
121 | .TP 19 |
---|
122 | .B ARES_EDESTRUCTION |
---|
123 | The name service channel |
---|
124 | .I channel |
---|
125 | is being destroyed; the query will not be completed. |
---|
126 | .PP |
---|
127 | If the query completed (even if there was something wrong with it, as |
---|
128 | indicated by some of the above error codes), the callback argument |
---|
129 | .I abuf |
---|
130 | points to a result buffer of length |
---|
131 | .IR alen . |
---|
132 | If the query did not complete, |
---|
133 | .I abuf |
---|
134 | will be NULL and |
---|
135 | .I alen |
---|
136 | will be 0. |
---|
137 | .SH SEE ALSO |
---|
138 | .BR ares_process (3) |
---|
139 | .SH AUTHOR |
---|
140 | Greg Hudson, MIT Information Systems |
---|
141 | .br |
---|
142 | Copyright 1998 by the Massachusetts Institute of Technology. |
---|