Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Help with ASN based dissector

From: Alex Lindberg <alindber@xxxxxxxxx>
Date: Tue, 1 Sep 2009 15:46:34 -0700 (PDT)
I am working on an ASN1 based dissector where there where major changes between V1 and V2 of the protocol.  As such I must select in the proto.cnf file the correct branch of the ASN1 tree to use.  As an example:

Both v1 and v2:
FirstFoo ::= SEQUENCE
{
  version       [0] INTEGER
  dataMessasge  [1] FooBar
}

v1:
FooBar ::= SEQUENCE
{
  item1 [0] IA5String
  item2 [1] INTEGER
}

v2:
FooBar ::= CHOICE
{
  item1 [0] IA5String
  item2 [1] INTEGER
}

I am using an IF statement based on version to call the dissector of either the v1 or v2 construction of FooBar.  I have added the v1 version of FooBar to the end of the ASN1 definition so v1 Foobar becomes:

FooBarV1 ::= SEQUENCE
{
  item1 [0] IA5String
  item2 [1] INTEGER
}

and the dissector is dissector_xxx_FooBarV1.   When the v1 dissector is called, wireshark complains that with a "DISSECTOR_ASSERT_NOT_REACHED" error which indicates that the type and value don't match correctly during decoding.

I suppect that I should pass the correct ASN1 definitions to the v1 dissector, but don't see how that is to be done.  asn2ws created the necessary data structures.

Any help would, as always, be greatly appreciated.

Alex Lindberg