Wireshark-dev: Re: [Wireshark-dev] Appending string to value

From: Jeff Morriss <jeff.morriss@xxxxxxxxxxx>
Date: Mon, 12 Feb 2007 21:33:33 +0800
[BTW, it's better to compose a new email rather than reply to an existing one on a different topic when sending to public mailing lists.]

Amit Khullar wrote:
Hi All,

I am new to wireshark dissector development, hence a help would be really appreciated. I want to print and additional string with the value of the field in the message decode window. This string I want to print is not a constant but varies depending upon the value of the field. Is there some routine which I can use after adding the value(hex) with proto_add_tree_item().

From proto.h:

/** Append to text of item after it has already been created.
 @param ti the item to append the text to
 @param format printf like format string
 @param ... printf like parameters */
extern void proto_item_append_text(proto_item *ti, const char *format, ...)
	GNUC_FORMAT_CHECK(printf, 2,3);

Or you can use one of the _format() functions to completely control the output.