mouse07410 / asn1c

The ASN.1 Compiler
http://lionet.info/asn1c/
BSD 2-Clause "Simplified" License
94 stars 70 forks source link

Is it possible to allow an unrecognized ASN.1 extension to be skipped? #113

Closed jamidon closed 1 year ago

jamidon commented 1 year ago

Thank you @vlm, your work and so many others that have contributed to make the ASN.1 to C compiler!

Using your fork, I have been able to implement a regional extension to a SAE J2735 (2016) message. It works great, I can encode, decode, with or without the extension present as long as both sides are using the same version of the generated ASN.1 code. However, if I have a asn1c generated version of the code without the extension present that attempts to decode a message that includes the extension, it fails: bsm-decode-fails.txt

Is that the expected behavior? Is there a way to use asn1c to allow it to skip extensions it doesn't understand?

Here's how I'm generating the source code: ~/sandbox/asn1c-mouse07410/asn1c/asn1c -fcompound-names -fincludes-quoted -no-gen-BER -no-gen-XER -no-gen-OER -no-gen-APER -no-gen-random-fill -no-gen-example ~/Downloads/J2735SET_201603/J2735_201603DA.ASN

Here is the message I'm trying to decode: bsm.txt

mouse07410 commented 1 year ago

Is there a way to use asn1c to allow it to skip extensions it doesn't understand?

It might be possible to parse ASN.1 and generate encoders-decoders that simply omit and ignore unrecognized extensions.

I don't think it's possible or doable for an encoder/decoder to just skip over the part of the binary message that it does not understand. Sorry!