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 |
---|
19 | ares_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 |
---|
31 | The |
---|
32 | .B ares_gethostbyname |
---|
33 | function initiates a host query by name on the name service channel |
---|
34 | identified by |
---|
35 | .IR channel . |
---|
36 | The parameter |
---|
37 | .I name |
---|
38 | gives the hostname as a NUL-terminated C string, and |
---|
39 | .I family |
---|
40 | gives the desired type of address for the resulting host entry. When |
---|
41 | the query is complete or has failed, the ares library will invoke |
---|
42 | .IR callback . |
---|
43 | Completion or failure of the query may happen immediately, or may |
---|
44 | happen during a later call to |
---|
45 | .BR ares_process (3) |
---|
46 | or |
---|
47 | .BR ares_destroy (3). |
---|
48 | .PP |
---|
49 | The callback argument |
---|
50 | .I arg |
---|
51 | is copied from the |
---|
52 | .B ares_gethostbyname |
---|
53 | argument |
---|
54 | .IR arg . |
---|
55 | The callback argument |
---|
56 | .I status |
---|
57 | indicates whether the query succeeded and, if not, how it failed. It |
---|
58 | may have any of the following values: |
---|
59 | .TP 19 |
---|
60 | .B ARES_SUCCESS |
---|
61 | The host lookup completed successfully. |
---|
62 | .TP 19 |
---|
63 | .B ARES_ENOTIMP |
---|
64 | The ares library does not know how to find addresses of type |
---|
65 | .IR family . |
---|
66 | .TP 19 |
---|
67 | .B ARES_EBADNAME |
---|
68 | The hostname |
---|
69 | .B name |
---|
70 | is composed entirely of numbers and periods, but is not a valid |
---|
71 | representation of an Internet address. |
---|
72 | .TP 19 |
---|
73 | .B ARES_ENOTFOUND |
---|
74 | The address |
---|
75 | .I addr |
---|
76 | was not found. |
---|
77 | .TP 19 |
---|
78 | .B ARES_ENOMEM |
---|
79 | Memory was exhausted. |
---|
80 | .TP 19 |
---|
81 | .B ARES_EDESTRUCTION |
---|
82 | The name service channel |
---|
83 | .I channel |
---|
84 | is being destroyed; the query will not be completed. |
---|
85 | .PP |
---|
86 | On successful completion of the query, the callback argument |
---|
87 | .I hostent |
---|
88 | points to a |
---|
89 | .B struct hostent |
---|
90 | containing the name of the host returned by the query. The callback |
---|
91 | need not and should not attempt to free the memory pointed to by |
---|
92 | .IR hostent ; |
---|
93 | the ares library will free it when the callback returns. If the query |
---|
94 | did not complete successfully, |
---|
95 | .I hostent |
---|
96 | will be |
---|
97 | .BR NULL . |
---|
98 | .SH SEE ALSO |
---|
99 | .BR ares_process (3) |
---|
100 | .SH AUTHOR |
---|
101 | Greg Hudson, MIT Information Systems |
---|
102 | .br |
---|
103 | Copyright 1998 by the Massachusetts Institute of Technology. |
---|