source: trunk/athena/lib/ares/ares_send.3 @ 11855

Revision 11855, 3.1 KB checked in by ghudson, 26 years ago (diff)
Documentation for libares, an asynchronous resolver library
Line 
1.\" $Id: ares_send.3,v 1.1 1998-08-13 18:07:35 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_SEND 3 "25 July 1998"
18.SH NAME
19ares_send \- Initiate a 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
28void ares_send(ares_channel \fIchannel\fP, const unsigned char *\fIqbuf\fP,
29.B      int \fIqlen\fP, ares_callback \fIcallback\fP, void *\fIarg\fP)
30.fi
31.SH DESCRIPTION
32The
33.B ares_send
34function initiates a DNS query on the name service channel identified
35by
36.IR channel .
37The parameters
38.I qbuf
39and
40.I qlen
41give the DNS query, which should already have been formatted according
42to the DNS protocol.  When the query is complete or has failed, the
43ares library will invoke
44.IR callback .
45Completion or failure of the query may happen immediately, or may
46happen during a later call to
47.BR ares_process (3)
48or
49.BR ares_destroy (3).
50.PP
51The callback argument
52.I arg
53is copied from the
54.B ares_send
55argument
56.IR arg .
57The callback argument
58.I status
59indicates whether the query succeeded and, if not, how it failed.  It
60may have any of the following values:
61.TP 19
62.B ARES_SUCCESS
63The query completed.
64.TP 19
65.B ARES_EBADQUERY
66The query buffer was poorly formed (was not long enough for a DNS
67header or was too long for TCP transmission).
68.TP 19
69.B ARES_ETIMEOUT
70No name servers responded within the timeout period.
71.TP 19
72.B ARES_ECONNREFUSED
73No name servers could be contacted.
74.TP 19
75.B ARES_ENOMEM
76Memory was exhausted.
77.TP 19
78.B ARES_EDESTRUCTION
79The name service channel
80.I channel
81is being destroyed; the query will not be completed.
82.PP
83If the query completed, the callback argument
84.I abuf
85points to a result buffer of length
86.IR alen .
87If the query did not complete,
88.I abuf
89will be NULL and
90.I alen
91will be 0.
92.PP
93Unless the flag
94.B ARES_FLAG_NOCHECKRESP
95was set at channel initialization time,
96.B ares_send
97will normally ignore responses whose questions do not match the
98questions in
99.IR qbuf ,
100as well as responses with reply codes of
101.BR SERVFAIL ,
102.BR NOTIMP ,
103and
104.BR REFUSED .
105Unlike other query functions in the ares library, however,
106.B ares_send
107does not inspect the header of the reply packet to determine the error
108status, so a callback status of
109.B ARES_SUCCESS
110does not reflect as much about the response as for other query
111functions.
112.SH SEE ALSO
113.BR ares_process (3)
114.SH AUTHOR
115Greg Hudson, MIT Information Systems
116.br
117Copyright 1998 by the Massachusetts Institute of Technology.
Note: See TracBrowser for help on using the repository browser.