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

From: ronnie sahlberg <ronniesahlberg@xxxxxxxxx>
Date: Wed, 2 Sep 2009 09:54:33 +1000
It might be possible to create a ANS.1/BER description that is
compatible with both encodings.


FooBar ::= SEQUENCE OF
{
  kludge KludgeFooBar
}

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

I think this might work and should be able to decode both types of encoding.

It is less than optimal from a maintenance perspective since you would
now have a "third" encoding to maintain. :-(


ronnie s




On Wed, Sep 2, 2009 at 8:46 AM, Alex Lindberg<alindber@xxxxxxxxx> wrote:
> 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
>
>
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>