summaryrefslogtreecommitdiffstats
path: root/include/apreq_error.h
blob: d669b89cdfd3c04843615822ab016abaac6649b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
**  Licensed to the Apache Software Foundation (ASF) under one or more
** contributor license agreements.  See the NOTICE file distributed with
** this work for additional information regarding copyright ownership.
** The ASF licenses this file to You under the Apache License, Version 2.0
** (the "License"); you may not use this file except in compliance with
** the License.  You may obtain a copy of the License at
**
**      http://www.apache.org/licenses/LICENSE-2.0
**
**  Unless required by applicable law or agreed to in writing, software
**  distributed under the License is distributed on an "AS IS" BASIS,
**  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
**  See the License for the specific language governing permissions and
**  limitations under the License.
*/

#ifndef APREQ_ERROR_H
#define APREQ_ERROR_H

#include "apr_errno.h"
#include "apreq.h"

#ifdef  __cplusplus
 extern "C" {
#endif

/**
 * apreq's wrapper around apr_strerror();
 * recognizes APREQ_ERROR_* status codes.
 */
APREQ_DECLARE(char *) apreq_strerror(apr_status_t s,
                                     char *buf,
                                     apr_size_t bufsize);

/**
 * @file apreq_error.h
 * @brief Error status codes.
 * @ingroup libapreq2
 *
 * Define the APREQ_ error codes.
 */

#ifndef APR_EBADARG
/**
 * Bad Arguments return value
 * @see APR_BADARG
 */
#define APR_EBADARG                APR_BADARG   /* XXX: don't use APR_BADARG */
#endif

/** Internal apreq error. */
#define APREQ_ERROR_GENERAL        APR_OS_START_USERERR
/** Attempted to perform unsafe action with tainted data. */
#define APREQ_ERROR_TAINTED        (APREQ_ERROR_GENERAL + 1)
/** Parsing interrupted. */
#define APREQ_ERROR_INTERRUPT      (APREQ_ERROR_GENERAL + 2)

/** Invalid input data. */
#define APREQ_ERROR_BADDATA        (APREQ_ERROR_GENERAL  + 10)
/** Invalid character. */
#define APREQ_ERROR_BADCHAR        (APREQ_ERROR_BADDATA  +  1)
/** Invalid byte sequence. */
#define APREQ_ERROR_BADSEQ         (APREQ_ERROR_BADDATA  +  2)
/** Invalid attribute. */
#define APREQ_ERROR_BADATTR        (APREQ_ERROR_BADDATA  +  3)
/** Invalid header. */
#define APREQ_ERROR_BADHEADER      (APREQ_ERROR_BADDATA  +  4)
/** Invalid utf8 encoding. */
#define APREQ_ERROR_BADUTF8        (APREQ_ERROR_BADDATA  +  5)

/** Missing input data. */
#define APREQ_ERROR_NODATA         (APREQ_ERROR_GENERAL  + 20)
/** Missing required token. */
#define APREQ_ERROR_NOTOKEN        (APREQ_ERROR_NODATA   +  1)
/** Missing attribute. */
#define APREQ_ERROR_NOATTR         (APREQ_ERROR_NODATA   +  2)
/** Missing header. */
#define APREQ_ERROR_NOHEADER       (APREQ_ERROR_NODATA   +  3)
/** Missing parser. */
#define APREQ_ERROR_NOPARSER       (APREQ_ERROR_NODATA   +  4)


/** Conflicting information. */
#define APREQ_ERROR_MISMATCH       (APREQ_ERROR_GENERAL  + 30)
/** Exceeds configured maximum limit. */
#define APREQ_ERROR_OVERLIMIT      (APREQ_ERROR_MISMATCH +  1)
/** Below configured minimum limit. */
#define APREQ_ERROR_UNDERLIMIT     (APREQ_ERROR_MISMATCH +  2)
/** Setting already configured. */
#define APREQ_ERROR_NOTEMPTY       (APREQ_ERROR_MISMATCH +  3)


#ifdef __cplusplus
 }
#endif

#endif /* APREQ_ERROR_H */