|
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_GETHOSTBYNAME 3 "25 July 1998"
|
|
Packit |
514978 |
.SH NAME
|
|
Packit |
514978 |
ares_gethostbyname \- Initiate a host query by name
|
|
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_gethostbyname(ares_channel \fIchannel\fP, const char *\fIname\fP,
|
|
Packit |
514978 |
.B int \fIfamily\fP, ares_host_callback \fIcallback\fP, void *\fIarg\fP)
|
|
Packit |
514978 |
.fi
|
|
Packit |
514978 |
.SH DESCRIPTION
|
|
Packit |
514978 |
The
|
|
Packit |
514978 |
.B ares_gethostbyname
|
|
Packit |
514978 |
function initiates a host query by name on the name service channel
|
|
Packit |
514978 |
identified by
|
|
Packit |
514978 |
.IR channel .
|
|
Packit |
514978 |
The parameter
|
|
Packit |
514978 |
.I name
|
|
Packit |
514978 |
gives the hostname as a NUL-terminated C string, and
|
|
Packit |
514978 |
.I family
|
|
Packit |
514978 |
gives the desired type of address for the resulting host entry. When the
|
|
Packit |
514978 |
query is complete or has failed, the ares library will invoke \fIcallback\fP.
|
|
Packit |
514978 |
Completion or failure of the query may happen immediately, or may happen
|
|
Packit |
514978 |
during a later call to \fIares_process(3)\fP, \fIares_destroy(3)\fP or
|
|
Packit |
514978 |
\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_gethostbyname
|
|
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 find addresses of type
|
|
Packit |
514978 |
.IR family .
|
|
Packit |
514978 |
.TP 19
|
|
Packit |
514978 |
.B ARES_EBADNAME
|
|
Packit |
514978 |
The hostname
|
|
Packit |
514978 |
.B name
|
|
Packit |
514978 |
is composed entirely of numbers and periods, but is not a valid
|
|
Packit |
514978 |
representation of an Internet address.
|
|
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_gethostbyaddr (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.
|