qwe
qwe

Reputation: 886

Is this correct ASN.1 syntax?

There is a great ASN.1 tool called asn1c ( https://github.com/vlm/asn1c ).

Sadly when I try to use it on Wireshark's Remote-Operations-Information-Objects ( https://github.com/wireshark/wireshark/tree/master/epan/dissectors/asn1/ros ), it fails with the following error:

ASN.1 grammar parse error near Remote-Operations-Generic-ROS-PDUs.asn:20 (token "!"): syntax error, unexpected '!', expecting ')'
Cannot parse "Remote-Operations-Generic-ROS-PDUs.asn"

Since I'm fairly new to ASN.1, I'd like to ask if this

(CONSTRAINED BY { -- must conform to the above definition --} !
 RejectProblem:general-unrecognizedPDU)

is actually a correct ASN.1. I guess it is, since Wireshark's tools/ans2wrs.py parses it successfully. Both tools are said to support the 2002 version of ASN.1.

So:

  1. Is this correct ASN.1 ()?
  2. Is it some kind of an extension?
  3. Can I actually replace that expression with something that wouldn't change the resulting C structures?

Upvotes: 1

Views: 471

Answers (1)

YaFred
YaFred

Reputation: 10008

Is this correct ASN.1 ()?

Yes.

To validate it, copy the content of the 3 files in ros folder in the left box (schema) of https://asn1.io/asn1playground/ and hit compile

Is it some kind of an extension?

It depends on what you mean by extension.

ASN.1 is a set of documents. Free tools usually limit themselves to Basic Notation (document x.680) and some Encoding Rules (documents x.690, x.691, etc)

The notation the tool you are using is choking on is Information Object Specification (document x.681). If you find an open source tool that handles it properly, please add a comment here (I'm very interested)

Can I actually replace that expression with something that wouldn't change the resulting C structures?

Nope

If you remove the constraint, you will still find plenty of other productions that won't be parsed (OPERATION, parameterized types)

To know more about information objects:

EDIT:

Look at this file https://github.com/wireshark/wireshark/blob/master/epan/dissectors/asn1/ros/ros.asn

They have stripped all the information objects and replaced them with deprecated ASN.1 type ANY

bind-invoke  [16]  --OPERATION.&ArgumentType({operation})-- ANY

May be this is the one to use.

Upvotes: 3

Related Questions