]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - contrib/bind9/lib/dns/include/dns/view.h
Upgrade to BIND version 9.6-ESV-R7, the latest from ISC.
[FreeBSD/stable/8.git] / contrib / bind9 / lib / dns / include / dns / view.h
1 /*
2  * Copyright (C) 2004-2010, 2012  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2003  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$ */
19
20 #ifndef DNS_VIEW_H
21 #define DNS_VIEW_H 1
22
23 /*****
24  ***** Module Info
25  *****/
26
27 /*! \file dns/view.h
28  * \brief
29  * DNS View
30  *
31  * A "view" is a DNS namespace, together with an optional resolver and a
32  * forwarding policy.  A "DNS namespace" is a (possibly empty) set of
33  * authoritative zones together with an optional cache and optional
34  * "hints" information.
35  *
36  * Views start out "unfrozen".  In this state, core attributes like
37  * the cache, set of zones, and forwarding policy may be set.  While
38  * "unfrozen", the caller (e.g. nameserver configuration loading
39  * code), must ensure exclusive access to the view.  When the view is
40  * "frozen", the core attributes become immutable, and the view module
41  * will ensure synchronization.  Freezing allows the view's core attributes
42  * to be accessed without locking.
43  *
44  * MP:
45  *\li   Before the view is frozen, the caller must ensure synchronization.
46  *
47  *\li   After the view is frozen, the module guarantees appropriate
48  *      synchronization of any data structures it creates and manipulates.
49  *
50  * Reliability:
51  *\li   No anticipated impact.
52  *
53  * Resources:
54  *\li   TBS
55  *
56  * Security:
57  *\li   No anticipated impact.
58  *
59  * Standards:
60  *\li   None.
61  */
62
63 #include <stdio.h>
64
65 #include <isc/lang.h>
66 #include <isc/magic.h>
67 #include <isc/event.h>
68 #include <isc/mutex.h>
69 #include <isc/net.h>
70 #include <isc/refcount.h>
71 #include <isc/rwlock.h>
72 #include <isc/stdtime.h>
73
74 #include <dns/acl.h>
75 #include <dns/fixedname.h>
76 #include <dns/types.h>
77
78 ISC_LANG_BEGINDECLS
79
80 struct dns_view {
81         /* Unlocked. */
82         unsigned int                    magic;
83         isc_mem_t *                     mctx;
84         dns_rdataclass_t                rdclass;
85         char *                          name;
86         dns_zt_t *                      zonetable;
87         dns_dlzdb_t *                   dlzdatabase;
88         dns_resolver_t *                resolver;
89         dns_adb_t *                     adb;
90         dns_requestmgr_t *              requestmgr;
91         dns_acache_t *                  acache;
92         dns_cache_t *                   cache;
93         dns_db_t *                      cachedb;
94         dns_db_t *                      hints;
95         dns_keytable_t *                secroots;
96         dns_keytable_t *                trustedkeys;
97         isc_mutex_t                     lock;
98         isc_boolean_t                   frozen;
99         isc_task_t *                    task;
100         isc_event_t                     resevent;
101         isc_event_t                     adbevent;
102         isc_event_t                     reqevent;
103         isc_stats_t *                   resstats;
104         dns_stats_t *                   resquerystats;
105
106         /* Configurable data. */
107         dns_tsig_keyring_t *            statickeys;
108         dns_tsig_keyring_t *            dynamickeys;
109         dns_peerlist_t *                peers;
110         dns_order_t *                   order;
111         dns_fwdtable_t *                fwdtable;
112         isc_boolean_t                   recursion;
113         isc_boolean_t                   auth_nxdomain;
114         isc_boolean_t                   additionalfromcache;
115         isc_boolean_t                   additionalfromauth;
116         isc_boolean_t                   minimalresponses;
117         isc_boolean_t                   enablednssec;
118         isc_boolean_t                   enablevalidation;
119         isc_boolean_t                   acceptexpired;
120         dns_transfer_format_t           transfer_format;
121         dns_acl_t *                     cacheacl;
122         dns_acl_t *                     cacheonacl;
123         dns_acl_t *                     queryacl;
124         dns_acl_t *                     queryonacl;
125         dns_acl_t *                     recursionacl;
126         dns_acl_t *                     recursiononacl;
127         dns_acl_t *                     sortlist;
128         dns_acl_t *                     notifyacl;
129         dns_acl_t *                     transferacl;
130         dns_acl_t *                     updateacl;
131         dns_acl_t *                     upfwdacl;
132         isc_boolean_t                   requestixfr;
133         isc_boolean_t                   provideixfr;
134         isc_boolean_t                   requestnsid;
135         dns_ttl_t                       maxcachettl;
136         dns_ttl_t                       maxncachettl;
137         in_port_t                       dstport;
138         dns_aclenv_t                    aclenv;
139         dns_rdatatype_t                 preferred_glue;
140         isc_boolean_t                   flush;
141         dns_namelist_t *                delonly;
142         isc_boolean_t                   rootdelonly;
143         dns_namelist_t *                rootexclude;
144         isc_boolean_t                   checknames;
145         dns_name_t *                    dlv;
146         dns_fixedname_t                 dlv_fixed;
147         isc_uint16_t                    maxudp;
148
149         /*
150          * Configurable data for server use only,
151          * locked by server configuration lock.
152          */
153         dns_acl_t *                     matchclients;
154         dns_acl_t *                     matchdestinations;
155         isc_boolean_t                   matchrecursiveonly;
156
157         /* Locked by themselves. */
158         isc_refcount_t                  references;
159
160         /* Locked by lock. */
161         unsigned int                    weakrefs;
162         unsigned int                    attributes;
163         /* Under owner's locking control. */
164         ISC_LINK(struct dns_view)       link;
165 };
166
167 #define DNS_VIEW_MAGIC                  ISC_MAGIC('V','i','e','w')
168 #define DNS_VIEW_VALID(view)            ISC_MAGIC_VALID(view, DNS_VIEW_MAGIC)
169
170 #define DNS_VIEWATTR_RESSHUTDOWN        0x01
171 #define DNS_VIEWATTR_ADBSHUTDOWN        0x02
172 #define DNS_VIEWATTR_REQSHUTDOWN        0x04
173
174 isc_result_t
175 dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
176                 const char *name, dns_view_t **viewp);
177 /*%<
178  * Create a view.
179  *
180  * Notes:
181  *
182  *\li   The newly created view has no cache, no resolver, and an empty
183  *      zone table.  The view is not frozen.
184  *
185  * Requires:
186  *
187  *\li   'mctx' is a valid memory context.
188  *
189  *\li   'rdclass' is a valid class.
190  *
191  *\li   'name' is a valid C string.
192  *
193  *\li   viewp != NULL && *viewp == NULL
194  *
195  * Returns:
196  *
197  *\li   #ISC_R_SUCCESS
198  *\li   #ISC_R_NOMEMORY
199  *
200  *\li   Other errors are possible.
201  */
202
203 void
204 dns_view_attach(dns_view_t *source, dns_view_t **targetp);
205 /*%<
206  * Attach '*targetp' to 'source'.
207  *
208  * Requires:
209  *
210  *\li   'source' is a valid, frozen view.
211  *
212  *\li   'targetp' points to a NULL dns_view_t *.
213  *
214  * Ensures:
215  *
216  *\li   *targetp is attached to source.
217  *
218  *\li   While *targetp is attached, the view will not shut down.
219  */
220
221 void
222 dns_view_detach(dns_view_t **viewp);
223 /*%<
224  * Detach '*viewp' from its view.
225  *
226  * Requires:
227  *
228  *\li   'viewp' points to a valid dns_view_t *
229  *
230  * Ensures:
231  *
232  *\li   *viewp is NULL.
233  */
234
235 void
236 dns_view_flushanddetach(dns_view_t **viewp);
237 /*%<
238  * Detach '*viewp' from its view.  If this was the last reference
239  * uncommitted changed in zones will be flushed to disk.
240  *
241  * Requires:
242  *
243  *\li   'viewp' points to a valid dns_view_t *
244  *
245  * Ensures:
246  *
247  *\li   *viewp is NULL.
248  */
249
250 void
251 dns_view_weakattach(dns_view_t *source, dns_view_t **targetp);
252 /*%<
253  * Weakly attach '*targetp' to 'source'.
254  *
255  * Requires:
256  *
257  *\li   'source' is a valid, frozen view.
258  *
259  *\li   'targetp' points to a NULL dns_view_t *.
260  *
261  * Ensures:
262  *
263  *\li   *targetp is attached to source.
264  *
265  * \li  While *targetp is attached, the view will not be freed.
266  */
267
268 void
269 dns_view_weakdetach(dns_view_t **targetp);
270 /*%<
271  * Detach '*viewp' from its view.
272  *
273  * Requires:
274  *
275  *\li   'viewp' points to a valid dns_view_t *.
276  *
277  * Ensures:
278  *
279  *\li   *viewp is NULL.
280  */
281
282 isc_result_t
283 dns_view_createresolver(dns_view_t *view,
284                         isc_taskmgr_t *taskmgr, unsigned int ntasks,
285                         isc_socketmgr_t *socketmgr,
286                         isc_timermgr_t *timermgr,
287                         unsigned int options,
288                         dns_dispatchmgr_t *dispatchmgr,
289                         dns_dispatch_t *dispatchv4,
290                         dns_dispatch_t *dispatchv6);
291 /*%<
292  * Create a resolver and address database for the view.
293  *
294  * Requires:
295  *
296  *\li   'view' is a valid, unfrozen view.
297  *
298  *\li   'view' does not have a resolver already.
299  *
300  *\li   The requirements of dns_resolver_create() apply to 'taskmgr',
301  *      'ntasks', 'socketmgr', 'timermgr', 'options', 'dispatchv4', and
302  *      'dispatchv6'.
303  *
304  * Returns:
305  *
306  *\li           #ISC_R_SUCCESS
307  *
308  *\li   Any error that dns_resolver_create() can return.
309  */
310
311 void
312 dns_view_setcache(dns_view_t *view, dns_cache_t *cache);
313 /*%<
314  * Set the view's cache database.
315  *
316  * Requires:
317  *
318  *\li   'view' is a valid, unfrozen view.
319  *
320  *\li   'cache' is a valid cache.
321  *
322  * Ensures:
323  *
324  * \li          The cache of 'view' is 'cached.
325  *
326  *\li   If this is not the first call to dns_view_setcache() for this
327  *      view, then previously set cache is detached.
328  */
329
330 void
331 dns_view_sethints(dns_view_t *view, dns_db_t *hints);
332 /*%<
333  * Set the view's hints database.
334  *
335  * Requires:
336  *
337  *\li   'view' is a valid, unfrozen view, whose hints database has not been
338  *      set.
339  *
340  *\li   'hints' is a valid zone database.
341  *
342  * Ensures:
343  *
344  * \li          The hints database of 'view' is 'hints'.
345  */
346
347 void
348 dns_view_setkeyring(dns_view_t *view, dns_tsig_keyring_t *ring);
349 /*%<
350  * Set the view's static TSIG keys
351  *
352  * Requires:
353  *
354  *   \li   'view' is a valid, unfrozen view, whose static TSIG keyring has not
355  *      been set.
356  *
357  *\li      'ring' is a valid TSIG keyring
358  *
359  * Ensures:
360  *
361  *\li      The static TSIG keyring of 'view' is 'ring'.
362  */
363
364 void
365 dns_view_setdstport(dns_view_t *view, in_port_t dstport);
366 /*%<
367  * Set the view's destination port.  This is the port to
368  * which outgoing queries are sent.  The default is 53,
369  * the standard DNS port.
370  *
371  * Requires:
372  *
373  *\li      'view' is a valid view.
374  *
375  *\li      'dstport' is a valid TCP/UDP port number.
376  *
377  * Ensures:
378  *\li   External name servers will be assumed to be listening
379  *      on 'dstport'.  For servers whose address has already
380  *      obtained obtained at the time of the call, the view may
381  *      continue to use the previously set port until the address
382  *      times out from the view's address database.
383  */
384
385
386 isc_result_t
387 dns_view_addzone(dns_view_t *view, dns_zone_t *zone);
388 /*%<
389  * Add zone 'zone' to 'view'.
390  *
391  * Requires:
392  *
393  *\li   'view' is a valid, unfrozen view.
394  *
395  *\li   'zone' is a valid zone.
396  */
397
398 void
399 dns_view_freeze(dns_view_t *view);
400 /*%<
401  * Freeze view.
402  *
403  * Requires:
404  *
405  *\li   'view' is a valid, unfrozen view.
406  *
407  * Ensures:
408  *
409  *\li   'view' is frozen.
410  */
411
412 isc_result_t
413 dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
414               isc_stdtime_t now, unsigned int options, isc_boolean_t use_hints,
415               dns_db_t **dbp, dns_dbnode_t **nodep, dns_name_t *foundname,
416               dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
417 /*%<
418  * Find an rdataset whose owner name is 'name', and whose type is
419  * 'type'.
420  *
421  * Notes:
422  *
423  *\li   See the description of dns_db_find() for information about 'options'.
424  *      If the caller sets #DNS_DBFIND_GLUEOK, it must ensure that 'name'
425  *      and 'type' are appropriate for glue retrieval.
426  *
427  *\li   If 'now' is zero, then the current time will be used.
428  *
429  *\li   If 'use_hints' is ISC_TRUE, and the view has a hints database, then
430  *      it will be searched last.  If the answer is found in the hints
431  *      database, the result code will be DNS_R_HINT.  If the name is found
432  *      in the hints database but not the type, the result code will be
433  *      #DNS_R_HINTNXRRSET.
434  *
435  *\li   'foundname' must meet the requirements of dns_db_find().
436  *
437  *\li   If 'sigrdataset' is not NULL, and there is a SIG rdataset which
438  *      covers 'type', then 'sigrdataset' will be bound to it.
439  *
440  * Requires:
441  *
442  *\li   'view' is a valid, frozen view.
443  *
444  *\li   'name' is valid name.
445  *
446  *\li   'type' is a valid dns_rdatatype_t, and is not a meta query type
447  *      except dns_rdatatype_any.
448  *
449  *\li   dbp == NULL || *dbp == NULL
450  *
451  *\li   nodep == NULL || *nodep == NULL.  If nodep != NULL, dbp != NULL.
452  *
453  *\li   'foundname' is a valid name with a dedicated buffer or NULL.
454  *
455  *\li   'rdataset' is a valid, disassociated rdataset.
456  *
457  *\li   'sigrdataset' is NULL, or is a valid, disassociated rdataset.
458  *
459  * Ensures:
460  *
461  *\li   In successful cases, 'rdataset', and possibly 'sigrdataset', are
462  *      bound to the found data.
463  *
464  *\li   If dbp != NULL, it points to the database containing the data.
465  *
466  *\li   If nodep != NULL, it points to the database node containing the data.
467  *
468  *\li   If foundname != NULL, it contains the full name of the found data.
469  *
470  * Returns:
471  *
472  *\li   Any result that dns_db_find() can return, with the exception of
473  *      #DNS_R_DELEGATION.
474  */
475
476 isc_result_t
477 dns_view_simplefind(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
478                     isc_stdtime_t now, unsigned int options,
479                     isc_boolean_t use_hints,
480                     dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
481 /*%<
482  * Find an rdataset whose owner name is 'name', and whose type is
483  * 'type'.
484  *
485  * Notes:
486  *
487  *\li   This routine is appropriate for simple, exact-match queries of the
488  *      view.  'name' must be a canonical name; there is no DNAME or CNAME
489  *      processing.
490  *
491  *\li   See the description of dns_db_find() for information about 'options'.
492  *      If the caller sets DNS_DBFIND_GLUEOK, it must ensure that 'name'
493  *      and 'type' are appropriate for glue retrieval.
494  *
495  *\li   If 'now' is zero, then the current time will be used.
496  *
497  *\li   If 'use_hints' is ISC_TRUE, and the view has a hints database, then
498  *      it will be searched last.  If the answer is found in the hints
499  *      database, the result code will be DNS_R_HINT.  If the name is found
500  *      in the hints database but not the type, the result code will be
501  *      DNS_R_HINTNXRRSET.
502  *
503  *\li   If 'sigrdataset' is not NULL, and there is a SIG rdataset which
504  *      covers 'type', then 'sigrdataset' will be bound to it.
505  *
506  * Requires:
507  *
508  *\li   'view' is a valid, frozen view.
509  *
510  *\li   'name' is valid name.
511  *
512  *\li   'type' is a valid dns_rdatatype_t, and is not a meta query type
513  *      (e.g. dns_rdatatype_any), or dns_rdatatype_rrsig.
514  *
515  *\li   'rdataset' is a valid, disassociated rdataset.
516  *
517  *\li   'sigrdataset' is NULL, or is a valid, disassociated rdataset.
518  *
519  * Ensures:
520  *
521  *\li   In successful cases, 'rdataset', and possibly 'sigrdataset', are
522  *      bound to the found data.
523  *
524  * Returns:
525  *
526  *\li   #ISC_R_SUCCESS                  Success; result is desired type.
527  *\li   DNS_R_GLUE                      Success; result is glue.
528  *\li   DNS_R_HINT                      Success; result is a hint.
529  *\li   DNS_R_NCACHENXDOMAIN            Success; result is a ncache entry.
530  *\li   DNS_R_NCACHENXRRSET             Success; result is a ncache entry.
531  *\li   DNS_R_NXDOMAIN                  The name does not exist.
532  *\li   DNS_R_NXRRSET                   The rrset does not exist.
533  *\li   #ISC_R_NOTFOUND                 No matching data found,
534  *                                      or an error occurred.
535  */
536
537 /*% See dns_view_findzonecut2() */
538 isc_result_t
539 dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
540                      isc_stdtime_t now, unsigned int options,
541                      isc_boolean_t use_hints,
542                      dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
543
544 isc_result_t
545 dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
546                       isc_stdtime_t now, unsigned int options,
547                       isc_boolean_t use_hints, isc_boolean_t use_cache,
548                       dns_rdataset_t *rdataset, dns_rdataset_t *sigrdataset);
549 /*%<
550  * Find the best known zonecut containing 'name'.
551  *
552  * This uses local authority, cache, and optionally hints data.
553  * No external queries are performed.
554  *
555  * Notes:
556  *
557  *\li   If 'now' is zero, then the current time will be used.
558  *
559  *\li   If 'use_hints' is ISC_TRUE, and the view has a hints database, then
560  *      it will be searched last.
561  *
562  *\li   If 'use_cache' is ISC_TRUE, and the view has a cache, then it will be
563  *      searched.
564  *
565  *\li   If 'sigrdataset' is not NULL, and there is a SIG rdataset which
566  *      covers 'type', then 'sigrdataset' will be bound to it.
567  *
568  *\li   If the DNS_DBFIND_NOEXACT option is set, then the zonecut returned
569  *      (if any) will be the deepest known ancestor of 'name'.
570  *
571  * Requires:
572  *
573  *\li   'view' is a valid, frozen view.
574  *
575  *\li   'name' is valid name.
576  *
577  *\li   'rdataset' is a valid, disassociated rdataset.
578  *
579  *\li   'sigrdataset' is NULL, or is a valid, disassociated rdataset.
580  *
581  * Returns:
582  *
583  *\li   #ISC_R_SUCCESS                          Success.
584  *
585  *\li   Many other results are possible.
586  */
587
588 isc_result_t
589 dns_viewlist_find(dns_viewlist_t *list, const char *name,
590                   dns_rdataclass_t rdclass, dns_view_t **viewp);
591 /*%<
592  * Search for a view with name 'name' and class 'rdclass' in 'list'.
593  * If found, '*viewp' is (strongly) attached to it.
594  *
595  * Requires:
596  *
597  *\li   'viewp' points to a NULL dns_view_t *.
598  *
599  * Returns:
600  *
601  *\li   #ISC_R_SUCCESS          A matching view was found.
602  *\li   #ISC_R_NOTFOUND         No matching view was found.
603  */
604
605 isc_result_t
606 dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allclasses,
607                       dns_rdataclass_t rdclass, dns_zone_t **zonep);
608
609 /*%<
610  * Search zone with 'name' in view with 'rdclass' in viewlist 'list'
611  * If found, zone is returned in *zonep. If allclasses is set rdclass is ignored
612  *
613  * Returns:
614  *\li   #ISC_R_SUCCESS          A matching zone was found.
615  *\li   #ISC_R_NOTFOUND         No matching zone was found.
616  */
617
618 isc_result_t
619 dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep);
620 /*%<
621  * Search for the zone 'name' in the zone table of 'view'.
622  * If found, 'zonep' is (strongly) attached to it.  There
623  * are no partial matches.
624  *
625  * Requires:
626  *
627  *\li   'zonep' points to a NULL dns_zone_t *.
628  *
629  * Returns:
630  *\li   #ISC_R_SUCCESS          A matching zone was found.
631  *\li   #ISC_R_NOTFOUND         No matching zone was found.
632  *\li   others                  An error occurred.
633  */
634
635 isc_result_t
636 dns_view_load(dns_view_t *view, isc_boolean_t stop);
637
638 isc_result_t
639 dns_view_loadnew(dns_view_t *view, isc_boolean_t stop);
640 /*%<
641  * Load zones attached to this view.  dns_view_load() loads
642  * all zones whose master file has changed since the last
643  * load; dns_view_loadnew() loads only zones that have never
644  * been loaded.
645  *
646  * If 'stop' is ISC_TRUE, stop on the first error and return it.
647  * If 'stop' is ISC_FALSE, ignore errors.
648  *
649  * Requires:
650  *
651  *\li   'view' is valid.
652  */
653
654 isc_result_t
655 dns_view_gettsig(dns_view_t *view, dns_name_t *keyname,
656                  dns_tsigkey_t **keyp);
657 /*%<
658  * Find the TSIG key configured in 'view' with name 'keyname',
659  * if any.
660  *
661  * Requires:
662  *\li   keyp points to a NULL dns_tsigkey_t *.
663  *
664  * Returns:
665  *\li   #ISC_R_SUCCESS  A key was found and '*keyp' now points to it.
666  *\li   #ISC_R_NOTFOUND No key was found.
667  *\li   others          An error occurred.
668  */
669
670 isc_result_t
671 dns_view_getpeertsig(dns_view_t *view, isc_netaddr_t *peeraddr,
672                      dns_tsigkey_t **keyp);
673 /*%<
674  * Find the TSIG key configured in 'view' for the server whose
675  * address is 'peeraddr', if any.
676  *
677  * Requires:
678  *      keyp points to a NULL dns_tsigkey_t *.
679  *
680  * Returns:
681  *\li   #ISC_R_SUCCESS  A key was found and '*keyp' now points to it.
682  *\li   #ISC_R_NOTFOUND No key was found.
683  *\li   others          An error occurred.
684  */
685
686 isc_result_t
687 dns_view_checksig(dns_view_t *view, isc_buffer_t *source, dns_message_t *msg);
688 /*%<
689  * Verifies the signature of a message.
690  *
691  * Requires:
692  *
693  *\li   'view' is a valid view.
694  *\li   'source' is a valid buffer containing the message
695  *\li   'msg' is a valid message
696  *
697  * Returns:
698  *\li   see dns_tsig_verify()
699  */
700
701 void
702 dns_view_dialup(dns_view_t *view);
703 /*%<
704  * Perform dialup-time maintenance on the zones of 'view'.
705  */
706
707 isc_result_t
708 dns_view_dumpdbtostream(dns_view_t *view, FILE *fp);
709 /*%<
710  * Dump the current state of the view 'view' to the stream 'fp'
711  * for purposes of analysis or debugging.
712  *
713  * Currently the dumped state includes the view's cache; in the future
714  * it may also include other state such as the address database.
715  * It will not not include authoritative data since it is voluminous and
716  * easily obtainable by other means.
717  *
718  * Requires:
719  *
720  *\li   'view' is valid.
721  *
722  *\li   'fp' refers to a file open for writing.
723  *
724  * Returns:
725  * \li  ISC_R_SUCCESS   The cache was successfully dumped.
726  * \li  others          An error occurred (see dns_master_dump)
727  */
728
729 isc_result_t
730 dns_view_flushcache(dns_view_t *view);
731 /*%<
732  * Flush the view's cache (and ADB).
733  *
734  * Requires:
735  *      'view' is valid.
736  *
737  *      No other tasks are executing.
738  *
739  * Returns:
740  *\li   #ISC_R_SUCCESS
741  *\li   #ISC_R_NOMEMORY
742  */
743
744 isc_result_t
745 dns_view_flushname(dns_view_t *view, dns_name_t *);
746 /*%<
747  * Flush the given name from the view's cache (and ADB).
748  *
749  * Requires:
750  *\li   'view' is valid.
751  *\li   'name' is valid.
752  *
753  * Returns:
754  *\li   #ISC_R_SUCCESS
755  *      other returns are failures.
756  */
757
758 isc_result_t
759 dns_view_adddelegationonly(dns_view_t *view, dns_name_t *name);
760 /*%<
761  * Add the given name to the delegation only table.
762  *
763  *
764  * Requires:
765  *\li   'view' is valid.
766  *\li   'name' is valid.
767  *
768  * Returns:
769  *\li   #ISC_R_SUCCESS
770  *\li   #ISC_R_NOMEMORY
771  */
772
773 isc_result_t
774 dns_view_excludedelegationonly(dns_view_t *view, dns_name_t *name);
775 /*%<
776  * Add the given name to be excluded from the root-delegation-only.
777  *
778  *
779  * Requires:
780  *\li   'view' is valid.
781  *\li   'name' is valid.
782  *
783  * Returns:
784  *\li   #ISC_R_SUCCESS
785  *\li   #ISC_R_NOMEMORY
786  */
787
788 isc_boolean_t
789 dns_view_isdelegationonly(dns_view_t *view, dns_name_t *name);
790 /*%<
791  * Check if 'name' is in the delegation only table or if
792  * rootdelonly is set that name is not being excluded.
793  *
794  * Requires:
795  *\li   'view' is valid.
796  *\li   'name' is valid.
797  *
798  * Returns:
799  *\li   #ISC_TRUE if the name is the table.
800  *\li   #ISC_FALSE otherwise.
801  */
802
803 void
804 dns_view_setrootdelonly(dns_view_t *view, isc_boolean_t value);
805 /*%<
806  * Set the root delegation only flag.
807  *
808  * Requires:
809  *\li   'view' is valid.
810  */
811
812 isc_boolean_t
813 dns_view_getrootdelonly(dns_view_t *view);
814 /*%<
815  * Get the root delegation only flag.
816  *
817  * Requires:
818  *\li   'view' is valid.
819  */
820
821 isc_result_t
822 dns_view_freezezones(dns_view_t *view, isc_boolean_t freeze);
823 /*%<
824  * Freeze/thaw updates to master zones.
825  *
826  * Requires:
827  * \li  'view' is valid.
828  */
829
830 void
831 dns_view_setresstats(dns_view_t *view, isc_stats_t *stats);
832 /*%<
833  * Set a general resolver statistics counter set 'stats' for 'view'.
834  *
835  * Requires:
836  * \li  'view' is valid and is not frozen.
837  *
838  *\li   stats is a valid statistics supporting resolver statistics counters
839  *      (see dns/stats.h).
840  */
841
842 void
843 dns_view_getresstats(dns_view_t *view, isc_stats_t **statsp);
844 /*%<
845  * Get the general statistics counter set for 'view'.  If a statistics set is
846  * set '*statsp' will be attached to the set; otherwise, '*statsp' will be
847  * untouched.
848  *
849  * Requires:
850  * \li  'view' is valid and is not frozen.
851  *
852  *\li   'statsp' != NULL && '*statsp' != NULL
853  */
854
855 void
856 dns_view_setresquerystats(dns_view_t *view, dns_stats_t *stats);
857 /*%<
858  * Set a statistics counter set of rdata type, 'stats', for 'view'.  Once the
859  * statistic set is installed, view's resolver will count outgoing queries
860  * per rdata type.
861  *
862  * Requires:
863  * \li  'view' is valid and is not frozen.
864  *
865  *\li   stats is a valid statistics created by dns_rdatatypestats_create().
866  */
867
868 void
869 dns_view_getresquerystats(dns_view_t *view, dns_stats_t **statsp);
870 /*%<
871  * Get the rdatatype statistics counter set for 'view'.  If a statistics set is
872  * set '*statsp' will be attached to the set; otherwise, '*statsp' will be
873  * untouched.
874  *
875  * Requires:
876  * \li  'view' is valid and is not frozen.
877  *
878  *\li   'statsp' != NULL && '*statsp' != NULL
879  */
880
881 ISC_LANG_ENDDECLS
882
883 #endif /* DNS_VIEW_H */