resolver.h revision 254897
1135446Strhodes/*
2234010Sdougb * Copyright (C) 2004-2012  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
18254897Serwin/* $Id: resolver.h,v 1.72 2011/12/05 17:10:51 each 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,
129254897Serwin		    isc_taskmgr_t *taskmgr,
130254897Serwin		    unsigned int ntasks, unsigned int ndisp,
131135446Strhodes		    isc_socketmgr_t *socketmgr,
132135446Strhodes		    isc_timermgr_t *timermgr,
133135446Strhodes		    unsigned int options,
134135446Strhodes		    dns_dispatchmgr_t *dispatchmgr,
135135446Strhodes		    dns_dispatch_t *dispatchv4,
136135446Strhodes		    dns_dispatch_t *dispatchv6,
137135446Strhodes		    dns_resolver_t **resp);
138135446Strhodes
139170222Sdougb/*%<
140135446Strhodes * Create a resolver.
141135446Strhodes *
142135446Strhodes * Notes:
143135446Strhodes *
144170222Sdougb *\li	Generally, applications should not create a resolver directly, but
145135446Strhodes *	should instead call dns_view_createresolver().
146135446Strhodes *
147135446Strhodes * Requires:
148135446Strhodes *
149170222Sdougb *\li	'view' is a valid view.
150135446Strhodes *
151170222Sdougb *\li	'taskmgr' is a valid task manager.
152135446Strhodes *
153170222Sdougb *\li	'ntasks' > 0.
154135446Strhodes *
155170222Sdougb *\li	'socketmgr' is a valid socket manager.
156135446Strhodes *
157170222Sdougb *\li	'timermgr' is a valid timer manager.
158135446Strhodes *
159254897Serwin *\li	'dispatchv4' is a dispatch with an IPv4 UDP socket, or is NULL.
160254897Serwin *	If not NULL, 'ndisp' clones of it will be created by the resolver.
161135446Strhodes *
162254897Serwin *\li	'dispatchv6' is a dispatch with an IPv6 UDP socket, or is NULL.
163254897Serwin *	If not NULL, 'ndisp' clones of it will be created by the resolver.
164135446Strhodes *
165170222Sdougb *\li	resp != NULL && *resp == NULL.
166135446Strhodes *
167135446Strhodes * Returns:
168135446Strhodes *
169170222Sdougb *\li	#ISC_R_SUCCESS				On success.
170135446Strhodes *
171170222Sdougb *\li	Anything else				Failure.
172135446Strhodes */
173135446Strhodes
174135446Strhodesvoid
175135446Strhodesdns_resolver_freeze(dns_resolver_t *res);
176170222Sdougb/*%<
177135446Strhodes * Freeze resolver.
178135446Strhodes *
179135446Strhodes * Notes:
180135446Strhodes *
181170222Sdougb *\li	Certain configuration changes cannot be made after the resolver
182135446Strhodes *	is frozen.  Fetches cannot be created until the resolver is frozen.
183135446Strhodes *
184135446Strhodes * Requires:
185135446Strhodes *
186224092Sdougb *\li	'res' is a valid resolver.
187135446Strhodes *
188135446Strhodes * Ensures:
189135446Strhodes *
190170222Sdougb *\li	'res' is frozen.
191135446Strhodes */
192135446Strhodes
193135446Strhodesvoid
194135446Strhodesdns_resolver_prime(dns_resolver_t *res);
195170222Sdougb/*%<
196135446Strhodes * Prime resolver.
197135446Strhodes *
198135446Strhodes * Notes:
199135446Strhodes *
200170222Sdougb *\li	Resolvers which have a forwarding policy other than dns_fwdpolicy_only
201135446Strhodes *	need to be primed with the root nameservers, otherwise the root
202135446Strhodes *	nameserver hints data may be used indefinitely.  This function requests
203135446Strhodes *	that the resolver start a priming fetch, if it isn't already priming.
204135446Strhodes *
205135446Strhodes * Requires:
206135446Strhodes *
207170222Sdougb *\li	'res' is a valid, frozen resolver.
208135446Strhodes */
209135446Strhodes
210135446Strhodes
211135446Strhodesvoid
212135446Strhodesdns_resolver_whenshutdown(dns_resolver_t *res, isc_task_t *task,
213135446Strhodes			  isc_event_t **eventp);
214170222Sdougb/*%<
215135446Strhodes * Send '*eventp' to 'task' when 'res' has completed shutdown.
216135446Strhodes *
217135446Strhodes * Notes:
218135446Strhodes *
219170222Sdougb *\li	It is not safe to detach the last reference to 'res' until
220135446Strhodes *	shutdown is complete.
221135446Strhodes *
222135446Strhodes * Requires:
223135446Strhodes *
224170222Sdougb *\li	'res' is a valid resolver.
225135446Strhodes *
226170222Sdougb *\li	'task' is a valid task.
227135446Strhodes *
228170222Sdougb *\li	*eventp is a valid event.
229135446Strhodes *
230135446Strhodes * Ensures:
231135446Strhodes *
232170222Sdougb *\li	*eventp == NULL.
233135446Strhodes */
234135446Strhodes
235135446Strhodesvoid
236135446Strhodesdns_resolver_shutdown(dns_resolver_t *res);
237170222Sdougb/*%<
238135446Strhodes * Start the shutdown process for 'res'.
239135446Strhodes *
240135446Strhodes * Notes:
241135446Strhodes *
242170222Sdougb *\li	This call has no effect if the resolver is already shutting down.
243135446Strhodes *
244135446Strhodes * Requires:
245135446Strhodes *
246170222Sdougb *\li	'res' is a valid resolver.
247135446Strhodes */
248135446Strhodes
249135446Strhodesvoid
250135446Strhodesdns_resolver_attach(dns_resolver_t *source, dns_resolver_t **targetp);
251135446Strhodes
252135446Strhodesvoid
253135446Strhodesdns_resolver_detach(dns_resolver_t **resp);
254135446Strhodes
255135446Strhodesisc_result_t
256135446Strhodesdns_resolver_createfetch(dns_resolver_t *res, dns_name_t *name,
257135446Strhodes			 dns_rdatatype_t type,
258135446Strhodes			 dns_name_t *domain, dns_rdataset_t *nameservers,
259135446Strhodes			 dns_forwarders_t *forwarders,
260135446Strhodes			 unsigned int options, isc_task_t *task,
261135446Strhodes			 isc_taskaction_t action, void *arg,
262135446Strhodes			 dns_rdataset_t *rdataset,
263135446Strhodes			 dns_rdataset_t *sigrdataset,
264135446Strhodes			 dns_fetch_t **fetchp);
265170222Sdougb
266170222Sdougbisc_result_t
267170222Sdougbdns_resolver_createfetch2(dns_resolver_t *res, dns_name_t *name,
268170222Sdougb			  dns_rdatatype_t type,
269170222Sdougb			  dns_name_t *domain, dns_rdataset_t *nameservers,
270170222Sdougb			  dns_forwarders_t *forwarders,
271170222Sdougb			  isc_sockaddr_t *client, isc_uint16_t id,
272170222Sdougb			  unsigned int options, isc_task_t *task,
273170222Sdougb			  isc_taskaction_t action, void *arg,
274170222Sdougb			  dns_rdataset_t *rdataset,
275170222Sdougb			  dns_rdataset_t *sigrdataset,
276170222Sdougb			  dns_fetch_t **fetchp);
277170222Sdougb/*%<
278135446Strhodes * Recurse to answer a question.
279135446Strhodes *
280135446Strhodes * Notes:
281135446Strhodes *
282170222Sdougb *\li	This call starts a query for 'name', type 'type'.
283135446Strhodes *
284170222Sdougb *\li	The 'domain' is a parent domain of 'name' for which
285135446Strhodes *	a set of name servers 'nameservers' is known.  If no
286135446Strhodes *	such name server information is available, set
287135446Strhodes * 	'domain' and 'nameservers' to NULL.
288135446Strhodes *
289170222Sdougb *\li	'forwarders' is unimplemented, and subject to change when
290135446Strhodes *	we figure out how selective forwarding will work.
291135446Strhodes *
292170222Sdougb *\li	When the fetch completes (successfully or otherwise), a
293170222Sdougb *	#DNS_EVENT_FETCHDONE event with action 'action' and arg 'arg' will be
294135446Strhodes *	posted to 'task'.
295135446Strhodes *
296170222Sdougb *\li	The values of 'rdataset' and 'sigrdataset' will be returned in
297135446Strhodes *	the FETCHDONE event.
298135446Strhodes *
299170222Sdougb *\li	'client' and 'id' are used for duplicate query detection.  '*client'
300170222Sdougb *	must remain stable until after 'action' has been called or
301170222Sdougb *	dns_resolver_cancelfetch() is called.
302170222Sdougb *
303135446Strhodes * Requires:
304135446Strhodes *
305170222Sdougb *\li	'res' is a valid resolver that has been frozen.
306135446Strhodes *
307170222Sdougb *\li	'name' is a valid name.
308135446Strhodes *
309170222Sdougb *\li	'type' is not a meta type other than ANY.
310135446Strhodes *
311170222Sdougb *\li	'domain' is a valid name or NULL.
312135446Strhodes *
313170222Sdougb *\li	'nameservers' is a valid NS rdataset (whose owner name is 'domain')
314135446Strhodes *	iff. 'domain' is not NULL.
315135446Strhodes *
316170222Sdougb *\li	'forwarders' is NULL.
317135446Strhodes *
318170222Sdougb *\li	'client' is a valid sockaddr or NULL.
319135446Strhodes *
320170222Sdougb *\li	'options' contains valid options.
321135446Strhodes *
322170222Sdougb *\li	'rdataset' is a valid, disassociated rdataset.
323135446Strhodes *
324170222Sdougb *\li	'sigrdataset' is NULL, or is a valid, disassociated rdataset.
325135446Strhodes *
326170222Sdougb *\li	fetchp != NULL && *fetchp == NULL.
327170222Sdougb *
328135446Strhodes * Returns:
329135446Strhodes *
330170222Sdougb *\li	#ISC_R_SUCCESS					Success
331170222Sdougb *\li	#DNS_R_DUPLICATE
332170222Sdougb *\li	#DNS_R_DROP
333135446Strhodes *
334170222Sdougb *\li	Many other values are possible, all of which indicate failure.
335135446Strhodes */
336135446Strhodes
337135446Strhodesvoid
338135446Strhodesdns_resolver_cancelfetch(dns_fetch_t *fetch);
339170222Sdougb/*%<
340135446Strhodes * Cancel 'fetch'.
341135446Strhodes *
342135446Strhodes * Notes:
343135446Strhodes *
344170222Sdougb *\li	If 'fetch' has not completed, post its FETCHDONE event with a
345170222Sdougb *	result code of #ISC_R_CANCELED.
346135446Strhodes *
347135446Strhodes * Requires:
348135446Strhodes *
349170222Sdougb *\li	'fetch' is a valid fetch.
350135446Strhodes */
351135446Strhodes
352135446Strhodesvoid
353135446Strhodesdns_resolver_destroyfetch(dns_fetch_t **fetchp);
354170222Sdougb/*%<
355135446Strhodes * Destroy 'fetch'.
356135446Strhodes *
357135446Strhodes * Requires:
358135446Strhodes *
359170222Sdougb *\li	'*fetchp' is a valid fetch.
360135446Strhodes *
361170222Sdougb *\li	The caller has received the FETCHDONE event (either because the
362135446Strhodes *	fetch completed or because dns_resolver_cancelfetch() was called).
363135446Strhodes *
364135446Strhodes * Ensures:
365135446Strhodes *
366170222Sdougb *\li	*fetchp == NULL.
367135446Strhodes */
368135446Strhodes
369193149Sdougbvoid
370193149Sdougbdns_resolver_logfetch(dns_fetch_t *fetch, isc_log_t *lctx,
371193149Sdougb		      isc_logcategory_t *category, isc_logmodule_t *module,
372193149Sdougb		      int level, isc_boolean_t duplicateok);
373193149Sdougb/*%<
374193149Sdougb * Dump a log message on internal state at the completion of given 'fetch'.
375193149Sdougb * 'lctx', 'category', 'module', and 'level' are used to write the log message.
376193149Sdougb * By default, only one log message is written even if the corresponding fetch
377193149Sdougb * context serves multiple clients; if 'duplicateok' is true the suppression
378193149Sdougb * is disabled and the message can be written every time this function is
379193149Sdougb * called.
380193149Sdougb *
381193149Sdougb * Requires:
382193149Sdougb *
383193149Sdougb *\li	'fetch' is a valid fetch, and has completed.
384193149Sdougb */
385193149Sdougb
386135446Strhodesdns_dispatchmgr_t *
387135446Strhodesdns_resolver_dispatchmgr(dns_resolver_t *resolver);
388135446Strhodes
389135446Strhodesdns_dispatch_t *
390135446Strhodesdns_resolver_dispatchv4(dns_resolver_t *resolver);
391135446Strhodes
392135446Strhodesdns_dispatch_t *
393135446Strhodesdns_resolver_dispatchv6(dns_resolver_t *resolver);
394135446Strhodes
395135446Strhodesisc_socketmgr_t *
396135446Strhodesdns_resolver_socketmgr(dns_resolver_t *resolver);
397135446Strhodes
398135446Strhodesisc_taskmgr_t *
399135446Strhodesdns_resolver_taskmgr(dns_resolver_t *resolver);
400135446Strhodes
401135446Strhodesisc_uint32_t
402135446Strhodesdns_resolver_getlamettl(dns_resolver_t *resolver);
403170222Sdougb/*%<
404135446Strhodes * Get the resolver's lame-ttl.  zero => no lame processing.
405135446Strhodes *
406135446Strhodes * Requires:
407170222Sdougb *\li	'resolver' to be valid.
408135446Strhodes */
409135446Strhodes
410135446Strhodesvoid
411135446Strhodesdns_resolver_setlamettl(dns_resolver_t *resolver, isc_uint32_t lame_ttl);
412170222Sdougb/*%<
413135446Strhodes * Set the resolver's lame-ttl.  zero => no lame processing.
414135446Strhodes *
415135446Strhodes * Requires:
416170222Sdougb *\li	'resolver' to be valid.
417135446Strhodes */
418135446Strhodes
419135446Strhodesunsigned int
420135446Strhodesdns_resolver_nrunning(dns_resolver_t *resolver);
421170222Sdougb/*%<
422135446Strhodes * Return the number of currently running resolutions in this
423135446Strhodes * resolver.  This is may be less than the number of outstanding
424135446Strhodes * fetches due to multiple identical fetches, or more than the
425135446Strhodes * number of of outstanding fetches due to the fact that resolution
426135446Strhodes * can continue even though a fetch has been canceled.
427135446Strhodes */
428135446Strhodes
429135446Strhodesisc_result_t
430135446Strhodesdns_resolver_addalternate(dns_resolver_t *resolver, isc_sockaddr_t *alt,
431135446Strhodes			  dns_name_t *name, in_port_t port);
432170222Sdougb/*%<
433135446Strhodes * Add alternate addresses to be tried in the event that the nameservers
434135446Strhodes * for a zone are not available in the address families supported by the
435135446Strhodes * operating system.
436135446Strhodes *
437135446Strhodes * Require:
438170222Sdougb * \li	only one of 'name' or 'alt' to be valid.
439135446Strhodes */
440135446Strhodes
441135446Strhodesvoid
442135446Strhodesdns_resolver_setudpsize(dns_resolver_t *resolver, isc_uint16_t udpsize);
443170222Sdougb/*%<
444135446Strhodes * Set the EDNS UDP buffer size advertised by the server.
445135446Strhodes */
446135446Strhodes
447135446Strhodesisc_uint16_t
448135446Strhodesdns_resolver_getudpsize(dns_resolver_t *resolver);
449170222Sdougb/*%<
450135446Strhodes * Get the current EDNS UDP buffer size.
451135446Strhodes */
452135446Strhodes
453135446Strhodesvoid
454135446Strhodesdns_resolver_reset_algorithms(dns_resolver_t *resolver);
455170222Sdougb/*%<
456135446Strhodes * Clear the disabled DNSSEC algorithms.
457135446Strhodes */
458135446Strhodes
459135446Strhodesisc_result_t
460135446Strhodesdns_resolver_disable_algorithm(dns_resolver_t *resolver, dns_name_t *name,
461135446Strhodes			       unsigned int alg);
462170222Sdougb/*%<
463135446Strhodes * Mark the give DNSSEC algorithm as disabled and below 'name'.
464135446Strhodes * Valid algorithms are less than 256.
465135446Strhodes *
466135446Strhodes * Returns:
467170222Sdougb *\li	#ISC_R_SUCCESS
468170222Sdougb *\li	#ISC_R_RANGE
469170222Sdougb *\li	#ISC_R_NOMEMORY
470135446Strhodes */
471135446Strhodes
472135446Strhodesisc_boolean_t
473135446Strhodesdns_resolver_algorithm_supported(dns_resolver_t *resolver, dns_name_t *name,
474135446Strhodes				 unsigned int alg);
475170222Sdougb/*%<
476135446Strhodes * Check if the given algorithm is supported by this resolver.
477135446Strhodes * This checks if the algorithm has been disabled via
478135446Strhodes * dns_resolver_disable_algorithm() then the underlying
479135446Strhodes * crypto libraries if not specifically disabled.
480135446Strhodes */
481135446Strhodes
482170222Sdougbisc_boolean_t
483170222Sdougbdns_resolver_digest_supported(dns_resolver_t *resolver, unsigned int digest_type);
484170222Sdougb/*%<
485170222Sdougb * Is this digest type supported.
486170222Sdougb */
487170222Sdougb
488135446Strhodesvoid
489135446Strhodesdns_resolver_resetmustbesecure(dns_resolver_t *resolver);
490135446Strhodes
491135446Strhodesisc_result_t
492135446Strhodesdns_resolver_setmustbesecure(dns_resolver_t *resolver, dns_name_t *name,
493135446Strhodes			     isc_boolean_t value);
494135446Strhodes
495135446Strhodesisc_boolean_t
496135446Strhodesdns_resolver_getmustbesecure(dns_resolver_t *resolver, dns_name_t *name);
497135446Strhodes
498224092Sdougb
499170222Sdougbvoid
500224092Sdougbdns_resolver_settimeout(dns_resolver_t *resolver, unsigned int seconds);
501224092Sdougb/*%<
502224092Sdougb * Set the length of time the resolver will work on a query, in seconds.
503224092Sdougb *
504224092Sdougb * If timeout is 0, the default timeout will be applied.
505224092Sdougb *
506224092Sdougb * Requires:
507224092Sdougb * \li  resolver to be valid.
508224092Sdougb */
509224092Sdougb
510224092Sdougbunsigned int
511224092Sdougbdns_resolver_gettimeout(dns_resolver_t *resolver);
512224092Sdougb/*%<
513224092Sdougb * Get the current length of time the resolver will work on a query, in seconds.
514224092Sdougb *
515224092Sdougb * Requires:
516224092Sdougb * \li  resolver to be valid.
517224092Sdougb */
518224092Sdougb
519224092Sdougbvoid
520170222Sdougbdns_resolver_setclientsperquery(dns_resolver_t *resolver,
521170222Sdougb				isc_uint32_t min, isc_uint32_t max);
522170222Sdougb
523170222Sdougbvoid
524170222Sdougbdns_resolver_getclientsperquery(dns_resolver_t *resolver, isc_uint32_t *cur,
525170222Sdougb				isc_uint32_t *min, isc_uint32_t *max);
526170222Sdougb
527170222Sdougbisc_boolean_t
528170222Sdougbdns_resolver_getzeronosoattl(dns_resolver_t *resolver);
529193149Sdougb
530170222Sdougbvoid
531170222Sdougbdns_resolver_setzeronosoattl(dns_resolver_t *resolver, isc_boolean_t state);
532170222Sdougb
533193149Sdougbunsigned int
534193149Sdougbdns_resolver_getoptions(dns_resolver_t *resolver);
535193149Sdougb
536205292Sdougbvoid
537205292Sdougbdns_resolver_addbadcache(dns_resolver_t *resolver, dns_name_t *name,
538205292Sdougb			 dns_rdatatype_t type, isc_time_t *expire);
539205292Sdougb/*%<
540205292Sdougb * Add a entry to the bad cache for <name,type> that will expire at 'expire'.
541205292Sdougb *
542205292Sdougb * Requires:
543205292Sdougb * \li	resolver to be valid.
544205292Sdougb * \li	name to be valid.
545205292Sdougb */
546205292Sdougb
547205292Sdougbisc_boolean_t
548205292Sdougbdns_resolver_getbadcache(dns_resolver_t *resolver, dns_name_t *name,
549205292Sdougb			 dns_rdatatype_t type, isc_time_t *now);
550205292Sdougb/*%<
551205292Sdougb * Check to see if there is a unexpired entry in the bad cache for
552205292Sdougb * <name,type>.
553205292Sdougb *
554205292Sdougb * Requires:
555205292Sdougb * \li	resolver to be valid.
556205292Sdougb * \li	name to be valid.
557205292Sdougb */
558205292Sdougb
559205292Sdougbvoid
560205292Sdougbdns_resolver_flushbadcache(dns_resolver_t *resolver, dns_name_t *name);
561205292Sdougb/*%<
562205292Sdougb * Flush the bad cache of all entries at 'name' if 'name' is non NULL.
563205292Sdougb * Flush the entire bad cache if 'name' is NULL.
564205292Sdougb *
565205292Sdougb * Requires:
566205292Sdougb * \li	resolver to be valid.
567205292Sdougb */
568205292Sdougb
569205292Sdougbvoid
570205292Sdougbdns_resolver_printbadcache(dns_resolver_t *resolver, FILE *fp);
571205292Sdougb/*%
572205292Sdougb * Print out the contents of the bad cache to 'fp'.
573205292Sdougb *
574205292Sdougb * Requires:
575205292Sdougb * \li	resolver to be valid.
576205292Sdougb */
577205292Sdougb
578135446StrhodesISC_LANG_ENDDECLS
579135446Strhodes
580135446Strhodes#endif /* DNS_RESOLVER_H */
581