Apache Portable Runtime
Loading...
Searching...
No Matches
apu_errno.h
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef APU_ERRNO_H
18#define APU_ERRNO_H
19
20/**
21 * @file apu_errno.h
22 * @brief APR-Util Error Codes
23 */
24
25#include "apr.h"
26#include "apr_errno.h"
27#include "apr_pools.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
33/**
34 * @defgroup apu_errno Error Codes
35 * @ingroup APR
36 * @{
37 */
38
39/**
40 * @defgroup APR_Util_Error APR_Util Error Values
41 * <PRE>
42 * <b>APU ERROR VALUES</b>
43 * APR_ENOKEY The key provided was empty or NULL
44 * APR_ENOIV The initialisation vector provided was NULL
45 * APR_EKEYTYPE The key type was not recognised
46 * APR_ENOSPACE The buffer supplied was not big enough
47 * APR_ECRYPT An error occurred while encrypting or decrypting
48 * APR_EPADDING Padding was not supported
49 * APR_EKEYLENGTH The key length was incorrect
50 * APR_ENOCIPHER The cipher provided was not recognised
51 * APR_ENODIGEST The digest provided was not recognised
52 * APR_ENOENGINE The engine provided was not recognised
53 * APR_EINITENGINE The engine could not be initialised
54 * APR_EREINIT Underlying crypto has already been initialised
55 * APR_ENOVERIFY The signature verification failed
56 * APR_SERVER_DOWN The server is down
57 * APR_AUTH_UNKNOWN Unknown SASL mechanism
58 * APR_PROXY_AUTH Proxy authorization has failed
59 * APR_INAPPROPRIATE_AUTH Authentication not appropriate for this entry
60 * APR_INVALID_CREDENTIALS Invalid credentials were presented
61 * APR_INSUFFICIENT_ACCESS The user has insufficient access
62 * APR_INSUFFICIENT_RIGHTS The user has insufficient rights
63 * APR_CONSTRAINT_VIOLATION A constraint was violated
64 * APR_FILTER_ERROR The filter was malformed
65 * APR_NO_SUCH_OBJECT The object does not exist
66 * APR_NO_SUCH_ATTRIBUTE The attribute does not exist
67 * APR_COMPARE_TRUE The comparison returned true
68 * APR_COMPARE_FALSE The comparison returned false
69 * APR_NO_RESULTS_RETURNED No results were returned
70 * APR_WANT_READ Call me again when the socket is ready for reading
71 * APR_WANT_WRITE Call me again when the socket is ready for writing
72 * APR_USER_CANCELLED User has cancelled the request
73 * </PRE>
74 *
75 * <PRE>
76 * <b>APR STATUS VALUES</b>
77 * APR_INCHILD Program is currently executing in the child
78 * </PRE>
79 * @{
80 */
81/** @see APR_STATUS_IS_ENOKEY */
82#define APR_ENOKEY (APR_UTIL_START_STATUS + 1)
83/** @see APR_STATUS_IS_ENOIV */
84#define APR_ENOIV (APR_UTIL_START_STATUS + 2)
85/** @see APR_STATUS_IS_EKEYTYPE */
86#define APR_EKEYTYPE (APR_UTIL_START_STATUS + 3)
87/** @see APR_STATUS_IS_ENOSPACE */
88#define APR_ENOSPACE (APR_UTIL_START_STATUS + 4)
89/** @see APR_STATUS_IS_ECRYPT */
90#define APR_ECRYPT (APR_UTIL_START_STATUS + 5)
91/** @see APR_STATUS_IS_EPADDING */
92#define APR_EPADDING (APR_UTIL_START_STATUS + 6)
93/** @see APR_STATUS_IS_EKEYLENGTH */
94#define APR_EKEYLENGTH (APR_UTIL_START_STATUS + 7)
95/** @see APR_STATUS_IS_ENOCIPHER */
96#define APR_ENOCIPHER (APR_UTIL_START_STATUS + 8)
97/** @see APR_STATUS_IS_ENODIGEST */
98#define APR_ENODIGEST (APR_UTIL_START_STATUS + 9)
99/** @see APR_STATUS_IS_ENOENGINE */
100#define APR_ENOENGINE (APR_UTIL_START_STATUS + 10)
101/** @see APR_STATUS_IS_EINITENGINE */
102#define APR_EINITENGINE (APR_UTIL_START_STATUS + 11)
103/** @see APR_STATUS_IS_EREINIT */
104#define APR_EREINIT (APR_UTIL_START_STATUS + 12)
105/** @see APR_STATUS_IS_ENOVERIFY */
106#define APR_ENOVERIFY (APR_UTIL_START_STATUS + 13)
107/** @see APR_STATUS_IS_SERVER_DOWN */
108#define APR_SERVER_DOWN (APR_UTIL_START_STATUS + 101)
109/** @see APR_STATUS_IS_AUTH_UNKNOWN */
110#define APR_AUTH_UNKNOWN (APR_UTIL_START_STATUS + 102)
111/** @see APR_STATUS_IS_PROXY_AUTH */
112#define APR_PROXY_AUTH (APR_UTIL_START_STATUS + 103)
113/** @see APR_STATUS_IS_INAPPROPRIATE_AUTH */
114#define APR_INAPPROPRIATE_AUTH (APR_UTIL_START_STATUS + 104)
115/** @see APR_STATUS_IS_INVALID_CREDENTIALS */
116#define APR_INVALID_CREDENTIALS (APR_UTIL_START_STATUS + 105)
117/** @see APR_STATUS_IS_INSUFFICIENT_ACCESS */
118#define APR_INSUFFICIENT_ACCESS (APR_UTIL_START_STATUS + 106)
119/** @see APR_STATUS_IS_INSUFFICIENT_RIGHTS */
120#define APR_INSUFFICIENT_RIGHTS (APR_UTIL_START_STATUS + 107)
121/** @see APR_STATUS_IS_CONSTRAINT_VIOLATION */
122#define APR_CONSTRAINT_VIOLATION (APR_UTIL_START_STATUS + 108)
123/** @see APR_STATUS_IS_FILTER_ERROR */
124#define APR_FILTER_ERROR (APR_UTIL_START_STATUS + 109)
125/** @see APR_STATUS_IS_NO_SUCH_OBJECT */
126#define APR_NO_SUCH_OBJECT (APR_UTIL_START_STATUS + 110)
127/** @see APR_STATUS_IS_NO_SUCH_ATTRIBUTE */
128#define APR_NO_SUCH_ATTRIBUTE (APR_UTIL_START_STATUS + 111)
129/** @see APR_STATUS_IS_COMPARE_TRUE */
130#define APR_COMPARE_TRUE (APR_UTIL_START_STATUS + 112)
131/** @see APR_STATUS_IS_COMPARE_FALSE */
132#define APR_COMPARE_FALSE (APR_UTIL_START_STATUS + 113)
133/** @see APR_STATUS_IS_NO_RESULTS_RETURNED */
134#define APR_NO_RESULTS_RETURNED (APR_UTIL_START_STATUS + 114)
135/** @see APR_STATUS_IS_WANT_READ */
136#define APR_WANT_READ (APR_UTIL_START_STATUS + 115)
137/** @see APR_STATUS_IS_WANT_WRITE */
138#define APR_WANT_WRITE (APR_UTIL_START_STATUS + 116)
139/** @see APR_STATUS_IS_USER_CANCELLED */
140#define APR_USER_CANCELLED (APR_UTIL_START_STATUS + 117)
141/** @} */
142
143/**
144 * @defgroup APU_STATUS_IS Status Value Tests
145 * @warning For any particular error condition, more than one of these tests
146 * may match. This is because platform-specific error codes may not
147 * always match the semantics of the POSIX codes these tests (and the
148 * corresponding APR error codes) are named after. A notable example
149 * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
150 * Win32 platforms. The programmer should always be aware of this and
151 * adjust the order of the tests accordingly.
152 * @{
153 */
154
155/** @} */
156
157/**
158 * @addtogroup APR_Util_Error
159 * @{
160 */
161/**
162 * The key was empty or not provided
163 */
164#define APR_STATUS_IS_ENOKEY(s) ((s) == APR_ENOKEY)
165/**
166 * The initialisation vector was not provided
167 */
168#define APR_STATUS_IS_ENOIV(s) ((s) == APR_ENOIV)
169/**
170 * The key type was not recognised
171 */
172#define APR_STATUS_IS_EKEYTYPE(s) ((s) == APR_EKEYTYPE)
173/**
174 * The buffer provided was not big enough
175 */
176#define APR_STATUS_IS_ENOSPACE(s) ((s) == APR_ENOSPACE)
177/**
178 * An error occurred while encrypting or decrypting
179 */
180#define APR_STATUS_IS_ECRYPT(s) ((s) == APR_ECRYPT)
181/**
182 * An error occurred while padding
183 */
184#define APR_STATUS_IS_EPADDING(s) ((s) == APR_EPADDING)
185/**
186 * An error occurred with the key length
187 */
188#define APR_STATUS_IS_EKEYLENGTH(s) ((s) == APR_EKEYLENGTH)
189/**
190 * The cipher provided was not recognised
191 */
192#define APR_STATUS_IS_ENOCIPHER(s) ((s) == APR_ENOCIPHER)
193/**
194 * The digest provided was not recognised
195 */
196#define APR_STATUS_IS_ENODIGEST(s) ((s) == APR_ENODIGEST)
197/**
198 * The engine provided was not recognised
199 */
200#define APR_STATUS_IS_ENOENGINE(s) ((s) == APR_ENOENGINE)
201/**
202 * The engine could not be initialised
203 */
204#define APR_STATUS_IS_EINITENGINE(s) ((s) == APR_EINITENGINE)
205/**
206 * Crypto has already been initialised
207 */
208#define APR_STATUS_IS_EREINIT(s) ((s) == APR_EREINIT)
209/**
210 * The signature verification failed
211 */
212#define APR_STATUS_IS_ENOVERIFY(s) ((s) == APR_ENOVERIFY)
213/**
214 * The server is down
215 */
216#define APR_STATUS_IS_SERVER_DOWN(s) ((s) == APR_SERVER_DOWN)
217/**
218 * Authentication mechanism not supoorted by this server
219 */
220#define APR_STATUS_IS_AUTH_UNKNOWN(s) ((s) == APR_AUTH_UNKNOWN)
221/**
222 * Proxy authorization has failed
223 */
224#define APR_STATUS_IS_PROXY_AUTH(s) ((s) == APR_PROXY_AUTH)
225/**
226 * Inappropriate authentication was specified (e.g., simple auth
227 * was specified but the entry does not have a userPassword attribute).
228 */
229#define APR_STATUS_IS_INAPPROPRIATE_AUTH(s) ((s) == APR_INAPPROPRIATE_AUTH)
230/**
231 * Invalid credentials were presented (e.g., the wrong password).
232 */
233#define APR_STATUS_IS_INVALID_CREDENTIALS(s) ((s) == APR_INVALID_CREDENTIALS)
234/**
235 * The user has insufficient access to perform the operation.
236 */
237#define APR_STATUS_IS_INSUFFICIENT_ACCESS(s) ((s) == APR_INSUFFICIENT_ACCESS)
238/**
239 * The user has insufficient rights to perform the operation.
240 */
241#define APR_STATUS_IS_INSUFFICIENT_RIGHTS(s) ((s) == APR_INSUFFICIENT_RIGHTS)
242/**
243 * A constraint was violated.
244 */
245#define APR_STATUS_IS_CONSTRAINT_VIOLATION(s) ((s) == APR_CONSTRAINT_VIOLATION)
246/**
247 * The filter was malformed.
248 */
249#define APR_STATUS_IS_FILTER_ERROR(s) ((s) == APR_FILTER_ERROR)
250/**
251 * No such object.
252 */
253#define APR_STATUS_IS_NO_SUCH_OBJECT(s) ((s) == APR_NO_SUCH_OBJECT)
254/**
255 * No such attribute.
256 */
257#define APR_STATUS_IS_NO_SUCH_ATTRIBUTE(s) ((s) == APR_NO_SUCH_ATTRIBUTE)
258/**
259 * Comparison is true.
260 */
261#define APR_STATUS_IS_COMPARE_TRUE(s) ((s) == APR_COMPARE_TRUE)
262/**
263 * Comparison is false.
264 */
265#define APR_STATUS_IS_COMPARE_FALSE(s) ((s) == APR_COMPARE_FALSE)
266/**
267 * No results were returned.
268 */
269#define APR_STATUS_IS_NO_RESULTS_RETURNED(s) ((s) == APR_NO_RESULTS_RETURNED)
270/**
271 * Call us back when the socket is ready for a read.
272 */
273#define APR_STATUS_IS_WANT_READ(s) ((s) == APR_WANT_READ)
274/**
275 * Call us back when the socket is ready for a write.
276 */
277#define APR_STATUS_IS_WANT_WRITE(s) ((s) == APR_WANT_WRITE)
278/**
279 * User has cancelled the request.
280 */
281#define APR_STATUS_IS_USER_CANCELLED(s) ((s) == APR_USER_CANCELLED)
282/** @} */
283
284/**
285 * This structure allows the underlying API error codes to be returned
286 * along with plain text error messages that explain to us mere mortals
287 * what really happened.
288 */
289typedef struct apu_err_t {
290 /** What was APR trying to do when the error occurred */
291 const char *reason;
292 /** Error message from the underlying system */
293 const char *msg;
294 /** Native return code from the underlying system */
295 int rc;
297
298/**
299 * Populate a apu_err_t structure with the given error, allocated
300 * from the given pool.
301 *
302 * If the result parameter points at a NULL pointer, a apu_err_t
303 * structure will be allocated, otherwise the apu_err_t structure
304 * will be reused.
305 * @param result If NULL, the apu_err_t structure is allocated and
306 * returned, otherwise the existing apu_err_t is used.
307 * @param p The pool to use.
308 * @param reason The reason string, may be NULL.
309 * @param rc The underlying result code.
310 * @param fmt The format of the string
311 * @param ... The arguments to use while printing the data
312 * @return The apu_err_t structure on success, NULL if out of memory.
313 */
315 apr_pool_t *p, const char *reason, int rc, const char *fmt, ...)
316 __attribute__((format(printf,5,6)))
317 __attribute__((nonnull(2)));
318
319/** @} */
320
321#ifdef __cplusplus
322}
323#endif
324
325#endif /* ! APU_ERRNO_H */
APR Platform Definitions.
APR Error Codes.
APR memory allocation.
#define APR_DECLARE_NONSTD(type)
Definition apr.h:529
struct apr_pool_t apr_pool_t
Definition apr_pools.h:60
struct apu_err_t apu_err_t
apu_err_t * apr_errprintf(apu_err_t *result, apr_pool_t *p, const char *reason, int rc, const char *fmt,...)
Definition apu_errno.h:289
const char * msg
Definition apu_errno.h:293
const char * reason
Definition apu_errno.h:291
int rc
Definition apu_errno.h:295