summaryrefslogtreecommitdiff
path: root/gnu-taler-error-codes
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-05-14 00:16:04 +0200
committerChristian Grothoff <christian@grothoff.org>2020-05-14 00:16:04 +0200
commite1b5f8e912b3aaca1719c5fd08c2152d9f7d5113 (patch)
treef2fd32f8d33ebbd21107d75547c29946fe21375c /gnu-taler-error-codes
parentd62efd6aaa7a408e04484f26d97b3b74114cc4b6 (diff)
start taler EC registry
Diffstat (limited to 'gnu-taler-error-codes')
-rw-r--r--gnu-taler-error-codes/.gitignore1
-rw-r--r--gnu-taler-error-codes/Makefile25
-rw-r--r--gnu-taler-error-codes/h.footer13
-rw-r--r--gnu-taler-error-codes/h.header37
-rw-r--r--gnu-taler-error-codes/h.template8
-rw-r--r--gnu-taler-error-codes/registry.rec37
6 files changed, 121 insertions, 0 deletions
diff --git a/gnu-taler-error-codes/.gitignore b/gnu-taler-error-codes/.gitignore
new file mode 100644
index 0000000..bbc53e4
--- /dev/null
+++ b/gnu-taler-error-codes/.gitignore
@@ -0,0 +1 @@
+taler-error-codes.h
diff --git a/gnu-taler-error-codes/Makefile b/gnu-taler-error-codes/Makefile
new file mode 100644
index 0000000..b95669f
--- /dev/null
+++ b/gnu-taler-error-codes/Makefile
@@ -0,0 +1,25 @@
+FILES=taler-error-codes.h
+all: check $(FILES)
+check: registry.rec
+ recfix --check registry.rec
+
+distclean:
+ rm -f *.tmp
+
+clean:
+ rm -f $(FILES) *.tmp
+
+prep:
+ cd ../http-status-codes; make ; cd -
+
+combined.tmp: registry.rec prep
+ recsel -t TalerErrorCode -j HttpStatus -p Description,Name,Value,HttpStatus,HttpStatus.Value,HttpStatus.Identifier ../http-status-codes/registry.rec registry.rec > $@
+
+taler-error-codes.h.tmp: combined.tmp h.template
+ ../format.sh h.template < combined.tmp > $@
+
+taler-error-codes.h: h.header taler-error-codes.h.tmp h.footer
+ cat $^ > $@
+
+
+.PHONY: check clean distclean prep
diff --git a/gnu-taler-error-codes/h.footer b/gnu-taler-error-codes/h.footer
new file mode 100644
index 0000000..5d32ee9
--- /dev/null
+++ b/gnu-taler-error-codes/h.footer
@@ -0,0 +1,13 @@
+
+
+};
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gnu-taler-error-codes/h.header b/gnu-taler-error-codes/h.header
new file mode 100644
index 0000000..e560939
--- /dev/null
+++ b/gnu-taler-error-codes/h.header
@@ -0,0 +1,37 @@
+/*
+ This file is part of GNU Taler
+ Copyright (C) 2012-2020 Taler Systems SA
+
+ GNU Taler 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, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNU Taler 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 program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: LGPL3.0-or-later
+
+ Note: the LGPL does not apply to all components of GNU Taler,
+ but it does apply to this file.
+ */
+#ifndef GNU_TALER_ERROR_CODES_H
+#define GNU_TALER_ERROR_CODES_H
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+
+/**
+ * Taler error codes.
+ */
+enum TALER_ErrorCode {
diff --git a/gnu-taler-error-codes/h.template b/gnu-taler-error-codes/h.template
new file mode 100644
index 0000000..30bd44d
--- /dev/null
+++ b/gnu-taler-error-codes/h.template
@@ -0,0 +1,8 @@
+
+
+ /**
+ * {{Description}}.
+ * Returned with an HTTP status code of #MHD_HTTP_{{HttpStatus_Identifier}} ({{HttpStatus_Value}}).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ TALER_EC_{{Name}} = {{Value}},
diff --git a/gnu-taler-error-codes/registry.rec b/gnu-taler-error-codes/registry.rec
new file mode 100644
index 0000000..a3c52db
--- /dev/null
+++ b/gnu-taler-error-codes/registry.rec
@@ -0,0 +1,37 @@
+# -*- mode: rec -*-
+#
+# Registry for HTTP status codes
+#
+%rec: TalerErrorCode
+%key: Value
+%typedef: ValueRange_t range 0 9999
+%constraint: ( Value < 100 ) || ( Value > 999 )
+%type: Value ValueRange_t
+%mandatory: Value
+%typedef: Description_t regexp /^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\(\)\. -]*$/
+%type: Description Description_t
+%mandatory: Description
+%typedef: Name_t regexp /^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/
+%type: Name Name_t
+%unique: Name
+%mandatory: Name
+# A status of 0 means not an HTTP status (i.e. created client-side)
+%typedef: HttpStatus_t range 0 599
+%type: HttpStatus rec HttpStatusCode
+%mandatory: HttpStatus
+%sort: Value
+
+Value: 0
+Name: NONE
+Description: No error (success).
+HttpStatus: 0
+
+Value: 1
+Name: TEST
+Description: Testing
+HttpStatus: 200
+
+Value: 2
+Name: TEST2
+Description: Invalid
+HttpStatus: 199