Ethereal-dev: [Ethereal-dev] How to start the desegmenting process

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

From: Matthijs Melchior <mmelchior@xxxxxxxxx>
Date: Fri, 02 May 2003 22:51:05 +0200
Hi,

I am building a dissector for messages specified through ASN.1.
These messages are transported via a tcp stream. The testing
sample message streams are decoded and desegmented properly.
The size of the top-level pdu's cannot be established before
completely parsing them [it uses indefinite length pdu's].
Using the exception mechanism and specifying
'desegment_offset = [offset of current top level pdu]' and
'dsegment_len = 1' when I get a ReportedBoundsError works fine,
the next tvbuff starts with that pdu and the rest of that packet
is parsed OK till we get an exeption at the next packet boundary
and everything happens again.

There is one problem left. All my test cases start correctly with
a top level pdu. I cannot expect that to happen when I look at a
live data stream. I will need some way to give ethereal a hint as
to where in the first packet of a capture it is reasonable to start
parsing. I have made an attempt to handle this through a protocol
preference, specifying the offset of the first pdu in the first
packet, but I do not know how to detect when the dissector is
parsing the first packet in a capture [just using the offset only
the first time after setting it works for the packet symmary display,
the packet details are created on a second pass when the dissector
does not know when the first packet is handled....].

Remembering the address of the first tvbuff and using the offset
only there does not seem to work, as there is always a new tvbuff.

I would like to hear more suggestions on how to do this.
I can immagine that a general interface/mechanism to do this would
be useful...

Please share your thoughts.


Thanks.

--
Regards,
----------------------------------------------------------------  -o)
Matthijs Melchior                                       Maarssen  /\\
mmelchior@xxxxxxxxx                                  Netherlands _\_v
---------------------------------------------------------------- ----