ares_dns.h: adjust DNS__16BIT and DNS__32BIT macro definitions
[platform/upstream/c-ares.git] / ares_get_servers.3
1 .\"
2 .\" Copyright 1998 by the Massachusetts Institute of Technology.
3 .\" Copyright (C) 2008-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_GET_SERVERS 3 "5 March 2010"
18 .SH NAME
19 ares_get_servers \- Retrieve name servers from an initialized ares_channel
20 .SH SYNOPSIS
21 .nf
22 .B #include <ares.h>
23 .PP
24 .B int ares_get_servers(ares_channel \fIchannel\fP, struct ares_addr_node **\fIservers\fP)
25 .fi
26 .SH DESCRIPTION
27 The \fBares_get_servers(3)\fP function retrieves name servers configuration
28 from the
29 channel data identified by
30 .IR channel ,
31 as a linked list of ares_addr_node structs storing a pointer to the first
32 node at the address specified by
33 .IR servers .
34
35 Function caller may traverse the returned name server linked list, or may use
36 it directly as suitable input for the \fBares_set_servers(3)\fP function, but
37 shall not shrink or extend the list on its own.
38
39 Each node of the name server linked list is stored in memory dynamically
40 allocated and managed by c-ares. It is the caller's responsibility to free
41 the resulting linked list, using \fBares_free_data(3)\fP , once the caller
42 does not need it any longer.
43
44 This function is capable of handling IPv4 and IPv6 name server
45 addresses simultaneously, rendering \fBares_save_options(3)\fP with
46 optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
47 IPv4-only name server usage.
48
49 .SH RETURN VALUES
50 .B ares_get_servers(3)
51 may return any of the following values:
52 .TP 15
53 .B ARES_SUCCESS
54 The name servers configuration was successfuly retrieved
55 .TP 15
56 .B ARES_ENOMEM
57 The memory was exhausted
58 .TP 15
59 .B ARES_ENODATA
60 The channel data identified by 
61 .IR channel
62 was invalid.
63 .SH SEE ALSO
64 .BR ares_set_servers (3),
65 .BR ares_init_options (3),
66 .BR ares_save_options(3)
67 .SH AVAILABILITY
68 ares_get_servers(3) was added in c-ares 1.7.1
69 .SH AUTHOR
70 Implementation of this function and associated library internals are based
71 on code, comments and feedback provided in November and December of 2008 by
72 Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
73 by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
74 shuffled all the bits and this function popped out.
75 .br
76 Copyright 1998 by the Massachusetts Institute of Technology.
77 .br
78 Copyright (C) 2008-2010 by Daniel Stenberg