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