1ARES_GETNAMEINFO(3) Library Functions Manual ARES_GETNAMEINFO(3)
2
3
4
6 ares_getnameinfo - Address-to-nodename translation in protocol-indepen‐
7 dent manner
8
10 #include <ares.h>
11
12 typedef void (*ares_nameinfo_callback)(void *arg, int status,
13 int timeouts, char *node,
14 char *service)
15
16 void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
17 ares_socklen_t salen, int flags,
18 ares_nameinfo_callback callback, void *arg)
19
21 The ares_getnameinfo function is defined for protocol-independent ad‐
22 dress translation. The function is a combination of ares_gethost‐
23 byaddr(3) and getservbyport(3). The function will translate the address
24 either by executing a host query on the name service channel identified
25 by channel or it will attempt to resolve it locally if possible. The
26 parameters sa and len give the address as a sockaddr structure, and
27 flags gives the options that the function will use. Valid flags are
28 listed below:
29
30 ARES_NI_NOFQDN Only the nodename portion of the FQDN is returned
31 for local hosts.
32
33 ARES_NI_NUMERICHOST
34 The numeric form of the hostname is returned rather
35 than the name.
36
37 ARES_NI_NAMEREQD An error is returned if the hostname cannot be found
38 in the DNS.
39
40 ARES_NI_NUMERICSERV
41 The numeric form of the service is returned rather
42 than the name.
43
44 ARES_NI_TCP The service name is to be looked up for the TCP pro‐
45 tocol.
46
47 ARES_NI_UDP The service name is to be looked up for the UDP pro‐
48 tocol.
49
50 ARES_NI_SCTP The service name is to be looked up for the SCTP
51 protocol.
52
53 ARES_NI_DCCP The service name is to be looked up for the DCCP
54 protocol.
55
56 ARES_NI_NUMERICSCOPE
57 The numeric form of the scope ID is returned rather
58 than the name.
59
60 ARES_NI_LOOKUPHOST A hostname lookup is being requested.
61
62 ARES_NI_LOOKUPSERVICE
63 A service name lookup is being requested.
64
65 When the query is complete or has failed, the ares library will invoke
66 callback. Completion or failure of the query may happen immediately,
67 or may happen during a later call to ares_process(3), ares_destroy(3)
68 or ares_cancel(3).
69
70 The callback argument arg is copied from the ares_getnameinfo argument
71 arg. The callback argument status indicates whether the query suc‐
72 ceeded and, if not, how it failed. It may have any of the following
73 values:
74
75 ARES_SUCCESS The host lookup completed successfully.
76
77 ARES_ENOTIMP The ares library does not know how to look up ad‐
78 dresses of type family.
79
80 ARES_ENOTFOUND The address addr was not found.
81
82 ARES_ENOMEM Memory was exhausted.
83
84 ARES_ECANCELLED The query was cancelled.
85
86 ARES_EDESTRUCTION The name service channel channel is being destroyed;
87 the query will not be completed.
88
89 ARES_EBADFLAGS The flags parameter contains an illegal value.
90
91 The callback argument timeouts reports how many times a query timed out
92 during the execution of the given request.
93
94 On successful completion of the query, the callback argument node con‐
95 tains a string representing the hostname (assuming ARES_NI_LOOKUPHOST
96 was specified). Additionally, service contains a string representing
97 the service name (assuming ARES_NI_LOOKUPSERVICE was specified). If
98 the query did not complete successfully, or one of the values was not
99 requested, node or service will be NULL.
100
102 ares_process(3),
103
105 Dominick Meglio
106 Copyright 2005 by Dominick Meglio.
107
108
109
110 1 May 2009 ARES_GETNAMEINFO(3)