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