Wireshark-dev: [Wireshark-dev] Attempting new dissectors using ASN and asn2wrs under MSVC 2008E
From: Adrienne Siskind <ASiskind@xxxxxxxxxxx>
Date: Fri, 9 Apr 2010 16:22:56 -0400
Greetings,

I am attempting to add SLE dissectors to Wireshark using their official ASN descriptions and the asn2wrs translation tool in WinXP with VC9.0 express (MSVC_VARIANT=MSVC2008EE).  I am using the latest stable Wireshark sources - 1.2.7.

>From a working Wireshark dev environment that builds the base sources into a full NSIS install package correctly, I have thus far encountered two separate problems:
   1. getting a translated asn packet-<name>.c/h to compile and link
      once it is added into the epan/dissectors directory and makefile, and
   2. cleanly translating the official CCSDS ASN definition of the
      desired SLE service using asn2wrs.

1:

I started by using the "foo" example on the ans2wrs wiki to understand the process for going from ASN definition to Wireshark package with new dissector.

It is here:  http://wiki.wireshark.org/ASN1_sample

>From this example, Makefile.nmake did need several minor corrections, but it was not hard to get it working correctly.  Thus "packet-foo.c" and "packet-foo.h" are now properly generated, have their eols fixed, and are copied to epan/dissectors using the 'copy_files' target.  (To fix Makefile.nmake, change "PKCS1.asn" in line 16 to "foo.asn", and fix the path names in lines 5,  7, 16, and 18 to use backslash instead of forward slash.)

In Makefile.common in the epan/dissectors directory, I respectively added  packet_foo.c and packet_foo.h into the DIRTY_ASN1_DISSECTOR_SRC and DISSECTOR_INCLUDES lists.  Then back to the wireshark root, and make targets distclean and all.

The resulting compile fails for the asn2wrs-generated packet-foo.c.  The compilation errors ostensibly occur in packet-per.h, and are of the type I'd usually expect to see if there was a missing closing brace somewhere above.  I did change the inclusion of packet-per.h to packet-ber.h to see what would happen, but this simply replaced one set of compile errors with another.

2:

Separately, under asn1\, I copy&pasted the ASN specification for the SLE Forward CLTU service (the one we need first) into appropriately named files; appropriately tweaked the .cnf, packet-<name>-template.c/.h, and makefile from my experimental foo directory; and tried to make target all (which creates the packet-<name>.c and .h files using asn2wrs).

This also failed.  In this case, the traceback says it failed on line 91 in ccsds-sle-transfer-service-bind-types.asn, which is the second file in the spec (I listed them in the makefile in the order they appear in the spec).  The error was "Unexpected token ALL('ALL')"

The spec is here (the asn definition is in Annex A at the end):
http://public.ccsds.org/publications/archive/912x1b2c1.pdf

The line in question reads:
   IdentifierString ::= VisibleString (FROM (ALL EXCEPT ” ”))

Any insight into what I may be doing wrong for either would be greatly appreciated.

Thanks,
--               
Adrienne