1ARES_SET_SERVERS(3) Library Functions Manual ARES_SET_SERVERS(3)
2
3
4
6 ares_set_servers - Initialize an ares_channel name servers configura‐
7 tion
8
10 #include <ares.h>
11
12 int ares_set_servers(ares_channel channel, struct ares_addr_node *servers)
13
15 The ares_set_servers(3) function initializes name servers configuration
16 for the channel data identified by channel, from a servers pointer to a
17 linked list of ares_addr_node structs holding name servers address
18 data.
19
20 The name server linked list pointer argument may be the result of a
21 previous call to ares_get_servers(3) or a linked list of ares_addr_node
22 structs setup by other means.
23
24 This function replaces any potentially previously configured name
25 servers with the ones given in the linked list. So, in order to config‐
26 ure a channel with more than one name server all the desired ones must
27 be specified in a single list.
28
29 ares_set_servers(3) does not take ownership of the linked list argu‐
30 ment. The caller is responsible for freeing the linked list when no
31 longer needed.
32
33 This function is capable of handling IPv4 and IPv6 name server
34 addresses simultaneously, rendering ares_init_options(3) with optmask
35 ARES_OPT_SERVERS functionally obsolete except for IPv4-only name server
36 usage.
37
38
40 ares_set_servers(3) may return any of the following values:
41
42 ARES_SUCCESS The name servers configuration was successfuly initial‐
43 ized.
44
45 ARES_ENOMEM The process's available memory was exhausted.
46
47 ARES_ENODATA The channel data identified by channel was invalid.
48
49 ARES_ENOTINITIALIZED
50 c-ares library initialization not yet performed.
51
53 ares_get_servers(3), ares_init_options(3), ares_dup(3)
54
56 ares_set_servers(3) was added in c-ares 1.7.1
57
59 Implementation of this function and associated library internals are
60 based on code, comments and feedback provided in November and December
61 of 2008 by Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse,
62 December 2009 by Cedric Bail, February 2010 by Jakub Hrozek. On March
63 2010 Yang Tse shuffled all the bits and this function popped out.
64 Copyright 1998 by the Massachusetts Institute of Technology.
65 Copyright (C) 2008-2010 by Daniel Stenberg
66
67
68
69 5 March 2010 ARES_SET_SERVERS(3)