summaryrefslogtreecommitdiffstats
path: root/ares_set_nameservers.3
blob: 9795c9872394afc708c002bb78947785719935d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.TH ARES_SET_NAMESERVERS 3 "12 Feb 2010"
.SH NAME
ares_set_nameservers - Set nameservers
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_set_nameservers(ares_channel \fIchannel\fP,
                            struct ares_addr *\fIservers\fP,
                            int \fInum_servers\fP)
.PP
.B cc file.c -lcares
.fi
.SH DESCRIPTION
.PP
This function sets nameservers for the given ares channel handle.
The array
.I servers
contains the addresses of nameservers, the length of the array
is stored in the 
.I num_servers
parameter.
Contrary to initializing nameservers with
.B ares_init_options
this function can be used to set IPv6 nameservers.

The structure 
.I ares_addr
contains the following fields:
.sp
.in +4n
.nf
struct ares_addr {
  int family;
  union {
    struct in_addr  addr4;
    struct in6_addr addr6;
  } addr;
};
.fi
.in

Two shortcuts for accessing members of the union
.I addr
are defined:
.sp
.in +4n
.nf
#define addrV4 addr.addr4
#define addrV6 addr.addr6
.fi
.in
.PP
.SH RETURN VALUES
.B ares_set_nameservers
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_init_options (3)
.SH AUTHOR
Written by Jakub Hrozek <jhrozek@redhat.com>,
on behalf of Red Hat, Inc http://www.redhat.com