I am writing, as a plugin, a dissector for a protocol used internally in my
organisation. The protocol runs over TCP and is very simple.
A header consisting of:
* 4 bytes message type,
* 4 bytes message length.
Followed by the message data of the length as specified in the header. I
would like to display this data as text.
The protocol does not specify a maximum length for the data; the use of the
protocol means that it ranges from just a few bytes to approximately 2K. In
our environment, the data can be spread across two TCP packets.
My first cut of the dissector explicitly checked that there the whole PDU
was in the packet, and refused to dissect if it was not. So long as the
whole PDU was in the packet, it worked fine using tvb_format_text for the
message data. The header is always at the beginning of the TCP packet.
I am now trying to use tcp_dissect_pdu to dissect a PDU across multiple
packets. As per the documentation, I have written a function to return the
PDU length based on the header as described above. So long as the PDU fits
within a single TCP packet, the dissector works fine. But if the PDU is
spread across two packets, dissection fails with a "short frame" error
message. I understand this to be because of an error reading from the
buffer. The call that fails is to tvb_format_text for the message data.
Tvb_reported_length_remaining returns a length that matches the length as
described in the header for both single packet PDUs and multiple packet
PDUs.
I have searched through other dissectors for an example of a similar use of
tcp_dissect_pdu (where the whole payload is dissected and the dissector uses
tcp_dissect_pdu) but I've failed to find anything, nor in previous postings
to this discussion group.
Can anyone point me in the right direction?
Many thanks,
Matthew
CNS
204-207 Western Docks, Southampton, Hants. SO15 1DA
Switchboard : +44 (0)845 6589920 Fax : +44 (0)2380 799602
Help Desk : +44 (0)845 6589930
http://www.cnsonline.net/
Reg. no. 2084279 England
*************************************************************
All views or opinions expressed herein are solely
those of the author and do not necessarily represent those
of Community Network Services Ltd who do not accept
liability for any action taken in reliance on the contents
of this message (other than where the company has a legal
or regulatory obligation to do so) or for the consequences
of any computer viruses which may have been transmitted
by this E-Mail
The E-Mail and any files transmitted with it, are confidential
and intended solely for the use of the individual or entity to
whom they are addressed. If you have received this message
in error please notify the sender and delete the message
immediately or alternatively email postmaster@xxxxxxxxxxxxx
***************************************************************