]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] move error codes to common/errors.h
authorWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2007 10:14:07 +0000 (11:14 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Oct 2007 10:14:07 +0000 (11:14 +0100)
It's useful to be able to share error codes between C files,
so move the codes currently only used in protocols to a generic
file.

include/common/errors.h [new file with mode: 0644]
include/types/protocols.h
src/haproxy.c
src/proto_uxst.c
src/proxy.c

diff --git a/include/common/errors.h b/include/common/errors.h
new file mode 100644 (file)
index 0000000..4877310
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+  include/common/errors.h
+  Global error macros and constants
+
+  Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
+  
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Lesser General Public
+  License as published by the Free Software Foundation, version 2.1
+  exclusively.
+
+  This library is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  Lesser General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with this library; if not, write to the Free Software
+  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef _COMMON_ERRORS_H
+#define _COMMON_ERRORS_H
+
+/* These flags may be used in various functions which are called from within
+ * loops (eg: to start all listeners from all proxies). They provide enough
+ * information to let the caller decide what to do. ERR_WARN and ERR_ALERT
+ * do not indicate any error, just that a message has been put in a shared
+ * buffer in order to be displayed by the caller.
+ */
+#define ERR_NONE       0x00    /* no error, no message returned */
+#define ERR_RETRYABLE  0x01    /* retryable error, may be cumulated */
+#define ERR_FATAL      0x02    /* fatal error, may be cumulated */
+#define ERR_ABORT      0x04    /* it's preferable to end any possible loop */
+#define ERR_WARN       0x08    /* a warning message has been returned */
+#define ERR_ALERT      0x10    /* an alert message has been returned */
+
+
+#endif /* _COMMON_ERRORS_H */
+
+/*
+ * Local variables:
+ *  c-indent-level: 8
+ *  c-basic-offset: 8
+ * End:
+ */
index 6ff44765169cb3cc1510348e658fabbd4b851ea0..a21f9a4a6ccd8f3757ac595c87ae781bb7d1ce48 100644 (file)
 /* max length of a protcol name, including trailing zero */
 #define PROTO_NAME_LEN 16
 
-/* return codes for bind_all() */
-#define ERR_NONE       0       /* no error */
-#define ERR_RETRYABLE  1       /* retryable error, may be cumulated */
-#define ERR_FATAL      2       /* fatal error, may be cumulated */
-
 /* listener state */
 #define LI_NEW         0       /* not initialized yet */
 #define LI_INIT                1       /* attached to the protocol, but not listening yet */
index 1108ea994c770a906e5321f9bcb6d4a1f0582c88..5152a3c63274badc0dee379d2b8e48ff3f0a3dd2 100644 (file)
@@ -64,6 +64,7 @@
 #include <common/compat.h>
 #include <common/config.h>
 #include <common/defaults.h>
+#include <common/errors.h>
 #include <common/memory.h>
 #include <common/mini-clist.h>
 #include <common/regex.h>
index 24c435ff6281b00dbb59cca296907b3a3301b2bb..307d7ef8e705ee24a03073c9137bfee198938e7c 100644 (file)
@@ -28,6 +28,7 @@
 #include <common/compat.h>
 #include <common/config.h>
 #include <common/debug.h>
+#include <common/errors.h>
 #include <common/memory.h>
 #include <common/mini-clist.h>
 #include <common/standard.h>
index f2967de3118e2f190c993a55c02744ddff13a7fc..435a1e206b036d90dbd8ef384795258ec109b550 100644 (file)
@@ -19,6 +19,7 @@
 #include <common/defaults.h>
 #include <common/compat.h>
 #include <common/config.h>
+#include <common/errors.h>
 #include <common/memory.h>
 #include <common/time.h>