1 /*	$NetBSD: query.h,v 1.6 2014/12/10 04:37:52 christos Exp $	*/
2 
3 /*
4  * Copyright (C) 2004, 2005, 2007, 2010, 2011, 2013, 2014  Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (C) 1999-2002  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef NAMED_QUERY_H
21 #define NAMED_QUERY_H 1
22 
23 /*! \file */
24 
25 #include <isc/types.h>
26 #include <isc/buffer.h>
27 #include <isc/netaddr.h>
28 
29 #include <dns/rdataset.h>
30 #include <dns/rpz.h>
31 #include <dns/types.h>
32 
33 #include <named/types.h>
34 
35 /*% nameserver database version structure */
36 typedef struct ns_dbversion {
37 	dns_db_t			*db;
38 	dns_dbversion_t			*version;
39 	isc_boolean_t			acl_checked;
40 	isc_boolean_t			queryok;
41 	ISC_LINK(struct ns_dbversion)	link;
42 } ns_dbversion_t;
43 
44 /*% nameserver query structure */
45 struct ns_query {
46 	unsigned int			attributes;
47 	unsigned int			restarts;
48 	isc_boolean_t			timerset;
49 	dns_name_t *			qname;
50 	dns_name_t *			origqname;
51 	unsigned int			dboptions;
52 	unsigned int			fetchoptions;
53 	dns_db_t *			gluedb;
54 	dns_db_t *			authdb;
55 	dns_zone_t *			authzone;
56 	isc_boolean_t			authdbset;
57 	isc_boolean_t			isreferral;
58 	isc_mutex_t			fetchlock;
59 	dns_fetch_t *			fetch;
60 	dns_fetch_t *			prefetch;
61 	dns_rpz_st_t *			rpz_st;
62 	isc_bufferlist_t		namebufs;
63 	ISC_LIST(ns_dbversion_t)	activeversions;
64 	ISC_LIST(ns_dbversion_t)	freeversions;
65 	dns_rdataset_t *		dns64_aaaa;
66 	dns_rdataset_t *		dns64_sigaaaa;
67 	isc_boolean_t *			dns64_aaaaok;
68 	unsigned int			dns64_aaaaoklen;
69 	unsigned int			dns64_options;
70 	unsigned int			dns64_ttl;
71 };
72 
73 #define NS_QUERYATTR_RECURSIONOK	0x0001
74 #define NS_QUERYATTR_CACHEOK		0x0002
75 #define NS_QUERYATTR_PARTIALANSWER	0x0004
76 #define NS_QUERYATTR_NAMEBUFUSED	0x0008
77 #define NS_QUERYATTR_RECURSING		0x0010
78 #define NS_QUERYATTR_CACHEGLUEOK	0x0020
79 #define NS_QUERYATTR_QUERYOKVALID	0x0040
80 #define NS_QUERYATTR_QUERYOK		0x0080
81 #define NS_QUERYATTR_WANTRECURSION	0x0100
82 #define NS_QUERYATTR_SECURE		0x0200
83 #define NS_QUERYATTR_NOAUTHORITY	0x0400
84 #define NS_QUERYATTR_NOADDITIONAL	0x0800
85 #define NS_QUERYATTR_CACHEACLOKVALID	0x1000
86 #define NS_QUERYATTR_CACHEACLOK		0x2000
87 #define NS_QUERYATTR_DNS64		0x4000
88 #define NS_QUERYATTR_DNS64EXCLUDE	0x8000
89 #define NS_QUERYATTR_RRL_CHECKED	0x10000
90 
91 
92 isc_result_t
93 ns_query_init(ns_client_t *client);
94 
95 void
96 ns_query_free(ns_client_t *client);
97 
98 void
99 ns_query_start(ns_client_t *client);
100 
101 void
102 ns_query_cancel(ns_client_t *client);
103 
104 #endif /* NAMED_QUERY_H */
105