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 * APR_ALREADY_EXISTS The object already exists
74 * APR_OBJECT_CLASS_VIOLATION Add or modify results in an objectclass violation
75 * </PRE>
76 *
77 * <PRE>
78 * <b>APR STATUS VALUES</b>
79 * APR_INCHILD Program is currently executing in the child
80 * </PRE>
81 * @{
82 */
83/** @see APR_STATUS_IS_ENOKEY */
84#define APR_ENOKEY (APR_UTIL_START_STATUS + 1)
85/** @see APR_STATUS_IS_ENOIV */
86#define APR_ENOIV (APR_UTIL_START_STATUS + 2)
87/** @see APR_STATUS_IS_EKEYTYPE */
88#define APR_EKEYTYPE (APR_UTIL_START_STATUS + 3)
89/** @see APR_STATUS_IS_ENOSPACE */
90#define APR_ENOSPACE (APR_UTIL_START_STATUS + 4)
91/** @see APR_STATUS_IS_ECRYPT */
92#define APR_ECRYPT (APR_UTIL_START_STATUS + 5)
93/** @see APR_STATUS_IS_EPADDING */
94#define APR_EPADDING (APR_UTIL_START_STATUS + 6)
95/** @see APR_STATUS_IS_EKEYLENGTH */
96#define APR_EKEYLENGTH (APR_UTIL_START_STATUS + 7)
97/** @see APR_STATUS_IS_ENOCIPHER */
98#define APR_ENOCIPHER (APR_UTIL_START_STATUS + 8)
99/** @see APR_STATUS_IS_ENODIGEST */
100#define APR_ENODIGEST (APR_UTIL_START_STATUS + 9)
101/** @see APR_STATUS_IS_ENOENGINE */
102#define APR_ENOENGINE (APR_UTIL_START_STATUS + 10)
103/** @see APR_STATUS_IS_EINITENGINE */
104#define APR_EINITENGINE (APR_UTIL_START_STATUS + 11)
105/** @see APR_STATUS_IS_EREINIT */
106#define APR_EREINIT (APR_UTIL_START_STATUS + 12)
107/** @see APR_STATUS_IS_ENOVERIFY */
108#define APR_ENOVERIFY (APR_UTIL_START_STATUS + 13)
109
110/** @see APR_STATUS_IS_WANT_READ */
111#define APR_WANT_READ (APR_UTIL_START_STATUS + 98)
112/** @see APR_STATUS_IS_WANT_WRITE */
113#define APR_WANT_WRITE (APR_UTIL_START_STATUS + 99)
114
115/** @see APR_STATUS_IS_OTHER */
116#define APR_OTHER (APR_UTIL_START_STATUS + 100)
117/** @see APR_STATUS_IS_SERVER_DOWN */
118#define APR_SERVER_DOWN (APR_UTIL_START_STATUS + 101)
119/** @see APR_STATUS_IS_LOCAL_ERROR */
120#define APR_LOCAL_ERROR (APR_UTIL_START_STATUS + 102)
121/** @see APR_STATUS_IS_ENCODING_ERROR */
122#define APR_ENCODING_ERROR (APR_UTIL_START_STATUS + 103)
123/** @see APR_STATUS_IS_DECODING_ERROR */
124#define APR_DECODING_ERROR (APR_UTIL_START_STATUS + 104)
125/** @see APR_STATUS_IS_TIMEOUT */
126#define APR_TIMEOUT (APR_ETIMEDOUT)
127/** @see APR_STATUS_IS_AUTH_UNKNOWN */
128#define APR_AUTH_UNKNOWN (APR_UTIL_START_STATUS + 106)
129/** @see APR_STATUS_IS_FILTER_ERROR */
130#define APR_FILTER_ERROR (APR_UTIL_START_STATUS + 107)
131/** @see APR_STATUS_IS_USER_CANCELLED */
132#define APR_USER_CANCELLED (APR_UTIL_START_STATUS + 108)
133/** @see APR_STATUS_IS_PARAM_ERROR */
134#define APR_PARAM_ERROR (APR_UTIL_START_STATUS + 109)
135/** @see APR_STATUS_IS_NO_MEMORY */
136#define APR_NO_MEMORY (APR_ENOMEM)
137/** @see APR_STATUS_IS_CONNECT_ERROR */
138#define APR_CONNECT_ERROR (APR_UTIL_START_STATUS + 111)
139/** @see APR_STATUS_IS_NOT_SUPPORTED */
140#define APR_NOT_SUPPORTED (APR_UTIL_START_STATUS + 112)
141/** @see APR_STATUS_IS_CONTROL_NOT_FOUND */
142#define APR_CONTROL_NOT_FOUND (APR_UTIL_START_STATUS + 113)
143/** @see APR_STATUS_IS_NO_RESULTS_RETURNED */
144#define APR_NO_RESULTS_RETURNED (APR_UTIL_START_STATUS + 114)
145/** @see APR_STATUS_IS_MORE_RESULTS_TO_RETURN */
146#define APR_MORE_RESULTS_TO_RETURN (APR_UTIL_START_STATUS + 115)
147/** @see APR_STATUS_IS_CLIENT_LOOP */
148#define APR_CLIENT_LOOP (APR_UTIL_START_STATUS + 116)
149/** @see APR_STATUS_IS_REFERRAL_LIMIT_EXCEEDED */
150#define APR_REFERRAL_LIMIT_EXCEEDED (APR_UTIL_START_STATUS + 117)
151/** @see APR_STATUS_IS_CONNECTING */
152#define APR_CONNECTING (APR_UTIL_START_STATUS + 118)
153
154/** @see APR_STATUS_IS_OPERATIONS_ERROR */
155#define APR_OPERATIONS_ERROR (APR_UTIL_START_STATUS + 200 + 0x01)
156/** @see APR_STATUS_IS_PROTOCOL_ERROR */
157#define APR_PROTOCOL_ERROR (APR_UTIL_START_STATUS + 200 + 0x02)
158/** @see APR_STATUS_IS_TIMELIMIT_EXCEEDED */
159#define APR_TIMELIMIT_EXCEEDED (APR_UTIL_START_STATUS + 200 + 0x03)
160/** @see APR_STATUS_IS_SIZELIMIT_EXCEEDED */
161#define APR_SIZELIMIT_EXCEEDED (APR_UTIL_START_STATUS + 200 + 0x04)
162/** @see APR_STATUS_IS_COMPARE_FALSE */
163#define APR_COMPARE_FALSE (APR_UTIL_START_STATUS + 200 + 0x05)
164/** @see APR_STATUS_IS_COMPARE_TRUE */
165#define APR_COMPARE_TRUE (APR_UTIL_START_STATUS + 200 + 0x06)
166/** @see APR_STATUS_IS_PROXY_AUTH */
167#define APR_PROXY_AUTH (APR_UTIL_START_STATUS + 200 + 0x2F)
168/** @see APR_STATUS_IS_INAPPROPRIATE_AUTH */
169#define APR_INAPPROPRIATE_AUTH (APR_UTIL_START_STATUS + 200 + 0x30)
170/** @see APR_STATUS_IS_INVALID_CREDENTIALS */
171#define APR_INVALID_CREDENTIALS (APR_UTIL_START_STATUS + 200 + 0x31)
172/** @see APR_STATUS_IS_INSUFFICIENT_ACCESS */
173#define APR_INSUFFICIENT_ACCESS (APR_UTIL_START_STATUS + 200 + 0x32)
174/** @see APR_STATUS_IS_UNAVAILABLE */
175#define APR_UNAVAILABLE (APR_UTIL_START_STATUS + 200 + 0x34)
176/** @see APR_STATUS_IS_CONSTRAINT_VIOLATION */
177#define APR_CONSTRAINT_VIOLATION (APR_UTIL_START_STATUS + 200 + 0x13)
178/** @see APR_STATUS_IS_NO_SUCH_OBJECT */
179#define APR_NO_SUCH_OBJECT (APR_UTIL_START_STATUS + 200 + 0x20)
180/** @see APR_STATUS_IS_NO_SUCH_ATTRIBUTE */
181#define APR_NO_SUCH_ATTRIBUTE (APR_UTIL_START_STATUS + 200 + 0x10)
182/** @see APR_STATUS_IS_ALREADY_EXISTS */
183#define APR_ALREADY_EXISTS (APR_UTIL_START_STATUS + 200 + 0x44)
184/** @see APR_STATUS_IS_OBJECT_CLASS_VIOLATION */
185#define APR_OBJECT_CLASS_VIOLATION (APR_UTIL_START_STATUS + 200 + 0x41)
186
187/** @} */
188
189/**
190 * @defgroup APU_STATUS_IS Status Value Tests
191 * @warning For any particular error condition, more than one of these tests
192 * may match. This is because platform-specific error codes may not
193 * always match the semantics of the POSIX codes these tests (and the
194 * corresponding APR error codes) are named after. A notable example
195 * are the APR_STATUS_IS_ENOENT and APR_STATUS_IS_ENOTDIR tests on
196 * Win32 platforms. The programmer should always be aware of this and
197 * adjust the order of the tests accordingly.
198 * @{
199 */
200
201/** @} */
202
203/**
204 * @addtogroup APR_Util_Error
205 * @{
206 */
207/**
208 * The key was empty or not provided
209 */
210#define APR_STATUS_IS_ENOKEY(s) ((s) == APR_ENOKEY)
211/**
212 * The initialisation vector was not provided
213 */
214#define APR_STATUS_IS_ENOIV(s) ((s) == APR_ENOIV)
215/**
216 * The key type was not recognised
217 */
218#define APR_STATUS_IS_EKEYTYPE(s) ((s) == APR_EKEYTYPE)
219/**
220 * The buffer provided was not big enough
221 */
222#define APR_STATUS_IS_ENOSPACE(s) ((s) == APR_ENOSPACE)
223/**
224 * An error occurred while encrypting or decrypting
225 */
226#define APR_STATUS_IS_ECRYPT(s) ((s) == APR_ECRYPT)
227/**
228 * An error occurred while padding
229 */
230#define APR_STATUS_IS_EPADDING(s) ((s) == APR_EPADDING)
231/**
232 * An error occurred with the key length
233 */
234#define APR_STATUS_IS_EKEYLENGTH(s) ((s) == APR_EKEYLENGTH)
235/**
236 * The cipher provided was not recognised
237 */
238#define APR_STATUS_IS_ENOCIPHER(s) ((s) == APR_ENOCIPHER)
239/**
240 * The digest provided was not recognised
241 */
242#define APR_STATUS_IS_ENODIGEST(s) ((s) == APR_ENODIGEST)
243/**
244 * The engine provided was not recognised
245 */
246#define APR_STATUS_IS_ENOENGINE(s) ((s) == APR_ENOENGINE)
247/**
248 * The engine could not be initialised
249 */
250#define APR_STATUS_IS_EINITENGINE(s) ((s) == APR_EINITENGINE)
251/**
252 * Crypto has already been initialised
253 */
254#define APR_STATUS_IS_EREINIT(s) ((s) == APR_EREINIT)
255/**
256 * The signature verification failed
257 */
258#define APR_STATUS_IS_ENOVERIFY(s) ((s) == APR_ENOVERIFY)
259
260/**
261 * Call us back when the socket is ready for a read.
262 */
263#define APR_STATUS_IS_WANT_READ(s) ((s) == APR_WANT_READ)
264/**
265 * Call us back when the socket is ready for a write.
266 */
267#define APR_STATUS_IS_WANT_WRITE(s) ((s) == APR_WANT_WRITE)
268
269/**
270 * An internal LDAP error has occurred
271 */
272#define APR_STATUS_IS_OTHER(s) ((s) == APR_OTHER)
273/**
274 * The server is down
275 */
276#define APR_STATUS_IS_SERVER_DOWN(s) ((s) == APR_SERVER_DOWN)
277/**
278 * An error has occurred locally
279 */
280#define APR_STATUS_IS_LOCAL_ERROR(s) ((s) == APR_LOCAL_ERROR)
281/**
282 * Encoding has failed
283 */
284#define APR_STATUS_IS_ENCODING_ERROR(s) ((s) == APR_ENCODING_ERROR)
285/**
286 * Decoding has failed
287 */
288#define APR_STATUS_IS_DECODING_ERROR(s) ((s) == APR_DECODING_ERROR)
289/**
290 * Timeout has occurred
291 */
292#define APR_STATUS_IS_TIMEOUT(s) ((s) == APR_TIMEOUT)
293/**
294 * Authentication mechanism not supported by this server
295 */
296#define APR_STATUS_IS_AUTH_UNKNOWN(s) ((s) == APR_AUTH_UNKNOWN)
297/**
298 * The filter was malformed
299 */
300#define APR_STATUS_IS_FILTER_ERROR(s) ((s) == APR_FILTER_ERROR)
301/**
302 * User has cancelled the request
303 */
304#define APR_STATUS_IS_USER_CANCELLED(s) ((s) == APR_USER_CANCELLED)
305/**
306 * Parameter error
307 */
308#define APR_STATUS_IS_PARAM_ERROR(s) ((s) == APR_PARAM_ERROR)
309/**
310 * No memory
311 */
312#define APR_STATUS_IS_NO_MEMORY(s) ((s) == APR_NO_MEMORY)
313/**
314 * Connect error
315 */
316#define APR_STATUS_IS_CONNECT_ERROR(s) ((s) == APR_CONNECT_ERROR)
317/**
318 * Not supported
319 */
320#define APR_STATUS_IS_NOT_SUPPORTED(s) ((s) == APR_NOT_SUPPORTED)
321/**
322 * Control not found
323 */
324#define APR_STATUS_IS_CONTROL_NOT_FOUND(s) ((s) == APR_CONTROL_NOT_FOUND)
325/**
326 * No results returned
327 */
328#define APR_STATUS_IS_NO_RESULTS_RETURNED(s) ((s) == APR_NO_RESULTS_RETURNED)
329/**
330 * More results to be returned
331 */
332#define APR_STATUS_IS_MORE_RESULTS_TO_RETURN(s) ((s) == APR_MORE_RESULTS_TO_RETURN)
333/**
334 * Client loop has occurred
335 */
336#define APR_STATUS_IS_CLIENT_LOOP(s) ((s) == APR_CLIENT_LOOP)
337/**
338 * Referral limit exceeded
339 */
340#define APR_STATUS_IS_REFERRAL_LIMIT_EXCEEDED(s) ((s) == APR_REFERRAL_LIMIT_EXCEEDED)
341/**
342 * Connecting
343 */
344#define APR_STATUS_IS_CONNECTING(s) ((s) == APR_CONNECTING)
345
346/**
347 * An operations error has occurred
348 */
349#define APR_STATUS_IS_OPERATIONS_ERROR(s) ((s) == APR_OPERATIONS_ERROR)
350/**
351 * An protocol error has occurred
352 */
353#define APR_STATUS_IS_PROTOCOL_ERROR(s) ((s) == APR_PROTOCOL_ERROR)
354/**
355 * Time limit has been exceeded
356 */
357#define APR_STATUS_IS_TIMELIMIT_EXCEEDED(s) ((s) == APR_TIMELIMIT_EXCEEDED)
358/**
359 * Size limit has been exceeded
360 */
361#define APR_STATUS_IS_SIZELIMIT_EXCEEDED(s) ((s) == APR_SIZELIMIT_EXCEEDED)
362/**
363 * Proxy authorization has failed
364 */
365#define APR_STATUS_IS_PROXY_AUTH(s) ((s) == APR_PROXY_AUTH)
366/**
367 * Inappropriate authentication was specified (e.g., simple auth
368 * was specified but the entry does not have a userPassword attribute).
369 */
370#define APR_STATUS_IS_INAPPROPRIATE_AUTH(s) ((s) == APR_INAPPROPRIATE_AUTH)
371/**
372 * Invalid credentials were presented (e.g., the wrong password).
373 */
374#define APR_STATUS_IS_INVALID_CREDENTIALS(s) ((s) == APR_INVALID_CREDENTIALS)
375/**
376 * The user has insufficient access to perform the operation.
377 */
378#define APR_STATUS_IS_INSUFFICIENT_ACCESS(s) ((s) == APR_INSUFFICIENT_ACCESS)
379/**
380 * Unavailable.
381 */
382#define APR_STATUS_IS_UNAVAILABLE(s) ((s) == APR_UNAVAILABLE)
383/**
384 * A constraint was violated.
385 */
386#define APR_STATUS_IS_CONSTRAINT_VIOLATION(s) ((s) == APR_CONSTRAINT_VIOLATION)
387/**
388 * No such object.
389 */
390#define APR_STATUS_IS_NO_SUCH_OBJECT(s) ((s) == APR_NO_SUCH_OBJECT)
391/**
392 * No such attribute.
393 */
394#define APR_STATUS_IS_NO_SUCH_ATTRIBUTE(s) ((s) == APR_NO_SUCH_ATTRIBUTE)
395/**
396 * Comparison is true.
397 */
398#define APR_STATUS_IS_COMPARE_TRUE(s) ((s) == APR_COMPARE_TRUE)
399/**
400 * Comparison is false.
401 */
402#define APR_STATUS_IS_COMPARE_FALSE(s) ((s) == APR_COMPARE_FALSE)
403/**
404 * Object already exists.
405 */
406#define APR_STATUS_IS_ALREADY_EXISTS(s) ((s) == APR_ALREADY_EXISTS)
407/**
408 * Object class violation.
409 */
410#define APR_STATUS_IS_OBJECT_CLASS_VIOLATION(s) ((s) == APR_OBJECT_CLASS_VIOLATION)
411/** @} */
412
413/**
414 * This structure allows the underlying API error codes to be returned
415 * along with plain text error messages that explain to us mere mortals
416 * what really happened.
417 */
418typedef struct apu_err_t {
419 /** What was APR trying to do when the error occurred */
420 const char *reason;
421 /** Error message from the underlying system */
422 const char *msg;
423 /** Native return code from the underlying system */
424 int rc;
426
427/**
428 * Populate a apu_err_t structure with the given error, allocated
429 * from the given pool.
430 *
431 * If the result parameter points at a NULL pointer, a apu_err_t
432 * structure will be allocated, otherwise the apu_err_t structure
433 * will be reused.
434 * @param result If NULL, the apu_err_t structure is allocated and
435 * returned, otherwise the existing apu_err_t is used.
436 * @param p The pool to use.
437 * @param reason The reason string, may be NULL.
438 * @param rc The underlying result code.
439 * @param fmt The format of the string
440 * @param ... The arguments to use while printing the data
441 * @return The apu_err_t structure on success, NULL if out of memory.
442 */
444 apr_pool_t *p, const char *reason, int rc, const char *fmt, ...)
445 __attribute__((format(printf,5,6)))
446 __attribute__((nonnull(2)));
447
448/** @} */
449
450#ifdef __cplusplus
451}
452#endif
453
454#endif /* ! APU_ERRNO_H */
APR Platform Definitions.
APR Error Codes.
APR memory allocation.
#define APR_DECLARE_NONSTD(type)
Definition apr.h:536
struct apr_pool_t apr_pool_t
Definition apr_pools.h:60
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:418
const char * msg
Definition apu_errno.h:422
const char * reason
Definition apu_errno.h:420
int rc
Definition apu_errno.h:424