aboutsummaryrefslogtreecommitdiff
path: root/gns-protocol-numbers
diff options
context:
space:
mode:
Diffstat (limited to 'gns-protocol-numbers')
-rw-r--r--gns-protocol-numbers/.gitignore1
-rw-r--r--gns-protocol-numbers/Makefile28
-rw-r--r--gns-protocol-numbers/POLICY20
-rw-r--r--gns-protocol-numbers/README8
-rw-r--r--gns-protocol-numbers/h.footer42
-rw-r--r--gns-protocol-numbers/h.header46
-rw-r--r--gns-protocol-numbers/h.template8
-rw-r--r--gns-protocol-numbers/registry.rec22
-rw-r--r--gns-protocol-numbers/rst.footer0
-rw-r--r--gns-protocol-numbers/rst.header.template11
-rw-r--r--gns-protocol-numbers/rst.template4
11 files changed, 190 insertions, 0 deletions
diff --git a/gns-protocol-numbers/.gitignore b/gns-protocol-numbers/.gitignore
new file mode 100644
index 0000000..0a437d0
--- /dev/null
+++ b/gns-protocol-numbers/.gitignore
@@ -0,0 +1 @@
gnu-name-system-record-types.h
diff --git a/gns-protocol-numbers/Makefile b/gns-protocol-numbers/Makefile
new file mode 100644
index 0000000..a491d11
--- /dev/null
+++ b/gns-protocol-numbers/Makefile
@@ -0,0 +1,28 @@
1FILES=gnu_name_system_protocols.h gnu_name_system_protocols.rst
2all: check $(FILES)
3
4check:
5 recfix --check registry.rec
6
7distclean:
8 rm -f *.tmp
9clean:
10 rm -f $(FILES) *.tmp
11
12gnu_name_system_protocols.h.tmp: registry.rec h.template
13 ../format.sh h.template < registry.rec > $@
14
15gnu_name_system_protocols.h: h.header gnu_name_system_protocols.h.tmp h.footer
16 cat h.header gnu_name_system_protocols.h.tmp h.footer > $@
17
18gnu_name_system_protocols.rst.tmp: registry.rec rst.template
19 ../format.sh rst.template < registry.rec > $@
20
21rst.header.tmp:
22 cat README POLICY rst.header.template > $@
23
24gnu_name_system_protocols.rst: rst.header.tmp gnu_name_system_protocols.rst.tmp rst.footer
25 cat rst.header.tmp gnu_name_system_protocols.rst.tmp rst.footer > $@
26
27
28.PHONY: check clean distclean
diff --git a/gns-protocol-numbers/POLICY b/gns-protocol-numbers/POLICY
new file mode 100644
index 0000000..3972d5d
--- /dev/null
+++ b/gns-protocol-numbers/POLICY
@@ -0,0 +1,20 @@
1Policy
2^^^^^^
3
4Each registry entry should contain three values: the port "Number" of the
5protocol, which must be above 255,
6the "Name" of the protocol, and a "Reference" with links
7to further information about the record type.
8
9The "Name" must be unique in the entire registry. The value must be a
10case insensitive ASCII string and is restricted to alphanumeric
11characters.
12
13Adding protocols is possible after expert review, using a
14first-come-first-served policy for unique "Name" allocation.
15Experts are responsible to ensure that the chosen "Name" is
16appropriate for the record type.
17
18The current contact(s) for expert review are reachable at
19gns-registry@gnunet.org.
20
diff --git a/gns-protocol-numbers/README b/gns-protocol-numbers/README
new file mode 100644
index 0000000..e34ad25
--- /dev/null
+++ b/gns-protocol-numbers/README
@@ -0,0 +1,8 @@
1GNS Protocol Numbers
2--------------------
3
4This registry is for protocol number mappings for GNS names that are BOXed.
5
6Some "_"-labels map to protocol numbers, but others do not.
7For common "_"-labels, we provide a number mapping in this registry.
8
diff --git a/gns-protocol-numbers/h.footer b/gns-protocol-numbers/h.footer
new file mode 100644
index 0000000..15aade3
--- /dev/null
+++ b/gns-protocol-numbers/h.footer
@@ -0,0 +1,42 @@
1 {
2 .name = NULL,
3 .number = 0
4 }
5};
6
7uint16_t
8GNUNET_GNS_protocol_name_to_number (const char *name)
9{
10 int i = 0;
11 while (NULL != GNUNET_GNS_Protocols[i].name)
12 {
13 if (0 == strcmp (name, GNUNET_GNS_Protocols[i].name))
14 return GNUNET_GNS_Protocols[i].number;
15 i++;
16 }
17 return 0;
18}
19
20
21const char*
22GNUNET_GNS_protocol_number_to_name (uint16_t number)
23{
24 int i = 0;
25 while (NULL != GNUNET_GNS_Protocols[i].name)
26 {
27 if (number == GNUNET_GNS_Protocols[i].number)
28 return GNUNET_GNS_Protocols[i].name;
29 i++;
30 }
31 return NULL;
32}
33
34
35#if 0 /* keep Emacsens' auto-indent happy */
36{
37#endif
38#ifdef __cplusplus
39}
40#endif
41
42#endif
diff --git a/gns-protocol-numbers/h.header b/gns-protocol-numbers/h.header
new file mode 100644
index 0000000..54c4b00
--- /dev/null
+++ b/gns-protocol-numbers/h.header
@@ -0,0 +1,46 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2012-2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero 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 GNUnet 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 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20#ifndef GNUNET_GNS_PROTOCOLS_H
21#define GNUNET_GNS_PROTOCOLS_H
22
23/**
24 * WARNING:
25 * This header is generated!
26 * In order to add GNS service ports, you must register
27 * them in GANA, and then use the header generation script
28 * to create an update of this file. You may then replace this
29 * file with the update.
30 */
31
32#ifdef __cplusplus
33extern "C" {
34#if 0 /* keep Emacsens' auto-indent happy */
35}
36#endif
37#endif
38
39struct GNUNET_GNS_Protocol
40{
41 const char *name;
42
43 uint16_t number;
44};
45
46struct GNUNET_GNS_Protocol GNUNET_GNS_Protocols[] = {
diff --git a/gns-protocol-numbers/h.template b/gns-protocol-numbers/h.template
new file mode 100644
index 0000000..08cdb3b
--- /dev/null
+++ b/gns-protocol-numbers/h.template
@@ -0,0 +1,8 @@
1 /**
2 * {{Comment}}
3 */
4 {
5 .name = "{{Name}}",
6 .number = {{Number}}
7 },
8
diff --git a/gns-protocol-numbers/registry.rec b/gns-protocol-numbers/registry.rec
new file mode 100644
index 0000000..96770ff
--- /dev/null
+++ b/gns-protocol-numbers/registry.rec
@@ -0,0 +1,22 @@
1# -*- mode: rec -*-
2#
3# Registry for GNS protocols
4#
5
6%rec: GnsProtocol
7%key: Number
8%type: Number int
9%mandatory: Number
10%typedef: Name_t regexp /^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-]*$/
11%type: Name Name_t
12%unique: Name
13%mandatory: Name
14%mandatory: Comment
15%allowed: Contact
16%allowed: References
17%sort: Number Name Contact References
18
19Number: 49152
20Name: trust
21Comment: LIGHTest trust policy scheme
22References: TODO
diff --git a/gns-protocol-numbers/rst.footer b/gns-protocol-numbers/rst.footer
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gns-protocol-numbers/rst.footer
diff --git a/gns-protocol-numbers/rst.header.template b/gns-protocol-numbers/rst.header.template
new file mode 100644
index 0000000..11b34a1
--- /dev/null
+++ b/gns-protocol-numbers/rst.header.template
@@ -0,0 +1,11 @@
1Entries
2^^^^^^^
3
4.. list-table:: GNS Protocol Numbers
5 :widths: auto
6 :header-rows: 1
7
8 * - Name
9 - Number
10 - References
11 - Comment
diff --git a/gns-protocol-numbers/rst.template b/gns-protocol-numbers/rst.template
new file mode 100644
index 0000000..11468c9
--- /dev/null
+++ b/gns-protocol-numbers/rst.template
@@ -0,0 +1,4 @@
1 * - {{Name}}
2 - {{Number}}
3 - {{References}}
4 - {{Comment}}