--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lib/errors.h Thu May 28 00:35:02 2009 +0300
@@ -0,0 +1,52 @@
+#ifndef LIBQMSK_ERRORS_H
+#define LIBQMSK_ERRORS_H
+
+/**
+ * @file
+ *
+ * Defines some errors codes for general-purpose use, or for common libraries.
+ */
+#include "error.h"
+
+/**
+ * General-purpose errors that may be useful and don't belong in any more specific namespace.
+ */
+enum general_error_code {
+ ERR_GENERAL_NONE,
+ ERR_MEM, ///< memory allocation error
+ ERR_NOT_IMPLEMENTED, ///< function not implmented: <func>
+ ERR_MISC, ///< miscellaneous error: <error>
+ ERR_CMD_OPT, ///< invalid command line option: <error> - XXX: replace with something getopt
+ ERR_UNKNOWN, ///< unknown error
+};
+
+const struct error_list general_errors;
+
+/**
+ * Convenience macros
+ */
+#define SET_ERROR_MEM(err_state) \
+ SET_ERROR(err_state, &general_errors, ERR_MEM)
+
+/**
+ * Errors for POSIX libc functions
+ */
+enum libc_error_code {
+ ERR_LIBC_NONE,
+ ERR_SIGACTION, ///< sigaction: <perror>
+};
+
+const struct error_list libc_errors;
+
+/**
+ * Errors for libevent
+ */
+enum libevent_error_code {
+ ERR_EVENT_NEW, ///< event_new
+ ERR_EVENT_ADD, ///< event_add
+ ERR_EVENT_DEL, ///< event_del
+};
+
+const struct error_list libevent_errors;
+
+#endif /* LIBQMSK_ERRORS_H */