Ethereal-dev: Re: [Ethereal-dev] Printing an array of bytes to the tree?

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 12 Aug 2002 10:39:07 -0700
On Mon, Aug 12, 2002 at 05:46:12PM +0200, Yaniv Kaul wrote:
> Is there an intelligent way to print an array of bytes to the tree?
> I'd like to have something like:
> 
> "array: 0x0102030405060708090A"

If the array of bytes is a named field, just make it a field of type
FT_BYTES.

If it's not a named field, and you're putting it into the protocol tree
with "proto_tree_add_text()", use "tvb_bytes_to_str()".

Doing one of those won't put a leading "0x" in there, and will just put
in a "..." after 16 bytes rather than showing ever single byte (16 is
1/2 the value of the #define MAX_BYTE_STR_LEN in epan/strutil.c -
MAX_BYTE_STR_LEN is the number of characters in the display, and each
byte is shown as 2 hex digits - so it could be increased), but it's the
type of thing you're asking for .