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] Announcing: A Wireshark Dissector Generator

From: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Date: Mon, 6 Aug 2018 07:54:37 -0700
Hi folks,

Since about last November I have been developing a Wireshark Dissector
Generator.

Since it is now at the point where it generates code that builds and
runs, I thought I would make it available for anyone who is interested
in looking at it.

My test example is based on the IEEE1905 specification. The dissector
generator takes a protocol description that looks like a set of data
structure definitions and generates a complete Wireshark dissector in
C.

The test example consists of about 252 lines of definition, and the
generator currently generates around 1044 lines of C which builds and
runs. Writing such a protocol description is much easier than the
learning curve required to actually manually write the 1044-line
dissector.

Attached is a screen shot showing the result. It is annotated with
some issues I think need rectifying, but I am going to take a break
from this for a while.

Anyone who is interested is welcome to try it out and send me
suggestions or patches.

Currently, it is not for the faint-of-heart. You need Antlr4 and a
Java environment as well as a Wireshark development environment.

In the future I expect to:

1. Remove the need for Antlr4 by shipping the generated Parser as jar
files or something.

2. Tidy up and refactor the code so that different generator backends
can be used, including a LUA back-end to make it much easier when
developing dissectors.

3. Add in the handling of exceptions.

4. Maybe create other backends. (Once you have a protocol description
it can be used for other things.

The code can be found at:
https://gitlab.com/realrichardsharpe/dissector_generator

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)(传说杜康是酒的发明者)

Attachment: wireshark-generator-annotated-1.jpg
Description: JPEG image