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       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_ENOTFOUND     The address addr was not found.
41
42       ARES_ENOMEM        Memory was exhausted.
43
44       ARES_EDESTRUCTION  The name service channel channel is being destroyed;
45                          the query will not be completed.
46
47       On successful completion of the query, the  callback  argument  hostent
48       points  to a struct hostent containing the name of the host returned by
49       the query.  The callback need not and should not attempt  to  free  the
50       memory  pointed  to  by hostent; the ares library will free it when the
51       callback returns.  If the query did not complete successfully,  hostent
52       will be NULL.
53

SEE ALSO

55       ares_process(3), ares_gethostbyaddr(3)
56

AUTHOR

58       Greg Hudson, MIT Information Systems
59       Copyright 1998 by the Massachusetts Institute of Technology.
60
61
62
63                                 25 July 1998            ARES_GETHOSTBYNAME(3)
Impressum