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

Revision 11855, 2.9 KB checked in by ghudson, 26 years ago (diff)
Documentation for libares, an asynchronous resolver library
Line 
1.\" $Id: ares_gethostbyname.3,v 1.1 1998-08-13 18:07:31 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_GETHOSTBYNAME 3 "25 July 1998"
18.SH NAME
19ares_gethostbyname \- Initiate a host query by name
20.SH SYNOPSIS
21.nf
22.B #include <ares.h>
23.PP
24.B typedef void (*ares_host_callback)(void *\fIarg\fP, int \fIstatus\fP,
25.B      struct hostent *\fIhostent\fP)
26.PP
27.B void ares_gethostbyname(ares_channel \fIchannel\fP, const char *\fIname\fP,
28.B      int \fIfamily\fP, ares_host_callback \fIcallback\fP, void *\fIarg\fP)
29.fi
30.SH DESCRIPTION
31The
32.B ares_gethostbyname
33function initiates a host query by name on the name service channel
34identified by
35.IR channel .
36The parameter
37.I name
38gives the hostname as a NUL-terminated C string, and
39.I family
40gives the desired type of address for the resulting host entry.  When
41the query is complete or has failed, the ares library will invoke
42.IR callback .
43Completion or failure of the query may happen immediately, or may
44happen during a later call to
45.BR ares_process (3)
46or
47.BR ares_destroy (3).
48.PP
49The callback argument
50.I arg
51is copied from the
52.B ares_gethostbyname
53argument
54.IR arg .
55The callback argument
56.I status
57indicates whether the query succeeded and, if not, how it failed.  It
58may have any of the following values:
59.TP 19
60.B ARES_SUCCESS
61The host lookup completed successfully.
62.TP 19
63.B ARES_ENOTIMP
64The ares library does not know how to find addresses of type
65.IR family .
66.TP 19
67.B ARES_EBADNAME
68The hostname
69.B name
70is composed entirely of numbers and periods, but is not a valid
71representation of an Internet address.
72.TP 19
73.B ARES_ENOTFOUND
74The address
75.I addr
76was not found.
77.TP 19
78.B ARES_ENOMEM
79Memory was exhausted.
80.TP 19
81.B ARES_EDESTRUCTION
82The name service channel
83.I channel
84is being destroyed; the query will not be completed.
85.PP
86On successful completion of the query, the callback argument
87.I hostent
88points to a
89.B struct hostent
90containing the name of the host returned by the query.  The callback
91need not and should not attempt to free the memory pointed to by
92.IR hostent ;
93the ares library will free it when the callback returns.  If the query
94did not complete successfully,
95.I hostent
96will be
97.BR NULL .
98.SH SEE ALSO
99.BR ares_process (3)
100.SH AUTHOR
101Greg Hudson, MIT Information Systems
102.br
103Copyright 1998 by the Massachusetts Institute of Technology.
Note: See TracBrowser for help on using the repository browser.