summaryrefslogtreecommitdiffstats
path: root/lib/ferr.h
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2018-06-14 01:08:30 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2018-08-14 22:02:05 +0200
commit7b526b616873cf360e690955e2ab36c2d9f04507 (patch)
treea7ccaad148df14e41604537dbdce156ff2b1c844 /lib/ferr.h
parentdoc: Add missing flowspec.rst to distribution tar file (diff)
downloadfrr-7b526b616873cf360e690955e2ab36c2d9f04507.tar.xz
frr-7b526b616873cf360e690955e2ab36c2d9f04507.zip
lib: add error reference system
* Add zlog_* function to log with a reference code * Add ability to track reference cards for errors to ferr.[ch] * Assign some reference code ranges Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/ferr.h')
-rw-r--r--lib/ferr.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/ferr.h b/lib/ferr.h
index 2f100c1b0..5efdc6bd6 100644
--- a/lib/ferr.h
+++ b/lib/ferr.h
@@ -25,6 +25,8 @@
#include <limits.h>
#include <errno.h>
+#include "vty.h"
+
/* return type when this error indication stuff is used.
*
* guaranteed to have boolean evaluation to "false" when OK, "true" when error
@@ -93,6 +95,34 @@ struct ferr {
char pathname[PATH_MAX];
};
+/* Numeric ranges assigned to daemons for use as error codes. */
+#define LIB_FERR_START 0x01000001
+#define LIB_FERR_END 0x01FFFFFF
+#define BGP_FERR_START 0x02000000
+#define BGP_FERR_END 0x02FFFFFF
+#define OSPF_FERR_START 0x03000001
+#define OSPF_FERR_END 0x03FFFFFF
+#define ZEBRA_FERR_START 0x04000001
+#define ZEBRA_FERR_END 0x04FFFFFF
+
+struct ferr_ref {
+ /* Unique error code displayed to end user as a reference. -1 means
+ * this is an uncoded error that does not have reference material. */
+ uint32_t code;
+ /* Ultra brief title */
+ const char *title;
+ /* Brief description of error */
+ const char *description;
+ /* Remedial suggestion */
+ const char *suggestion;
+};
+
+void ferr_ref_add(struct ferr_ref *ref);
+struct ferr_ref *ferr_ref_get(uint32_t code);
+void ferr_ref_display(struct vty *, uint32_t code);
+void ferr_ref_init(void);
+void ferr_ref_fini(void);
+
/* get error details.
*
* NB: errval/ferr_r does NOT carry the full error information. It's only