Blame ares_set_servers.3

Packit 514978
.\"
Packit 514978
.\" Copyright 2010 by Ben Greear <greearb@candelatech.com>
Packit 514978
.\"
Packit 514978
.\" Permission to use, copy, modify, and distribute this
Packit 514978
.\" software and its documentation for any purpose and without
Packit 514978
.\" fee is hereby granted, provided that the above copyright
Packit 514978
.\" notice appear in all copies and that both that copyright
Packit 514978
.\" notice and this permission notice appear in supporting
Packit 514978
.\" documentation, and that the name of M.I.T. not be used in
Packit 514978
.\" advertising or publicity pertaining to distribution of the
Packit 514978
.\" software without specific, written prior permission.
Packit 514978
.\" M.I.T. makes no representations about the suitability of
Packit 514978
.\" this software for any purpose.  It is provided "as is"
Packit 514978
.\" without express or implied warranty.
Packit 514978
.\"
Packit 514978
.TH ARES_SET_SERVERS 3 "5 March 2010"
Packit 514978
.SH NAME
Packit 514978
ares_set_servers, ares_set_servers_ports \- Initialize an ares_channel name servers configuration
Packit 514978
.SH SYNOPSIS
Packit 514978
.nf
Packit 514978
.B #include <ares.h>
Packit 514978
.PP
Packit 514978
.B int ares_set_servers(ares_channel \fIchannel\fP, struct ares_addr_node *\fIservers\fP)
Packit 514978
.B int ares_set_servers_ports(ares_channel \fIchannel\fP, struct ares_addr_port_node *\fIservers\fP)
Packit 514978
.fi
Packit 514978
.SH DESCRIPTION
Packit 514978
The \fBares_set_servers(3)\fP function initializes name servers configuration
Packit 514978
for the channel data identified by
Packit 514978
.IR channel ,
Packit 514978
from a
Packit 514978
.IR servers
Packit 514978
pointer to a linked list of ares_addr_node structs holding name servers
Packit 514978
address data.
Packit 514978
.PP
Packit 514978
The name server linked list pointer argument may be the result of a previous
Packit 514978
call to \fBares_get_servers(3)\fP or a linked list of \fBares_addr_node\fP structs
Packit 514978
set up by other means.
Packit 514978
.PP
Packit 514978
The \fBares_set_servers(3)\fP function also allows the specification of UDP and
Packit 514978
TCP ports to be used for communication on a per-server basis.  The provided
Packit 514978
linked list argument may be the result of a previous call to
Packit 514978
\fBares_get_servers_ports(3)\fP or a linked list of \fBares_addr_port_node\fP structs
Packit 514978
set up by other means.
Packit 514978
.PP
Packit 514978
This function replaces any potentially previously configured name servers
Packit 514978
with the ones given in the linked list. So, in order to configure a channel
Packit 514978
with more than one name server all the desired ones must be specified in a
Packit 514978
single list.
Packit 514978
.PP
Packit 514978
The function does not take ownership of the linked list argument.
Packit 514978
The caller is responsible for freeing the linked list when no longer needed.
Packit 514978
.PP
Packit 514978
This function is capable of handling IPv4 and IPv6 name server
Packit 514978
addresses simultaneously, rendering \fBares_init_options(3)\fP with
Packit 514978
optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for
Packit 514978
IPv4-only name server usage.
Packit 514978
Packit 514978
.SH RETURN VALUES
Packit 514978
.B ares_set_servers(3)
Packit 514978
may return any of the following values:
Packit 514978
.TP 15
Packit 514978
.B ARES_SUCCESS
Packit 514978
The name servers configuration was successfully initialized.
Packit 514978
.TP 15
Packit 514978
.B ARES_ENOMEM
Packit 514978
The process's available memory was exhausted.
Packit 514978
.TP 15
Packit 514978
.B ARES_ENODATA
Packit 514978
The channel data identified by 
Packit 514978
.IR channel
Packit 514978
was invalid.
Packit 514978
.TP 15
Packit 514978
.B ARES_ENOTINITIALIZED
Packit 514978
c-ares library initialization not yet performed.
Packit 514978
.SH SEE ALSO
Packit 514978
.BR ares_set_servers_csv (3),
Packit 514978
.BR ares_get_servers (3),
Packit 514978
.BR ares_init_options (3),
Packit 514978
.BR ares_dup(3)
Packit 514978
.SH AVAILABILITY
Packit 514978
\fBares_set_servers(3)\fP was added in c-ares 1.7.1;
Packit 514978
\fBares_set_servers_ports(3)\fP was added in c-ares 1.11.0.
Packit 514978
.SH AUTHOR
Packit 514978
Implementation of this function and associated library internals are based
Packit 514978
on code, comments and feedback provided in November and December of 2008 by
Packit 514978
Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009
Packit 514978
by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse
Packit 514978
shuffled all the bits and this function popped out.
Packit 514978
.br
Packit 514978
Copyright 1998 by the Massachusetts Institute of Technology.
Packit 514978
.br
Packit 514978
Copyright (C) 2008-2010 by Daniel Stenberg