update the readme files for bind-9.3.4 import
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / dns / sec / dst / dst_result.c
1 /*
2  * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
3  * Copyright (C) 1999-2001  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and 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 /*
19  * Principal Author: Brian Wellington
20  * $Id: dst_result.c,v 1.18.2.2 2004/03/09 06:11:40 marka Exp $
21  */
22
23 #include <config.h>
24
25 #include <isc/once.h>
26 #include <isc/util.h>
27
28 #include <dst/result.h>
29 #include <dst/lib.h>
30
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 };
53
54 #define DST_RESULT_RESULTSET                    2
55
56 static isc_once_t               once = ISC_ONCE_INIT;
57
58 static void
59 initialize_action(void) {
60         isc_result_t result;
61
62         result = isc_result_register(ISC_RESULTCLASS_DST, DST_R_NRESULTS,
63                                      text, dst_msgcat, DST_RESULT_RESULTSET);
64         if (result != ISC_R_SUCCESS)
65                 UNEXPECTED_ERROR(__FILE__, __LINE__,
66                                  "isc_result_register() failed: %u", result);
67 }
68
69 static void
70 initialize(void) {
71         dst_lib_initmsgcat();
72         RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
73 }
74
75 const char *
76 dst_result_totext(isc_result_t result) {
77         initialize();
78
79         return (isc_result_totext(result));
80 }
81
82 void
83 dst_result_register(void) {
84         initialize();
85 }