1ARES_GETNAMEINFO(3)        Library Functions Manual        ARES_GETNAMEINFO(3)
2
3
4

NAME

6       ares_getnameinfo - Address-to-nodename translation in protocol-indepen‐
7       dent manner
8

SYNOPSIS

10       #include <ares.h>
11
12       typedef void (*ares_nameinfo_callback)(void *arg, int status,
13       int timeouts, char *node, char *service)
14
15       void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
16            ares_socklen_t salen, int flags, ares_nameinfo_callback callback,
17            void *arg)
18

DESCRIPTION

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

SEE ALSO

101       ares_process(3),
102

AUTHOR

104       Dominick Meglio
105       Copyright 2005 by Dominick Meglio.
106
107
108
109                                  1 May 2009               ARES_GETNAMEINFO(3)
Impressum