1ARES_GETHOSTBYNAME(3) Library Functions Manual ARES_GETHOSTBYNAME(3)
2
3
4
6 ares_gethostbyname_file - Lookup a name in the system's hosts file
7
9 #include <ares.h>
10
11 int ares_gethostbyname_file(ares_channel channel, const char *name,
12 int family, struct hostent **host)
13
15 The ares_gethostbyname_file function performs a host lookup by name
16 against the system's hosts file (or equivalent local hostname data‐
17 base). The channel parameter is required, but no asynchronous queries
18 are performed. Instead, the lookup is done via the same mechanism used
19 to perform 'f' lookups (see the lookups options field in ares_init_op‐
20 tions(3)). The parameter name gives the hostname as a NUL-terminated C
21 string, and family gives the desired type of address for the resulting
22 host entry.
23
24 The return value indicates whether the query succeeded and, if not, how
25 it failed. It may have any of the following values:
26
27 ARES_SUCCESS The host lookup completed successfully and host now
28 points to the result (and must be freed with
29 ares_free_hostent(3)).
30
31 ARES_ENOTFOUND The hostname name was not found.
32
33 ARES_EFILE There was a file I/O error while performing the
34 lookup.
35
36 ARES_ENOMEM Memory was exhausted.
37
38 On successful completion of the query, the pointer pointed to by host
39 points to a struct hostent containing the address of the host returned
40 by the lookup. The user must free the memory pointed to by host when
41 finished with it by calling ares_free_hostent(3). If the lookup did
42 not complete successfully, host will be NULL.
43
45 Added in c-ares 1.5.4
46
48 ares_gethostbyname(3), ares_free_hostent(3), ares_init_options(3)
49
51 Brad Spencer
52 Copyright 1998 by the Massachusetts Institute of Technology.
53
54
55
56 25 July 1998 ARES_GETHOSTBYNAME(3)