2 .\" Copyright 2005 by Dominick Meglio.
4 .\" Permission to use, copy, modify, and distribute this
5 .\" software and its documentation for any purpose and without
6 .\" fee is hereby granted, provided that the above copyright
7 .\" notice appear in all copies and that both that copyright
8 .\" notice and this permission notice appear in supporting
9 .\" documentation, and that the name of M.I.T. not be used in
10 .\" advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission.
12 .\" M.I.T. makes no representations about the suitability of
13 .\" this software for any purpose. It is provided "as is"
14 .\" without express or implied warranty.
16 .TH ARES_GETNAMEINFO 3 "1 May 2009"
18 ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner
23 .B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP,
24 .B int \fItimeouts\fP, char *\fInode\fP, char *\fIservice\fP)
26 .B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP,
27 .B ares_socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP,
33 function is defined for protocol-independent address translation. The function
34 is a combination of \fIares_gethostbyaddr(3)\fP and \fIgetservbyport(3)\fP. The function will
35 translate the address either by executing a host query on the name service channel
38 or it will attempt to resolve it locally if possible.
43 give the address as a sockaddr structure, and
45 gives the options that the function will use. Valid flags are listed below:
48 Only the nodename portion of the FQDN is returned for local hosts.
50 .B ARES_NI_NUMERICHOST
51 The numeric form of the hostname is returned rather than the name.
54 An error is returned if the hostname cannot be found in the DNS.
56 .B ARES_NI_NUMERICSERV
57 The numeric form of the service is returned rather than the name.
60 The service name is to be looked up for the TCP protocol.
63 The service name is to be looked up for the UDP protocol.
66 The service name is to be looked up for the SCTP protocol.
69 The service name is to be looked up for the DCCP protocol.
71 .B ARES_NI_NUMERICSCOPE
72 The numeric form of the scope ID is returned rather than the name.
75 A hostname lookup is being requested.
77 .B ARES_NI_LOOKUPSERVICE
78 A service name lookup is being requested.
82 failed, the ares library will invoke \fIcallback\fP. Completion or failure of
83 the query may happen immediately, or may happen during a later call to
84 \fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
94 indicates whether the query succeeded and, if not, how it failed. It
95 may have any of the following values:
98 The host lookup completed successfully.
101 The ares library does not know how to look up addresses of type
110 Memory was exhausted.
113 The name service channel
115 is being destroyed; the query will not be completed.
120 parameter contains an illegal value.
122 The callback argument
124 reports how many times a query timed out during the execution of the
127 On successful completion of the query, the callback argument
129 contains a string representing the hostname (assuming
130 .B ARES_NI_LOOKUPHOST
131 was specified). Additionally,
133 contains a string representing the service name (assuming
134 .B ARES_NI_LOOKUPSERVICE
136 If the query did not complete successfully, or one of the values
144 .BR ares_process (3),
145 .BR ares_getaddrinfo (3)
149 Copyright 2005 by Dominick Meglio.