commit 092edfe57896d5f0fdf11008a4cba561203dfadd
parent d83d2584fd4698719b8eb78a4e0e9c8dad698aca
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Thu, 10 Nov 2022 13:46:18 +0900
Add record flags registry
Diffstat:
12 files changed, 174 insertions(+), 1 deletion(-)
diff --git a/gnu-name-system-record-flags/.gitignore b/gnu-name-system-record-flags/.gitignore
@@ -0,0 +1 @@
+gnu-name-system-record-types.h
diff --git a/gnu-name-system-record-flags/Makefile b/gnu-name-system-record-flags/Makefile
@@ -0,0 +1,25 @@
+FILES=gnu_name_system_record_flags.h gnu_name_system_record_flags.rst
+all: check $(FILES)
+
+check:
+ recfix --check registry.rec
+
+distclean:
+ rm -f *.tmp
+clean:
+ rm -f $(FILES) *.tmp
+
+gnu_name_system_record_flags.h.tmp: registry.rec h.template
+ ../format.sh h.template < registry.rec > $@
+
+gnu_name_system_record_flags.h: h.header gnu_name_system_record_flags.h.tmp h.footer
+ cat h.header gnu_name_system_record_flags.h.tmp h.footer > $@
+
+gnu_name_system_record_flags.rst.tmp: registry.rec rst.template
+ ../format.sh rst.template < registry.rec > $@
+
+gnu_name_system_record_flags.rst: rst.header gnu_name_system_record_flags.rst.tmp rst.footer
+ cat rst.header gnu_name_system_record_flags.rst.tmp rst.footer > $@
+
+
+.PHONY: check clean distclean
diff --git a/gnu-name-system-record-flags/POLICY b/gnu-name-system-record-flags/POLICY
@@ -0,0 +1,16 @@
+Each registry entry should contain three values: the "Number" of the
+record flags, which must be between 0 and 15,
+the "Name" of the record flag, and a "Reference" with links
+to further information about the record flag.
+
+The "Name" must be unique in the entire registry. The value must be a
+case insensitive ASCII string and is restricted to alphanumeric
+characters.
+
+Adding flags is possible after expert review, using a
+first-come-first-served policy for unique "Name" allocation.
+Experts are responsible to ensure that the chosen "Name" is
+appropriate for the record flag.
+
+The current contact(s) for expert review are reachable at
+gns-registry@gnunet.org.
diff --git a/gnu-name-system-record-flags/README b/gnu-name-system-record-flags/README
@@ -0,0 +1,9 @@
+This registry is for GNU Name System Record Flags.
+
+GNU Name System Record flags uniquely identify the different kinds
+of key-value pairs that can be used as flags of a GNU Name System record.
+
+This registry is used to ensure that the names and numeric values
+used to identify record flags are uniquely defined and to
+allow GNS resolvers implementors to find out details about the
+respective semantics and human-readable syntax.
diff --git a/gnu-name-system-record-flags/h.footer b/gnu-name-system-record-flags/h.footer
@@ -0,0 +1,11 @@
+
+};
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gnu-name-system-record-flags/h.header b/gnu-name-system-record-flags/h.header
@@ -0,0 +1,49 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2012-2022 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+#ifndef GNU_NAME_SYSTEM_RECORD_FLAGS_H
+#define GNU_NAME_SYSTEM_RECORD_FLAGS_H
+
+/**
+ * WARNING:
+ * This header is generated!
+ * In order to add GNS record flags, you must register
+ * them in GANA, and then use the header generation script
+ * to create an update of this file. You may then replace this
+ * file with the update.
+ */
+
+/**
+ * Flags that can be set for a record.
+ * The numbers in the registry correspond to the bit index as specified in
+ * LSD0001 Chapter "Resource Records".
+ * Each enum member represents the 16-bit integer value of the flags field if
+ * only that particular flag was set.
+ * The value can be used to efficiently compare the bitmask setting for the
+ * record flag in C.
+ * WARNING: The values are in host byte order! In order to correctly check
+ * against the flags field a record, the respective fields must
+ * also be converted to HBO (or the enum value to NBO).
+ */
+enum GNUNET_GNSRECORD_Flags
+{
+ /**
+ * Entry for no flags / cleared flags.
+ */
+ GNUNET_GNSRECORD_RF_NONE = 0,
diff --git a/gnu-name-system-record-flags/h.template b/gnu-name-system-record-flags/h.template
@@ -0,0 +1,6 @@
+
+
+ /**
+ * {{Comment}}
+ */
+ GNUNET_GNSRECORD_RF_{{Name}} = 1 << (15 - {{Number}}),
diff --git a/gnu-name-system-record-flags/registry.rec b/gnu-name-system-record-flags/registry.rec
@@ -0,0 +1,43 @@
+# -*- mode: rec -*-
+#
+# Registry for GNU Name System record flags
+#
+
+%rec: RecordType
+%key: Number
+%typedef: FlagRange_t range 0 15
+%type: Number FlagRange_t
+%mandatory: Number
+%typedef: Name_t regexp /^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]*$/
+%type: Name Name_t
+%unique: Name
+%mandatory: Name
+%mandatory: Comment
+%allowed: Contact
+%allowed: References
+%sort: Number Name Contact References
+
+Number: 15
+Name: CRITICAL
+Comment: This record is critical. If it cannot be processed (for example because the record type is unknown) resolution MUST fail
+References: LSD0001
+
+Number: 14
+Name: SHADOW
+Comment: This record should not be used unless all (other) records in the set with an absolute expiration time have expired.
+References: LSD0001
+
+Number: 13
+Name: SUPPLEMENTAL
+Comment: This is a supplemental record.
+References: LSD0001
+
+Number: 1
+Name: RELATIVE_EXPIRATION
+Comment: This expiration time of the record is a relative time (not an absolute time). Used in GNUnet implementation.
+References: GNUnet implementation
+
+Number: 0
+Name: PRIVATE
+Comment: This is a private record of this peer and it should thus not be published.
+References: GNUnet implementation
diff --git a/gnu-name-system-record-flags/rst.footer b/gnu-name-system-record-flags/rst.footer
diff --git a/gnu-name-system-record-flags/rst.header b/gnu-name-system-record-flags/rst.header
@@ -0,0 +1,4 @@
+Registry for GNU Name System record flags
+-----------------------------------------
+
+
diff --git a/gnu-name-system-record-flags/rst.template b/gnu-name-system-record-flags/rst.template
@@ -0,0 +1,9 @@
+
+
+=================== ===========================================================
+Name GNUNET_GNSRECORD_RF_{{Name}}
+------------------- -----------------------------------------------------------
+Number {{Number}}
+Comment {{Comment}}
+=================== ===========================================================
+
diff --git a/gnu-name-system-record-types/rst.template b/gnu-name-system-record-types/rst.template
@@ -4,6 +4,6 @@
Name GNUNET_GNSRECORD_TYPE_{{Name}}
------------------- -----------------------------------------------------------
Number {{Number}}
-Commenr {{Comment}}
+Comment {{Comment}}
=================== ===========================================================