blob: a48c11c0ac3b6321efcd034d813122efe40e75ab [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001.\"
2.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
3.\"
4.\" Permission to use, copy, modify, and distribute this
5.\" software and its documentation for any purpose and without
6.\" fee is hereby granted, provided that the above copyright
7.\" notice appear in all copies and that both that copyright
8.\" notice and this permission notice appear in supporting
9.\" documentation, and that the name of M.I.T. not be used in
10.\" advertising or publicity pertaining to distribution of the
11.\" software without specific, written prior permission.
12.\" M.I.T. makes no representations about the suitability of
13.\" this software for any purpose. It is provided "as is"
14.\" without express or implied warranty.
15.\"
16.TH ARES_SET_SERVERS 3 "5 March 2010"
17.SH NAME
18ares_set_servers, ares_set_servers_ports \- Initialize an ares_channel name servers configuration
19.SH SYNOPSIS
20.nf
21.B #include <ares.h>
22.PP
23.B int ares_set_servers(ares_channel \fIchannel\fP, struct ares_addr_node *\fIservers\fP)
24.B int ares_set_servers_ports(ares_channel \fIchannel\fP, struct ares_addr_port_node *\fIservers\fP)
25.fi
26.SH DESCRIPTION
27The \fBares_set_servers(3)\fP function initializes name servers configuration
28for the channel data identified by
29.IR channel ,
30from a
31.IR servers
32pointer to a linked list of ares_addr_node structs holding name servers
33address data.
34.PP
35The name server linked list pointer argument may be the result of a previous
36call to \fBares_get_servers(3)\fP or a linked list of \fBares_addr_node\fP structs
37set up by other means.
38.PP
39The \fBares_set_servers(3)\fP function also allows the specification of UDP and
40TCP ports to be used for communication on a per-server basis. The provided
41linked list argument may be the result of a previous call to
42\fBares_get_servers_ports(3)\fP or a linked list of \fBares_addr_port_node\fP structs
43set up by other means.
44.PP
45This function replaces any potentially previously configured name servers
46with the ones given in the linked list. So, in order to configure a channel
47with more than one name server all the desired ones must be specified in a
48single list.
49.PP
50The function does not take ownership of the linked list argument.
51The caller is responsible for freeing the linked list when no longer needed.
52.PP
53This function is capable of handling IPv4 and IPv6 name server
54addresses simultaneously, rendering \fBares_init_options(3)\fP with
55optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
56IPv4-only name server usage.
57
58.SH RETURN VALUES
59.B ares_set_servers(3)
60may return any of the following values:
61.TP 15
62.B ARES_SUCCESS
63The name servers configuration was successfully initialized.
64.TP 15
65.B ARES_ENOMEM
66The process's available memory was exhausted.
67.TP 15
68.B ARES_ENODATA
69The channel data identified by
70.IR channel
71was invalid.
72.TP 15
73.B ARES_ENOTINITIALIZED
74c-ares library initialization not yet performed.
75.SH SEE ALSO
76.BR ares_set_servers_csv (3),
77.BR ares_get_servers (3),
78.BR ares_init_options (3),
79.BR ares_dup(3)
80.SH AVAILABILITY
81\fBares_set_servers(3)\fP was added in c-ares 1.7.1;
82\fBares_set_servers_ports(3)\fP was added in c-ares 1.11.0.
83.SH AUTHOR
84Implementation of this function and associated library internals are based
85on code, comments and feedback provided in November and December of 2008 by
86Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
87by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
88shuffled all the bits and this function popped out.
89.br
90Copyright 1998 by the Massachusetts Institute of Technology.
91.br
92Copyright (C) 2008-2010 by Daniel Stenberg