Ethereal-dev: [Ethereal-dev] Creating buffer for Decryption/Decompression

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

From: "Jasim Tariq" <jasimtariqjt@xxxxxxxxxxx>
Date: Wed, 22 Mar 2006 14:29:20 -0800
Hello,
I just need some help in using tvbuff_t. In my dissector sourse, I have a function that decompresses and decrypts the bytes (buffer) passed into it.

I have tried using the function "tvb_get_ephemeral_string" to grab the complete buffer till the end(using -1 for length) but I get an error in ethereal that says "Malfunctioned Packet" since I am also using the buffer to display some other contents of the protocol and after using this command I cannot access the default buffer "tvb". Nothing is displayed after that.

Using the "tvbuff.h" file and its inplementation in "tvbuff.c", I understand that there are some other functions which will enable me to create a buffer of type tvbuff_t and then use the "guint8 *realdata" part of the tvbuff_t obtained to pass into my function. What functions are those? But this process will require creating another tvbuff_t.

I am not using the function "tvb_get_ptr" because there is a comment in "tvbuff.h" file that says:
* The returned pointer is data that is internal to the tvbuff, so do not
* attempt to free it. Don't modify the data, either, because another tvbuff
* that might be using this tvbuff may have already copied that portion of
* the data (sometimes tvbuff's need to make copies of data, but that's the
* internal implementation that you need not worry about). Assume that the
* guint8* points to read-only data that the tvbuff manages.

What would be a better and effective solution that won't effect the default tvbuff_t "tvb" in this case. I only need a guint8* to pass into my function that performs the decompression/decryption.

Thanks,

Jasim Tariq