OpenDNSSEC-signer  1.3.16
status.c
Go to the documentation of this file.
1 /*
2  * $Id$
3  *
4  * Copyright (c) 2009-2011 NLNet Labs. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
21  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
25  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
34 #include "config.h"
35 #include "shared/status.h"
36 
37 #include <stdlib.h>
38 
40  { ODS_STATUS_OK, "All OK" },
41  { ODS_STATUS_ASSERT_ERR, "Assertion error"},
42  { ODS_STATUS_CFG_ERR, "Configuration error"},
43  { ODS_STATUS_CHDIR_ERR, "Change directory failed"},
44  { ODS_STATUS_CHROOT_ERR, "Change root failed"},
45  { ODS_STATUS_CMDHANDLER_ERR, "Command handler error"},
46  { ODS_STATUS_CONFLICT_ERR, "Conflict detected"},
47  { ODS_STATUS_ERR, "General error"},
48  { ODS_STATUS_FOPEN_ERR, "Unable to open file"},
49  { ODS_STATUS_FORK_ERR, "fork() failed"},
50  { ODS_STATUS_FREAD_ERR, "Unable to read file"},
51  { ODS_STATUS_FWRITE_ERR, "Unable to write file"},
52  { ODS_STATUS_HSM_ERR, "HSM error"},
53  { ODS_STATUS_INSECURE, "Insecure"},
54  { ODS_STATUS_MALLOC_ERR, "Memory allocation error"},
55  { ODS_STATUS_PARSE_ERR, "Parse error"},
56  { ODS_STATUS_PRIVDROP_ERR, "Unable to drop privileges"},
57  { ODS_STATUS_RENAME_ERR, "Unable to rename file"},
58  { ODS_STATUS_RNG_ERR, "RelaxNG error"},
59  { ODS_STATUS_SETSID_ERR, "setsid() failed"},
60  { ODS_STATUS_UNCHANGED, "Status unchanged"},
61  { ODS_STATUS_WRITE_PIDFILE_ERR, "Unable to write process id to pidfile"},
62  { ODS_STATUS_XML_ERR, "XML error"},
63  { 0, NULL }
64 };
65 
68 {
69  while (table->name != NULL) {
70  if (table->id == id) {
71  return table;
72  }
73  table++;
74  }
75  return NULL;
76 }
77 
78 
83 const char *
85 {
86  ods_lookup_table *lt;
87  lt = ods_lookup_by_id(ods_status_str, status);
88  if (lt) {
89  return lt->name;
90  }
91  return NULL;
92 }
93 
enum ods_enum_status ods_status
Definition: status.h:64
const char * ods_status2str(ods_status status)
Definition: status.c:84
ods_lookup_table * ods_lookup_by_id(ods_lookup_table *table, int id)
Definition: status.c:67
const char * name
Definition: status.h:69
ods_lookup_table ods_status_str[]
Definition: status.c:39