bind - Removed version tag from contrib directory and updated README.DRAGONFLY.
[dragonfly.git] / contrib / bind / lib / dns / dst_result.c
blob797ec3f060728a6ad3773922746ec5a88426a695
1 /*
2 * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC")
3 * Copyright (C) 1999-2001 Internet Software Consortium.
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.
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.
18 /*%
19 * Principal Author: Brian Wellington
20 * $Id: dst_result.c,v 1.5 2007/06/19 23:47:16 tbox Exp $
23 #include <config.h>
25 #include <isc/once.h>
26 #include <isc/util.h>
28 #include <dst/result.h>
29 #include <dst/lib.h>
31 static const char *text[DST_R_NRESULTS] = {
32 "algorithm is unsupported", /*%< 0 */
33 "openssl failure", /*%< 1 */
34 "built with no crypto support", /*%< 2 */
35 "illegal operation for a null key", /*%< 3 */
36 "public key is invalid", /*%< 4 */
37 "private key is invalid", /*%< 5 */
38 "UNUSED6", /*%< 6 */
39 "error occurred writing key to disk", /*%< 7 */
40 "invalid algorithm specific parameter", /*%< 8 */
41 "UNUSED9", /*%< 9 */
42 "UNUSED10", /*%< 10 */
43 "sign failure", /*%< 11 */
44 "UNUSED12", /*%< 12 */
45 "UNUSED13", /*%< 13 */
46 "verify failure", /*%< 14 */
47 "not a public key", /*%< 15 */
48 "not a private key", /*%< 16 */
49 "not a key that can compute a secret", /*%< 17 */
50 "failure computing a shared secret", /*%< 18 */
51 "no randomness available", /*%< 19 */
52 "bad key type" /*%< 20 */
55 #define DST_RESULT_RESULTSET 2
57 static isc_once_t once = ISC_ONCE_INIT;
59 static void
60 initialize_action(void) {
61 isc_result_t result;
63 result = isc_result_register(ISC_RESULTCLASS_DST, DST_R_NRESULTS,
64 text, dst_msgcat, DST_RESULT_RESULTSET);
65 if (result != ISC_R_SUCCESS)
66 UNEXPECTED_ERROR(__FILE__, __LINE__,
67 "isc_result_register() failed: %u", result);
70 static void
71 initialize(void) {
72 dst_lib_initmsgcat();
73 RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
76 const char *
77 dst_result_totext(isc_result_t result) {
78 initialize();
80 return (isc_result_totext(result));
83 void
84 dst_result_register(void) {
85 initialize();
88 /*! \file */