1ARES_GET_SERVERS(3) Library Functions Manual ARES_GET_SERVERS(3)
2
3
4
6 ares_get_servers - Retrieve name servers from an initialized ares_chan‐
7 nel
8
10 #include <ares.h>
11
12 int ares_get_servers(ares_channel channel, struct ares_addr_node **servers)
13
15 The ares_get_servers(3) function retrieves name servers configuration
16 from the channel data identified by channel, as a linked list of
17 ares_addr_node structs storing a pointer to the first node at the
18 address specified by servers.
19
20 Function caller may traverse the returned name server linked list, or
21 may use it directly as suitable input for the ares_set_servers(3) func‐
22 tion, but shall not shrink or extend the list on its own.
23
24 Each node of the name server linked list is stored in memory dynami‐
25 cally allocated and managed by c-ares. It is the caller's responsibil‐
26 ity to free the resulting linked list, using ares_free_data(3) , once
27 the caller does not need it any longer.
28
29 This function is capable of handling IPv4 and IPv6 name server
30 addresses simultaneously, rendering ares_save_options(3) with optmask
31 ARES_OPT_SERVERS functionally obsolete except for IPv4-only name server
32 usage.
33
34
36 ares_get_servers(3) may return any of the following values:
37
38 ARES_SUCCESS The name servers configuration was successfuly retrieved
39
40 ARES_ENOMEM The memory was exhausted
41
42 ARES_ENODATA The channel data identified by channel was invalid.
43
45 ares_set_servers(3), ares_init_options(3), ares_save_options(3)
46
48 ares_get_servers(3) was added in c-ares 1.7.1
49
51 Implementation of this function and associated library internals are
52 based on code, comments and feedback provided in November and December
53 of 2008 by Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse,
54 December 2009 by Cedric Bail, February 2010 by Jakub Hrozek. On March
55 2010 Yang Tse shuffled all the bits and this function popped out.
56 Copyright 1998 by the Massachusetts Institute of Technology.
57 Copyright (C) 2008-2010 by Daniel Stenberg
58
59
60
61 5 March 2010 ARES_GET_SERVERS(3)