Blame ares_gethostbyaddr.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_GETHOSTBYADDR 3 "24 July 1998"
Packit 514978
.SH NAME
Packit 514978
ares_gethostbyaddr \- Initiate a host query by address
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
.B #include <ares.h>
Packit 514978
.PP
Packit 514978
.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
Packit 514978
.B	int \fItimeouts\fP, struct hostent *\fIhostent\fP)
Packit 514978
.PP
Packit 514978
.B void ares_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP,
Packit 514978
.B 	int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP,
Packit 514978
.B 	void *\fIarg\fP)
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The
Packit 514978
.B ares_gethostbyaddr
Packit 514978
function initiates a host query by address on the name service channel
Packit 514978
identified by
Packit 514978
.IR channel .
Packit 514978
The parameters
Packit 514978
.I addr
Packit 514978
and
Packit 514978
.I addrlen
Packit 514978
give the address as a series of bytes, and
Packit 514978
.I family
Packit 514978
gives the type of address.  When the query is complete or has failed, the ares
Packit 514978
library will invoke \fIcallback\fP.  Completion or failure of the query may
Packit 514978
happen immediately, or may happen during a later call to
Packit 514978
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
Packit 514978
.PP
Packit 514978
The callback argument
Packit 514978
.I arg
Packit 514978
is copied from the
Packit 514978
.B ares_gethostbyaddr
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 host lookup completed successfully.
Packit 514978
.TP 19
Packit 514978
.B ARES_ENOTIMP
Packit 514978
The ares library does not know how to look up addresses of type
Packit 514978
.IR family .
Packit 514978
.TP 19
Packit 514978
.B ARES_ENOTFOUND
Packit 514978
The address
Packit 514978
.I addr
Packit 514978
was not found.
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
On successful completion of the query, the callback argument
Packit 514978
.I hostent
Packit 514978
points to a
Packit 514978
.B struct hostent
Packit 514978
containing the name of the host returned by the query.  The callback
Packit 514978
need not and should not attempt to free the memory pointed to by
Packit 514978
.IR hostent ;
Packit 514978
the ares library will free it when the callback returns.  If the query
Packit 514978
did not complete successfully,
Packit 514978
.I hostent
Packit 514978
will be
Packit 514978
.BR NULL .
Packit 514978
.SH SEE ALSO
Packit 514978
.BR ares_process (3),
Packit 514978
.BR ares_gethostbyname (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.