]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - libares/ares_gethostbyaddr.3
need automake as a build-dep, even though we don't use most of it
[1ts-debian.git] / libares / ares_gethostbyaddr.3
1 .\" $Id: ares_gethostbyaddr.3,v 1.1 1998/08/13 18:07:30 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_GETHOSTBYADDR 3 "24 July 1998"
18 .SH NAME
19 ares_gethostbyaddr \- Initiate a host query by address
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_gethostbyaddr(ares_channel \fIchannel\fP, const void *\fIaddr\fP,
28 .B      int \fIaddrlen\fP, int \fIfamily\fP, ares_host_callback \fIcallback\fP,
29 .B      void *\fIarg\fP)
30 .fi
31 .SH DESCRIPTION
32 The
33 .B ares_gethostbyaddr
34 function initiates a host query by address on the name service channel
35 identified by
36 .IR channel .
37 The parameters
38 .I addr
39 and
40 .I addrlen
41 give the address as a series of bytes, and
42 .I family
43 gives the type of address.  When the query is complete or has failed,
44 the ares library will invoke
45 .IR callback .
46 Completion or failure of the query may happen immediately, or may
47 happen during a later call to
48 .BR ares_process (3)
49 or
50 .BR ares_destroy (3).
51 .PP
52 The callback argument
53 .I arg
54 is copied from the
55 .B ares_gethostbyaddr
56 argument
57 .IR arg .
58 The callback argument
59 .I status
60 indicates whether the query succeeded and, if not, how it failed.  It
61 may have any of the following values:
62 .TP 19
63 .B ARES_SUCCESS
64 The host lookup completed successfully.
65 .TP 19
66 .B ARES_ENOTIMP
67 The ares library does not know how to look up addresses of type
68 .IR family .
69 .TP 19
70 .B ARES_ENOTFOUND
71 The address
72 .I addr
73 was not found.
74 .TP 19
75 .B ARES_ENOMEM
76 Memory was exhausted.
77 .TP 19
78 .B ARES_EDESTRUCTION
79 The name service channel
80 .I channel
81 is being destroyed; the query will not be completed.
82 .PP
83 On successful completion of the query, the callback argument
84 .I hostent
85 points to a
86 .B struct hostent
87 containing the name of the host returned by the query.  The callback
88 need not and should not attempt to free the memory pointed to by
89 .IR hostent ;
90 the ares library will free it when the callback returns.  If the query
91 did not complete successfully,
92 .I hostent
93 will be
94 .BR NULL .
95 .SH SEE ALSO
96 .BR ares_process (3)
97 .SH AUTHOR
98 Greg Hudson, MIT Information Systems
99 .br
100 Copyright 1998 by the Massachusetts Institute of Technology.