Ethereal-dev: [Ethereal-dev] reassembly tcp segments

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

From: Dickson Law <dickson@xxxxxxxxxxxxx>
Date: Wed, 29 Mar 2006 13:31:01 +0800
Hi All

after reading README.developer I am still confused with coding up TCP
segment reassembling.  I have a private protocol that alway ends with
hex 0x03 and can span multiple segments.  It is also possible to have
multiple PDU in the same segments.  To deal with PDU spanning over
multiple segments in the dissect function I have this code fragment:

 /*Need to reassemble?*/

        /* Looking for 0x03*/

        len = tvb_find_guint8(tvb, offset, -1, 0x03);


        if ( len == -1 ) {

                pinfo->desegment_offset = offset;
                pinfo->desegment_len = 1;
                return;
        }


	/*Do normal packet dissecting */
...

..


It works fine with PDUs spanning over multiple segments but for some
reason some other PDU contain in a single TCP segment was not decoded
properly, for ethereal thinks reassembling is needed and it end results
contain 1 more byte from the header (I was expecting 0x02 to indicate
the start of PDU but the start is now the last byte of the TCP header,
and there the packet we decoded incorrectly).

For the case of single segment containing multiple PDU, I do have much
of a clue to deal with it yet.

I am wondering if there is some source code than I an make reference to?

thanks

dickson




================================================================================
This e-mail contains information some or all of which may be confidential, proprietary and/or legally privileged.  If an addressing or transmission error has misdirected this e-mail, please notify the sender by replying to this e-mail.  If you are not the intended recipient you must not use, disclose, distribute, copy, print or rely on this e-mail.
================================================================================