Ethereal-dev: [Ethereal-dev] TCP stream reassembly problem

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

From: Sergey Makarenko <SMakarenko@xxxxxxxxxxxxxx>
Date: Mon, 3 Jan 2005 17:43:03 +0200

Hello,

I make a dissector for a protocol which works atop TCP and I want to use reassembly functionality provided by tcp dissector.
All works fine until lost packet situation occurs.
Since this protocol uses encryption it is necessary to revceive data in correct order.
When I receive a some packet (let's name it packet_A) and I decide to do reassembly then I return execution to the tcp dissector and wait for more data.
Let's suppose that the next packet in the tcp stream (packet_B) was lost. Then the next packet that my dissector will receive will be packet_C (which follows packet_B in the tcp stream).
And only when tcp dissector will met retransmitted packet_B it will join packet_A and packet_B and pass this data to my subdissector.
Hence the reassembly functionality of the tcp dissector doesn't keep the continuity of the tcp stream.
I don't see the way how subdissector can recognize lost packet situation.
Also subdissector doesn't have access to SEQ/ACK numbers of the tcp stream. So it can not reorder packets by itself.
As I can see other dissectors also use this technique and rely only on the tcp dissector functionality.

So, is there any way to deal correctly with lost packets/retransmission for subdissector and receive data in correct order?

Best regards,
       Sergey Makarenko.