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