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 / zt.h < prev   
Encoding:
C/C++ Source or Header  |  2008-09-17  |  4.5 KB  |  184 lines

  1. /*
  2.  * Copyright (C) 2004, 2005  Internet Systems Consortium, Inc. ("ISC")
  3.  * Copyright (C) 1999-2002  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: zt.h,v 1.30.18.3 2005/04/27 05:01:42 sra Exp $ */
  19.  
  20. #ifndef DNS_ZT_H
  21. #define DNS_ZT_H 1
  22.  
  23. /*! \file */
  24.  
  25. #include <isc/lang.h>
  26.  
  27. #include <dns/types.h>
  28.  
  29. #define DNS_ZTFIND_NOEXACT        0x01
  30.  
  31. ISC_LANG_BEGINDECLS
  32.  
  33. isc_result_t
  34. dns_zt_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_zt_t **zt);
  35. /*%<
  36.  * Creates a new zone table.
  37.  *
  38.  * Requires:
  39.  * \li    'mctx' to be initialized.
  40.  *
  41.  * Returns:
  42.  * \li    #ISC_R_SUCCESS on success.
  43.  * \li    #ISC_R_NOMEMORY
  44.  */
  45.  
  46. isc_result_t
  47. dns_zt_mount(dns_zt_t *zt, dns_zone_t *zone);
  48. /*%<
  49.  * Mounts the zone on the zone table.
  50.  *
  51.  * Requires:
  52.  * \li    'zt' to be valid
  53.  * \li    'zone' to be valid
  54.  *
  55.  * Returns:
  56.  * \li    #ISC_R_SUCCESS
  57.  * \li    #ISC_R_EXISTS
  58.  * \li    #ISC_R_NOSPACE
  59.  * \li    #ISC_R_NOMEMORY
  60.  */
  61.  
  62. isc_result_t
  63. dns_zt_unmount(dns_zt_t *zt, dns_zone_t *zone);
  64. /*%<
  65.  * Unmount the given zone from the table.
  66.  *
  67.  * Requires:
  68.  *     'zt' to be valid
  69.  * \li    'zone' to be valid
  70.  *
  71.  * Returns:
  72.  * \li    #ISC_R_SUCCESS
  73.  * \li    #ISC_R_NOTFOUND
  74.  * \li    #ISC_R_NOMEMORY
  75.  */
  76.  
  77. isc_result_t
  78. dns_zt_find(dns_zt_t *zt, dns_name_t *name, unsigned int options,
  79.         dns_name_t *foundname, dns_zone_t **zone);
  80. /*%<
  81.  * Find the best match for 'name' in 'zt'.  If foundname is non NULL
  82.  * then the name of the zone found is returned.
  83.  *
  84.  * Notes:
  85.  * \li    If the DNS_ZTFIND_NOEXACT is set, the best partial match (if any)
  86.  *    to 'name' will be returned.
  87.  *
  88.  * Requires:
  89.  * \li    'zt' to be valid
  90.  * \li    'name' to be valid
  91.  * \li    'foundname' to be initialized and associated with a fixedname or NULL
  92.  * \li    'zone' to be non NULL and '*zone' to be NULL
  93.  *
  94.  * Returns:
  95.  * \li    #ISC_R_SUCCESS
  96.  * \li    #DNS_R_PARTIALMATCH
  97.  * \li    #ISC_R_NOTFOUND
  98.  * \li    #ISC_R_NOSPACE
  99.  */
  100.  
  101. void
  102. dns_zt_detach(dns_zt_t **ztp);
  103. /*%<
  104.  * Detach the given zonetable, if the reference count goes to zero the
  105.  * zonetable will be freed.  In either case 'ztp' is set to NULL.
  106.  *
  107.  * Requires:
  108.  * \li    '*ztp' to be valid
  109.  */
  110.  
  111. void
  112. dns_zt_flushanddetach(dns_zt_t **ztp);
  113. /*%<
  114.  * Detach the given zonetable, if the reference count goes to zero the
  115.  * zonetable will be flushed and then freed.  In either case 'ztp' is
  116.  * set to NULL.
  117.  *
  118.  * Requires:
  119.  * \li    '*ztp' to be valid
  120.  */
  121.  
  122. void
  123. dns_zt_attach(dns_zt_t *zt, dns_zt_t **ztp);
  124. /*%<
  125.  * Attach 'zt' to '*ztp'.
  126.  *
  127.  * Requires:
  128.  * \li    'zt' to be valid
  129.  * \li    '*ztp' to be NULL
  130.  */
  131.  
  132. isc_result_t
  133. dns_zt_load(dns_zt_t *zt, isc_boolean_t stop);
  134.  
  135. isc_result_t
  136. dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop);
  137. /*%<
  138.  * Load all zones in the table.  If 'stop' is ISC_TRUE,
  139.  * stop on the first error and return it.  If 'stop'
  140.  * is ISC_FALSE, ignore errors.
  141.  *
  142.  * dns_zt_loadnew() only loads zones that are not yet loaded.
  143.  * dns_zt_load() also loads zones that are already loaded and
  144.  * and whose master file has changed since the last load.
  145.  *
  146.  * Requires:
  147.  * \li    'zt' to be valid
  148.  */
  149.  
  150. isc_result_t
  151. dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze);
  152. /*%<
  153.  * Freeze/thaw updates to master zones.
  154.  * Any pending updates will be flushed.
  155.  * Zones will be reloaded on thaw.
  156.  */
  157.  
  158. isc_result_t
  159. dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop,
  160.          isc_result_t (*action)(dns_zone_t *, void *), void *uap);
  161.  
  162. isc_result_t
  163. dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
  164.           isc_result_t (*action)(dns_zone_t *, void *), void *uap);
  165. /*%<
  166.  * Apply a given 'action' to all zone zones in the table.
  167.  * If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if
  168.  * 'action' does not return ISC_R_SUCCESS.
  169.  *
  170.  * Requires:
  171.  * \li    'zt' to be valid.
  172.  * \li    'action' to be non NULL.
  173.  *
  174.  * Returns:
  175.  * \li    ISC_R_SUCCESS if action was applied to all nodes.  If 'stop' is
  176.  *    ISC_FALSE and 'sub' is non NULL then the first error (if any)
  177.  *    reported by 'action' is returned in '*sub';
  178.  *    any error code from 'action'.
  179.  */
  180.  
  181. ISC_LANG_ENDDECLS
  182.  
  183. #endif /* DNS_ZT_H */
  184.