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: Guy Harris <guy@xxxxxxxxxx>
Date: Thu, 1 Nov 2001 17:05:56 -0800 (PST)
> 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. 

	col_append_fstr(pinfo->fd, COL_INFO, "%.*s", i1,
	    tvb_get_ptr(tvb, offset, i1));

although what you may really want is

           switch (opcode) {
           case TFTP_RRQ:
             i1 = tvb_strsize(tvb, offset);
             proto_tree_add_item(tftp_tree, hf_tftp_source_file,
                             tvb, offset, i1, FALSE);
	     if (check_col(pinfo->fd, COL_INFO)
		col_append_fstr(pinfo->fd, COL_INFO, "File: %.*s", i1,
		    tvb_get_ptr(tvb, offset, i1));
             offset += i1;

             i1 = tvb_strsize(tvb, offset);
             ti = proto_tree_add_item(tftp_tree, hf_tftp_transfer_type,
                             tvb, offset, i1, FALSE);
	     if (check_col(pinfo->fd, COL_INFO)
		col_append_fstr(pinfo->fd, COL_INFO, "Transfer type: %.*s", i1,
		    tvb_get_ptr(tvb, offset, i1));
             offset += i1;

to tag the strings so that you can identify the string.

So should there be a "col_append_field()" that appends to the column the
exact same string that would be generated in the protocol tree by
"proto_tree_add_item()", so that it'd show up as

	TFTP Read Request Source File: /tftpboot/hello Transfer type: ascii

(BTW, is "TFTP" redundant in the Info column?  It should already be in
the Protocol column.)