dst_result.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004, 2005, 2007, 2008, 2012-2014  Internet Systems Consortium, Inc. ("ISC")
00003  * Copyright (C) 1999-2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00010  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00011  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00012  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00013  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00014  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00015  * PERFORMANCE OF THIS SOFTWARE.
00016  */
00017 
00018 /*%
00019  * Principal Author: Brian Wellington
00020  * $Id: dst_result.c,v 1.7 2008/04/01 23:47:10 tbox Exp $
00021  */
00022 
00023 #include <config.h>
00024 
00025 #include <isc/once.h>
00026 #include <isc/util.h>
00027 
00028 #include <dst/result.h>
00029 #include <dst/lib.h>
00030 
00031 static const char *text[DST_R_NRESULTS] = {
00032         "algorithm is unsupported",             /*%< 0 */
00033         "crypto failure",                       /*%< 1 */
00034         "built with no crypto support",         /*%< 2 */
00035         "illegal operation for a null key",     /*%< 3 */
00036         "public key is invalid",                /*%< 4 */
00037         "private key is invalid",               /*%< 5 */
00038         "external key",                         /*%< 6 */
00039         "error occurred writing key to disk",   /*%< 7 */
00040         "invalid algorithm specific parameter", /*%< 8 */
00041         "UNUSED9",                              /*%< 9 */
00042         "UNUSED10",                             /*%< 10 */
00043         "sign failure",                         /*%< 11 */
00044         "UNUSED12",                             /*%< 12 */
00045         "UNUSED13",                             /*%< 13 */
00046         "verify failure",                       /*%< 14 */
00047         "not a public key",                     /*%< 15 */
00048         "not a private key",                    /*%< 16 */
00049         "not a key that can compute a secret",  /*%< 17 */
00050         "failure computing a shared secret",    /*%< 18 */
00051         "no randomness available",              /*%< 19 */
00052         "bad key type",                         /*%< 20 */
00053         "no engine",                            /*%< 21 */
00054         "illegal operation for an external key",/*%< 22 */
00055 };
00056 
00057 #define DST_RESULT_RESULTSET                    2
00058 
00059 static isc_once_t               once = ISC_ONCE_INIT;
00060 
00061 static void
00062 initialize_action(void) {
00063         isc_result_t result;
00064 
00065         result = isc_result_register(ISC_RESULTCLASS_DST, DST_R_NRESULTS,
00066                                      text, dst_msgcat, DST_RESULT_RESULTSET);
00067         if (result != ISC_R_SUCCESS)
00068                 UNEXPECTED_ERROR(__FILE__, __LINE__,
00069                                  "isc_result_register() failed: %u", result);
00070 }
00071 
00072 static void
00073 initialize(void) {
00074         dst_lib_initmsgcat();
00075         RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS);
00076 }
00077 
00078 const char *
00079 dst_result_totext(isc_result_t result) {
00080         initialize();
00081 
00082         return (isc_result_totext(result));
00083 }
00084 
00085 void
00086 dst_result_register(void) {
00087         initialize();
00088 }
00089 
00090 /*! \file */

Generated on Tue Apr 28 17:40:56 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha