Skip to content

Commit df1d75a

Browse files
committed
Add reserved code range for private use by applications
See GH/multiformats#158. Changes are analogous to those proposed in GH/multiformats#159.
1 parent ad0c435 commit df1d75a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [Multicodec table](#multicodec-table)
1616
- [Adding new multicodecs to the table](#adding-new-multicodecs-to-the-table)
1717
- [Implementations](#implementations)
18+
- [Reserved Code Ranges](#reserved-code-ranges)
1819
- [FAQ](#faq)
1920
- [Contribute](#contribute)
2021
- [License](#license)
@@ -62,6 +63,16 @@ The `validate.py` script can be used to validate the table once it's edited.
6263
- [Ruby](https://github.com/sleeplessbyte/ruby-multicodec)
6364
- [Add yours today!](https://github.com/multiformats/multicodec/edit/master/table.csv)
6465

66+
## Reserved Code Ranges
67+
68+
The following code ranges have special meaning and may only have meanings assigned to as specified in their description:
69+
70+
### Private Use Area
71+
72+
*Range*: `0x300000 – 0x3FFFFF`
73+
74+
Codes in this range are reserved for internal use by applications and will never be assigned any meaning as part of the Multicodec specification.
75+
6576
## FAQ
6677

6778
> Why varints?

validate.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ class CheckError(Exception):
7272
)
7373
else:
7474
codes[code] = name
75+
76+
# Reserved Code Range: Private Use Area – Do not permit any codes in this range
77+
if code in range(0x300000, 0x400000):
78+
raise CheckError(
79+
f"found code in Private Use Area: {hex(code)} with name '{name}'"
80+
)
7581
except CheckError as e:
7682
success = False
7783
print(f"row {line}: {e}", file=sys.stderr)

0 commit comments

Comments
 (0)