OpenDNSSEC-signer  1.4.3
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_EOF, "End of file" },
42  { ODS_STATUS_NOTIMPL, "Not implemented"},
43  { ODS_STATUS_UPTODATE, "Up to date"},
44 
45  { ODS_STATUS_ASSERT_ERR, "Assertion error"},
46  { ODS_STATUS_CFG_ERR, "Configuration error"},
47  { ODS_STATUS_CHDIR_ERR, "Change directory failed"},
48  { ODS_STATUS_CHROOT_ERR, "Change root failed"},
49  { ODS_STATUS_CMDHANDLER_ERR, "Command handler error"},
50  { ODS_STATUS_XFRHANDLER_ERR, "XFR handler error"},
51  { ODS_STATUS_CONFLICT_ERR, "Conflict detected"},
52  { ODS_STATUS_ERR, "General error"},
53  { ODS_STATUS_FOPEN_ERR, "Unable to open file"},
54  { ODS_STATUS_FORK_ERR, "fork() failed"},
55  { ODS_STATUS_FREAD_ERR, "Unable to read file"},
56  { ODS_STATUS_FWRITE_ERR, "Unable to write file"},
57  { ODS_STATUS_HSM_ERR, "HSM error"},
58  { ODS_STATUS_INSECURE, "Insecure"},
59  { ODS_STATUS_MALLOC_ERR, "Memory allocation error"},
60  { ODS_STATUS_RENAME_ERR, "Unable to rename file"},
61  { ODS_STATUS_UNLINK_ERR, "Unable to unlink file"},
62 
63  { ODS_STATUS_SOCK_BIND, "Unable to bind socket"},
64  { ODS_STATUS_SOCK_FCNTL_NONBLOCK, "Unable to set socket to nonblocking"},
65  { ODS_STATUS_SOCK_GETADDRINFO, "Unable to retrieve address information"},
66  { ODS_STATUS_SOCK_LISTEN, "Unable to listen on socket"},
67  { ODS_STATUS_SOCK_SETSOCKOPT_V6ONLY, "Unable to set socket to v6only"},
68  { ODS_STATUS_SOCK_SOCKET_UDP, "Unable to create udp socket"},
69  { ODS_STATUS_SOCK_SOCKET_TCP, "Unable to create tcp socket"},
70 
71  { ODS_STATUS_ACL_SUBNET_BAD_RANGE, "Bad subnet range"},
72  { ODS_STATUS_ACL_SUBNET_OUT_RANGE, "Subnet out of range"},
73 
74  { ODS_STATUS_PARSE_ERR, "Parse error"},
75  { ODS_STATUS_PRIVDROP_ERR, "Unable to drop privileges"},
76  { ODS_STATUS_RNG_ERR, "RelaxNG error"},
77  { ODS_STATUS_SETSID_ERR, "setsid() failed"},
78  { ODS_STATUS_UNCHANGED, "Status unchanged"},
79  { ODS_STATUS_WRITE_PIDFILE_ERR, "Unable to write process id to pidfile"},
80  { ODS_STATUS_XML_ERR, "XML error"},
81 
82  { ODS_STATUS_XFR_NOT_READY, "Incoming zone transfer not ready"},
83  { ODS_STATUS_SKIPDNAME, "Failed to skip domain name"},
84  { ODS_STATUS_BUFAVAIL, "Insufficient space available in buffer"},
85  { ODS_STATUS_PARSESOA, "Failed to parse SOA RR"},
86  { ODS_STATUS_REQAXFR, "Got IXFR, but AXFR required"},
87  { ODS_STATUS_INSERIAL, "Serial mismatch"},
88  { ODS_STATUS_XFRBADFORM, "XFR bad format"},
89  { ODS_STATUS_XFRINCOMPLETE, "XFR on disk incomplete (in progress?)"},
90 
91  { 0, NULL }
92 };
93 
96 {
97  while (table->name != NULL) {
98  if (table->id == id) {
99  return table;
100  }
101  table++;
102  }
103  return NULL;
104 }
105 
106 
111 const char*
113 {
114  ods_lookup_table *lt;
115  lt = ods_lookup_by_id(ods_status_str, status);
116  if (lt) {
117  return lt->name;
118  }
119  return NULL;
120 }
121 
enum ods_enum_status ods_status
Definition: status.h:91
const char * ods_status2str(ods_status status)
Definition: status.c:112
ods_lookup_table * ods_lookup_by_id(ods_lookup_table *table, int id)
Definition: status.c:95
const char * name
Definition: status.h:96
ods_lookup_table ods_status_str[]
Definition: status.c:39