Blame ares_search.3

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_SEARCH 3 "24 July 1998"
Packit 514978
.SH NAME
Packit 514978
ares_search \- Initiate a DNS query with domain search
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_search(ares_channel \fIchannel\fP, const char *\fIname\fP,
Packit 514978
.B 	int \fIdnsclass\fP, int \fItype\fP, ares_callback \fIcallback\fP,
Packit 514978
.B	void *\fIarg\fP)
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The
Packit 514978
.B ares_search
Packit 514978
function initiates a series of single-question DNS queries on the name
Packit 514978
service channel identified by
Packit 514978
.IR channel ,
Packit 514978
using the channel's search domains as well as a host alias file given
Packit 514978
by the HOSTALIAS environment variable.  The parameter
Packit 514978
.I name
Packit 514978
gives the alias name or the base of the query name as a NUL-terminated
Packit 514978
C string of period-separated labels; if it ends with a period, the
Packit 514978
channel's search domains will not be used.  Periods and backslashes
Packit 514978
within a label must be escaped with a backslash.  The parameters
Packit 514978
.I dnsclass
Packit 514978
and
Packit 514978
.I type
Packit 514978
give the class and type of the query using the values defined in
Packit 514978
.BR <arpa/nameser.h> .
Packit 514978
When the query sequence is complete or has failed, the ares library
Packit 514978
will invoke
Packit 514978
.IR callback .
Packit 514978
Completion or failure of the query sequence may happen immediately, or
Packit 514978
may 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_search
Packit 514978
argument
Packit 514978
.IR arg .
Packit 514978
The callback argument
Packit 514978
.I status
Packit 514978
indicates whether the query sequence ended with a successful query
Packit 514978
and, if not, how the query sequence failed.  It may have any of the
Packit 514978
following values:
Packit 514978
.TP 19
Packit 514978
.B ARES_SUCCESS
Packit 514978
A query completed successfully.
Packit 514978
.TP 19
Packit 514978
.B ARES_ENODATA
Packit 514978
No query completed successfully; when the query was tried without a
Packit 514978
search domain appended, a response was returned with no answers.
Packit 514978
.TP 19
Packit 514978
.B ARES_EFORMERR
Packit 514978
A query completed but the server claimed that the query was
Packit 514978
malformatted.
Packit 514978
.TP 19
Packit 514978
.B ARES_ESERVFAIL
Packit 514978
No query completed successfully; when the query was tried without a
Packit 514978
search domain appended, the server claimed to have experienced a
Packit 514978
failure.  (This code can only occur if the
Packit 514978
.B ARES_FLAG_NOCHECKRESP
Packit 514978
flag was specified at channel initialization time; otherwise, such
Packit 514978
responses are ignored at the
Packit 514978
.BR ares_send (3)
Packit 514978
level.)
Packit 514978
.TP 19
Packit 514978
.B ARES_ENOTFOUND
Packit 514978
No query completed successfully; when the query was tried without a
Packit 514978
search domain appended, the server reported that the queried-for
Packit 514978
domain name was not found.
Packit 514978
.TP 19
Packit 514978
.B ARES_ENOTIMP
Packit 514978
A query completed but the server does not implement the operation
Packit 514978
requested by the query.  (This code can only occur if the
Packit 514978
.B ARES_FLAG_NOCHECKRESP
Packit 514978
flag was specified at channel initialization time; otherwise, such
Packit 514978
responses are ignored at the
Packit 514978
.BR ares_send (3)
Packit 514978
level.)
Packit 514978
.TP 19
Packit 514978
.B ARES_EREFUSED
Packit 514978
A query completed but the server refused the query.  (This code can
Packit 514978
only occur returned if the
Packit 514978
.B ARES_FLAG_NOCHECKRESP
Packit 514978
flag was specified at channel initialization time; otherwise, such
Packit 514978
responses are ignored at the
Packit 514978
.BR ares_send (3)
Packit 514978
level.)
Packit 514978
.TP 19
Packit 514978
.B ARES_TIMEOUT
Packit 514978
No name servers responded to a query 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 a query completed successfully, 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 successfully,
Packit 514978
.I abuf
Packit 514978
will usually be NULL and
Packit 514978
.I alen
Packit 514978
will usually be 0, but in some cases an unsuccessful query result may
Packit 514978
be placed in
Packit 514978
.IR abuf .
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.