Ethereal-dev: Re: [Ethereal-dev] Voip Calls analysis and Graph analysis

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

From: Alejandro Vaquero <alejandrovaquero@xxxxxxxxx>
Date: Tue, 22 Feb 2005 21:01:10 -0700
Hi All,
    Here is another patch for:

voip_calls_dlg.c
    Change the "prepare filter" function to be protocol independent. Now it uses the "frame_num"s  from the Graph structure to create the filter. This also add support to MGCP and H323 LRQ/LCF filters that were not supported before.

graph_analysis.c:
    Change the mouse scroll wheel implementation to make a 3 line step change instead of 1 line.

Regards
Alejandro


Add support to filter MGCP and

Alejandro Vaquero wrote:
Thanks Lars,
  Also attached find a patch to graph_analysis.c to add support of mouse scroll wheel and directional keys (Up, down, left, and right) in the Graph Analysis.

Regards
Alejandro

Lars Roland wrote:

Lars Roland schrieb:

Having a short look at the patch, I have to disagree on an implementation detail:

I don't like to have the mgcp dissector allocating a mgcp_info_t structure for each dissection of an mgcp packet without freeing it. This could be considered to be a big memory leak.
Instead use a static array of mgcp_info_t structures. You can take the h225 or the q931 dissector as an example of such an implementation.



On Fri, 18 Feb 2005 13:00:00 -0700, Alejandro Vaquero
<alejandrovaquero@xxxxxxxxx> wrote:

Hi All,
   find attached a patch to add MGCP calls to the "Voip Analysis". The
implementation is oriented to MGCP Residential Gateways.


checked in along with the changes I've proposed above and an additional check for the presence of the mgcp plugin.

Regards,
Lars

_______________________________________________
Ethereal-dev mailing list
Ethereal-dev@xxxxxxxxxxxx
http://www.ethereal.com/mailman/listinfo/ethereal-dev


Index: graph_analysis.c =================================================================== --- graph_analysis.c (revision 13449) +++ graph_analysis.c (working copy) @@ -38,6 +38,7 @@ /* in /gtk ... */ #include <gtk/gtk.h> +#include <gdk/gdkkeysyms.h> #include "gtkglobals.h" #include "dlg_utils.h" @@ -647,6 +648,63 @@ } /****************************************************************************/ +static gint scroll_event(GtkWidget *widget, GdkEventButton *event _U_) +{ + graph_analysis_data_t *user_data; + + user_data=(graph_analysis_data_t *)OBJECT_GET_DATA(widget, "graph_analysis_data_t"); + + /* Up scroll */ + if (event->state == 0){ + if (user_data->dlg.first_item == 0) return TRUE; + user_data->dlg.first_item--; + + /* Down scroll */ + } else { + if ((user_data->dlg.first_item+user_data->dlg.v_scrollbar_adjustment->page_size+1 == user_data->num_items)) return TRUE; + user_data->dlg.first_item++; + } + dialog_graph_redraw(user_data); + + return TRUE; +} + +/****************************************************************************/ +static gint key_press_event(GtkWidget *widget, GdkEventKey *event _U_) +{ + graph_analysis_data_t *user_data; + + user_data=(graph_analysis_data_t *)OBJECT_GET_DATA(widget, "graph_analysis_data_t"); + + /* Up arrow */ + if (event->keyval == GDK_Up){ + if (user_data->dlg.selected_item == 0) return TRUE; + user_data->dlg.selected_item--; + if ( (user_data->dlg.selected_item<user_data->dlg.first_item) || (user_data->dlg.selected_item>user_data->dlg.first_item+user_data->dlg.v_scrollbar_adjustment->page_size) ) + user_data->dlg.first_item = user_data->dlg.selected_item; + /* Down arrow */ + } else if (event->keyval == GDK_Down){ + if (user_data->dlg.selected_item == user_data->num_items-1) return TRUE; + user_data->dlg.selected_item++; + if ( (user_data->dlg.selected_item<user_data->dlg.first_item) || (user_data->dlg.selected_item>user_data->dlg.first_item+user_data->dlg.v_scrollbar_adjustment->page_size) ) + user_data->dlg.first_item = (guint32)user_data->dlg.selected_item-(guint32)user_data->dlg.v_scrollbar_adjustment->page_size; + } else if (event->keyval == GDK_Left){ + if (user_data->dlg.first_node == 0) return TRUE; + user_data->dlg.first_node--; + } else if (event->keyval == GDK_Right){ + if ((user_data->dlg.first_node+user_data->dlg.h_scrollbar_adjustment->page_size+1 == user_data->num_nodes)) return TRUE; + user_data->dlg.first_node++; + } + + user_data->dlg.needs_redraw=TRUE; + dialog_graph_draw(user_data); + + cf_goto_frame(&cfile, user_data->dlg.items[user_data->dlg.selected_item-user_data->dlg.first_item].frame_num); + + return TRUE; +} + +/****************************************************************************/ static gint expose_event(GtkWidget *widget, GdkEventExpose *event) { graph_analysis_data_t *user_data; @@ -795,6 +853,8 @@ user_data->dlg.draw_area=gtk_drawing_area_new(); + GTK_WIDGET_SET_FLAGS(user_data->dlg.draw_area, GTK_CAN_FOCUS); + gtk_widget_grab_focus(user_data->dlg.draw_area); SIGNAL_CONNECT(user_data->dlg.draw_area, "destroy", quit, user_data); OBJECT_SET_DATA(user_data->dlg.draw_area, "graph_analysis_data_t", user_data); @@ -807,6 +867,8 @@ gtk_widget_add_events (user_data->dlg.draw_area, GDK_BUTTON_PRESS_MASK); SIGNAL_CONNECT(user_data->dlg.draw_area, "button_press_event", button_press_event, user_data); + SIGNAL_CONNECT(user_data->dlg.draw_area, "scroll_event", scroll_event, user_data); + SIGNAL_CONNECT(user_data->dlg.draw_area, "key_press_event", key_press_event, user_data); gtk_widget_show(user_data->dlg.draw_area); gtk_box_pack_start(GTK_BOX(vbox), user_data->dlg.draw_area, TRUE, TRUE, 0);

_______________________________________________ Ethereal-dev mailing list Ethereal-dev@xxxxxxxxxxxx http://www.ethereal.com/mailman/listinfo/ethereal-dev
Index: gtk/voip_calls_dlg.c
===================================================================
--- gtk/voip_calls_dlg.c	(revision 13474)
+++ gtk/voip_calls_dlg.c	(working copy)
@@ -221,12 +221,11 @@
 	gchar c;
 	GString *filter_string_fwd;
 	gchar *filter_prepend;
-	sip_calls_info_t *tmp_sipinfo;
-	isup_calls_info_t *tmp_isupinfo;
-	h323_calls_info_t *tmp_h323info;
-	h245_address_t *h245_add = NULL;
+	gboolean isFirst = TRUE;
 	GList* list;
 
+	graph_analysis_item_t *gai;
+
 	if (selected_call_fwd==NULL)
 		return;
 
@@ -242,51 +241,23 @@
 	}
 		
 	filter_string_fwd = g_string_new(filter_prepend);
-	switch(selected_call_fwd->protocol){
-		case VOIP_SIP:
-			tmp_sipinfo = selected_call_fwd->prot_info;
-			g_string_sprintfa(filter_string_fwd,
-			   "(sip.Call-ID == \"%s\") ",
-			   tmp_sipinfo->call_identifier 
-			   );
-			gtk_entry_append_text(GTK_ENTRY(main_display_filter_widget), filter_string_fwd->str);
-			break;
-		case VOIP_ISUP:
-			tmp_isupinfo = selected_call_fwd->prot_info;
-			g_string_sprintfa(filter_string_fwd,
-			   "(isup.cic == %i and frame.number >=%i and frame.number<=%i and mtp3.network_indicator == %i and ((mtp3.dpc == %i) and (mtp3.opc == %i)) or((mtp3.dpc == %i) and (mtp3.opc == %i))) ",
-			   tmp_isupinfo->cic,selected_call_fwd->first_frame_num,
-			   selected_call_fwd->last_frame_num, 
-			   tmp_isupinfo->ni, tmp_isupinfo->dpc, tmp_isupinfo->opc, 
-			   tmp_isupinfo->opc, tmp_isupinfo->dpc
-			   );
-			gtk_entry_append_text(GTK_ENTRY(main_display_filter_widget), filter_string_fwd->str);
-			break;
-		case VOIP_H323:
-			tmp_h323info = selected_call_fwd->prot_info;
-			g_string_sprintfa(filter_string_fwd,
-			   "((h225.guid == %x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x:%x || q931.call_ref == %x:%x || q931.call_ref == %x:%x) ",
-			   (guint8)tmp_h323info->guid[0], (guint8)tmp_h323info->guid[1], (guint8)tmp_h323info->guid[2],
-			   (guint8)tmp_h323info->guid[3], (guint8)tmp_h323info->guid[4], (guint8)tmp_h323info->guid[5], (guint8)tmp_h323info->guid[6],
-			   (guint8)tmp_h323info->guid[7], (guint8)tmp_h323info->guid[8], (guint8)tmp_h323info->guid[9], (guint8)tmp_h323info->guid[10],
-			   (guint8)tmp_h323info->guid[11], (guint8)tmp_h323info->guid[12], (guint8)tmp_h323info->guid[13], (guint8)tmp_h323info->guid[14],
-			   (guint8)tmp_h323info->guid[15], (guint8)(tmp_h323info->q931_crv & 0xff), (guint8)((tmp_h323info->q931_crv & 0xff00)>>8)
-			   , (guint8)(tmp_h323info->q931_crv2 & 0xff), (guint8)((tmp_h323info->q931_crv2 & 0xff00)>>8));
+	
+	/* look in the Graph and get all the frame_num for this call */
+	g_string_sprintfa(filter_string_fwd, " (");
+	list = g_list_first(voip_calls_get_info()->graph_analysis->list);
+	while (list)
+	{
+		gai = list->data;
+		if (gai->conv_num == selected_call_fwd->call_num){
+			g_string_sprintfa(filter_string_fwd,"%sframe.number == %d", isFirst?"":" or ", gai->frame_num );
+			isFirst = FALSE;
+		}		
+		list = g_list_next (list);
+	}
+	g_string_sprintfa(filter_string_fwd, ") ");
 
-			list = g_list_first(tmp_h323info->h245_list);
-			while (list)
-			{
-				h245_add=list->data;
-				g_string_sprintfa(filter_string_fwd,
-					" || (ip.addr == %s && tcp.port == %d && h245) ", 
-					ip_to_str((guint8 *)&(h245_add->h245_address)), h245_add->h245_port);
-				list = g_list_next(list);
-			}
-			g_string_sprintfa(filter_string_fwd, ") ");
-			gtk_entry_append_text(GTK_ENTRY(main_display_filter_widget), filter_string_fwd->str);
-			break;
+	gtk_entry_append_text(GTK_ENTRY(main_display_filter_widget), filter_string_fwd->str);
 
-	}
 	g_string_free(filter_string_fwd, TRUE);
 }
 
Index: gtk/graph_analysis.c
===================================================================
--- gtk/graph_analysis.c	(revision 13474)
+++ gtk/graph_analysis.c	(working copy)
@@ -662,12 +662,18 @@
 	/* Up scroll */
 	if (event->state == 0){
 		if (user_data->dlg.first_item == 0) return TRUE;
-		user_data->dlg.first_item--;
+		if (user_data->dlg.first_item < 3) 
+			user_data->dlg.first_item = 0;
+		else
+			user_data->dlg.first_item -= 3;
 		
-		/* Down scroll */
+	/* Down scroll */
 	} else {
 		if ((user_data->dlg.first_item+user_data->dlg.v_scrollbar_adjustment->page_size+1 == user_data->num_items)) return TRUE;
-		user_data->dlg.first_item++;
+		if ((user_data->dlg.first_item+user_data->dlg.v_scrollbar_adjustment->page_size+1) > (user_data->num_items-3)) 
+			user_data->dlg.first_item = user_data->num_items-(guint32)user_data->dlg.v_scrollbar_adjustment->page_size-1;
+		else
+			user_data->dlg.first_item += 3;
 	}
 	dialog_graph_redraw(user_data);