OpenDNSSEC-signer
1.3.8
|
00001 /* 00002 * $Id$ 00003 * 00004 * Copyright (c) 2009-2011 NLNet Labs. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 00015 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00016 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00017 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00018 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00019 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00020 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00021 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00023 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00024 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 00025 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 * 00027 */ 00028 00034 #include "config.h" 00035 #include "shared/status.h" 00036 00037 #include <stdlib.h> 00038 00039 ods_lookup_table ods_status_str[] = { 00040 { ODS_STATUS_OK, "All OK" }, 00041 { ODS_STATUS_ASSERT_ERR, "Assertion error"}, 00042 { ODS_STATUS_CFG_ERR, "Configuration error"}, 00043 { ODS_STATUS_CHDIR_ERR, "Change directory failed"}, 00044 { ODS_STATUS_CHROOT_ERR, "Change root failed"}, 00045 { ODS_STATUS_CMDHANDLER_ERR, "Command handler error"}, 00046 { ODS_STATUS_CONFLICT_ERR, "Conflict detected"}, 00047 { ODS_STATUS_ERR, "General error"}, 00048 { ODS_STATUS_FOPEN_ERR, "Unable to open file"}, 00049 { ODS_STATUS_FORK_ERR, "fork() failed"}, 00050 { ODS_STATUS_FREAD_ERR, "Unable to read file"}, 00051 { ODS_STATUS_FWRITE_ERR, "Unable to write file"}, 00052 { ODS_STATUS_HSM_ERR, "HSM error"}, 00053 { ODS_STATUS_INSECURE, "Insecure"}, 00054 { ODS_STATUS_MALLOC_ERR, "Memory allocation error"}, 00055 { ODS_STATUS_PARSE_ERR, "Parse error"}, 00056 { ODS_STATUS_PRIVDROP_ERR, "Unable to drop privileges"}, 00057 { ODS_STATUS_RENAME_ERR, "Unable to rename file"}, 00058 { ODS_STATUS_RNG_ERR, "RelaxNG error"}, 00059 { ODS_STATUS_SETSID_ERR, "setsid() failed"}, 00060 { ODS_STATUS_UNCHANGED, "Status unchanged"}, 00061 { ODS_STATUS_WRITE_PIDFILE_ERR, "Unable to write process id to pidfile"}, 00062 { ODS_STATUS_XML_ERR, "XML error"}, 00063 { 0, NULL } 00064 }; 00065 00066 ods_lookup_table* 00067 ods_lookup_by_id(ods_lookup_table *table, int id) 00068 { 00069 while (table->name != NULL) { 00070 if (table->id == id) { 00071 return table; 00072 } 00073 table++; 00074 } 00075 return NULL; 00076 } 00077 00078 00083 const char * 00084 ods_status2str(ods_status status) 00085 { 00086 ods_lookup_table *lt; 00087 lt = ods_lookup_by_id(ods_status_str, status); 00088 if (lt) { 00089 return lt->name; 00090 } 00091 return NULL; 00092 } 00093