source: trunk/athena/lib/ares/ares_query.3 @ 15107

Revision 15107, 4.1 KB checked in by ghudson, 24 years ago (diff)
Rename 'class' to 'dnsclass' for the sake of C++.
Line 
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
19ares_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
32The
33.B ares_query
34function initiates a single-question DNS query on the name service
35channel identified by
36.IR channel .
37The parameter
38.I name
39gives the query name as a NUL-terminated C string of period-separated
40labels optionally ending with a period; periods and backslashes within
41a label must be escaped with a backslash.  The parameters
42.I dnsclass
43and
44.I type
45give the class and type of the query using the values defined in
46.BR <arpa/nameser.h> .
47When the query is complete or has failed, the ares library will invoke
48.IR callback .
49Completion or failure of the query may happen immediately, or may
50happen during a later call to
51.BR ares_process (3)
52or
53.BR ares_destroy (3).
54.PP
55The callback argument
56.I arg
57is copied from the
58.B ares_query
59argument
60.IR arg .
61The callback argument
62.I status
63indicates whether the query succeeded and, if not, how it failed.  It
64may have any of the following values:
65.TP 19
66.B ARES_SUCCESS
67The query completed successfully.
68.TP 19
69.B ARES_ENODATA
70The query completed but contains no answers.
71.TP 19
72.B ARES_EFORMERR
73The query completed but the server claims that the query was
74malformatted.
75.TP 19
76.B ARES_ESERVFAIL
77The query completed but the server claims to have experienced a
78failure.  (This code can only occur if the
79.B ARES_FLAG_NOCHECKRESP
80flag was specified at channel initialization time; otherwise, such
81responses are ignored at the
82.BR ares_send (3)
83level.)
84.TP 19
85.B ARES_ENOTFOUND
86The query completed but the queried-for domain name was not found.
87.TP 19
88.B ARES_ENOTIMP
89The query completed but the server does not implement the operation
90requested by the query.  (This code can only occur if the
91.B ARES_FLAG_NOCHECKRESP
92flag was specified at channel initialization time; otherwise, such
93responses are ignored at the
94.BR ares_send (3)
95level.)
96.TP 19
97.B ARES_EREFUSED
98The query completed but the server refused the query.  (This code can
99only occur if the
100.B ARES_FLAG_NOCHECKRESP
101flag was specified at channel initialization time; otherwise, such
102responses are ignored at the
103.BR ares_send (3)
104level.)
105.TP 19
106.B ARES_EBADNAME
107The query name
108.I name
109could not be encoded as a domain name, either because it contained a
110zero-length label or because it contained a label of more than 63
111characters.
112.TP 19
113.B ARES_ETIMEOUT
114No name servers responded within the timeout period.
115.TP 19
116.B ARES_ECONNREFUSED
117No name servers could be contacted.
118.TP 19
119.B ARES_ENOMEM
120Memory was exhausted.
121.TP 19
122.B ARES_EDESTRUCTION
123The name service channel
124.I channel
125is being destroyed; the query will not be completed.
126.PP
127If the query completed (even if there was something wrong with it, as
128indicated by some of the above error codes), the callback argument
129.I abuf
130points to a result buffer of length
131.IR alen .
132If the query did not complete,
133.I abuf
134will be NULL and
135.I alen
136will be 0.
137.SH SEE ALSO
138.BR ares_process (3)
139.SH AUTHOR
140Greg Hudson, MIT Information Systems
141.br
142Copyright 1998 by the Massachusetts Institute of Technology.
Note: See TracBrowser for help on using the repository browser.