Merge branch 'master' of ctdb into 'master' of samba
[samba.git] / libcli / dns / dns.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  Internal DNS query structures
4  *  Copyright (C) Gerald Carter                2006.
5  *  Copyright (C) Andrew Bartlett 2011
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 3 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
19  */
20
21 /* DNS query section in replies */
22
23 struct dns_query {
24         const char *hostname;
25         uint16_t type;
26         uint16_t in_class;
27 };
28
29 /* DNS RR record in reply */
30
31 struct dns_rr {
32         const char *hostname;
33         uint16_t type;
34         uint16_t in_class;
35         uint32_t ttl;
36         uint16_t rdatalen;
37         uint8_t *rdata;
38 };
39
40 /* SRV records */
41
42 struct dns_rr_srv {
43         const char *hostname;
44         uint16_t priority;
45         uint16_t weight;
46         uint16_t port;
47         size_t num_ips;
48         struct sockaddr_storage *ss_s;  /* support multi-homed hosts */
49 };
50
51 /* NS records */
52
53 struct dns_rr_ns {
54         const char *hostname;
55         struct sockaddr_storage ss;
56 };
57
58 NTSTATUS resolve_dns_hosts_file_as_sockaddr(const char *dns_hosts_file,
59                                             const char *name, bool srv_lookup,
60                                             TALLOC_CTX *mem_ctx,
61                                             struct sockaddr_storage **return_iplist,
62                                             int *return_count);
63
64 NTSTATUS resolve_dns_hosts_file_as_dns_rr(const char *dns_hosts_file,
65                                           const char *name, bool srv_lookup,
66                                           TALLOC_CTX *mem_ctx,
67                                           struct dns_rr_srv **return_rr,
68                                           int *return_count);