resolver.h revision 224092
1135446Strhodes/*
2224092Sdougb * Copyright (C) 2004-2011  Internet Systems Consortium, Inc. ("ISC")
3135446Strhodes * Copyright (C) 1999-2001, 2003  Internet Software Consortium.
4135446Strhodes *
5193149Sdougb * Permission to use, copy, modify, and/or distribute this software for any
6135446Strhodes * purpose with or without fee is hereby granted, provided that the above
7135446Strhodes * copyright notice and this permission notice appear in all copies.
8135446Strhodes *
9135446Strhodes * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
10135446Strhodes * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11135446Strhodes * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
12135446Strhodes * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13135446Strhodes * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14135446Strhodes * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15135446Strhodes * PERFORMANCE OF THIS SOFTWARE.
16135446Strhodes */
17135446Strhodes
18224092Sdougb/* $Id: resolver.h,v 1.67.86.1.2.1 2011-06-02 23:47:36 tbox Exp $ */
19135446Strhodes
20135446Strhodes#ifndef DNS_RESOLVER_H
21135446Strhodes#define DNS_RESOLVER_H 1
22135446Strhodes
23135446Strhodes/*****
24135446Strhodes ***** Module Info
25135446Strhodes *****/
26135446Strhodes
27193149Sdougb/*! \file dns/resolver.h
28135446Strhodes *
29170222Sdougb * \brief
30135446Strhodes * This is the BIND 9 resolver, the module responsible for resolving DNS
31135446Strhodes * requests by iteratively querying authoritative servers and following
32135446Strhodes * referrals.  This is a "full resolver", not to be confused with
33135446Strhodes * the stub resolvers most people associate with the word "resolver".
34135446Strhodes * The full resolver is part of the caching name server or resolver
35135446Strhodes * daemon the stub resolver talks to.
36135446Strhodes *
37135446Strhodes * MP:
38170222Sdougb *\li	The module ensures appropriate synchronization of data structures it
39135446Strhodes *	creates and manipulates.
40135446Strhodes *
41135446Strhodes * Reliability:
42170222Sdougb *\li	No anticipated impact.
43135446Strhodes *
44135446Strhodes * Resources:
45170222Sdougb *\li	TBS
46135446Strhodes *
47135446Strhodes * Security:
48170222Sdougb *\li	No anticipated impact.
49135446Strhodes *
50135446Strhodes * Standards:
51170222Sdougb *\li	RFCs:	1034, 1035, 2181, TBS
52170222Sdougb *\li	Drafts:	TBS
53135446Strhodes */
54135446Strhodes
55135446Strhodes#include <isc/lang.h>
56135446Strhodes#include <isc/socket.h>
57135446Strhodes
58135446Strhodes#include <dns/types.h>
59135446Strhodes#include <dns/fixedname.h>
60135446Strhodes
61135446StrhodesISC_LANG_BEGINDECLS
62135446Strhodes
63170222Sdougb/*%
64135446Strhodes * A dns_fetchevent_t is sent when a 'fetch' completes.  Any of 'db',
65135446Strhodes * 'node', 'rdataset', and 'sigrdataset' may be bound.  It is the
66135446Strhodes * receiver's responsibility to detach before freeing the event.
67170222Sdougb * \brief
68170222Sdougb * 'rdataset', 'sigrdataset', 'client' and 'id' are the values that were
69170222Sdougb * supplied when dns_resolver_createfetch() was called.  They are returned
70170222Sdougb *  to the caller so that they may be freed.
71135446Strhodes */
72135446Strhodestypedef struct dns_fetchevent {
73135446Strhodes	ISC_EVENT_COMMON(struct dns_fetchevent);
74135446Strhodes	dns_fetch_t *			fetch;
75135446Strhodes	isc_result_t			result;
76135446Strhodes	dns_rdatatype_t			qtype;
77135446Strhodes	dns_db_t *			db;
78135446Strhodes	dns_dbnode_t *			node;
79135446Strhodes	dns_rdataset_t *		rdataset;
80135446Strhodes	dns_rdataset_t *		sigrdataset;
81135446Strhodes	dns_fixedname_t			foundname;
82170222Sdougb	isc_sockaddr_t *		client;
83170222Sdougb	dns_messageid_t			id;
84224092Sdougb	isc_result_t			vresult;
85135446Strhodes} dns_fetchevent_t;
86135446Strhodes
87135446Strhodes/*
88135446Strhodes * Options that modify how a 'fetch' is done.
89135446Strhodes */
90170222Sdougb#define DNS_FETCHOPT_TCP		0x01	     /*%< Use TCP. */
91170222Sdougb#define DNS_FETCHOPT_UNSHARED		0x02	     /*%< See below. */
92170222Sdougb#define DNS_FETCHOPT_RECURSIVE		0x04	     /*%< Set RD? */
93170222Sdougb#define DNS_FETCHOPT_NOEDNS0		0x08	     /*%< Do not use EDNS. */
94170222Sdougb#define DNS_FETCHOPT_FORWARDONLY	0x10	     /*%< Only use forwarders. */
95170222Sdougb#define DNS_FETCHOPT_NOVALIDATE		0x20	     /*%< Disable validation. */
96170222Sdougb#define DNS_FETCHOPT_EDNS512		0x40	     /*%< Advertise a 512 byte
97193149Sdougb							  UDP buffer. */
98193149Sdougb#define DNS_FETCHOPT_WANTNSID           0x80         /*%< Request NSID */
99135446Strhodes
100170222Sdougb#define	DNS_FETCHOPT_EDNSVERSIONSET	0x00800000
101170222Sdougb#define	DNS_FETCHOPT_EDNSVERSIONMASK	0xff000000
102170222Sdougb#define	DNS_FETCHOPT_EDNSVERSIONSHIFT	24
103170222Sdougb
104135446Strhodes/*
105193149Sdougb * Upper bounds of class of query RTT (ms).  Corresponds to
106193149Sdougb * dns_resstatscounter_queryrttX statistics counters.
107193149Sdougb */
108193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS0	10
109193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS0STR	"10"
110193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS1	100
111193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS1STR	"100"
112193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS2	500
113193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS2STR	"500"
114193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS3	800
115193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS3STR	"800"
116193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS4	1600
117193149Sdougb#define DNS_RESOLVER_QRYRTTCLASS4STR	"1600"
118193149Sdougb
119193149Sdougb/*
120135446Strhodes * XXXRTH  Should this API be made semi-private?  (I.e.
121135446Strhodes * _dns_resolver_create()).
122135446Strhodes */
123135446Strhodes
124135446Strhodes#define DNS_RESOLVER_CHECKNAMES		0x01
125135446Strhodes#define DNS_RESOLVER_CHECKNAMESFAIL	0x02
126135446Strhodes
127135446Strhodesisc_result_t
128135446Strhodesdns_resolver_create(dns_view_t *view,
129135446Strhodes		    isc_taskmgr_t *taskmgr, unsigned int ntasks,
130135446Strhodes		    isc_socketmgr_t *socketmgr,
131135446Strhodes		    isc_timermgr_t *timermgr,
132135446Strhodes		    unsigned int options,
133135446Strhodes		    dns_dispatchmgr_t *dispatchmgr,
134135446Strhodes		    dns_dispatch_t *dispatchv4,
135135446Strhodes		    dns_dispatch_t *dispatchv6,
136135446Strhodes		    dns_resolver_t **resp);
137135446Strhodes
138170222Sdougb/*%<
139135446Strhodes * Create a resolver.
140135446Strhodes *
141135446Strhodes * Notes:
142135446Strhodes *
143170222Sdougb *\li	Generally, applications should not create a resolver directly, but
144135446Strhodes *	should instead call dns_view_createresolver().
145135446Strhodes *
146135446Strhodes * Requires:
147135446Strhodes *
148170222Sdougb *\li	'view' is a valid view.
149135446Strhodes *
150170222Sdougb *\li	'taskmgr' is a valid task manager.
151135446Strhodes *
152170222Sdougb *\li	'ntasks' > 0.
153135446Strhodes *
154170222Sdougb *\li	'socketmgr' is a valid socket manager.
155135446Strhodes *
156170222Sdougb *\li	'timermgr' is a valid timer manager.
157135446Strhodes *
158170222Sdougb *\li	'dispatchv4' is a valid dispatcher with an IPv4 UDP socket, or is NULL.
159135446Strhodes *
160170222Sdougb *\li	'dispatchv6' is a valid dispatcher with an IPv6 UDP socket, or is NULL.
161135446Strhodes *
162170222Sdougb *\li	resp != NULL && *resp == NULL.
163135446Strhodes *
164135446Strhodes * Returns:
165135446Strhodes *
166170222Sdougb *\li	#ISC_R_SUCCESS				On success.
167135446Strhodes *
168170222Sdougb *\li	Anything else				Failure.
169135446Strhodes */
170135446Strhodes
171135446Strhodesvoid
172135446Strhodesdns_resolver_freeze(dns_resolver_t *res);
173170222Sdougb/*%<
174135446Strhodes * Freeze resolver.
175135446Strhodes *
176135446Strhodes * Notes:
177135446Strhodes *
178170222Sdougb *\li	Certain configuration changes cannot be made after the resolver
179135446Strhodes *	is frozen.  Fetches cannot be created until the resolver is frozen.
180135446Strhodes *
181135446Strhodes * Requires:
182135446Strhodes *
183224092Sdougb *\li	'res' is a valid resolver.
184135446Strhodes *
185135446Strhodes * Ensures:
186135446Strhodes *
187170222Sdougb *\li	'res' is frozen.
188135446Strhodes */
189135446Strhodes
190135446Strhodesvoid
191135446Strhodesdns_resolver_prime(dns_resolver_t *res);
192170222Sdougb/*%<
193135446Strhodes * Prime resolver.
194135446Strhodes *
195135446Strhodes * Notes:
196135446Strhodes *
197170222Sdougb *\li	Resolvers which have a forwarding policy other than dns_fwdpolicy_only
198135446Strhodes *	need to be primed with the root nameservers, otherwise the root
199135446Strhodes *	nameserver hints data may be used indefinitely.  This function requests
200135446Strhodes *	that the resolver start a priming fetch, if it isn't already priming.
201135446Strhodes *
202135446Strhodes * Requires:
203135446Strhodes *
204170222Sdougb *\li	'res' is a valid, frozen resolver.
205135446Strhodes */
206135446Strhodes
207135446Strhodes
208135446Strhodesvoid
209135446Strhodesdns_resolver_whenshutdown(dns_resolver_t *res, isc_task_t *task,
210135446Strhodes			  isc_event_t **eventp);
211170222Sdougb/*%<
212135446Strhodes * Send '*eventp' to 'task' when 'res' has completed shutdown.
213135446Strhodes *
214135446Strhodes * Notes:
215135446Strhodes *
216170222Sdougb *\li	It is not safe to detach the last reference to 'res' until
217135446Strhodes *	shutdown is complete.
218135446Strhodes *
219135446Strhodes * Requires:
220135446Strhodes *
221170222Sdougb *\li	'res' is a valid resolver.
222135446Strhodes *
223170222Sdougb *\li	'task' is a valid task.
224135446Strhodes *
225170222Sdougb *\li	*eventp is a valid event.
226135446Strhodes *
227135446Strhodes * Ensures:
228135446Strhodes *
229170222Sdougb *\li	*eventp == NULL.
230135446Strhodes */
231135446Strhodes
232135446Strhodesvoid
233135446Strhodesdns_resolver_shutdown(dns_resolver_t *res);
234170222Sdougb/*%<
235135446Strhodes * Start the shutdown process for 'res'.
236135446Strhodes *
237135446Strhodes * Notes:
238135446Strhodes *
239170222Sdougb *\li	This call has no effect if the resolver is already shutting down.
240135446Strhodes *
241135446Strhodes * Requires:
242135446Strhodes *
243170222Sdougb *\li	'res' is a valid resolver.
244135446Strhodes */
245135446Strhodes
246135446Strhodesvoid
247135446Strhodesdns_resolver_attach(dns_resolver_t *source, dns_resolver_t **targetp);
248135446Strhodes
249135446Strhodesvoid
250135446Strhodesdns_resolver_detach(dns_resolver_t **resp);
251135446Strhodes
252135446Strhodesisc_result_t
253135446Strhodesdns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name,
254135446Strhodes			 dns_rdatatype_t type,
255135446Strhodes			 dns_name_t *domain, dns_rdataset_t *nameservers,
256135446Strhodes			 dns_forwarders_t *forwarders,
257135446Strhodes			 unsigned int options, isc_task_t *task,
258135446Strhodes			 isc_taskaction_t action, void *arg,
259135446Strhodes			 dns_rdataset_t *rdataset,
260135446Strhodes			 dns_rdataset_t *sigrdataset,
261135446Strhodes			 dns_fetch_t **fetchp);
262170222Sdougb
263170222Sdougbisc_result_t
264170222Sdougbdns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name,
265170222Sdougb			  dns_rdatatype_t type,
266170222Sdougb			  dns_name_t *domain, dns_rdataset_t *nameservers,
267170222Sdougb			  dns_forwarders_t *forwarders,
268170222Sdougb			  isc_sockaddr_t *client, isc_uint16_t id,
269170222Sdougb			  unsigned int options, isc_task_t *task,
270170222Sdougb			  isc_taskaction_t action, void *arg,
271170222Sdougb			  dns_rdataset_t *rdataset,
272170222Sdougb			  dns_rdataset_t *sigrdataset,
273170222Sdougb			  dns_fetch_t **fetchp);
274170222Sdougb/*%<
275135446Strhodes * Recurse to answer a question.
276135446Strhodes *
277135446Strhodes * Notes:
278135446Strhodes *
279170222Sdougb *\li	This call starts a query for 'name', type 'type'.
280135446Strhodes *
281170222Sdougb *\li	The 'domain' is a parent domain of 'name' for which
282135446Strhodes *	a set of name servers 'nameservers' is known.  If no
283135446Strhodes *	such name server information is available, set
284135446Strhodes * 	'domain' and 'nameservers' to NULL.
285135446Strhodes *
286170222Sdougb *\li	'forwarders' is unimplemented, and subject to change when
287135446Strhodes *	we figure out how selective forwarding will work.
288135446Strhodes *
289170222Sdougb *\li	When the fetch completes (successfully or otherwise), a
290170222Sdougb *	#DNS_EVENT_FETCHDONE event with action 'action' and arg 'arg' will be
291135446Strhodes *	posted to 'task'.
292135446Strhodes *
293170222Sdougb *\li	The values of 'rdataset' and 'sigrdataset' will be returned in
294135446Strhodes *	the FETCHDONE event.
295135446Strhodes *
296170222Sdougb *\li	'client' and 'id' are used for duplicate query detection.  '*client'
297170222Sdougb *	must remain stable until after 'action' has been called or
298170222Sdougb *	dns_resolver_cancelfetch() is called.
299170222Sdougb *
300135446Strhodes * Requires:
301135446Strhodes *
302170222Sdougb *\li	'res' is a valid resolver that has been frozen.
303135446Strhodes *
304170222Sdougb *\li	'name' is a valid name.
305135446Strhodes *
306170222Sdougb *\li	'type' is not a meta type other than ANY.
307135446Strhodes *
308170222Sdougb *\li	'domain' is a valid name or NULL.
309135446Strhodes *
310170222Sdougb *\li	'nameservers' is a valid NS rdataset (whose owner name is 'domain')
311135446Strhodes *	iff. 'domain' is not NULL.
312135446Strhodes *
313170222Sdougb *\li	'forwarders' is NULL.
314135446Strhodes *
315170222Sdougb *\li	'client' is a valid sockaddr or NULL.
316135446Strhodes *
317170222Sdougb *\li	'options' contains valid options.
318135446Strhodes *
319170222Sdougb *\li	'rdataset' is a valid, disassociated rdataset.
320135446Strhodes *
321170222Sdougb *\li	'sigrdataset' is NULL, or is a valid, disassociated rdataset.
322135446Strhodes *
323170222Sdougb *\li	fetchp != NULL && *fetchp == NULL.
324170222Sdougb *
325135446Strhodes * Returns:
326135446Strhodes *
327170222Sdougb *\li	#ISC_R_SUCCESS					Success
328170222Sdougb *\li	#DNS_R_DUPLICATE
329170222Sdougb *\li	#DNS_R_DROP
330135446Strhodes *
331170222Sdougb *\li	Many other values are possible, all of which indicate failure.
332135446Strhodes */
333135446Strhodes
334135446Strhodesvoid
335135446Strhodesdns_resolver_cancelfetch(dns_fetch_t *fetch);
336170222Sdougb/*%<
337135446Strhodes * Cancel 'fetch'.
338135446Strhodes *
339135446Strhodes * Notes:
340135446Strhodes *
341170222Sdougb *\li	If 'fetch' has not completed, post its FETCHDONE event with a
342170222Sdougb *	result code of #ISC_R_CANCELED.
343135446Strhodes *
344135446Strhodes * Requires:
345135446Strhodes *
346170222Sdougb *\li	'fetch' is a valid fetch.
347135446Strhodes */
348135446Strhodes
349135446Strhodesvoid
350135446Strhodesdns_resolver_destroyfetch(dns_fetch_t **fetchp);
351170222Sdougb/*%<
352135446Strhodes * Destroy 'fetch'.
353135446Strhodes *
354135446Strhodes * Requires:
355135446Strhodes *
356170222Sdougb *\li	'*fetchp' is a valid fetch.
357135446Strhodes *
358170222Sdougb *\li	The caller has received the FETCHDONE event (either because the
359135446Strhodes *	fetch completed or because dns_resolver_cancelfetch() was called).
360135446Strhodes *
361135446Strhodes * Ensures:
362135446Strhodes *
363170222Sdougb *\li	*fetchp == NULL.
364135446Strhodes */
365135446Strhodes
366193149Sdougbvoid
367193149Sdougbdns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx,
368193149Sdougb		      isc_logcategory_t *category, isc_logmodule_t *module,
369193149Sdougb		      int level, isc_boolean_t duplicateok);
370193149Sdougb/*%<
371193149Sdougb * Dump a log message on internal state at the completion of given 'fetch'.
372193149Sdougb * 'lctx', 'category', 'module', and 'level' are used to write the log message.
373193149Sdougb * By default, only one log message is written even if the corresponding fetch
374193149Sdougb * context serves multiple clients; if 'duplicateok' is true the suppression
375193149Sdougb * is disabled and the message can be written every time this function is
376193149Sdougb * called.
377193149Sdougb *
378193149Sdougb * Requires:
379193149Sdougb *
380193149Sdougb *\li	'fetch' is a valid fetch, and has completed.
381193149Sdougb */
382193149Sdougb
383135446Strhodesdns_dispatchmgr_t *
384135446Strhodesdns_resolver_dispatchmgr(dns_resolver_t *resolver);
385135446Strhodes
386135446Strhodesdns_dispatch_t *
387135446Strhodesdns_resolver_dispatchv4(dns_resolver_t *resolver);
388135446Strhodes
389135446Strhodesdns_dispatch_t *
390135446Strhodesdns_resolver_dispatchv6(dns_resolver_t *resolver);
391135446Strhodes
392135446Strhodesisc_socketmgr_t *
393135446Strhodesdns_resolver_socketmgr(dns_resolver_t *resolver);
394135446Strhodes
395135446Strhodesisc_taskmgr_t *
396135446Strhodesdns_resolver_taskmgr(dns_resolver_t *resolver);
397135446Strhodes
398135446Strhodesisc_uint32_t
399135446Strhodesdns_resolver_getlamettl(dns_resolver_t *resolver);
400170222Sdougb/*%<
401135446Strhodes * Get the resolver's lame-ttl.  zero => no lame processing.
402135446Strhodes *
403135446Strhodes * Requires:
404170222Sdougb *\li	'resolver' to be valid.
405135446Strhodes */
406135446Strhodes
407135446Strhodesvoid
408135446Strhodesdns_resolver_setlamettl(dns_resolver_t *resolver, isc_uint32_t lame_ttl);
409170222Sdougb/*%<
410135446Strhodes * Set the resolver's lame-ttl.  zero => no lame processing.
411135446Strhodes *
412135446Strhodes * Requires:
413170222Sdougb *\li	'resolver' to be valid.
414135446Strhodes */
415135446Strhodes
416135446Strhodesunsigned int
417135446Strhodesdns_resolver_nrunning(dns_resolver_t *resolver);
418170222Sdougb/*%<
419135446Strhodes * Return the number of currently running resolutions in this
420135446Strhodes * resolver.  This is may be less than the number of outstanding
421135446Strhodes * fetches due to multiple identical fetches, or more than the
422135446Strhodes * number of of outstanding fetches due to the fact that resolution
423135446Strhodes * can continue even though a fetch has been canceled.
424135446Strhodes */
425135446Strhodes
426135446Strhodesisc_result_t
427135446Strhodesdns_resolver_addalternate(dns_resolver_t *resolver, isc_sockaddr_t *alt,
428135446Strhodes			  dns_name_t *name, in_port_t port);
429170222Sdougb/*%<
430135446Strhodes * Add alternate addresses to be tried in the event that the nameservers
431135446Strhodes * for a zone are not available in the address families supported by the
432135446Strhodes * operating system.
433135446Strhodes *
434135446Strhodes * Require:
435170222Sdougb * \li	only one of 'name' or 'alt' to be valid.
436135446Strhodes */
437135446Strhodes
438135446Strhodesvoid
439135446Strhodesdns_resolver_setudpsize(dns_resolver_t *resolver, isc_uint16_t udpsize);
440170222Sdougb/*%<
441135446Strhodes * Set the EDNS UDP buffer size advertised by the server.
442135446Strhodes */
443135446Strhodes
444135446Strhodesisc_uint16_t
445135446Strhodesdns_resolver_getudpsize(dns_resolver_t *resolver);
446170222Sdougb/*%<
447135446Strhodes * Get the current EDNS UDP buffer size.
448135446Strhodes */
449135446Strhodes
450135446Strhodesvoid
451135446Strhodesdns_resolver_reset_algorithms(dns_resolver_t *resolver);
452170222Sdougb/*%<
453135446Strhodes * Clear the disabled DNSSEC algorithms.
454135446Strhodes */
455135446Strhodes
456135446Strhodesisc_result_t
457135446Strhodesdns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name,
458135446Strhodes			       unsigned int alg);
459170222Sdougb/*%<
460135446Strhodes * Mark the give DNSSEC algorithm as disabled and below 'name'.
461135446Strhodes * Valid algorithms are less than 256.
462135446Strhodes *
463135446Strhodes * Returns:
464170222Sdougb *\li	#ISC_R_SUCCESS
465170222Sdougb *\li	#ISC_R_RANGE
466170222Sdougb *\li	#ISC_R_NOMEMORY
467135446Strhodes */
468135446Strhodes
469135446Strhodesisc_boolean_t
470135446Strhodesdns_resolver_algorithm_supported(dns_resolver_t *resolver, dns_name_t *name,
471135446Strhodes				 unsigned int alg);
472170222Sdougb/*%<
473135446Strhodes * Check if the given algorithm is supported by this resolver.
474135446Strhodes * This checks if the algorithm has been disabled via
475135446Strhodes * dns_resolver_disable_algorithm() then the underlying
476135446Strhodes * crypto libraries if not specifically disabled.
477135446Strhodes */
478135446Strhodes
479170222Sdougbisc_boolean_t
480170222Sdougbdns_resolver_digest_supported(dns_resolver_t *resolver, unsigned int digest_type);
481170222Sdougb/*%<
482170222Sdougb * Is this digest type supported.
483170222Sdougb */
484170222Sdougb
485135446Strhodesvoid
486135446Strhodesdns_resolver_resetmustbesecure(dns_resolver_t *resolver);
487135446Strhodes
488135446Strhodesisc_result_t
489135446Strhodesdns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name,
490135446Strhodes			     isc_boolean_t value);
491135446Strhodes
492135446Strhodesisc_boolean_t
493135446Strhodesdns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name);
494135446Strhodes
495224092Sdougb
496170222Sdougbvoid
497224092Sdougbdns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds);
498224092Sdougb/*%<
499224092Sdougb * Set the length of time the resolver will work on a query, in seconds.
500224092Sdougb *
501224092Sdougb * If timeout is 0, the default timeout will be applied.
502224092Sdougb *
503224092Sdougb * Requires:
504224092Sdougb * \li  resolver to be valid.
505224092Sdougb */
506224092Sdougb
507224092Sdougbunsigned int
508224092Sdougbdns_resolver_gettimeout(dns_resolver_t *resolver);
509224092Sdougb/*%<
510224092Sdougb * Get the current length of time the resolver will work on a query, in seconds.
511224092Sdougb *
512224092Sdougb * Requires:
513224092Sdougb * \li  resolver to be valid.
514224092Sdougb */
515224092Sdougb
516224092Sdougbvoid
517170222Sdougbdns_resolver_setclientsperquery(dns_resolver_t *resolver,
518170222Sdougb				isc_uint32_t min, isc_uint32_t max);
519170222Sdougb
520170222Sdougbvoid
521170222Sdougbdns_resolver_getclientsperquery(dns_resolver_t *resolver, isc_uint32_t *cur,
522170222Sdougb				isc_uint32_t *min, isc_uint32_t *max);
523170222Sdougb
524170222Sdougbisc_boolean_t
525170222Sdougbdns_resolver_getzeronosoattl(dns_resolver_t *resolver);
526193149Sdougb
527170222Sdougbvoid
528170222Sdougbdns_resolver_setzeronosoattl(dns_resolver_t *resolver, isc_boolean_t state);
529170222Sdougb
530193149Sdougbunsigned int
531193149Sdougbdns_resolver_getoptions(dns_resolver_t *resolver);
532193149Sdougb
533205292Sdougbvoid
534205292Sdougbdns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
535205292Sdougb			 dns_rdatatype_t type, isc_time_t *expire);
536205292Sdougb/*%<
537205292Sdougb * Add a entry to the bad cache for <name,type> that will expire at 'expire'.
538205292Sdougb *
539205292Sdougb * Requires:
540205292Sdougb * \li	resolver to be valid.
541205292Sdougb * \li	name to be valid.
542205292Sdougb */
543205292Sdougb
544205292Sdougbisc_boolean_t
545205292Sdougbdns_resolver_getbadcache(dns_resolver_t *resolver, dns_name_t *name,
546205292Sdougb			 dns_rdatatype_t type, isc_time_t *now);
547205292Sdougb/*%<
548205292Sdougb * Check to see if there is a unexpired entry in the bad cache for
549205292Sdougb * <name,type>.
550205292Sdougb *
551205292Sdougb * Requires:
552205292Sdougb * \li	resolver to be valid.
553205292Sdougb * \li	name to be valid.
554205292Sdougb */
555205292Sdougb
556205292Sdougbvoid
557205292Sdougbdns_resolver_flushbadcache(dns_resolver_t *resolver, dns_name_t *name);
558205292Sdougb/*%<
559205292Sdougb * Flush the bad cache of all entries at 'name' if 'name' is non NULL.
560205292Sdougb * Flush the entire bad cache if 'name' is NULL.
561205292Sdougb *
562205292Sdougb * Requires:
563205292Sdougb * \li	resolver to be valid.
564205292Sdougb */
565205292Sdougb
566205292Sdougbvoid
567205292Sdougbdns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp);
568205292Sdougb/*%
569205292Sdougb * Print out the contents of the bad cache to 'fp'.
570205292Sdougb *
571205292Sdougb * Requires:
572205292Sdougb * \li	resolver to be valid.
573205292Sdougb */
574205292Sdougb
575135446StrhodesISC_LANG_ENDDECLS
576135446Strhodes
577135446Strhodes#endif /* DNS_RESOLVER_H */
578