Ethereal-dev: Re: [Ethereal-dev] unknown PDU length

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Fri, 23 Dec 2005 01:54:54 -0800
Lars Dörner wrote:

It's a RFB based protocol running on TCP.
To dissect the PDU I need the length of it, put the Problem is The length is
encoded at the end of the PDU.

Presumably there is *something* in the data stream that indicates where the PDU ends - i.e., it *has* to be possible to scan forward in the data stream to find the end of the PDU.

Or is there a possibility to continue with the Next TCP packet if I Realize
the end of the Video PDU is not reached?

Yes. You'd need to do TCP reassembly, but you'd process the data in the current TCP segment - *without* building the protocol tree - and:

if the PDU ends within the TCP segment, dissect it, and then start processing the next PDU (I'm assuming the next PDU is immediately after the previous one);

if the PDU *doesn't* end within the TCP segment, set pinfo->desegment_offset to the offset within the tvbuff of the first byte of that PDU, and set pinfo->desegment_len to 1 (which requests that at least one more byte be added to the PDU from the next segment), and then return.

See, for example, the code that dissects the entity headers in "req_resp_hdrs_do_reassembly()".