Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reserved code range for private use by applications #191

Merged
merged 1 commit into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Multicodec table](#multicodec-table)
- [Adding new multicodecs to the table](#adding-new-multicodecs-to-the-table)
- [Implementations](#implementations)
- [Reserved Code Ranges](#reserved-code-ranges)
- [FAQ](#faq)
- [Contribute](#contribute)
- [License](#license)
Expand Down Expand Up @@ -62,6 +63,16 @@ The `validate.py` script can be used to validate the table once it's edited.
- [Ruby](https://github.com/sleeplessbyte/ruby-multicodec)
- [Add yours today!](https://github.com/multiformats/multicodec/edit/master/table.csv)

## Reserved Code Ranges

The following code ranges have special meaning and may only have meanings assigned to as specified in their description:

### Private Use Area

*Range*: `0x300000 – 0x3FFFFF`

Codes in this range are reserved for internal use by applications and will never be assigned any meaning as part of the Multicodec specification.

## FAQ

> Why varints?
Expand Down
6 changes: 6 additions & 0 deletions validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ class CheckError(Exception):
)
else:
codes[code] = name

# Reserved Code Range: Private Use Area – Do not permit any codes in this range
if code in range(0x300000, 0x400000):
raise CheckError(
f"found code in Private Use Area: {hex(code)} with name '{name}'"
)
except CheckError as e:
success = False
print(f"row {line}: {e}", file=sys.stderr)
Expand Down