fix line break
[platform/upstream/c-ares.git] / ares_get_servers.3
1 .\" $Id$
2 .\"
3 .\" Copyright 1998 by the Massachusetts Institute of Technology.
4 .\" Copyright (C) 2008-2010 by Daniel Stenberg
5 .\"
6 .\" Permission to use, copy, modify, and distribute this
7 .\" software and its documentation for any purpose and without
8 .\" fee is hereby granted, provided that the above copyright
9 .\" notice appear in all copies and that both that copyright
10 .\" notice and this permission notice appear in supporting
11 .\" documentation, and that the name of M.I.T. not be used in
12 .\" advertising or publicity pertaining to distribution of the
13 .\" software without specific, written prior permission.
14 .\" M.I.T. makes no representations about the suitability of
15 .\" this software for any purpose.  It is provided "as is"
16 .\" without express or implied warranty.
17 .\"
18 .TH ARES_GET_SERVERS 3 "5 March 2010"
19 .SH NAME
20 ares_get_servers \- Retrieve name servers from an initialized ares_channel
21 .SH SYNOPSIS
22 .nf
23 .B #include <ares.h>
24 .PP
25 .B int ares_get_servers(ares_channel \fIchannel\fP, struct ares_addr_node **\fIservers\fP)
26 .fi
27 .SH DESCRIPTION
28 The \fBares_get_servers(3)\fP function retrieves name servers configuration
29 from the
30 channel data identified by
31 .IR channel ,
32 as a linked list of ares_addr_node structs storing a pointer to the first
33 node at the address specified by
34 .IR servers .
35
36 Function caller may traverse the returned name server linked list, or may use
37 it directly as suitable input for the \fBares_set_servers(3)\fP function, but
38 shall not shrink or extend the list on its own.
39
40 Each node of the name server linked list is stored in memory dynamically
41 allocated and managed by c-ares. It is the caller's responsibility to free
42 the resulting linked list, using \fBares_free_data(3)\fP , once the caller
43 does not need it any longer.
44
45 This function is capable of handling IPv4 and IPv6 name server
46 addresses simultaneously, rendering \fBares_save_options(3)\fP with
47 optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
48 IPv4-only name server usage.
49
50 .SH RETURN VALUES
51 .B ares_get_servers(3)
52 may return any of the following values:
53 .TP 15
54 .B ARES_SUCCESS
55 The name servers configuration was successfuly retrieved
56 .TP 15
57 .B ARES_ENOMEM
58 The memory was exhausted
59 .TP 15
60 .B ARES_ENODATA
61 The channel data identified by 
62 .IR channel
63 was invalid.
64 .SH SEE ALSO
65 .BR ares_set_servers (3),
66 .BR ares_init_options (3),
67 .BR ares_save_options(3)
68 .SH AVAILABILITY
69 ares_get_servers(3) was added in c-ares 1.7.1
70 .SH AUTHOR
71 Implementation of this function and associated library internals are based
72 on code, comments and feedback provided November and December of 2008 by
73 Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
74 by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
75 shuffled all the bits and this function popped out.
76 .br
77 Copyright 1998 by the Massachusetts Institute of Technology.
78 .br
79 Copyright (C) 2008-2010 by Daniel Stenberg