Willy Tarreau | d740bab | 2007-10-28 11:14:07 +0100 | [diff] [blame] | 1 | /* |
Willy Tarreau | f25fbad | 2010-06-20 10:26:51 +0200 | [diff] [blame] | 2 | * include/common/errors.h |
| 3 | * Global error macros and constants |
| 4 | * |
| 5 | * Copyright (C) 2000-2010 Willy Tarreau - w@1wt.eu |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation, version 2.1 |
| 10 | * exclusively. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
Willy Tarreau | d740bab | 2007-10-28 11:14:07 +0100 | [diff] [blame] | 21 | |
| 22 | #ifndef _COMMON_ERRORS_H |
| 23 | #define _COMMON_ERRORS_H |
| 24 | |
| 25 | /* These flags may be used in various functions which are called from within |
| 26 | * loops (eg: to start all listeners from all proxies). They provide enough |
| 27 | * information to let the caller decide what to do. ERR_WARN and ERR_ALERT |
| 28 | * do not indicate any error, just that a message has been put in a shared |
| 29 | * buffer in order to be displayed by the caller. |
| 30 | */ |
| 31 | #define ERR_NONE 0x00 /* no error, no message returned */ |
| 32 | #define ERR_RETRYABLE 0x01 /* retryable error, may be cumulated */ |
| 33 | #define ERR_FATAL 0x02 /* fatal error, may be cumulated */ |
| 34 | #define ERR_ABORT 0x04 /* it's preferable to end any possible loop */ |
| 35 | #define ERR_WARN 0x08 /* a warning message has been returned */ |
| 36 | #define ERR_ALERT 0x10 /* an alert message has been returned */ |
| 37 | |
Willy Tarreau | 6fb42e0 | 2007-10-28 17:02:33 +0100 | [diff] [blame] | 38 | #define ERR_CODE (ERR_RETRYABLE|ERR_FATAL|ERR_ABORT) /* mask */ |
Willy Tarreau | d740bab | 2007-10-28 11:14:07 +0100 | [diff] [blame] | 39 | |
Willy Tarreau | f25fbad | 2010-06-20 10:26:51 +0200 | [diff] [blame] | 40 | |
| 41 | /* These codes may be used by config parsing functions which detect errors and |
| 42 | * which need to inform the upper layer about them. They are all prefixed with |
| 43 | * "PE_" for "Parse Error". These codes will probably be extended, and functions |
| 44 | * making use of them should be documented as such. Only code PE_NONE (zero) may |
| 45 | * indicate a valid condition, all other ones must be caught as errors, event if |
| 46 | * unknown by the caller. This must not be used to forward warnings. |
| 47 | */ |
| 48 | enum { |
| 49 | PE_NONE = 0, /* no error */ |
| 50 | PE_ENUM_OOR, /* enum data out of allowed range */ |
| 51 | PE_EXIST, /* trying to create something which already exists */ |
| 52 | PE_ARG_MISSING, /* mandatory argument not provided */ |
| 53 | PE_ARG_NOT_USED, /* argument provided cannot be used */ |
| 54 | PE_ARG_INVC, /* invalid char in argument (pointer not provided) */ |
| 55 | PE_ARG_INVC_PTR, /* invalid char in argument (pointer provided) */ |
| 56 | PE_ARG_NOT_FOUND, /* argument references something not found */ |
| 57 | }; |
| 58 | |
Willy Tarreau | d740bab | 2007-10-28 11:14:07 +0100 | [diff] [blame] | 59 | #endif /* _COMMON_ERRORS_H */ |
| 60 | |
| 61 | /* |
| 62 | * Local variables: |
| 63 | * c-indent-level: 8 |
| 64 | * c-basic-offset: 8 |
| 65 | * End: |
| 66 | */ |