Ethereal-dev: Re: [Ethereal-dev] ISUP Messages types not working

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

Date: Wed, 18 May 2005 15:49:51 +0200
On 5/16/05, Cvetan Ivanov <zezo@xxxxxxxxx> wrote:
> Javier Acuña wrote:
> > I have this trace with ISUP messages, but when I go to
> > Statistics -- > ISUP Message Types
> > I get 0 for all types of messages. Do I need to enable something?
> 
> The ISUP statistics are updated only if the file is read/reread while
> the stats window is open.
> 
> Looking at various starts sources, it seems thah could be fixed:
> 
> a) the easy way - by rescanning the capture file when the window is opened
> b) the hard way - by major rewrite
> 
The hard way (using stats_tree):

static int st_node_msg = -1;
static int st_node_dir = -1;

static void msg_stats_tree_init(stats_tree* st) {
	st_node_msg = stats_tree_create_node(st, "Messages by Type", 0, TRUE);	
	st_node_dir = stats_tree_create_node(st, "Messages by Direction", 0, TRUE);	
}

static int msg_stats_tree_packet(stats_tree *st  , packet_info *pinfo,
epan_dissect_t *edt _U_, const void *p ) {
	const gchar* msg = match_strval(((isup_tap_rec_t*)p)->message_type,
isup_message_type_value_acro);
	gchar src[32];
	gchar dst[32];
	gchar dir[64];
	int msg_node;
	int dir_node;
	
	address_to_str_buf(&(pinfo->net_src), src);
	address_to_str_buf(&(pinfo->net_dst), dst);
	g_snprintf(dir,sizeof(dir),"%s->%s",src,dst);
	
	msg_node = tick_stat_node(st, msg, st_node_msg, TRUE);
	tick_stat_node(st, dir, msg_node, FALSE);
	
	dir_node = tick_stat_node(st, dir, st_node_dir, TRUE);
	tick_stat_node(st, msg, dir_node, FALSE);
	
	return 1;
}

Ain't that hard after all.