diff options
-rw-r--r-- | gnu-taler-error-codes/.gitignore | 1 | ||||
-rw-r--r-- | gnu-taler-error-codes/Makefile | 25 | ||||
-rw-r--r-- | gnu-taler-error-codes/h.footer | 13 | ||||
-rw-r--r-- | gnu-taler-error-codes/h.header | 37 | ||||
-rw-r--r-- | gnu-taler-error-codes/h.template | 8 | ||||
-rw-r--r-- | gnu-taler-error-codes/registry.rec | 37 | ||||
-rw-r--r-- | http-status-codes/.gitignore | 1 | ||||
-rwxr-xr-x | http-status-codes/extend.sh | 2 | ||||
-rw-r--r-- | http-status-codes/extras.rec | 5 |
9 files changed, 128 insertions, 1 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 @@ | |||
1 | FILES=taler-error-codes.h | ||
2 | all: check $(FILES) | ||
3 | check: registry.rec | ||
4 | recfix --check registry.rec | ||
5 | |||
6 | distclean: | ||
7 | rm -f *.tmp | ||
8 | |||
9 | clean: | ||
10 | rm -f $(FILES) *.tmp | ||
11 | |||
12 | prep: | ||
13 | cd ../http-status-codes; make ; cd - | ||
14 | |||
15 | combined.tmp: registry.rec prep | ||
16 | recsel -t TalerErrorCode -j HttpStatus -p Description,Name,Value,HttpStatus,HttpStatus.Value,HttpStatus.Identifier ../http-status-codes/registry.rec registry.rec > $@ | ||
17 | |||
18 | taler-error-codes.h.tmp: combined.tmp h.template | ||
19 | ../format.sh h.template < combined.tmp > $@ | ||
20 | |||
21 | taler-error-codes.h: h.header taler-error-codes.h.tmp h.footer | ||
22 | cat $^ > $@ | ||
23 | |||
24 | |||
25 | .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 @@ | |||
1 | |||
2 | |||
3 | }; | ||
4 | |||
5 | |||
6 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
7 | { | ||
8 | #endif | ||
9 | #ifdef __cplusplus | ||
10 | } | ||
11 | #endif | ||
12 | |||
13 | #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 @@ | |||
1 | /* | ||
2 | This file is part of GNU Taler | ||
3 | Copyright (C) 2012-2020 Taler Systems SA | ||
4 | |||
5 | GNU Taler is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Lesser General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNU Taler is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: LGPL3.0-or-later | ||
19 | |||
20 | Note: the LGPL does not apply to all components of GNU Taler, | ||
21 | but it does apply to this file. | ||
22 | */ | ||
23 | #ifndef GNU_TALER_ERROR_CODES_H | ||
24 | #define GNU_TALER_ERROR_CODES_H | ||
25 | |||
26 | #ifdef __cplusplus | ||
27 | extern "C" { | ||
28 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
29 | } | ||
30 | #endif | ||
31 | #endif | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Taler error codes. | ||
36 | */ | ||
37 | 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 @@ | |||
1 | |||
2 | |||
3 | /** | ||
4 | * {{Description}}. | ||
5 | * Returned with an HTTP status code of #MHD_HTTP_{{HttpStatus_Identifier}} ({{HttpStatus_Value}}). | ||
6 | * (A value of 0 indicates that the error is generated client-side). | ||
7 | */ | ||
8 | 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 @@ | |||
1 | # -*- mode: rec -*- | ||
2 | # | ||
3 | # Registry for HTTP status codes | ||
4 | # | ||
5 | %rec: TalerErrorCode | ||
6 | %key: Value | ||
7 | %typedef: ValueRange_t range 0 9999 | ||
8 | %constraint: ( Value < 100 ) || ( Value > 999 ) | ||
9 | %type: Value ValueRange_t | ||
10 | %mandatory: Value | ||
11 | %typedef: Description_t regexp /^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_\(\)\. -]*$/ | ||
12 | %type: Description Description_t | ||
13 | %mandatory: Description | ||
14 | %typedef: Name_t regexp /^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$/ | ||
15 | %type: Name Name_t | ||
16 | %unique: Name | ||
17 | %mandatory: Name | ||
18 | # A status of 0 means not an HTTP status (i.e. created client-side) | ||
19 | %typedef: HttpStatus_t range 0 599 | ||
20 | %type: HttpStatus rec HttpStatusCode | ||
21 | %mandatory: HttpStatus | ||
22 | %sort: Value | ||
23 | |||
24 | Value: 0 | ||
25 | Name: NONE | ||
26 | Description: No error (success). | ||
27 | HttpStatus: 0 | ||
28 | |||
29 | Value: 1 | ||
30 | Name: TEST | ||
31 | Description: Testing | ||
32 | HttpStatus: 200 | ||
33 | |||
34 | Value: 2 | ||
35 | Name: TEST2 | ||
36 | Description: Invalid | ||
37 | HttpStatus: 199 | ||
diff --git a/http-status-codes/.gitignore b/http-status-codes/.gitignore new file mode 100644 index 0000000..861cc70 --- /dev/null +++ b/http-status-codes/.gitignore | |||
@@ -0,0 +1 @@ | |||
registry.rec | |||
diff --git a/http-status-codes/extend.sh b/http-status-codes/extend.sh index 679d541..ac09d89 100755 --- a/http-status-codes/extend.sh +++ b/http-status-codes/extend.sh | |||
@@ -8,7 +8,7 @@ cat "$@" > ${TARGET} | |||
8 | 8 | ||
9 | for n in `seq 100 599` | 9 | for n in `seq 100 599` |
10 | do | 10 | do |
11 | VAL=`recsel -e "Value = $n" -P Description iana.rec || true` | 11 | VAL=`recsel -e "Value = $n" -P Description iana.tmp || true` |
12 | CAPS=`echo ${VAL} | tr [a-z] [A-Z] | tr " -" "__"` | 12 | CAPS=`echo ${VAL} | tr [a-z] [A-Z] | tr " -" "__"` |
13 | recset -f Identifier -a "${CAPS}" -e "Value = $n" ${TARGET} | 13 | recset -f Identifier -a "${CAPS}" -e "Value = $n" ${TARGET} |
14 | done | 14 | done |
diff --git a/http-status-codes/extras.rec b/http-status-codes/extras.rec index 6251e4a..e01c387 100644 --- a/http-status-codes/extras.rec +++ b/http-status-codes/extras.rec | |||
@@ -11,3 +11,8 @@ Value: 509 | |||
11 | Description: Bandwidth Limit Exceeded | 11 | Description: Bandwidth Limit Exceeded |
12 | Reference: [Apache extension] | 12 | Reference: [Apache extension] |
13 | Identifier: BANDWIDTH_LIMIT_EXCEEDED | 13 | Identifier: BANDWIDTH_LIMIT_EXCEEDED |
14 | |||
15 | Value: 0 | ||
16 | Description: No status code, used if no HTTP status is available (uninitialized) | ||
17 | Reference: [None] | ||
18 | Identifier: UNINITIALIZED | ||