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

https://bitbucket.org/freebsd/freebsd-head/ · C Header · 113 lines · 14 code · 13 blank · 86 comment · 0 complexity · d4659e2c10e75fdafc489c016f94d5af MD5 · raw file

  1. /*
  2. * Copyright (C) 2004-2008 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: rcode.h,v 1.21 2008/09/25 04:02:39 tbox Exp $ */
  18. #ifndef DNS_RCODE_H
  19. #define DNS_RCODE_H 1
  20. /*! \file dns/rcode.h */
  21. #include <isc/lang.h>
  22. #include <dns/types.h>
  23. ISC_LANG_BEGINDECLS
  24. isc_result_t dns_rcode_fromtext(dns_rcode_t *rcodep, isc_textregion_t *source);
  25. /*%<
  26. * Convert the text 'source' refers to into a DNS error value.
  27. *
  28. * Requires:
  29. *\li 'rcodep' is a valid pointer.
  30. *
  31. *\li 'source' is a valid text region.
  32. *
  33. * Returns:
  34. *\li #ISC_R_SUCCESS on success
  35. *\li #DNS_R_UNKNOWN type is unknown
  36. */
  37. isc_result_t dns_rcode_totext(dns_rcode_t rcode, isc_buffer_t *target);
  38. /*%<
  39. * Put a textual representation of error 'rcode' into 'target'.
  40. *
  41. * Requires:
  42. *\li 'rcode' is a valid rcode.
  43. *
  44. *\li 'target' is a valid text buffer.
  45. *
  46. * Ensures:
  47. *\li If the result is success:
  48. * The used space in 'target' is updated.
  49. *
  50. * Returns:
  51. *\li #ISC_R_SUCCESS on success
  52. *\li #ISC_R_NOSPACE target buffer is too small
  53. */
  54. isc_result_t dns_tsigrcode_fromtext(dns_rcode_t *rcodep,
  55. isc_textregion_t *source);
  56. /*%<
  57. * Convert the text 'source' refers to into a TSIG/TKEY error value.
  58. *
  59. * Requires:
  60. *\li 'rcodep' is a valid pointer.
  61. *
  62. *\li 'source' is a valid text region.
  63. *
  64. * Returns:
  65. *\li #ISC_R_SUCCESS on success
  66. *\li #DNS_R_UNKNOWN type is unknown
  67. */
  68. isc_result_t dns_tsigrcode_totext(dns_rcode_t rcode, isc_buffer_t *target);
  69. /*%<
  70. * Put a textual representation of TSIG/TKEY error 'rcode' into 'target'.
  71. *
  72. * Requires:
  73. *\li 'rcode' is a valid TSIG/TKEY error code.
  74. *
  75. *\li 'target' is a valid text buffer.
  76. *
  77. * Ensures:
  78. *\li If the result is success:
  79. * The used space in 'target' is updated.
  80. *
  81. * Returns:
  82. *\li #ISC_R_SUCCESS on success
  83. *\li #ISC_R_NOSPACE target buffer is too small
  84. */
  85. isc_result_t
  86. dns_hashalg_fromtext(unsigned char *hashalg, isc_textregion_t *source);
  87. /*%<
  88. * Convert the text 'source' refers to into a has algorithm value.
  89. *
  90. * Requires:
  91. *\li 'hashalg' is a valid pointer.
  92. *
  93. *\li 'source' is a valid text region.
  94. *
  95. * Returns:
  96. *\li #ISC_R_SUCCESS on success
  97. *\li #DNS_R_UNKNOWN type is unknown
  98. */
  99. ISC_LANG_ENDDECLS
  100. #endif /* DNS_RCODE_H */