General

The asn2wrs compiler can be used to create a dissector from an ASN.1 specification of a protocol. It is work in progress but has been used to create a number of dissectors.
It supports:

Limitations: Add text here

Inbuilt support for:

How to

The compiler needs 4 input files, an ASN.1 description of a protocol, a .cnf file, and two template files. An ASN.1 specification may have to be edited to work, however work is in progress to at least read all ASN1 specifications. Changing the ASN1 file is beeing depreciated as this creates problems when updating protocols. The H.248 Binary encoding dissector is a good example of a dissector with relatively small changes (work in progress) http://anonsvn.wireshark.org/viewvc/viewvc.cgi/trunk/asn1/h248/ ... add more here

A complete simple UDP-based dissector can be viewed at FooPage.

Understanding error messages

When running asn2wrs, you could get the following errors:

__main__.ParseError: LexToken(DOT,'.',71)

__main__.ParseError: LexToken(SEMICOLON,';',88)

Handmassaging the ASN file

This is beeing depreciated. Instead if something is unsupported then prefered way is to report it on the Wireshar dev-mailng list or in bugzilla so asn2wrs can be updated.

Commandline syntax

asn2wrs [-h|?] [-d dbg] [-b] [-p proto] [-c conform_file] [-e] input_file(s) ...

  -h|?          : usage
  -b            : BER (default is PER)
  -u            : unaligned (default is aligned)
  -p proto      : protocol name (implies -S)
                  default is module-name from input_file (renamed by #.MODULE if
 present)
  -F            : create 'field functions'
  -T            : tagged type support (experimental)
  -o name       : output files name core (default is <proto>)
  -O dir        : output directory
  -c conform_file : conformation file
  -I path       : path for conformance file includes
  -e            : create conformation file for exported types
  -S            : single output for multiple modules
  -s template   : single file output (template is input file without .c/.h exten
sion)
  -k            : keep intermediate files though single file output is used
  -L            : suppress #line directive from .cnf file
  input_file(s) : input ASN.1 file(s)

  -d dbg     : debug output, dbg = [l][y][p][s][a][t][c][m][o]
               l - lex
               y - yacc
               p - parsing
               s - internal ASN.1 structure
               a - list of assignments
               t - tables
               c - conformance values
               m - list of compiled modules with dependency
               o - list of output files

Generated files

Intermeddiate files created:

These files should be included in the template file as in the examples(some are optional).

Explanation for .cnf file and template file .cnf file keywords

Step by step instruction

Hints for using Asn2wrs

Discussion

sy: Separate the page into two

Asn2wrs (last edited 2008-04-12 17:50:41 by localhost)