Project

General

Profile

Actions

Feature #5114

closed

Introduce proper TLV parser + constructor

Added by laforge about 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
-
Target version:
-
Start date:
04/11/2021
Due date:
% Done:

100%

Spec Reference:

Description

With 'construct' we now have the tools to deal with various hand-coded binary formats.

What we're still missing is a proper TLV parser/encoder that does what we need:
  • support single-byte tag + single-byte value
  • support BER-TLV with variable-length length fields
  • discovering unknown TLVs is not an error and should just work
  • a way to specify human-readable description text for each tag
  • a way to specify a brief name/identifier which is to be used in the parse result to describe the field
  • ability to call a sub-decoder
    • for nested TLVs, or
    • to further decode the value part in whatever format it may be

Once we have this in place, we should migrate any existing encoders/decoders over to this new TLV codebase.

We've so far explored
  • pytlv
    • lacks support for BER-TLV
    • doesn't support parsing unknown tags
    • name/id mapping needs to be glued on top
  • uttlv
    • lacks support for BER-TLV
    • natively supports tag names via its tag_map concept
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)