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

Discussion: support of value types other than bytes (and integers) #2

Open
quentinlampin opened this issue Oct 21, 2022 · 0 comments
Open
Assignees
Labels
question Further information is requested

Comments

@quentinlampin
Copy link
Owner

Context

In RFC 8724, it is explained that field values types returned by the parser are not constrained and the choice is left to the implementer. In page 13, it is indeed stated:

Target Value (TV) is the value used to match against the packet header field. The Target Value can be a scalar value of any type (integer, strings, etc.) or a more complex structure (array, list, etc.). The types and representations are out of scope for this document.

Moreover, the Matching Operators MSB(x), described in section 7.3, implicitly mandates the support of a raw representation of the field values. In (micro)Python, the closest representation type is bytes, making it a default, de facto, type for parsers.

Supporting types other than bytes, e.g. integer, strings, arrays, is challenging because of encoding/decoding issues. Here is a list of issues that comes to mind:

  • Integers of arbitrary encoding, e.g. endianness
  • Arbitrary string encoding: e.g. utf-8, ascii, latin-*, etc.
  • Arrays encoding: e.g. array delimiters.

In general, unless the Compression/Decompression Actions (CDAs) keep track of the specific encoding of source (uncompressed) packets, the received (decompressed) packets may end up different from the source, leading to systematic transmission errors.

Assuming network ordering of bytes, the implementation can however get away without storing the encoding of integer fields, hence the "easy" support of integers.

The Question

In light of the encoding issues, should the implementation support other field types ? What would be the pros and cons ?

The issue is there to keep track of the thought process about this.

@quentinlampin quentinlampin self-assigned this Oct 21, 2022
@quentinlampin quentinlampin added the question Further information is requested label Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant