Re: Fwd: Length bytes and lookahead in ASN.1 Alaric Snell-Pym 27 Sep 2019 16:51 UTC
On 27/09/2019 17:40, John Cowan wrote:

> E0 (list type) 09 (length in bytes)
>    02 (integer type) 01 (length of integer in bytes) 08 (integer data)
>    0C (UTF-8 type) 02 (length of string in bytes) 66 78 (UTF-8 data)
>    E0 (list type) 00 (length of list in bytes
>
> And that's it.  Byte lengths > 127 are encoded specially in 2 or more bytes.
>
> That design allows you to efficiently skip over objects you don't want to
> convert to internal form, not so much because they are understood but
> uninteresting, but because they are not understood at all.

In this case, the only way to make that decision is based on the type
tag (E0 et al)...; so, if a reader is a stream with types it doesn't
understand.

I don't know if we came to any conclusion as to whether we wanted to
support skippable things at this level of the spec, but if so, we should
assign a bit of that length as a "skippable" flag and decide how to use
it: what metadata to (write ...) would be used to decide what elements
are skippable if the reader doesn't understand their type?

...I'm not sure this is a useful feature at this level :-/

The alternative is not to have "safely skippable" flags at this level,
and instead to have the reader produce some kind of "unknown
placeholder" value for things whose type it didn't understand, instead
of just rejecting the whole thing.

What would applications do with that information? Is that desirable?

ABS

--
Alaric Snell-Pym   (M7KIT)
http://www.snell-pym.org.uk/alaric/