commit cdbbcf7ed842c15f987a55e6981d5aa98e68c865
parent fa6373d8e2432cd63da881e05f4100240e688cdf
Author: Martin Schanzenbach <schanzen@gnunet.org>
Date: Mon, 9 May 2022 09:36:56 +0200
Add DHT block types
Diffstat:
7 files changed, 189 insertions(+), 0 deletions(-)
diff --git a/gnunet-dht-block-types/Makefile b/gnunet-dht-block-types/Makefile
@@ -0,0 +1,18 @@
+FILES=gnunet_dht_block_types.h
+all: check $(FILES)
+
+check:
+ recfix --check registry.rec
+
+distclean:
+ rm -f *.tmp
+clean:
+ rm -f $(FILES) *.tmp
+
+gnunet_dht_block_types.h.tmp: registry.rec h.template
+ ../format.sh h.template < registry.rec > $@
+
+gnunet_dht_block_types.h: h.header gnunet_dht_block_types.h.tmp h.footer
+ cat h.header gnunet_dht_block_types.h.tmp h.footer > $@
+
+.PHONY: check clean distclean
diff --git a/gnunet-dht-block-types/POLICY b/gnunet-dht-block-types/POLICY
@@ -0,0 +1,15 @@
+Each registry entry should contain three values: the "Number" of the
+block type, the "Name" of the block type, and a "Reference" with links
+to further information about the block type.
+
+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 records 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 block type.
+
+The current contact(s) for expert review are reachable at
+gana@gnunet.org.
diff --git a/gnunet-dht-block-types/README b/gnunet-dht-block-types/README
@@ -0,0 +1,9 @@
+This registry is for GNUnet DHT Block Types.
+
+DHT Block Types types uniquely identify the different kinds
+of blocks that can be found in the GNUnet DHT.
+
+This registry is used to ensure that the names and numeric values
+used to identify block types are uniquely defined and to
+allow DHT implementors to find out details about the
+respective semantics and human-readable syntax.
diff --git a/gnunet-dht-block-types/h.footer b/gnunet-dht-block-types/h.footer
@@ -0,0 +1,11 @@
+};
+
+
+#if 0 /* keep Emacsens' auto-indent happy */
+{
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/gnunet-dht-block-types/h.header b/gnunet-dht-block-types/h.header
@@ -0,0 +1,43 @@
+/*
+ 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 GNUNET_DHT_BLOCK_TYPES_H
+#define GNUNET_DHT_BLOCK_TYPES_H
+
+/**
+ * WARNING:
+ * This header is generated!
+ * In order to add DHT block types, 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.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0 /* keep Emacsens' auto-indent happy */
+}
+#endif
+#endif
+
+/**
+ * Blocks in the datastore and the datacache must have a unique type.
+ */
+enum GNUNET_BLOCK_Type
+{
diff --git a/gnunet-dht-block-types/h.template b/gnunet-dht-block-types/h.template
@@ -0,0 +1,6 @@
+
+
+ /**
+ * {{Comment}}
+ */
+ GNUNET_BLOCK_TYPE_{{Name}} = {{Number}},
diff --git a/gnunet-dht-block-types/registry.rec b/gnunet-dht-block-types/registry.rec
@@ -0,0 +1,87 @@
+# -*- mode: rec -*-
+#
+# Registry for GNU Name System record types
+#
+
+%rec: BlockType
+%key: Number
+%type: Number int
+%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: 1
+Name: FS_DBLOCK
+Comment: Data block (leaf) in the CHK tree.
+References: None
+
+Number: 2
+Name: FS_IBLOCK
+Comment: Inner block in the CHK tree.
+References: None
+
+Number: 6
+Name: FS_ONDEMAND
+Comment: Type of a block representing a block to be encoded on demand from disk. Should never appear on the network directly.
+References: None
+
+Number: 7
+Name: DHT_HELLO
+Comment: Type of a block that contains a HELLO for a peer.
+References: None
+
+Number: 8
+Name: TEST
+Comment: Block for testing.
+References: None
+
+Number: 9
+Name: FS_UBLOCK
+Comment: Type of a block representing any type of search result (universal).
+References: None
+
+Number: 10
+Name: DNS
+Comment: Block for storing DNS exit service advertisements.
+References: None
+
+Number: 11
+Name: GNS_NAMERECORD
+Comment: Block for storing GNS record data.
+References: None
+
+Number: 12
+Name: REVOCATION
+Comment: Block type for a revocation message by which a key is revoked.
+References: None
+
+Number: 13
+Name: DHT_URL_HELLO
+Comment: Type of a block that contains a DHT-NG HELLO for a peer.
+References: None
+
+Number: 22
+Name: REGEX
+Comment: Block to store a cadet regex state
+References: None
+
+Number: 23
+Name: REGEX_ACCEPT
+Comment: Block to store a cadet regex accepting state
+References: None
+
+Number: 24
+Name: SET_TEST
+Comment: Block for testing set/consensus. If first byte of the block is non-zero, the block is considered invalid.
+References: None
+
+Number: 25
+Name: CONSENSUS_ELEMENT
+Comment: Block type for consensus elements. Contains either special marker elements or a nested block.
+References: None