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,
13                                          struct hostent *hostent)
14
15       void ares_gethostbyname(ares_channel channel, const char *name,
16                               int family, ares_host_callback callback,
17                               void *arg)
18

DESCRIPTION

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

SEE ALSO

64       ares_process(3), ares_gethostbyaddr(3)
65

AUTHOR

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