This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Extracting and dissecting small packets

0

Hi Forum

I am writing a protocol dissector. The protocol data packets are small and always prefixed with a message length. Multiple messages are contained inside one TCP packet.

To date I have process the tvb buffer and called tvb_new_subset with the length and offset to -1 and processed the new packet. But this leads me to a problem is the message length (currently unused in my approach) is actually greater than the fields I am aware of in the packet I end up starting thinking I have a new message before I have consumed all the previous packet.

Is there a way I can read n bytes from main tvb buffer into a tmp tvb for processing and continue using the tvb_new_subset to recursively continue processing the messages.

If there an example protocol I could look at for achieving this?

Thanks

Stuart

asked 22 Jan '13, 11:54

StuieNorris's gravatar image

StuieNorris
6557
accept rate: 0%


One Answer:

1

Have a look at "tcp_dissect_pdus()" (see also paragraph 2.7.1 in doc/README.developer). It might be just the thing you're looking for.

answered 22 Jan '13, 13:39

SYN-bit's gravatar image

SYN-bit ♦♦
17.1k957245
accept rate: 20%