Ethereal-dev: Re: [Ethereal-dev] Adding useful info to the summary info ...

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

From: Richard Sharpe <sharpe@xxxxxxxxxx>
Date: Fri, 02 Nov 2001 12:02:12 +1030
Guy Harris wrote:

Hi folks,
At the moment, there is a neat routine, proto_tree_add_item, that adds items to the tree, and you do not have to worry about extracting the appropriate item from the TVB/data stream.

It would be nice to have the same for col_add_fstr or whatever ...


What would that routine do?

For the protocol tree, there's a fairly standard format for items:

	{name}: {value}

and not only "proto_tree_add_item()", but all the non-"_format"
"proto_tree_add_XXX" routines will generate the visual representation of
the item for you.

An equivalent routine for the summary line would make sense only with a
standard format; what would that format be?


OK, what I am thinking of is the following:

I want to add code to the following to put the file name on the summary line:

          switch (opcode) {
          case TFTP_RRQ:
            i1 = tvb_strsize(tvb, offset);
            proto_tree_add_item(tftp_tree, hf_tftp_source_file,
                            tvb, offset, i1, FALSE);
            offset += i1;

            i1 = tvb_strsize(tvb, offset);
            ti = proto_tree_add_item(tftp_tree, hf_tftp_transfer_type,
                            tvb, offset, i1, FALSE);
            offset += i1;

Now the filename and the transfer type are simply strings, and it would be nice if I could call a tvb routine that gives me a string without me having to copy it out of the tvb.


At the moment, I am going to have to copy the string out, and then call col_append_fstr or some such.



--
Richard Sharpe, rsharpe@xxxxxxxxxx, LPIC-1
www.samba.org, www.ethereal.com, SAMS Teach Yourself Samba
in 24 Hours, Special Edition, Using Samba