3 .\" Copyright 1998 by the Massachusetts Institute of Technology.
5 .\" Permission to use, copy, modify, and distribute this
6 .\" software and its documentation for any purpose and without
7 .\" fee is hereby granted, provided that the above copyright
8 .\" notice appear in all copies and that both that copyright
9 .\" notice and this permission notice appear in supporting
10 .\" documentation, and that the name of M.I.T. not be used in
11 .\" advertising or publicity pertaining to distribution of the
12 .\" software without specific, written prior permission.
13 .\" M.I.T. makes no representations about the suitability of
14 .\" this software for any purpose. It is provided "as is"
15 .\" without express or implied warranty.
17 .TH ARES_INIT 3 "21 July 1998"
19 ares_init, ares_init_options \- Initialize a resolver channel
24 .B int ares_init(ares_channel *\fIchannel\fP)
25 .B int ares_init_options(ares_channel *\fIchannel\fP,
26 .B struct ares_options *\fIoptions\fP, int \fIoptmask\fP)
33 function initializes a communications channel for name service
34 lookups. If it returns successfully,
36 will set the variable pointed to by
38 to a handle used to identify the name service channel. The caller
41 on the handle when the channel is no longer needed.
45 function also initializes a name service channel, with additional
46 options useful for applications requiring more control over name
47 service configuration. The
49 parameter specifies which fields in the structure pointed to by
57 Flags controlling the behavior of the resolver. See below for a
58 description of possible flag values.
63 The number of seconds each name server is given to respond to a query
64 on the first try. (After the first try, the timeout algorithm becomes
65 more complicated, but scales linearly with the value of
66 \fItimeout\fP.) The default is five seconds.
71 The number of tries the resolver will try contacting each name server
72 before giving up. The default is four tries.
77 The number of dots which must be present in a domain name for it to be
78 queried for "as is" prior to querying for it with the default domain
79 extensions appended. The default value is 1 unless set otherwise by
80 resolv.conf or the RES_OPTIONS environment variable.
83 .B unsigned short \fIport\fP;
85 The port to use for queries (both TCP and UDP), in network byte order.
86 The default value is 53 (in network byte order), the standard name
90 .B struct in_addr *\fIservers\fP;
92 .B int \fInservers\fP;
94 The list of servers to contact, instead of the servers specified in
95 resolv.conf or the local named.
98 .B char **\fIdomains\fP;
100 .B int \fIndomains\fP;
102 The domains to search, instead of the domains specified in resolv.conf
103 or the domain derived from the kernel hostname variable.
106 .B char *\fIlookups\fP;
108 The lookups to perform for host queries.
110 should be set to a string of the characters "b" or "f", where "b"
111 indicates a DNS lookup and "f" indicates a lookup in the hosts file.
115 field should be the bitwise or of some subset of the following values:
118 Always use TCP queries (the "virtual circuit") instead of UDP
119 queries. Normally, TCP is only used if a UDP query yields a truncated
123 Only query the first server in the list of servers to query.
126 If a truncated response to a UDP query is received, do not fall back
127 to TCP; simply continue on with the truncated response.
129 .B ARES_FLAG_NORECURSE
130 Do not set the "recursion desired" bit on outgoing queries, so that
131 the name server being contacted will not try to fetch the answer from
132 other servers if it doesn't know the answer locally.
134 .B ARES_FLAG_STAYOPEN
135 Do not close communciations sockets when the number of active queries
138 .B ARES_FLAG_NOSEARCH
139 Do not use the default search domains; only query hostnames as-is or
142 .B ARES_FLAG_NOALIASES
143 Do not honor the HOSTALIASES environment variable, which normally
144 specifies a file of hostname translations.
146 .B ARES_FLAG_NOCHECKRESP
147 Do not discard responses with the SERVFAIL, NOTIMP, or REFUSED
148 response code or responses whose questions don't match the questions
149 in the request. Primarily useful for writing clients which might be
150 used to test or debug name servers.
155 can return any of the following values:
158 Initialization succeeded.
161 A configuration file could not be read.
164 The process's available memory was exhausted.
168 Greg Hudson, MIT Information Systems
170 Copyright 1998 by the Massachusetts Institute of Technology.