lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | .\" |
| 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 |
| 18 | ares_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 |
| 27 | The \fBares_set_servers(3)\fP function initializes name servers configuration |
| 28 | for the channel data identified by |
| 29 | .IR channel , |
| 30 | from a |
| 31 | .IR servers |
| 32 | pointer to a linked list of ares_addr_node structs holding name servers |
| 33 | address data. |
| 34 | .PP |
| 35 | The name server linked list pointer argument may be the result of a previous |
| 36 | call to \fBares_get_servers(3)\fP or a linked list of \fBares_addr_node\fP structs |
| 37 | set up by other means. |
| 38 | .PP |
| 39 | The \fBares_set_servers(3)\fP function also allows the specification of UDP and |
| 40 | TCP ports to be used for communication on a per-server basis. The provided |
| 41 | linked 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 |
| 43 | set up by other means. |
| 44 | .PP |
| 45 | This function replaces any potentially previously configured name servers |
| 46 | with the ones given in the linked list. So, in order to configure a channel |
| 47 | with more than one name server all the desired ones must be specified in a |
| 48 | single list. |
| 49 | .PP |
| 50 | The function does not take ownership of the linked list argument. |
| 51 | The caller is responsible for freeing the linked list when no longer needed. |
| 52 | .PP |
| 53 | This function is capable of handling IPv4 and IPv6 name server |
| 54 | addresses simultaneously, rendering \fBares_init_options(3)\fP with |
| 55 | optmask \fBARES_OPT_SERVERS\fP functionally obsolete except for |
| 56 | IPv4-only name server usage. |
| 57 | |
| 58 | .SH RETURN VALUES |
| 59 | .B ares_set_servers(3) |
| 60 | may return any of the following values: |
| 61 | .TP 15 |
| 62 | .B ARES_SUCCESS |
| 63 | The name servers configuration was successfully initialized. |
| 64 | .TP 15 |
| 65 | .B ARES_ENOMEM |
| 66 | The process's available memory was exhausted. |
| 67 | .TP 15 |
| 68 | .B ARES_ENODATA |
| 69 | The channel data identified by |
| 70 | .IR channel |
| 71 | was invalid. |
| 72 | .TP 15 |
| 73 | .B ARES_ENOTINITIALIZED |
| 74 | c-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 |
| 84 | Implementation of this function and associated library internals are based |
| 85 | on code, comments and feedback provided in November and December of 2008 by |
| 86 | Daniel Stenberg, Gregor Jasny, Phil Blundell and Yang Tse, December 2009 |
| 87 | by Cedric Bail, February 2010 by Jakub Hrozek. On March 2010 Yang Tse |
| 88 | shuffled all the bits and this function popped out. |
| 89 | .br |
| 90 | Copyright 1998 by the Massachusetts Institute of Technology. |
| 91 | .br |
| 92 | Copyright (C) 2008-2010 by Daniel Stenberg |