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