/contrib/bind9/lib/irs/include/irs/context.h

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 159 lines · 29 code · 18 blank · 112 comment · 0 complexity · f458b83ba8950bbfa2a94c83968f3964 MD5 · raw file

  1. /*
  2. * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC")
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  9. * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  10. * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  13. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  14. * PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /* $Id: context.h,v 1.3 2009/09/02 23:48:02 tbox Exp $ */
  17. #ifndef IRS_CONTEXT_H
  18. #define IRS_CONTEXT_H 1
  19. /*! \file
  20. *
  21. * \brief
  22. * The IRS context module provides an abstract interface to the DNS library
  23. * with an application. An IRS context object initializes and holds various
  24. * resources used in the DNS library.
  25. */
  26. #include <dns/types.h>
  27. #include <irs/types.h>
  28. ISC_LANG_BEGINDECLS
  29. isc_result_t
  30. irs_context_create(irs_context_t **contextp);
  31. /*%<
  32. * Create an IRS context. It internally initializes the ISC and DNS libraries
  33. * (if not yet), creates a DNS client object and initializes the client using
  34. * the configuration files parsed via the 'resconf' and 'dnsconf' IRS modules.
  35. * Some of the internally initialized objects can be used by the application
  36. * via irs_context_getxxx() functions (see below).
  37. *
  38. * Requires:
  39. *
  40. *\li contextp != NULL && *contextp == NULL.
  41. */
  42. isc_result_t
  43. irs_context_get(irs_context_t **contextp);
  44. /*%<
  45. * Return an IRS context for the calling thread. If no IRS context is
  46. * associated to the thread, this function creates a new one by calling
  47. * irs_context_create(), and associates it with the thread as a thread specific
  48. * data value. This function is provided for standard libraries that are
  49. * expected to be thread-safe but do not accept an appropriate IRS context
  50. * as a library parameter, e.g., getaddrinfo().
  51. *
  52. * Requires:
  53. *
  54. *\li contextp != NULL && *contextp == NULL.
  55. */
  56. void
  57. irs_context_destroy(irs_context_t **contextp);
  58. /*%<
  59. * Destroy an IRS context.
  60. *
  61. * Requires:
  62. *
  63. *\li '*contextp' is a valid IRS context.
  64. *
  65. * Ensures:
  66. *\li '*contextp' == NULL.
  67. */
  68. isc_mem_t *
  69. irs_context_getmctx(irs_context_t *context);
  70. /*%<
  71. * Return the memory context held in the context.
  72. *
  73. * Requires:
  74. *
  75. *\li 'context' is a valid IRS context.
  76. */
  77. isc_appctx_t *
  78. irs_context_getappctx(irs_context_t *context);
  79. /*%<
  80. * Return the application context held in the context.
  81. *
  82. * Requires:
  83. *
  84. *\li 'context' is a valid IRS context.
  85. */
  86. isc_taskmgr_t *
  87. irs_context_gettaskmgr(irs_context_t *context);
  88. /*%<
  89. * Return the task manager held in the context.
  90. *
  91. * Requires:
  92. *
  93. *\li 'context' is a valid IRS context.
  94. */
  95. isc_timermgr_t *
  96. irs_context_gettimermgr(irs_context_t *context);
  97. /*%<
  98. * Return the timer manager held in the context.
  99. *
  100. * Requires:
  101. *
  102. *\li 'context' is a valid IRS context.
  103. */
  104. isc_task_t *
  105. irs_context_gettask(irs_context_t *context);
  106. /*%<
  107. * Return the task object held in the context.
  108. *
  109. * Requires:
  110. *
  111. *\li 'context' is a valid IRS context.
  112. */
  113. dns_client_t *
  114. irs_context_getdnsclient(irs_context_t *context);
  115. /*%<
  116. * Return the DNS client object held in the context.
  117. *
  118. * Requires:
  119. *
  120. *\li 'context' is a valid IRS context.
  121. */
  122. irs_resconf_t *
  123. irs_context_getresconf(irs_context_t *context);
  124. /*%<
  125. * Return the resolver configuration object held in the context.
  126. *
  127. * Requires:
  128. *
  129. *\li 'context' is a valid IRS context.
  130. */
  131. irs_dnsconf_t *
  132. irs_context_getdnsconf(irs_context_t *context);
  133. /*%<
  134. * Return the advanced DNS configuration object held in the context.
  135. *
  136. * Requires:
  137. *
  138. *\li 'context' is a valid IRS context.
  139. */
  140. ISC_LANG_ENDDECLS
  141. #endif /* IRS_CONTEXT_H */