/contrib/bind9/lib/dns/include/dns/dbtable.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 165 lines · 28 code · 19 blank · 118 comment · 0 complexity · c889036d0fafb7836bb8de164147205a MD5 · raw file

  1. /*
  2. * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
  3. * Copyright (C) 1999-2001 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. /* $Id: dbtable.h,v 1.23 2007/06/19 23:47:16 tbox Exp $ */
  18. #ifndef DNS_DBTABLE_H
  19. #define DNS_DBTABLE_H 1
  20. /*****
  21. ***** Module Info
  22. *****/
  23. /*! \file dns/dbtable.h
  24. * \brief
  25. * DNS DB Tables
  26. *
  27. * XXX TBS XXX
  28. *
  29. * MP:
  30. *\li The module ensures appropriate synchronization of data structures it
  31. * creates and manipulates.
  32. *
  33. * Reliability:
  34. *\li No anticipated impact.
  35. *
  36. * Resources:
  37. *\li None.
  38. *
  39. * Security:
  40. *\li No anticipated impact.
  41. *
  42. * Standards:
  43. *\li None.
  44. */
  45. #include <isc/lang.h>
  46. #include <dns/types.h>
  47. #define DNS_DBTABLEFIND_NOEXACT 0x01
  48. ISC_LANG_BEGINDECLS
  49. isc_result_t
  50. dns_dbtable_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
  51. dns_dbtable_t **dbtablep);
  52. /*%<
  53. * Make a new dbtable of class 'rdclass'
  54. *
  55. * Requires:
  56. *\li mctx != NULL
  57. * \li dbtablep != NULL && *dptablep == NULL
  58. *\li 'rdclass' is a valid class
  59. *
  60. * Returns:
  61. *\li #ISC_R_SUCCESS
  62. *\li #ISC_R_NOMEMORY
  63. *\li #ISC_R_UNEXPECTED
  64. */
  65. void
  66. dns_dbtable_attach(dns_dbtable_t *source, dns_dbtable_t **targetp);
  67. /*%<
  68. * Attach '*targetp' to 'source'.
  69. *
  70. * Requires:
  71. *
  72. *\li 'source' is a valid dbtable.
  73. *
  74. *\li 'targetp' points to a NULL dns_dbtable_t *.
  75. *
  76. * Ensures:
  77. *
  78. *\li *targetp is attached to source.
  79. */
  80. void
  81. dns_dbtable_detach(dns_dbtable_t **dbtablep);
  82. /*%<
  83. * Detach *dbtablep from its dbtable.
  84. *
  85. * Requires:
  86. *
  87. *\li '*dbtablep' points to a valid dbtable.
  88. *
  89. * Ensures:
  90. *
  91. *\li *dbtablep is NULL.
  92. *
  93. *\li If '*dbtablep' is the last reference to the dbtable,
  94. * all resources used by the dbtable will be freed
  95. */
  96. isc_result_t
  97. dns_dbtable_add(dns_dbtable_t *dbtable, dns_db_t *db);
  98. /*%<
  99. * Add 'db' to 'dbtable'.
  100. *
  101. * Requires:
  102. *\li 'dbtable' is a valid dbtable.
  103. *
  104. *\li 'db' is a valid database with the same class as 'dbtable'
  105. */
  106. void
  107. dns_dbtable_remove(dns_dbtable_t *dbtable, dns_db_t *db);
  108. /*%<
  109. * Remove 'db' from 'dbtable'.
  110. *
  111. * Requires:
  112. *\li 'db' was previously added to 'dbtable'.
  113. */
  114. void
  115. dns_dbtable_adddefault(dns_dbtable_t *dbtable, dns_db_t *db);
  116. /*%<
  117. * Use 'db' as the result of a dns_dbtable_find() if no better match is
  118. * available.
  119. */
  120. void
  121. dns_dbtable_getdefault(dns_dbtable_t *dbtable, dns_db_t **db);
  122. /*%<
  123. * Get the 'db' used as the result of a dns_dbtable_find()
  124. * if no better match is available.
  125. */
  126. void
  127. dns_dbtable_removedefault(dns_dbtable_t *dbtable);
  128. /*%<
  129. * Remove the default db from 'dbtable'.
  130. */
  131. isc_result_t
  132. dns_dbtable_find(dns_dbtable_t *dbtable, dns_name_t *name,
  133. unsigned int options, dns_db_t **dbp);
  134. /*%<
  135. * Find the deepest match to 'name' in the dbtable, and return it
  136. *
  137. * Notes:
  138. *\li If the DNS_DBTABLEFIND_NOEXACT option is set, the best partial
  139. * match (if any) to 'name' will be returned.
  140. *
  141. * Returns:
  142. * \li #ISC_R_SUCCESS on success
  143. *\li something else: no default and match
  144. */
  145. ISC_LANG_ENDDECLS
  146. #endif /* DNS_DBTABLE_H */