ares_set_servers_csv: fixed IPv6 address parsing
[platform/upstream/c-ares.git] / ares_set_servers.3
1 .\"
2 .\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
3 .\"
4 .\" Permission to use, copy, modify, and distribute this
5 .\" software and its documentation for any purpose and without
6 .\" fee is hereby granted, provided that the above copyright
7 .\" notice appear in all copies and that both that copyright
8 .\" notice and this permission notice appear in supporting
9 .\" documentation, and that the name of M.I.T. not be used in
10 .\" advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission.
12 .\" M.I.T. makes no representations about the suitability of
13 .\" this software for any purpose.  It is provided "as is"
14 .\" without express or implied warranty.
15 .\"
16 .TH ARES_SET_SERVERS 3 "5 March 2010"
17 .SH NAME
18 ares_set_servers \- Initialize an ares_channel name servers configuration
19 .SH SYNOPSIS
20 .nf
21 .B #include <ares.h>
22 .PP
23 .B int ares_set_servers(ares_channel \fIchannel\fP, struct ares_addr_node *\fIservers\fP)
24 .fi
25 .SH DESCRIPTION
26 The \fBares_set_servers(3)\fP function initializes name servers configuration
27 for the channel data identified by
28 .IR channel ,
29 from a
30 .IR servers
31 pointer to a linked list of ares_addr_node structs holding name servers
32 address data.
33
34 The name server linked list pointer argument may be the result of a previous
35 call to \fBares_get_servers(3)\fP or a linked list of ares_addr_node structs
36 setup by other means.
37
38 This function replaces any potentially previously configured name servers
39 with the ones given in the linked list. So, in order to configure a channel
40 with more than one name server all the desired ones must be specified in a 
41 single list.
42
43 \fBares_set_servers(3)\fP does not take ownership of the linked list argument.
44 The caller is responsible for freeing the linked list when no longer needed.
45
46 This function is capable of handling IPv4 and IPv6 name server
47 addresses simultaneously, rendering \fBares_init_options(3)\fP with
48 optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
49 IPv4-only name server usage.
50
51 .SH RETURN VALUES
52 .B ares_set_servers(3)
53 may return any of the following values:
54 .TP 15
55 .B ARES_SUCCESS
56 The name servers configuration was successfuly initialized.
57 .TP 15
58 .B ARES_ENOMEM
59 The process's available memory was exhausted.
60 .TP 15
61 .B ARES_ENODATA
62 The channel data identified by 
63 .IR channel
64 was invalid.
65 .TP 15
66 .B ARES_ENOTINITIALIZED
67 c-ares library initialization not yet performed.
68 .SH SEE ALSO
69 .BR ares_set_servers_csv (3),
70 .BR ares_get_servers (3),
71 .BR ares_init_options (3),
72 .BR ares_dup(3)
73 .SH AVAILABILITY
74 ares_set_servers(3) was added in c-ares 1.7.1
75 .SH AUTHOR
76 Implementation of this function and associated library internals are based
77 on code, comments and feedback provided in November and December of 2008 by
78 Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
79 by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
80 shuffled all the bits and this function popped out.
81 .br
82 Copyright 1998 by the Massachusetts Institute of Technology.
83 .br
84 Copyright (C) 2008-2010 by Daniel Stenberg