home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / dns / view.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-09-17  |  19.7 KB  |  805 lines

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