| 1 | /*
 | 
|---|
| 2 |  *  Unix SMB/CIFS implementation.
 | 
|---|
| 3 |  *  Internal DNS query structures
 | 
|---|
| 4 |  *  Copyright (C) Gerald Carter                2006.
 | 
|---|
| 5 |  *
 | 
|---|
| 6 |  *  This program is free software; you can redistribute it and/or modify
 | 
|---|
| 7 |  *  it under the terms of the GNU General Public License as published by
 | 
|---|
| 8 |  *  the Free Software Foundation; either version 3 of the License, or
 | 
|---|
| 9 |  *  (at your option) any later version.
 | 
|---|
| 10 |  *
 | 
|---|
| 11 |  *  This program is distributed in the hope that it will be useful,
 | 
|---|
| 12 |  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 13 |  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
| 14 |  *  GNU General Public License for more details.
 | 
|---|
| 15 |  *
 | 
|---|
| 16 |  *  You should have received a copy of the GNU General Public License
 | 
|---|
| 17 |  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 18 |  */
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #ifndef _ADS_DNS_H
 | 
|---|
| 21 | #define _ADS_DNS_H
 | 
|---|
| 22 | 
 | 
|---|
| 23 | /* DNS query section in replies */
 | 
|---|
| 24 | 
 | 
|---|
| 25 | struct dns_query {
 | 
|---|
| 26 |         const char *hostname;
 | 
|---|
| 27 |         uint16 type;
 | 
|---|
| 28 |         uint16 in_class;
 | 
|---|
| 29 | };
 | 
|---|
| 30 | 
 | 
|---|
| 31 | /* DNS RR record in reply */
 | 
|---|
| 32 | 
 | 
|---|
| 33 | struct dns_rr {
 | 
|---|
| 34 |         const char *hostname;
 | 
|---|
| 35 |         uint16 type;
 | 
|---|
| 36 |         uint16 in_class;
 | 
|---|
| 37 |         uint32 ttl;
 | 
|---|
| 38 |         uint16 rdatalen;
 | 
|---|
| 39 |         uint8 *rdata;
 | 
|---|
| 40 | };
 | 
|---|
| 41 | 
 | 
|---|
| 42 | /* SRV records */
 | 
|---|
| 43 | 
 | 
|---|
| 44 | struct dns_rr_srv {
 | 
|---|
| 45 |         const char *hostname;
 | 
|---|
| 46 |         uint16 priority;
 | 
|---|
| 47 |         uint16 weight;
 | 
|---|
| 48 |         uint16 port;
 | 
|---|
| 49 |         size_t num_ips;
 | 
|---|
| 50 |         struct sockaddr_storage *ss_s;  /* support multi-homed hosts */
 | 
|---|
| 51 | };
 | 
|---|
| 52 | 
 | 
|---|
| 53 | /* NS records */
 | 
|---|
| 54 | 
 | 
|---|
| 55 | struct dns_rr_ns {
 | 
|---|
| 56 |         const char *hostname;
 | 
|---|
| 57 |         struct sockaddr_storage ss;
 | 
|---|
| 58 | };
 | 
|---|
| 59 | 
 | 
|---|
| 60 | /* The following definitions come from libads/dns.c  */
 | 
|---|
| 61 | 
 | 
|---|
| 62 | NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
 | 
|---|
| 63 |                                 const char *dnsdomain,
 | 
|---|
| 64 |                                 struct dns_rr_ns **nslist,
 | 
|---|
| 65 |                                 int *numns);
 | 
|---|
| 66 | NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
 | 
|---|
| 67 |                            const char *realm,
 | 
|---|
| 68 |                            const char *sitename,
 | 
|---|
| 69 |                            struct dns_rr_srv **dclist,
 | 
|---|
| 70 |                            int *numdcs );
 | 
|---|
| 71 | NTSTATUS ads_dns_query_gcs(TALLOC_CTX *ctx,
 | 
|---|
| 72 |                            const char *realm,
 | 
|---|
| 73 |                            const char *sitename,
 | 
|---|
| 74 |                            struct dns_rr_srv **dclist,
 | 
|---|
| 75 |                            int *numdcs );
 | 
|---|
| 76 | NTSTATUS ads_dns_query_kdcs(TALLOC_CTX *ctx,
 | 
|---|
| 77 |                             const char *dns_forest_name,
 | 
|---|
| 78 |                             const char *sitename,
 | 
|---|
| 79 |                             struct dns_rr_srv **dclist,
 | 
|---|
| 80 |                             int *numdcs );
 | 
|---|
| 81 | NTSTATUS ads_dns_query_pdc(TALLOC_CTX *ctx,
 | 
|---|
| 82 |                            const char *dns_domain_name,
 | 
|---|
| 83 |                            struct dns_rr_srv **dclist,
 | 
|---|
| 84 |                            int *numdcs );
 | 
|---|
| 85 | NTSTATUS ads_dns_query_dcs_guid(TALLOC_CTX *ctx,
 | 
|---|
| 86 |                                 const char *dns_forest_name,
 | 
|---|
| 87 |                                 const struct GUID *domain_guid,
 | 
|---|
| 88 |                                 struct dns_rr_srv **dclist,
 | 
|---|
| 89 |                                 int *numdcs );
 | 
|---|
| 90 | #endif  /* _ADS_DNS_H */
 | 
|---|