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

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 171 lines · 28 code · 16 blank · 127 comment · 0 complexity · 255dd034646957bec70f29166b607406 MD5 · raw file

  1. /*
  2. * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
  3. * Copyright (C) 2000-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. /* $Id: byaddr.h,v 1.22 2007/06/19 23:47:16 tbox Exp $ */
  18. #ifndef DNS_BYADDR_H
  19. #define DNS_BYADDR_H 1
  20. /*****
  21. ***** Module Info
  22. *****/
  23. /*! \file dns/byaddr.h
  24. * \brief
  25. * The byaddr module provides reverse lookup services for IPv4 and IPv6
  26. * addresses.
  27. *
  28. * MP:
  29. *\li The module ensures appropriate synchronization of data structures it
  30. * creates and manipulates.
  31. *
  32. * Reliability:
  33. *\li No anticipated impact.
  34. *
  35. * Resources:
  36. *\li TBS
  37. *
  38. * Security:
  39. *\li No anticipated impact.
  40. *
  41. * Standards:
  42. *\li RFCs: 1034, 1035, 2181, TBS
  43. *\li Drafts: TBS
  44. */
  45. #include <isc/lang.h>
  46. #include <isc/event.h>
  47. #include <dns/types.h>
  48. ISC_LANG_BEGINDECLS
  49. /*%
  50. * A 'dns_byaddrevent_t' is returned when a byaddr completes.
  51. * The sender field will be set to the byaddr that completed. If 'result'
  52. * is ISC_R_SUCCESS, then 'names' will contain a list of names associated
  53. * with the address. The recipient of the event must not change the list
  54. * and must not refer to any of the name data after the event is freed.
  55. */
  56. typedef struct dns_byaddrevent {
  57. ISC_EVENT_COMMON(struct dns_byaddrevent);
  58. isc_result_t result;
  59. dns_namelist_t names;
  60. } dns_byaddrevent_t;
  61. /*
  62. * This option is deprecated since we now only consider nibbles.
  63. #define DNS_BYADDROPT_IPV6NIBBLE 0x0001
  64. */
  65. /*% Note DNS_BYADDROPT_IPV6NIBBLE is now deprecated. */
  66. #define DNS_BYADDROPT_IPV6INT 0x0002
  67. isc_result_t
  68. dns_byaddr_create(isc_mem_t *mctx, isc_netaddr_t *address, dns_view_t *view,
  69. unsigned int options, isc_task_t *task,
  70. isc_taskaction_t action, void *arg, dns_byaddr_t **byaddrp);
  71. /*%<
  72. * Find the domain name of 'address'.
  73. *
  74. * Notes:
  75. *
  76. *\li There is a reverse lookup format for IPv6 addresses, 'nibble'
  77. *
  78. *\li The 'nibble' format for that address is
  79. *
  80. * \code
  81. * 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.e.f.ip6.arpa.
  82. * \endcode
  83. *
  84. *\li #DNS_BYADDROPT_IPV6INT can be used to get nibble lookups under ip6.int.
  85. *
  86. * Requires:
  87. *
  88. *\li 'mctx' is a valid mctx.
  89. *
  90. *\li 'address' is a valid IPv4 or IPv6 address.
  91. *
  92. *\li 'view' is a valid view which has a resolver.
  93. *
  94. *\li 'task' is a valid task.
  95. *
  96. *\li byaddrp != NULL && *byaddrp == NULL
  97. *
  98. * Returns:
  99. *
  100. *\li #ISC_R_SUCCESS
  101. *\li #ISC_R_NOMEMORY
  102. *
  103. *\li Any resolver-related error (e.g. #ISC_R_SHUTTINGDOWN) may also be
  104. * returned.
  105. */
  106. void
  107. dns_byaddr_cancel(dns_byaddr_t *byaddr);
  108. /*%<
  109. * Cancel 'byaddr'.
  110. *
  111. * Notes:
  112. *
  113. *\li If 'byaddr' has not completed, post its #DNS_EVENT_BYADDRDONE
  114. * event with a result code of #ISC_R_CANCELED.
  115. *
  116. * Requires:
  117. *
  118. *\li 'byaddr' is a valid byaddr.
  119. */
  120. void
  121. dns_byaddr_destroy(dns_byaddr_t **byaddrp);
  122. /*%<
  123. * Destroy 'byaddr'.
  124. *
  125. * Requires:
  126. *
  127. *\li '*byaddrp' is a valid byaddr.
  128. *
  129. *\li The caller has received the #DNS_EVENT_BYADDRDONE event (either because
  130. * the byaddr completed or because dns_byaddr_cancel() was called).
  131. *
  132. * Ensures:
  133. *
  134. *\li *byaddrp == NULL.
  135. */
  136. isc_result_t
  137. dns_byaddr_createptrname(isc_netaddr_t *address, isc_boolean_t nibble,
  138. dns_name_t *name);
  139. isc_result_t
  140. dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options,
  141. dns_name_t *name);
  142. /*%<
  143. * Creates a name that would be used in a PTR query for this address. The
  144. * nibble flag indicates that the 'nibble' format is to be used if an IPv6
  145. * address is provided, instead of the 'bitstring' format. Since we dropped
  146. * the support of the bitstring labels, it is expected that the flag is always
  147. * set. 'options' are the same as for dns_byaddr_create().
  148. *
  149. * Requires:
  150. *
  151. * \li 'address' is a valid address.
  152. * \li 'name' is a valid name with a dedicated buffer.
  153. */
  154. ISC_LANG_ENDDECLS
  155. #endif /* DNS_BYADDR_H */