/contrib/bind9/lib/dns/dst_result.c

https://bitbucket.org/freebsd/freebsd-head/ · C · 89 lines · 54 code · 14 blank · 21 comment · 3 complexity · 2327411389d41f851296704494515e19 MD5 · raw file

  1. /*
  2. * Copyright (C) 2004, 2005, 2007, 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. /*%
  18. * Principal Author: Brian Wellington
  19. * $Id: dst_result.c,v 1.7 2008/04/01 23:47:10 tbox Exp $
  20. */
  21. #include <config.h>
  22. #include <isc/once.h>
  23. #include <isc/util.h>
  24. #include <dst/result.h>
  25. #include <dst/lib.h>
  26. static const char *text[DST_R_NRESULTS] = {
  27. "algorithm is unsupported", /*%< 0 */
  28. "openssl failure", /*%< 1 */
  29. "built with no crypto support", /*%< 2 */
  30. "illegal operation for a null key", /*%< 3 */
  31. "public key is invalid", /*%< 4 */
  32. "private key is invalid", /*%< 5 */
  33. "UNUSED6", /*%< 6 */
  34. "error occurred writing key to disk", /*%< 7 */
  35. "invalid algorithm specific parameter", /*%< 8 */
  36. "UNUSED9", /*%< 9 */
  37. "UNUSED10", /*%< 10 */
  38. "sign failure", /*%< 11 */
  39. "UNUSED12", /*%< 12 */
  40. "UNUSED13", /*%< 13 */
  41. "verify failure", /*%< 14 */
  42. "not a public key", /*%< 15 */
  43. "not a private key", /*%< 16 */
  44. "not a key that can compute a secret", /*%< 17 */
  45. "failure computing a shared secret", /*%< 18 */
  46. "no randomness available", /*%< 19 */
  47. "bad key type", /*%< 20 */
  48. "no engine" /*%< 21 */
  49. };
  50. #define DST_RESULT_RESULTSET 2
  51. static isc_once_t once = ISC_ONCE_INIT;
  52. static void
  53. initialize_action(void) {
  54. isc_result_t result;
  55. result = isc_result_register(ISC_RESULTCLASS_DST, DST_R_NRESULTS,
  56. text, dst_msgcat, DST_RESULT_RESULTSET);
  57. if (result != ISC_R_SUCCESS)
  58. UNEXPECTED_ERROR(__FILE__, __LINE__,
  59. "isc_result_register() failed: %u", result);
  60. }
  61. static void
  62. initialize(void) {
  63. dst_lib_initmsgcat();
  64. RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
  65. }
  66. const char *
  67. dst_result_totext(isc_result_t result) {
  68. initialize();
  69. return (isc_result_totext(result));
  70. }
  71. void
  72. dst_result_register(void) {
  73. initialize();
  74. }
  75. /*! \file */