|
Packit |
514978 |
.\"
|
|
Packit |
514978 |
.\" Copyright 1998 by the Massachusetts Institute of Technology.
|
|
Packit |
514978 |
.\"
|
|
Packit |
514978 |
.\" Permission to use, copy, modify, and distribute this
|
|
Packit |
514978 |
.\" software and its documentation for any purpose and without
|
|
Packit |
514978 |
.\" fee is hereby granted, provided that the above copyright
|
|
Packit |
514978 |
.\" notice appear in all copies and that both that copyright
|
|
Packit |
514978 |
.\" notice and this permission notice appear in supporting
|
|
Packit |
514978 |
.\" documentation, and that the name of M.I.T. not be used in
|
|
Packit |
514978 |
.\" advertising or publicity pertaining to distribution of the
|
|
Packit |
514978 |
.\" software without specific, written prior permission.
|
|
Packit |
514978 |
.\" M.I.T. makes no representations about the suitability of
|
|
Packit |
514978 |
.\" this software for any purpose. It is provided "as is"
|
|
Packit |
514978 |
.\" without express or implied warranty.
|
|
Packit |
514978 |
.\"
|
|
Packit |
514978 |
.TH ARES_SEND 3 "25 July 1998"
|
|
Packit |
514978 |
.SH NAME
|
|
Packit |
514978 |
ares_send \- Initiate a DNS query
|
|
Packit |
514978 |
.SH SYNOPSIS
|
|
Packit |
514978 |
.nf
|
|
Packit |
514978 |
.B #include <ares.h>
|
|
Packit |
514978 |
.PP
|
|
Packit |
514978 |
.B typedef void (*ares_callback)(void *\fIarg\fP, int \fIstatus\fP,
|
|
Packit |
514978 |
.B int \fItimeouts\fP, unsigned char *\fIabuf\fP, int \fIalen\fP)
|
|
Packit |
514978 |
.PP
|
|
Packit |
514978 |
.B void ares_send(ares_channel \fIchannel\fP, const unsigned char *\fIqbuf\fP,
|
|
Packit |
514978 |
.B int \fIqlen\fP, ares_callback \fIcallback\fP, void *\fIarg\fP)
|
|
Packit |
514978 |
.fi
|
|
Packit |
514978 |
.SH DESCRIPTION
|
|
Packit |
514978 |
The
|
|
Packit |
514978 |
.B ares_send
|
|
Packit |
514978 |
function initiates a DNS query on the name service channel identified
|
|
Packit |
514978 |
by
|
|
Packit |
514978 |
.IR channel .
|
|
Packit |
514978 |
The parameters
|
|
Packit |
514978 |
.I qbuf
|
|
Packit |
514978 |
and
|
|
Packit |
514978 |
.I qlen
|
|
Packit |
514978 |
give the DNS query, which should already have been formatted according
|
|
Packit |
514978 |
to the DNS protocol. When the query is complete or has failed, the
|
|
Packit |
514978 |
ares library will invoke
|
|
Packit |
514978 |
.IR callback .
|
|
Packit |
514978 |
Completion or failure of the query may happen immediately, or may
|
|
Packit |
514978 |
happen during a later call to
|
|
Packit |
514978 |
.BR ares_process (3)
|
|
Packit |
514978 |
or
|
|
Packit |
514978 |
.BR ares_destroy (3).
|
|
Packit |
514978 |
.PP
|
|
Packit |
514978 |
The callback argument
|
|
Packit |
514978 |
.I arg
|
|
Packit |
514978 |
is copied from the
|
|
Packit |
514978 |
.B ares_send
|
|
Packit |
514978 |
argument
|
|
Packit |
514978 |
.IR arg .
|
|
Packit |
514978 |
The callback argument
|
|
Packit |
514978 |
.I status
|
|
Packit |
514978 |
indicates whether the query succeeded and, if not, how it failed. It
|
|
Packit |
514978 |
may have any of the following values:
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_SUCCESS
|
|
Packit |
514978 |
The query completed.
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_EBADQUERY
|
|
Packit |
514978 |
The query buffer was poorly formed (was not long enough for a DNS
|
|
Packit |
514978 |
header or was too long for TCP transmission).
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_ETIMEOUT
|
|
Packit |
514978 |
No name servers responded within the timeout period.
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_ECONNREFUSED
|
|
Packit |
514978 |
No name servers could be contacted.
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_ENOMEM
|
|
Packit |
514978 |
Memory was exhausted.
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_ECANCELLED
|
|
Packit |
514978 |
The query was cancelled.
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_EDESTRUCTION
|
|
Packit |
514978 |
The name service channel
|
|
Packit |
514978 |
.I channel
|
|
Packit |
514978 |
is being destroyed; the query will not be completed.
|
|
Packit |
514978 |
.PP
|
|
Packit |
514978 |
The callback argument
|
|
Packit |
514978 |
.I timeouts
|
|
Packit |
514978 |
reports how many times a query timed out during the execution of the
|
|
Packit |
514978 |
given request.
|
|
Packit |
514978 |
.PP
|
|
Packit |
514978 |
If the query completed, the callback argument
|
|
Packit |
514978 |
.I abuf
|
|
Packit |
514978 |
points to a result buffer of length
|
|
Packit |
514978 |
.IR alen .
|
|
Packit |
514978 |
If the query did not complete,
|
|
Packit |
514978 |
.I abuf
|
|
Packit |
514978 |
will be NULL and
|
|
Packit |
514978 |
.I alen
|
|
Packit |
514978 |
will be 0.
|
|
Packit |
514978 |
.PP
|
|
Packit |
514978 |
Unless the flag
|
|
Packit |
514978 |
.B ARES_FLAG_NOCHECKRESP
|
|
Packit |
514978 |
was set at channel initialization time,
|
|
Packit |
514978 |
.B ares_send
|
|
Packit |
514978 |
will normally ignore responses whose questions do not match the
|
|
Packit |
514978 |
questions in
|
|
Packit |
514978 |
.IR qbuf ,
|
|
Packit |
514978 |
as well as responses with reply codes of
|
|
Packit |
514978 |
.BR SERVFAIL ,
|
|
Packit |
514978 |
.BR NOTIMP ,
|
|
Packit |
514978 |
and
|
|
Packit |
514978 |
.BR REFUSED .
|
|
Packit |
514978 |
Unlike other query functions in the ares library, however,
|
|
Packit |
514978 |
.B ares_send
|
|
Packit |
514978 |
does not inspect the header of the reply packet to determine the error
|
|
Packit |
514978 |
status, so a callback status of
|
|
Packit |
514978 |
.B ARES_SUCCESS
|
|
Packit |
514978 |
does not reflect as much about the response as for other query
|
|
Packit |
514978 |
functions.
|
|
Packit |
514978 |
.SH SEE ALSO
|
|
Packit |
514978 |
.BR ares_process (3)
|
|
Packit |
514978 |
.SH AUTHOR
|
|
Packit |
514978 |
Greg Hudson, MIT Information Systems
|
|
Packit |
514978 |
.br
|
|
Packit |
514978 |
Copyright 1998 by the Massachusetts Institute of Technology.
|