ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [Ethereal-dev] Autogenerating dissectors ...

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Richard Sharpe <sharpe@xxxxxxxxxx>
Date: Fri, 25 May 2001 06:19:00 +0900
Hi,

A while ago when Ronnie Sahlberg complained about the SMB dissector, I
spent some time again on my auto-generating dissector code (my third
attempt at this).

I realized, in trying to write the code that generates the main dissector
code from a description, that there is more of a problem that I had thought.

I had assumed that I could create a simple protocol description language
(which I have done using XML) that would not contain any information about
how the protocol should be displayed by Ethereal.

However, it turns out that this is not possible if I want to generate
dissectors for Ethereal, because Ethereal dissectors require two things:

1. The info to display in the summary pane. In the past I have used simple
stuff here, like request or response, but this is really not satisfactory. 

As an aside, we should have a standard on what is expected here. It is
possible to summarize the contents of the tree view here, as I have done
with more recent dissectors.

2. The tree view, which can be built straight from the description of the
protocol elements quite easily.

The problem I ran into is that I could not easily generate anything more
meaningful than request/response in the summary view without some
information in the protocol description that specifies what to display in
the summary view.

This of course makes my auto-generator and my description language specific
to Ethereal (which might not be a bad thing for the moment).

If I want to go down that path, I think I need to do the following:

1. Add a summary specification to the protocol description. Details below

2. Generate code in the dissector to always dissect the packets fully
   according to the protocol description

3. Generate code that checks if tree view wanted or summary view wanted.

   If summary wanted, insert the description by filling in any variables that
   may be included, like $smb.header.cmd.text: $smb.body.filename

   If detail wanted, insert all the fields into the tree view as needed.

For something as complicated as the SMB protocol, this implies that each
sub-command will need to specify the summary info displayed.

Perhaps I can push code like:

  if (tree) {

    # Handle tree view display

 } else {

   # Handle summary view display

 }

down into each subroutine that handles commands.

This all makes the dissector generater very specific to ethereal, which I
had hoped to avoid. Perhaps next time (when we work on a dissection library
...).

Any comments?

Regards
-------
Richard Sharpe, sharpe@xxxxxxxxxx
Samba (Team member, www.samba.org), Ethereal (Team member, www.ethereal.com)
Contributing author, SAMS Teach Yourself Samba in 24 Hours
Author, Special Edition, Using Samba