0baf4b76fea59f5896f3347dd9ba1f7c9ab10931
[platform/upstream/c-ares.git] / docs / ares_init.3
1 .\"
2 .\" Copyright 1998 by the Massachusetts Institute of Technology.
3 .\" Copyright (C) 2004-2010 by Daniel Stenberg
4 .\"
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.
16 .\"
17 .TH ARES_INIT 3 "5 March 2010"
18 .SH NAME
19 ares_init \- Initialize a resolver channel
20 .SH SYNOPSIS
21 .nf
22 #include <ares.h>
23
24 int ares_init(ares_channel *\fIchannelptr\fP)
25 .fi
26 .SH DESCRIPTION
27 The \fBares_init(3)\fP function initializes a communications channel for name
28 service lookups.  If it returns successfully, \fBares_init(3)\fP will set the
29 variable pointed to by \fIchannelptr\fP to a handle used to identify the name
30 service channel.  The caller should invoke \fIares_destroy(3)\fP on the handle
31 when the channel is no longer needed.
32
33 The \fIares_init_options(3)\fP function is provide to offer more init
34 alternatives.
35 .SH RETURN VALUES
36 \fIares_init(3)\fP can return any of the following values:
37 .TP 14
38 .B ARES_SUCCESS
39 Initialization succeeded.
40 .TP 14
41 .B ARES_EFILE
42 A configuration file could not be read.
43 .TP 14
44 .B ARES_ENOMEM
45 The process's available memory was exhausted.
46 .TP 14
47 .B ARES_ENOTINITIALIZED
48 c-ares library initialization not yet performed.
49 .SH NOTES
50 When initializing from
51 .B /etc/resolv.conf,
52 .BR ares_init (3)
53 reads the
54 .I domain
55 and
56 .I search
57 directives to allow lookups of short names relative to the domains
58 specified. The
59 .I domain
60 and
61 .I search
62 directives override one another. If more that one instance of either
63 .I domain
64 or
65 .I search
66 directives is specified, the last occurrence wins. For more information,
67 please see the
68 .BR resolv.conf (5)
69 manual page.
70 .SH SEE ALSO
71 .BR ares_init_options(3),
72 .BR ares_destroy(3),
73 .BR ares_dup(3),
74 .BR ares_library_init(3),
75 .BR ares_set_servers(3)
76 .SH AUTHOR
77 Greg Hudson, MIT Information Systems
78 .br
79 Copyright 1998 by the Massachusetts Institute of Technology.
80 .br
81 Copyright (C) 2004-2010 by Daniel Stenberg.