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

NAME

6       ares_gethostbyname - Initiate a host query by name
7

SYNOPSIS

9       #include <ares.h>
10
11       typedef void (*ares_host_callback)(void *arg, int status,
12       int timeouts, struct hostent *hostent)
13
14       void ares_gethostbyname(ares_channel channel, const char *name,
15            int family, ares_host_callback callback, void *arg)
16

DESCRIPTION

18       The  ares_gethostbyname  function initiates a host query by name on the
19       name service channel identified by channel.  The parameter  name  gives
20       the hostname as a NUL-terminated C string, and family gives the desired
21       type of address for the resulting host entry.  When the query  is  com‐
22       plete or has failed, the ares library will invoke callback.  Completion
23       or failure of the query may happen immediately, or may happen during  a
24       later call to ares_process(3), ares_destroy(3) or ares_cancel(3).
25
26       The  callback  argument arg is copied from the ares_gethostbyname argu‐
27       ment arg.  The callback argument status  indicates  whether  the  query
28       succeeded and, if not, how it failed.  It may have any of the following
29       values:
30
31       ARES_SUCCESS       The host lookup completed successfully.
32
33       ARES_ENOTIMP       The ares library does not know how to find addresses
34                          of type family.
35
36       ARES_EBADNAME      The  hostname  name  is composed entirely of numbers
37                          and periods, but is not a valid representation of an
38                          Internet address.
39
40       ARES_ENODATA       There was no data returned to extract a result from.
41
42       ARES_ENOTFOUND     The name name was not found.
43
44       ARES_ENOMEM        Memory was exhausted.
45
46       ARES_ECANCELLED    The query was cancelled.
47
48       ARES_EDESTRUCTION  The name service channel channel is being destroyed;
49                          the query will not be completed.
50
51       The callback argument timeouts reports how many times a query timed out
52       during the execution of the given request.
53
54       On  successful  completion  of the query, the callback argument hostent
55       points to a struct hostent containing the name of the host returned  by
56       the  query.   The  callback need not and should not attempt to free the
57       memory pointed to by hostent; the ares library will free  it  when  the
58       callback  returns.  If the query did not complete successfully, hostent
59       will be NULL.
60

SEE ALSO

62       ares_process(3), ares_gethostbyaddr(3)
63

AUTHOR

65       Greg Hudson, MIT Information Systems
66       Copyright 1998 by the Massachusetts Institute of Technology.
67
68
69
70                                 25 July 1998            ARES_GETHOSTBYNAME(3)
Impressum