00001 /* 00002 * Portions Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") 00003 * Portions Copyright (C) 2001, 2003 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 AND NOMINUM DISCLAIMS ALL 00010 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 00011 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY 00012 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00013 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00014 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00015 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00016 * 00017 * Portions Copyright (C) 2001 Nominum, Inc. 00018 * 00019 * Permission to use, copy, modify, and/or distribute this software for any 00020 * purpose with or without fee is hereby granted, provided that the above 00021 * copyright notice and this permission notice appear in all copies. 00022 * 00023 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL 00024 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES 00025 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY 00026 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 00027 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 00028 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 00029 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00030 */ 00031 00032 /* $Id: result.c,v 1.10 2007/08/28 07:20:43 tbox Exp $ */ 00033 00034 /*! \file */ 00035 00036 #include <config.h> 00037 00038 #include <isc/once.h> 00039 #include <isc/util.h> 00040 00041 #include <isccc/result.h> 00042 #include <isccc/lib.h> 00043 00044 static const char *text[ISCCC_R_NRESULTS] = { 00045 "unknown version", /* 1 */ 00046 "syntax error", /* 2 */ 00047 "bad auth", /* 3 */ 00048 "expired", /* 4 */ 00049 "clock skew", /* 5 */ 00050 "duplicate" /* 6 */ 00051 }; 00052 00053 #define ISCCC_RESULT_RESULTSET 2 00054 00055 static isc_once_t once = ISC_ONCE_INIT; 00056 00057 static void 00058 initialize_action(void) { 00059 isc_result_t result; 00060 00061 result = isc_result_register(ISC_RESULTCLASS_ISCCC, ISCCC_R_NRESULTS, 00062 text, isccc_msgcat, 00063 ISCCC_RESULT_RESULTSET); 00064 if (result != ISC_R_SUCCESS) 00065 UNEXPECTED_ERROR(__FILE__, __LINE__, 00066 "isc_result_register() failed: %u", result); 00067 } 00068 00069 static void 00070 initialize(void) { 00071 isccc_lib_initmsgcat(); 00072 RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); 00073 } 00074 00075 const char * 00076 isccc_result_totext(isc_result_t result) { 00077 initialize(); 00078 00079 return (isc_result_totext(result)); 00080 } 00081 00082 void 00083 isccc_result_register(void) { 00084 initialize(); 00085 }