Ethereal-dev: RE: [ethereal-dev] Popup packet window

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

From: Jeff Foster <jfoste@xxxxxxxxxxxx>
Date: Wed, 16 Feb 2000 11:39:53 -0600
Attached is a new version of new-win.c.

I found that using 'info_ptr->col_data[i]' didn't work because it
is only valid while packets are being added to the packet list.
So I changed the code to get the text from the packet CList.  I 
removed the 'Row=x' because it is redundant if row number is in
the packet list.  I'm open to comments/suggestions about the format
of the title bar.

I have a question/problem.  When I create the tree_view callbacks,
I'm giving it a pointer to the g_malloc'ed data structure. I used
the gtk_signal_connect_full function instead of the gtk_signal_connect 
to add a destroy_func.  Is this the best way ?

Jeff Foster
jfoste@xxxxxxxxxxxx


-----Original Message-----
From: Gilbert Ramirez [mailto:gram@xxxxxxxxxx]
Sent: Wednesday, February 16, 2000 8:10 AM
To: Jeff Foster
Cc: ethereal-dev@xxxxxxxx
Subject: Re: [ethereal-dev] Popup packet window


On Tue, Feb 15, 2000 at 01:28:18PM -0600, Jeff Foster wrote:
> 
> 
> 
> OK. Here are the files; a diff file fore gtk/menu.c and a new file
> gtk/new-win.c.  Of course you will have to add new-win.c into the make
> files.
> 
> Jeff Foster.
> jfoste@xxxxxxxxxxxx

That's pretty cool; it's a much-needed feature. I like how you
put the packet summary in the title bar. But there appears to
be bug in the title bar creation.

If I create a "New Window" for one packet, the title bar gets created
incorrectly. I get this title bar:

Ethereal row=1,100 6.525604 146.84.27.44 osmosis.dev.tivoli.com 368 TCP ...

But the packet is:

No   Time      Source        Destination             Length  Protocol  Info
1    0.00000   146.84.28.221 IGRP-ROUTERS.MCAST.NET  74      EIGRP


If I open a second "new window", while keeping the first one open,
again, the title bar is incorrect. In fact, the title bar is the exact
same as the first title bar, except for "row=%d", which is correct.

The contents of the proto_tree and hex dump are correct.


Okay, I did a bit of investigating. The packet whose information
is being printed on the title bar is the last packet in my trace file.

--gilbert


void new_window_cb(GtkWidget *w){

  	gint	tv_size = 95, bv_size = 75;
	struct _column_info *info_ptr = &cf.cinfo;
	int i;
	char Title[ 1000] = "";
	

					/* build title of window */
	sprintf( Title, "Ethereal row=%d,", cf.current_frame->row + 1);
	
	for( i = 0; i < info_ptr->num_cols; ++i){
		if (( strlen( Title) + strlen( info_ptr->col_data[i]))
				< (1000 - 1)){

			strcat( Title,  info_ptr->col_data[i]);
			strcat( Title,  " ");
		}		
	}	
	
 create_new_window ( Title, tv_size, bv_size);
}


Attachment: new-win.c
Description: Binary data