2005-02-01 12:12:35 +00:00
/* voip_calls_dlg.c
2006-05-22 07:29:40 +00:00
* VoIP calls summary addition for Wireshark
2005-02-01 12:12:35 +00:00
*
* $ Id $
*
* Copyright 2004 , Ericsson , Spain
* By Francisco Alcoba < francisco . alcoba @ ericsson . com >
*
* based on h323_calls_dlg . c
* Copyright 2004 , Iskratel , Ltd , Kranj
* By Miha Jemec < m . jemec @ iskratel . si >
*
* H323 , RTP and Graph Support
* By Alejandro Vaquero , alejandro . vaquero @ verso . com
* Copyright 2005 , Verso Technologies Inc .
*
2006-05-21 05:12:17 +00:00
* Wireshark - Network traffic analyzer
* By Gerald Combs < gerald @ wireshark . org >
2005-02-01 12:12:35 +00:00
* Copyright 1998 Gerald Combs
*
* This program is free software ; you can redistribute it and / or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation ; either version 2
* of the License , or ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program ; if not , write to the Free Software
* Foundation , Inc . , 59 Temple Place - Suite 330 , Boston , MA 02111 - 1307 , USA .
*/
# ifdef HAVE_CONFIG_H
# include <config.h>
# endif
2009-08-27 04:47:28 +00:00
# include <stdio.h>
2005-02-14 22:06:22 +00:00
# include <string.h>
# include <ctype.h>
2008-04-13 03:32:24 +00:00
# include "gtk/gtk.h"
2005-02-01 12:12:35 +00:00
2008-04-13 03:32:24 +00:00
# include <epan/epan.h>
# include <epan/packet.h>
2005-02-01 12:12:35 +00:00
# include "epan/filesystem.h"
2005-02-20 15:53:11 +00:00
# include <epan/tap.h>
2005-08-20 20:06:05 +00:00
# include <epan/stat_cmd_args.h>
2008-04-13 03:32:24 +00:00
# include <epan/to_str.h>
# include <epan/address.h>
# include <epan/addr_resolv.h>
# include <epan/dissectors/packet-h248.h>
# include "../register.h"
# include "../globals.h"
2005-08-21 09:48:27 +00:00
# include "../stat_menu.h"
2008-04-13 03:32:24 +00:00
# include "gtk/graph_analysis.h"
# include "gtk/voip_calls_dlg.h"
# include "gtk/voip_calls.h"
# include "gtk/gui_stat_menu.h"
# include "gtk/dlg_utils.h"
# include "gtk/gui_utils.h"
# include "gtk/gtkglobals.h"
2009-11-15 20:13:08 +00:00
# include "gtk/stock_icons.h"
2005-02-01 12:12:35 +00:00
# include "image/clist_ascend.xpm"
# include "image/clist_descend.xpm"
# include "simple_dialog.h"
2006-09-05 07:58:14 +00:00
# ifdef HAVE_LIBPORTAUDIO
2008-04-13 03:32:24 +00:00
# include "gtk/rtp_analysis.h"
# include "gtk/rtp_player.h"
2006-09-05 07:58:14 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/* pointer to the one and only dialog window */
static GtkWidget * voip_calls_dlg = NULL ;
static GtkWidget * clist = NULL ;
static GtkWidget * top_label = NULL ;
static GtkWidget * status_label = NULL ;
/*static GtkWidet *bt_unselect = NULL;*/
static GtkWidget * bt_filter = NULL ;
static GtkWidget * bt_graph = NULL ;
2006-10-20 20:05:27 +00:00
# ifdef HAVE_LIBPORTAUDIO
2006-08-30 21:51:31 +00:00
static GtkWidget * bt_player = NULL ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2005-02-01 12:12:35 +00:00
static voip_calls_info_t * selected_call_fwd = NULL ; /* current selection */
static GList * last_list = NULL ;
static guint32 calls_nb = 0 ; /* number of displayed calls */
static guint32 calls_ns = 0 ; /* number of selected calls */
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
static graph_analysis_data_t * graph_analysis_data = NULL ;
2005-02-01 12:12:35 +00:00
2010-02-19 19:00:06 +00:00
enum
{
CALL_COL_START_TIME ,
CALL_COL_STOP_TIME ,
CALL_COL_INITIAL_SPEAKER ,
CALL_COL_FROM ,
CALL_COL_TO ,
CALL_COL_PROTOCOL ,
CALL_COL_PACKETS ,
CALL_COL_STATE ,
CALL_COL_COMMENTS ,
CALL_COL_INFO ,
NUM_COLS /* The number of columns */
} ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
static const GdkColor COLOR_SELECT = { 0 , 0x00ff , 0x80ff , 0x80ff } ;
static const GdkColor COLOR_DEFAULT = { 0 , 0xffff , 0xffff , 0xffff } ;
2008-05-01 18:26:01 +00:00
static const GdkColor COLOR_FOREGROUND = { 0 , 0x0000 , 0x0000 , 0x0000 } ;
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/* append a line to clist */
static void add_to_clist ( voip_calls_info_t * strinfo )
{
gchar label_text [ 256 ] ;
gint added_row ;
gchar * data [ NUM_COLS ] ;
gchar field [ NUM_COLS ] [ 50 ] ;
gint c ;
isup_calls_info_t * tmp_isupinfo ;
h323_calls_info_t * tmp_h323info ;
gboolean tmp_bool = FALSE ;
2008-05-01 18:26:01 +00:00
GdkColor bg_color = COLOR_SELECT ;
GdkColor fg_color = COLOR_FOREGROUND ;
2005-02-01 12:12:35 +00:00
for ( c = 0 ; c < NUM_COLS ; c + + ) {
data [ c ] = & field [ c ] [ 0 ] ;
}
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
/* strinfo->selected = FALSE;*/
2005-02-01 12:12:35 +00:00
2007-10-24 08:30:46 +00:00
g_snprintf ( field [ CALL_COL_START_TIME ] , 15 , " %i.%03i " , strinfo - > start_sec , strinfo - > start_usec / 1000 ) ;
g_snprintf ( field [ CALL_COL_STOP_TIME ] , 15 , " %i.%03i " , strinfo - > stop_sec , strinfo - > stop_usec / 1000 ) ;
2010-01-19 19:37:03 +00:00
/* xxx display_signed_time(data[0], sizeof(field[CALL_COL_START_TIME]), strinfo->start_sec, strinfo->start_usec, TO_STR_TIME_RES_T_USECS); */
/* display_signed_time(data[1], sizeof(field[CALL_COL_STOP_TIME]), strinfo->stop_sec, strinfo->stop_usec, TO_STR_TIME_RES_T_USECS); */
2006-10-20 18:36:42 +00:00
g_snprintf ( field [ CALL_COL_INITIAL_SPEAKER ] , 30 , " %s " , get_addr_name ( & ( strinfo - > initial_speaker ) ) ) ;
g_snprintf ( field [ CALL_COL_FROM ] , 50 , " %s " , strinfo - > from_identity ) ;
g_snprintf ( field [ CALL_COL_TO ] , 50 , " %s " , strinfo - > to_identity ) ;
2007-10-24 08:30:46 +00:00
g_snprintf ( field [ CALL_COL_PROTOCOL ] , 15 , " %s " , ( ( strinfo - > protocol = = VOIP_COMMON ) & & strinfo - > protocol_name ) ? strinfo - > protocol_name : voip_protocol_name [ strinfo - > protocol ] ) ;
2006-10-20 18:36:42 +00:00
g_snprintf ( field [ CALL_COL_PACKETS ] , 15 , " %u " , strinfo - > npackets ) ;
g_snprintf ( field [ CALL_COL_STATE ] , 15 , " %s " , voip_call_state_name [ strinfo - > call_state ] ) ;
2005-02-01 12:12:35 +00:00
/* Add comments based on the protocol */
switch ( strinfo - > protocol ) {
case VOIP_ISUP :
tmp_isupinfo = strinfo - > prot_info ;
2006-10-20 18:36:42 +00:00
g_snprintf ( field [ CALL_COL_COMMENTS ] , 30 , " %i-%i -> %i-%i " , tmp_isupinfo - > ni , tmp_isupinfo - > opc ,
2005-06-27 06:20:23 +00:00
tmp_isupinfo - > ni , tmp_isupinfo - > dpc ) ;
2005-02-01 12:12:35 +00:00
break ;
case VOIP_H323 :
tmp_h323info = strinfo - > prot_info ;
if ( strinfo - > call_state = = VOIP_CALL_SETUP )
tmp_bool = tmp_h323info - > is_faststart_Setup ;
else
if ( ( tmp_h323info - > is_faststart_Setup = = TRUE ) & & ( tmp_h323info - > is_faststart_Proc = = TRUE ) ) tmp_bool = TRUE ;
2006-10-20 18:36:42 +00:00
g_snprintf ( field [ CALL_COL_COMMENTS ] , 35 , " Tunneling: %s Fast Start: %s " , ( tmp_h323info - > is_h245Tunneling = = TRUE ? " ON " : " OFF " ) ,
2005-02-01 12:12:35 +00:00
( tmp_bool = = TRUE ? " ON " : " OFF " ) ) ;
break ;
2007-10-24 08:30:46 +00:00
case VOIP_COMMON :
field [ CALL_COL_COMMENTS ] [ 0 ] = ' \0 ' ;
if ( strinfo - > call_comment )
g_snprintf ( field [ CALL_COL_COMMENTS ] , 30 , " %s " , strinfo - > call_comment ) ;
break ;
2005-02-01 12:12:35 +00:00
default :
2006-10-20 18:36:42 +00:00
field [ CALL_COL_COMMENTS ] [ 0 ] = ' \0 ' ;
2005-02-01 12:12:35 +00:00
}
added_row = gtk_clist_append ( GTK_CLIST ( clist ) , data ) ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
/* set the background color if selected */
if ( strinfo - > selected ) {
calls_ns + + ;
2008-05-01 18:26:01 +00:00
gtk_clist_set_background ( GTK_CLIST ( clist ) , added_row , & bg_color ) ;
gtk_clist_set_foreground ( GTK_CLIST ( clist ) , added_row , & fg_color ) ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
}
2005-02-01 12:12:35 +00:00
/* set data pointer of last row to point to user data for that row */
gtk_clist_set_row_data ( GTK_CLIST ( clist ) , added_row , strinfo ) ;
/* Update the top label with the number of detected calls */
calls_nb + + ;
g_snprintf ( label_text , 256 ,
" Detected %d VoIP %s. Selected %d %s. " ,
calls_nb ,
plurality ( calls_nb , " Call " , " Calls " ) ,
calls_ns ,
plurality ( calls_ns , " Call " , " Calls " ) ) ;
2009-02-26 21:11:06 +00:00
gtk_label_set_text ( GTK_LABEL ( top_label ) , label_text ) ;
2005-02-01 12:12:35 +00:00
/* Update the status label with the number of total messages */
g_snprintf ( label_text , 256 ,
" Total: Calls: %d Start packets: %d Completed calls: %d Rejected calls: %d " ,
2008-01-09 08:34:58 +00:00
g_list_length ( voip_calls_get_info ( ) - > callsinfo_list ) ,
2005-02-01 12:12:35 +00:00
voip_calls_get_info ( ) - > start_packets ,
voip_calls_get_info ( ) - > completed_calls ,
voip_calls_get_info ( ) - > rejected_calls ) ;
2009-02-26 21:11:06 +00:00
gtk_label_set_text ( GTK_LABEL ( status_label ) , label_text ) ;
2005-02-01 12:12:35 +00:00
}
2005-08-20 14:02:00 +00:00
static void voip_calls_remove_tap_listener ( void )
2005-02-01 12:12:35 +00:00
{
/* Remove the calls tap listener */
remove_tap_listener_sip_calls ( ) ;
remove_tap_listener_isup_calls ( ) ;
remove_tap_listener_mtp3_calls ( ) ;
remove_tap_listener_h225_calls ( ) ;
remove_tap_listener_h245dg_calls ( ) ;
remove_tap_listener_q931_calls ( ) ;
2007-03-18 22:14:12 +00:00
remove_tap_listener_h248_calls ( ) ;
2007-03-21 00:59:00 +00:00
remove_tap_listener_sccp_calls ( ) ;
2005-02-01 12:12:35 +00:00
remove_tap_listener_sdp_calls ( ) ;
2005-02-05 11:07:21 +00:00
remove_tap_listener_rtp ( ) ;
2007-09-10 07:21:27 +00:00
if ( find_tap_id ( " unistim " ) ) {
remove_tap_listener_unistim_calls ( ) ;
}
2007-10-24 08:30:46 +00:00
if ( find_tap_id ( " voip " ) ) {
remove_tap_listener_voip_calls ( ) ;
}
2005-03-10 19:32:22 +00:00
remove_tap_listener_rtp_event ( ) ;
2008-11-25 06:41:15 +00:00
remove_tap_listener_mgcp_calls ( ) ;
2005-06-27 06:20:23 +00:00
remove_tap_listener_actrace_calls ( ) ;
2006-01-15 15:01:14 +00:00
remove_tap_listener_t38 ( ) ;
2009-01-30 21:25:52 +00:00
remove_tap_listener_skinny_calls ( ) ;
2009-03-11 06:43:46 +00:00
remove_tap_listener_iax2_calls ( ) ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
/* CALLBACKS */
/****************************************************************************/
static void
voip_calls_on_destroy ( GtkObject * object _U_ ,
gpointer user_data _U_ )
{
2005-02-02 01:02:09 +00:00
/* remove_tap_listeners */
voip_calls_remove_tap_listener ( ) ;
2005-02-01 12:12:35 +00:00
/* Clean up memory used by calls tap */
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
voip_calls_dlg_reset ( NULL ) ;
2005-02-01 12:12:35 +00:00
/* Note that we no longer have a "VoIP Calls" dialog box. */
voip_calls_dlg = NULL ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
graph_analysis_data = NULL ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
static void
voip_calls_on_unselect ( GtkButton * button _U_ ,
gpointer user_data _U_ )
{
selected_call_fwd = NULL ;
gtk_clist_unselect_all ( GTK_CLIST ( clist ) ) ;
2007-10-08 00:31:26 +00:00
/* gtk_label_set_text(GTK_LABEL(label_fwd), FWD_LABEL_TEXT);
*/
2005-02-01 12:12:35 +00:00
/*gtk_widget_set_sensitive(bt_unselect, FALSE);*/
gtk_widget_set_sensitive ( bt_filter , FALSE ) ;
2005-02-22 07:31:19 +00:00
gtk_widget_set_sensitive ( bt_graph , FALSE ) ;
2006-10-20 20:05:27 +00:00
# ifdef HAVE_LIBPORTAUDIO
2006-08-30 21:51:31 +00:00
gtk_widget_set_sensitive ( bt_player , FALSE ) ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
static void
voip_calls_on_filter ( GtkButton * button _U_ ,
gpointer user_data _U_ )
{
2005-02-02 08:53:08 +00:00
const gchar * filter_string ;
gchar c ;
GString * filter_string_fwd ;
2005-08-06 14:03:14 +00:00
const gchar * filter_prepend ;
2005-02-24 04:15:40 +00:00
gboolean isFirst = TRUE ;
2005-02-01 12:12:35 +00:00
GList * list ;
2009-04-16 03:18:10 +00:00
size_t filter_length = 0 ;
size_t max_filter_length = 2048 ;
2005-03-09 10:12:05 +00:00
sip_calls_info_t * tmp_sipinfo ;
isup_calls_info_t * tmp_isupinfo ;
h323_calls_info_t * tmp_h323info ;
h245_address_t * h245_add = NULL ;
2009-12-29 19:23:39 +00:00
int pos ;
2005-02-01 12:12:35 +00:00
2005-02-24 04:15:40 +00:00
graph_analysis_item_t * gai ;
2005-02-01 12:12:35 +00:00
if ( selected_call_fwd = = NULL )
return ;
2009-12-29 19:23:39 +00:00
filter_string = gtk_entry_get_text ( GTK_ENTRY ( main_display_filter_widget ) ) ; /* sets 'position' of the entry widget to 0 ? */
2005-03-09 10:12:05 +00:00
filter_length = strlen ( filter_string ) ;
2009-12-29 21:37:20 +00:00
pos = ( int ) filter_length ; /* remember for later insert (ie: append */
2009-12-29 19:23:39 +00:00
2005-02-02 08:53:08 +00:00
filter_prepend = " " ;
while ( ( c = * filter_string + + ) ! = ' \0 ' ) {
if ( ! isspace ( ( guchar ) c ) ) {
/* The filter string isn't blank, so there's already
an expression ; we OR in the new expression */
filter_prepend = " or " ;
break ;
}
2005-02-01 12:12:35 +00:00
}
2005-02-02 08:53:08 +00:00
filter_string_fwd = g_string_new ( filter_prepend ) ;
2005-02-24 04:15:40 +00:00
/* look in the Graph and get all the frame_num for this call */
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd , " ( " ) ;
2005-02-24 04:15:40 +00:00
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 ) {
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd , " %sframe.number == %d " , isFirst ? " " : " or " , gai - > frame_num ) ;
2005-02-24 04:15:40 +00:00
isFirst = FALSE ;
}
list = g_list_next ( list ) ;
2005-02-01 12:12:35 +00:00
}
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd , " ) " ) ;
2005-03-09 10:12:05 +00:00
filter_length = filter_length + filter_string_fwd - > len ;
2005-02-24 04:15:40 +00:00
2005-03-09 10:12:05 +00:00
if ( filter_length < max_filter_length ) {
2009-12-29 19:23:39 +00:00
gtk_editable_insert_text ( GTK_EDITABLE ( main_display_filter_widget ) , filter_string_fwd - > str , - 1 , & pos ) ;
2007-03-18 22:14:12 +00:00
} else {
2005-03-09 10:12:05 +00:00
g_string_free ( filter_string_fwd , TRUE ) ;
filter_string_fwd = g_string_new ( filter_prepend ) ;
switch ( selected_call_fwd - > protocol ) {
case VOIP_SIP :
tmp_sipinfo = selected_call_fwd - > prot_info ;
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd ,
2005-03-09 10:12:05 +00:00
" (sip.Call-ID == \" %s \" ) " ,
tmp_sipinfo - > call_identifier
) ;
2009-12-29 19:23:39 +00:00
gtk_editable_insert_text ( GTK_EDITABLE ( main_display_filter_widget ) , filter_string_fwd - > str , - 1 , & pos ) ;
2005-03-09 10:12:05 +00:00
break ;
case VOIP_ISUP :
tmp_isupinfo = selected_call_fwd - > prot_info ;
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd ,
2005-03-09 10:12:05 +00:00
" (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
) ;
2009-12-29 19:23:39 +00:00
gtk_editable_insert_text ( GTK_EDITABLE ( main_display_filter_widget ) , filter_string_fwd - > str , - 1 , & pos ) ;
2005-03-09 10:12:05 +00:00
break ;
case VOIP_H323 :
tmp_h323info = selected_call_fwd - > prot_info ;
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd ,
2006-03-19 20:45:45 +00:00
" ((h225.guid == %s || q931.call_ref == %x:%x || q931.call_ref == %x:%x) " ,
guid_to_str ( & tmp_h323info - > guid [ 0 ] ) ,
( 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 ) ) ;
2005-03-09 10:12:05 +00:00
list = g_list_first ( tmp_h323info - > h245_list ) ;
while ( list )
{
h245_add = list - > data ;
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd ,
2005-03-09 10:12:05 +00:00
" || (ip.addr == %s && tcp.port == %d && h245) " ,
ip_to_str ( ( guint8 * ) & ( h245_add - > h245_address ) ) , h245_add - > h245_port ) ;
list = g_list_next ( list ) ;
}
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd , " ) " ) ;
2009-12-29 19:23:39 +00:00
gtk_editable_insert_text ( GTK_EDITABLE ( main_display_filter_widget ) , filter_string_fwd - > str , - 1 , & pos ) ;
2005-03-09 10:12:05 +00:00
break ;
2007-03-18 22:14:12 +00:00
case TEL_H248 : {
2007-03-25 21:56:08 +00:00
const gcp_ctx_t * ctx = selected_call_fwd - > prot_info ;
2009-12-29 19:23:39 +00:00
gtk_editable_insert_text ( GTK_EDITABLE ( main_display_filter_widget ) ,
ep_strdup_printf ( " h248.ctx == 0x%x " , ctx - > id ) , - 1 , & pos ) ;
2007-03-18 22:14:12 +00:00
break ;
}
2007-03-21 00:59:00 +00:00
case TEL_SCCP :
2005-03-09 10:12:05 +00:00
case VOIP_MGCP :
2005-06-28 22:01:18 +00:00
case VOIP_AC_ISDN :
case VOIP_AC_CAS :
2006-01-15 15:01:14 +00:00
case MEDIA_T38 :
2007-10-24 09:21:13 +00:00
case TEL_BSSMAP :
case TEL_RANAP :
2007-09-10 07:21:27 +00:00
case VOIP_UNISTIM :
2009-01-30 21:25:52 +00:00
case VOIP_SKINNY :
2009-03-11 06:43:46 +00:00
case VOIP_IAX2 :
2007-10-24 09:21:13 +00:00
case VOIP_COMMON :
2005-03-09 10:12:05 +00:00
/* XXX - not supported */
break ;
}
}
2005-02-02 08:53:08 +00:00
g_string_free ( filter_string_fwd , TRUE ) ;
2005-02-01 12:12:35 +00:00
}
2007-10-08 00:31:26 +00:00
/****************************************************************************/
static void
voip_calls_on_select_all ( GtkButton * button _U_ ,
gpointer user_data _U_ )
{
gtk_clist_select_all ( GTK_CLIST ( clist ) ) ;
}
2005-02-01 12:12:35 +00:00
/****************************************************************************/
static void
on_graph_bt_clicked ( GtkButton * button _U_ ,
gpointer user_data _U_ )
{
graph_analysis_item_t * gai ;
GList * list ;
GList * list2 ;
voip_calls_info_t * tmp_listinfo ;
/* reset the "display" parameter in graph analysis */
list2 = g_list_first ( voip_calls_get_info ( ) - > graph_analysis - > list ) ;
while ( list2 ) {
gai = list2 - > data ;
gai - > display = FALSE ;
list2 = g_list_next ( list2 ) ;
}
/* set the display for selected calls */
2008-01-09 08:34:58 +00:00
list = g_list_first ( voip_calls_get_info ( ) - > callsinfo_list ) ;
2005-02-01 12:12:35 +00:00
while ( list ) {
tmp_listinfo = list - > data ;
if ( tmp_listinfo - > selected ) {
list2 = g_list_first ( voip_calls_get_info ( ) - > graph_analysis - > list ) ;
while ( list2 ) {
gai = list2 - > data ;
if ( gai - > conv_num = = tmp_listinfo - > call_num ) {
gai - > display = TRUE ;
}
list2 = g_list_next ( list2 ) ;
}
}
list = g_list_next ( list ) ;
}
/* create or refresh the graph windows */
if ( graph_analysis_data - > dlg . window = = NULL ) /* create the window */
graph_analysis_create ( graph_analysis_data ) ;
else
graph_analysis_update ( graph_analysis_data ) ; /* refresh it */
}
2006-10-20 20:05:27 +00:00
# ifdef HAVE_LIBPORTAUDIO
2006-08-30 21:51:31 +00:00
/****************************************************************************/
static void
on_player_bt_clicked ( GtkButton * button _U_ ,
gpointer user_data _U_ )
{
2006-10-20 20:05:27 +00:00
rtp_player_init ( voip_calls_get_info ( ) ) ;
2006-08-30 21:51:31 +00:00
}
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2006-08-30 21:51:31 +00:00
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/* when the user selects a row in the calls list */
static void
2010-02-01 16:22:17 +00:00
voip_calls_on_select_row ( GtkCList * clist_lcl ,
gint row _U_ ,
gint column _U_ ,
GdkEventButton * event _U_ ,
gpointer user_data _U_ )
2005-02-01 12:12:35 +00:00
{
2007-10-08 00:31:26 +00:00
/* GdkColor color = COLOR_DEFAULT;*/
2005-02-01 12:12:35 +00:00
gchar label_text [ 80 ] ;
2007-10-08 00:31:26 +00:00
GList * list ;
voip_calls_info_t * listinfo ;
2005-02-01 12:12:35 +00:00
2010-02-01 16:22:17 +00:00
selected_call_fwd = gtk_clist_get_row_data ( GTK_CLIST ( clist_lcl ) , row ) ;
2005-02-01 12:12:35 +00:00
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
if ( selected_call_fwd = = NULL )
return ;
2007-10-08 00:31:26 +00:00
selected_call_fwd - > selected = TRUE ;
/* count the selected calls */
calls_ns = 0 ;
2008-01-09 08:34:58 +00:00
list = g_list_first ( voip_calls_get_info ( ) - > callsinfo_list ) ;
2007-10-08 00:31:26 +00:00
while ( list ) {
listinfo = list - > data ;
if ( listinfo - > selected ) {
calls_ns + + ;
}
list = g_list_next ( list ) ;
}
2005-02-01 12:12:35 +00:00
2006-03-09 07:07:35 +00:00
g_snprintf ( label_text , 80 ,
2005-02-01 12:12:35 +00:00
" Detected %d VoIP %s. Selected %d %s. " ,
calls_nb ,
plurality ( calls_nb , " Call " , " Calls " ) ,
calls_ns ,
plurality ( calls_ns , " Call " , " Calls " ) ) ;
2009-02-26 21:11:06 +00:00
gtk_label_set_text ( GTK_LABEL ( top_label ) , label_text ) ;
2005-02-01 12:12:35 +00:00
2007-10-08 00:31:26 +00:00
if ( calls_ns > 0 ) {
gtk_widget_set_sensitive ( bt_filter , TRUE ) ;
gtk_widget_set_sensitive ( bt_graph , TRUE ) ;
# ifdef HAVE_LIBPORTAUDIO
gtk_widget_set_sensitive ( bt_player , TRUE ) ;
# endif /* HAVE_LIBPORTAUDIO */
} else {
gtk_widget_set_sensitive ( bt_filter , FALSE ) ;
gtk_widget_set_sensitive ( bt_graph , FALSE ) ;
# ifdef HAVE_LIBPORTAUDIO
gtk_widget_set_sensitive ( bt_player , FALSE ) ;
# endif /* HAVE_LIBPORTAUDIO */
}
/* TODO: activate other buttons when implemented */
}
/****************************************************************************/
/* when the user selects a row in the calls list */
static void
2010-02-01 16:22:17 +00:00
voip_calls_on_unselect_row ( GtkCList * clist_lcl ,
gint row _U_ ,
gint column _U_ ,
GdkEventButton * event _U_ ,
gpointer user_data _U_ )
2007-10-08 00:31:26 +00:00
{
gchar label_text [ 80 ] ;
GList * list ;
voip_calls_info_t * listinfo ;
2010-02-01 16:22:17 +00:00
selected_call_fwd = gtk_clist_get_row_data ( GTK_CLIST ( clist_lcl ) , row ) ;
2007-10-08 00:31:26 +00:00
if ( selected_call_fwd = = NULL )
return ;
selected_call_fwd - > selected = FALSE ;
/* count the selected calls */
calls_ns = 0 ;
2008-01-09 08:34:58 +00:00
list = g_list_first ( voip_calls_get_info ( ) - > callsinfo_list ) ;
2007-10-08 00:31:26 +00:00
while ( list ) {
listinfo = list - > data ;
if ( listinfo - > selected ) {
calls_ns + + ;
}
list = g_list_next ( list ) ;
}
g_snprintf ( label_text , 80 ,
" Detected %d VoIP %s. Selected %d %s. " ,
calls_nb ,
plurality ( calls_nb , " Call " , " Calls " ) ,
calls_ns ,
plurality ( calls_ns , " Call " , " Calls " ) ) ;
2009-02-26 21:11:06 +00:00
gtk_label_set_text ( GTK_LABEL ( top_label ) , label_text ) ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
if ( calls_ns > 0 ) {
gtk_widget_set_sensitive ( bt_filter , TRUE ) ;
gtk_widget_set_sensitive ( bt_graph , TRUE ) ;
2006-08-30 21:51:31 +00:00
# ifdef HAVE_LIBPORTAUDIO
gtk_widget_set_sensitive ( bt_player , TRUE ) ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
} else {
gtk_widget_set_sensitive ( bt_filter , FALSE ) ;
gtk_widget_set_sensitive ( bt_graph , FALSE ) ;
2006-10-20 20:05:27 +00:00
# ifdef HAVE_LIBPORTAUDIO
2006-08-30 21:51:31 +00:00
gtk_widget_set_sensitive ( bt_player , FALSE ) ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
}
2005-02-01 12:12:35 +00:00
/* TODO: activate other buttons when implemented */
}
2007-10-08 00:31:26 +00:00
2005-02-01 12:12:35 +00:00
/****************************************************************************/
typedef struct column_arrows {
GtkWidget * table ;
GtkWidget * ascend_pm ;
GtkWidget * descend_pm ;
} column_arrows ;
/****************************************************************************/
static void
2010-02-01 16:22:17 +00:00
voip_calls_click_column_cb ( GtkCList * clist_lcl , gint column , gpointer data )
2005-02-01 12:12:35 +00:00
{
column_arrows * col_arrows = ( column_arrows * ) data ;
int i ;
2010-02-01 16:22:17 +00:00
gtk_clist_freeze ( clist_lcl ) ;
2005-02-01 12:12:35 +00:00
for ( i = 0 ; i < NUM_COLS ; i + + ) {
gtk_widget_hide ( col_arrows [ i ] . ascend_pm ) ;
gtk_widget_hide ( col_arrows [ i ] . descend_pm ) ;
}
2010-02-01 16:22:17 +00:00
if ( column = = clist_lcl - > sort_column ) {
if ( clist_lcl - > sort_type = = GTK_SORT_ASCENDING ) {
clist_lcl - > sort_type = GTK_SORT_DESCENDING ;
2005-02-01 12:12:35 +00:00
gtk_widget_show ( col_arrows [ column ] . descend_pm ) ;
} else {
2010-02-01 16:22:17 +00:00
clist_lcl - > sort_type = GTK_SORT_ASCENDING ;
2005-02-01 12:12:35 +00:00
gtk_widget_show ( col_arrows [ column ] . ascend_pm ) ;
}
} else {
2010-02-01 16:22:17 +00:00
clist_lcl - > sort_type = GTK_SORT_ASCENDING ;
2005-02-01 12:12:35 +00:00
gtk_widget_show ( col_arrows [ column ] . ascend_pm ) ;
2010-02-01 16:22:17 +00:00
gtk_clist_set_sort_column ( clist_lcl , column ) ;
2005-02-01 12:12:35 +00:00
}
2010-02-01 16:22:17 +00:00
gtk_clist_thaw ( clist_lcl ) ;
2005-02-01 12:12:35 +00:00
2010-02-01 16:22:17 +00:00
gtk_clist_sort ( clist_lcl ) ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
static gint
2010-02-01 16:22:17 +00:00
voip_calls_sort_column ( GtkCList * clist_lcl , gconstpointer ptr1 , gconstpointer ptr2 )
2005-02-01 12:12:35 +00:00
{
char * text1 = NULL ;
char * text2 = NULL ;
2005-11-22 12:51:14 +00:00
guint i1 , i2 , i3 , i4 ;
2005-02-01 12:12:35 +00:00
const GtkCListRow * row1 = ( const GtkCListRow * ) ptr1 ;
const GtkCListRow * row2 = ( const GtkCListRow * ) ptr2 ;
2010-02-01 16:22:17 +00:00
text1 = GTK_CELL_TEXT ( row1 - > cell [ clist_lcl - > sort_column ] ) - > text ;
text2 = GTK_CELL_TEXT ( row2 - > cell [ clist_lcl - > sort_column ] ) - > text ;
2005-02-01 12:12:35 +00:00
2010-02-01 16:22:17 +00:00
switch ( clist_lcl - > sort_column ) {
2006-10-20 18:36:42 +00:00
case CALL_COL_START_TIME :
case CALL_COL_STOP_TIME :
2005-03-07 11:01:16 +00:00
if ( ( sscanf ( text1 , " %u.%u " , & i1 , & i2 ) ! = 2 ) | |
( sscanf ( text2 , " %u.%u " , & i3 , & i4 ) ! = 2 ) ) {
return 0 ;
}
if ( i1 > i3 )
return 1 ;
if ( i1 < i3 )
return - 1 ;
return ( i3 - i4 ) ;
2006-10-20 18:36:42 +00:00
case CALL_COL_INITIAL_SPEAKER :
case CALL_COL_FROM :
case CALL_COL_TO :
case CALL_COL_PROTOCOL :
case CALL_COL_STATE :
case CALL_COL_COMMENTS :
2005-02-01 12:12:35 +00:00
return strcmp ( text1 , text2 ) ;
2006-10-20 18:36:42 +00:00
case CALL_COL_PACKETS :
2005-02-01 12:12:35 +00:00
i1 = atoi ( text1 ) ;
i2 = atoi ( text2 ) ;
return i1 - i2 ;
}
g_assert_not_reached ( ) ;
return 0 ;
}
2010-02-19 19:00:06 +00:00
#if 0
Start of converting the clist to a gtk_list_store
/* Create list */
static
GtkWidget * create_list ( void )
{
GtkListStore * list_store ;
GtkWidget * list ;
GtkTreeViewColumn * column ;
GtkCellRenderer * renderer ;
GtkTreeSortable * sortable ;
2010-02-19 19:50:23 +00:00
GtkTreeView * list_view ;
GtkTreeSelection * selection ;
/* Create the store */
list_store = gtk_list_store_new ( NUM_COLS , /* Total number of columns XXX */
G_TYPE_STRING , /* Start Time */
G_TYPE_STRING , /* Stop Time */
G_TYPE_STRING , /* Initial Speaker */
G_TYPE_STRING , /* From */
G_TYPE_STRING , /* To */
G_TYPE_STRING , /* Protocol */
G_TYPE_STRING , /* Packets */
G_TYPE_STRING , /* State */
G_TYPE_STRING , /* Comments */
G_TYPE_POINTER , /* Data */
G_TYPE_STRING , /* Foreground color */
G_TYPE_STRING ) ; /* Background color */
2010-02-19 19:00:06 +00:00
/* Create a view */
list = gtk_tree_view_new_with_model ( GTK_TREE_MODEL ( list_store ) ) ;
2010-02-19 19:50:23 +00:00
list_view = GTK_TREE_VIEW ( list ) ;
sortable = GTK_TREE_SORTABLE ( list_store ) ;
2010-02-19 19:00:06 +00:00
# if GTK_CHECK_VERSION(2,6,0)
2010-02-19 19:50:23 +00:00
/* Speed up the list display */
gtk_tree_view_set_fixed_height_mode ( list_view , TRUE ) ;
2010-02-19 19:00:06 +00:00
# endif
2005-02-01 12:12:35 +00:00
2010-02-19 19:00:06 +00:00
/* Setup the sortable columns */
gtk_tree_sortable_set_sort_column_id ( sortable , CALL_COL_START_TIME , GTK_SORT_ASCENDING ) ;
gtk_tree_view_set_headers_clickable ( list_view , FALSE ) ;
/* The view now holds a reference. We can get rid of our own reference */
g_object_unref ( G_OBJECT ( list_store ) ) ;
/*
2010-02-19 19:50:23 +00:00
* Create the first column packet , associating the " text " attribute of the
2010-02-19 19:00:06 +00:00
* cell_renderer to the first column of the model
2010-02-19 19:50:23 +00:00
*/
2010-02-19 19:00:06 +00:00
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Start Time " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_START_TIME ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_START_TIME ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 60 ) ;
2010-02-19 19:50:23 +00:00
gtk_tree_view_column_set_fixed_width ( column , 80 ) ;
/* Add the column to the view. */
2010-02-19 19:00:06 +00:00
gtk_tree_view_append_column ( list_view , column ) ;
/* Stop Time */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Stop Time " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_STOP_TIME ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_STOP_TIME ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 60 ) ;
2010-02-19 19:50:23 +00:00
gtk_tree_view_column_set_fixed_width ( column , 80 ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_append_column ( list_view , column ) ;
/* Initial Speaker */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Initial Speaker " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_INITIAL_SPEAKER ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_INITIAL_SPEAKER ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 80 ) ;
2010-02-19 19:50:23 +00:00
gtk_tree_view_column_set_fixed_width ( column , 90 ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_append_column ( list_view , column ) ;
/* From */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " From " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_FROM ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_FROM ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 130 ) ;
2010-02-19 19:50:23 +00:00
gtk_tree_view_column_set_fixed_width ( column , 140 ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_append_column ( list_view , column ) ;
/* To */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " To " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_TO ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_TO ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 130 ) ;
2010-02-19 19:50:23 +00:00
gtk_tree_view_column_set_fixed_width ( column , 140 ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_append_column ( list_view , column ) ;
/* Protocol */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Protocol " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_PROTOCOL ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_PROTOCOL ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 50 ) ;
gtk_tree_view_append_column ( list_view , column ) ;
/* Packets */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Packets " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_PACKETS ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_PACKETS ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 70 ) ;
gtk_tree_view_append_column ( list_view , column ) ;
/* State */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " State " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_STATE ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_STATE ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 60 ) ;
2010-02-19 19:50:23 +00:00
gtk_tree_view_column_set_fixed_width ( column , 70 ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_append_column ( list_view , column ) ;
/* Comments */
renderer = gtk_cell_renderer_text_new ( ) ;
column = gtk_tree_view_column_new_with_attributes ( " Comments " , renderer ,
2010-02-19 19:50:23 +00:00
" text " , CALL_COL_COMMENTS ,
2010-02-19 19:00:06 +00:00
" foreground-gdk " , FOREGROUND_COLOR_COL ,
" background-gdk " , BACKGROUND_COLOR_COL ,
2010-02-19 19:50:23 +00:00
NULL ) ;
2010-02-19 19:00:06 +00:00
gtk_tree_view_column_set_sort_column_id ( column , CALL_COL_COMMENTS ) ;
gtk_tree_view_column_set_resizable ( column , TRUE ) ;
gtk_tree_view_column_set_sizing ( column , GTK_TREE_VIEW_COLUMN_FIXED ) ;
gtk_tree_view_column_set_min_width ( column , 100 ) ;
gtk_tree_view_append_column ( list_view , column ) ;
/* Now enable the sorting of each column */
gtk_tree_view_set_rules_hint ( GTK_TREE_VIEW ( list_view ) , TRUE ) ;
gtk_tree_view_set_headers_clickable ( GTK_TREE_VIEW ( list_view ) , TRUE ) ;
2010-02-19 19:50:23 +00:00
/* Setup the selection handler */
selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( list ) ) ;
gtk_tree_selection_set_mode ( selection , GTK_SELECTION_SINGLE ) ;
2010-02-19 19:00:06 +00:00
2010-02-19 19:50:23 +00:00
#if 0
g_signal_connect ( G_OBJECT ( selection ) , " changed " , /* select_row */
G_CALLBACK ( voip_calls_click_column_cb ) ,
NULL ) ;
# endif
return list ;
2010-02-19 19:00:06 +00:00
}
# endif
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/* INTERFACE */
/****************************************************************************/
static void voip_calls_dlg_create ( void )
{
GtkWidget * voip_calls_dlg_w ;
GtkWidget * main_vb ;
GtkWidget * scrolledwindow ;
GtkWidget * hbuttonbox ;
GtkWidget * bt_close ;
2007-10-08 00:31:26 +00:00
GtkWidget * bt_select_all ;
2005-02-01 12:12:35 +00:00
GtkTooltips * tooltips = gtk_tooltips_new ( ) ;
2007-10-08 00:31:26 +00:00
const gchar * title_name_ptr ;
gchar * win_name ;
2005-02-01 12:12:35 +00:00
2005-08-06 14:03:14 +00:00
const gchar * titles [ NUM_COLS ] = { " Start Time " , " Stop Time " , " Initial Speaker " , " From " , " To " , " Protocol " , " Packets " , " State " , " Comments " } ;
2005-02-01 12:12:35 +00:00
column_arrows * col_arrows ;
GtkWidget * column_lb ;
int i ;
2007-10-08 00:31:26 +00:00
title_name_ptr = cf_get_display_name ( & cfile ) ;
win_name = g_strdup_printf ( " %s - VoIP Calls " , title_name_ptr ) ;
2009-06-22 15:22:37 +00:00
voip_calls_dlg_w = dlg_window_new ( win_name ) ; /* transient_for top_level */
gtk_window_set_destroy_with_parent ( GTK_WINDOW ( voip_calls_dlg_w ) , TRUE ) ;
2005-02-01 12:12:35 +00:00
gtk_window_set_default_size ( GTK_WINDOW ( voip_calls_dlg_w ) , 840 , 350 ) ;
main_vb = gtk_vbox_new ( FALSE , 0 ) ;
gtk_container_add ( GTK_CONTAINER ( voip_calls_dlg_w ) , main_vb ) ;
gtk_container_set_border_width ( GTK_CONTAINER ( main_vb ) , 12 ) ;
top_label = gtk_label_new ( " Detected 0 VoIP Calls. Selected 0 Calls. " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , top_label , FALSE , FALSE , 8 ) ;
scrolledwindow = scrolled_window_new ( NULL , NULL ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , scrolledwindow , TRUE , TRUE , 0 ) ;
clist = gtk_clist_new ( NUM_COLS ) ;
2007-10-08 00:31:26 +00:00
gtk_clist_set_selection_mode ( GTK_CLIST ( clist ) , GTK_SELECTION_MULTIPLE ) ;
2005-02-01 12:12:35 +00:00
gtk_container_add ( GTK_CONTAINER ( scrolledwindow ) , clist ) ;
2006-10-20 18:36:42 +00:00
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_START_TIME , 60 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_STOP_TIME , 60 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_INITIAL_SPEAKER , 80 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_FROM , 130 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_TO , 130 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_PROTOCOL , 50 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_PACKETS , 45 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_STATE , 60 ) ;
gtk_clist_set_column_width ( GTK_CLIST ( clist ) , CALL_COL_COMMENTS , 100 ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_START_TIME , GTK_JUSTIFY_LEFT ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_STOP_TIME , GTK_JUSTIFY_LEFT ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_INITIAL_SPEAKER , GTK_JUSTIFY_LEFT ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_FROM , GTK_JUSTIFY_LEFT ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_TO , GTK_JUSTIFY_LEFT ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_PROTOCOL , GTK_JUSTIFY_CENTER ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_PACKETS , GTK_JUSTIFY_CENTER ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_STATE , GTK_JUSTIFY_LEFT ) ;
gtk_clist_set_column_justification ( GTK_CLIST ( clist ) , CALL_COL_COMMENTS , GTK_JUSTIFY_LEFT ) ;
2005-02-01 12:12:35 +00:00
gtk_clist_column_titles_show ( GTK_CLIST ( clist ) ) ;
gtk_clist_set_compare_func ( GTK_CLIST ( clist ) , voip_calls_sort_column ) ;
gtk_clist_set_sort_column ( GTK_CLIST ( clist ) , 0 ) ;
gtk_clist_set_sort_type ( GTK_CLIST ( clist ) , GTK_SORT_ASCENDING ) ;
gtk_widget_show ( voip_calls_dlg_w ) ;
/* sort by column feature */
col_arrows = ( column_arrows * ) g_malloc ( sizeof ( column_arrows ) * NUM_COLS ) ;
for ( i = 0 ; i < NUM_COLS ; i + + ) {
col_arrows [ i ] . table = gtk_table_new ( 2 , 2 , FALSE ) ;
gtk_table_set_col_spacings ( GTK_TABLE ( col_arrows [ i ] . table ) , 5 ) ;
column_lb = gtk_label_new ( titles [ i ] ) ;
gtk_table_attach ( GTK_TABLE ( col_arrows [ i ] . table ) , column_lb , 0 , 1 , 0 , 2 , GTK_SHRINK , GTK_SHRINK , 0 , 0 ) ;
gtk_widget_show ( column_lb ) ;
col_arrows [ i ] . ascend_pm = xpm_to_widget ( clist_ascend_xpm ) ;
gtk_table_attach ( GTK_TABLE ( col_arrows [ i ] . table ) , col_arrows [ i ] . ascend_pm , 1 , 2 , 1 , 2 , GTK_SHRINK , GTK_SHRINK , 0 , 0 ) ;
col_arrows [ i ] . descend_pm = xpm_to_widget ( clist_descend_xpm ) ;
gtk_table_attach ( GTK_TABLE ( col_arrows [ i ] . table ) , col_arrows [ i ] . descend_pm , 1 , 2 , 0 , 1 , GTK_SHRINK , GTK_SHRINK , 0 , 0 ) ;
/* make start time be the default sort order */
if ( i = = 0 ) {
gtk_widget_show ( col_arrows [ i ] . ascend_pm ) ;
}
gtk_clist_set_column_widget ( GTK_CLIST ( clist ) , i , col_arrows [ i ] . table ) ;
gtk_widget_show ( col_arrows [ i ] . table ) ;
}
2008-04-11 23:16:06 +00:00
g_signal_connect ( clist , " click-column " , G_CALLBACK ( voip_calls_click_column_cb ) , col_arrows ) ;
2005-02-01 12:12:35 +00:00
2007-10-08 00:31:26 +00:00
/* label_fwd = gtk_label_new (FWD_LABEL_TEXT);
2005-02-01 12:12:35 +00:00
gtk_box_pack_start ( GTK_BOX ( main_vb ) , label_fwd , FALSE , FALSE , 0 ) ;
2007-10-08 00:31:26 +00:00
*/
2005-02-01 12:12:35 +00:00
status_label = gtk_label_new ( " Total: Calls: 0 Start packets: 0 Completed calls: 0 Rejected calls: 0 " ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , status_label , FALSE , FALSE , 8 ) ;
/* button row */
hbuttonbox = gtk_hbutton_box_new ( ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , hbuttonbox , FALSE , FALSE , 0 ) ;
gtk_button_box_set_layout ( GTK_BUTTON_BOX ( hbuttonbox ) , GTK_BUTTONBOX_SPREAD ) ;
2008-07-08 02:43:40 +00:00
gtk_box_set_spacing ( GTK_BOX ( hbuttonbox ) , 30 ) ;
2005-02-01 12:12:35 +00:00
/*bt_unselect = gtk_button_new_with_label ("Unselect");
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_unselect ) ;
gtk_tooltips_set_tip ( tooltips , bt_unselect , " Unselect this conversation " , NULL ) ; */
2009-11-15 20:13:08 +00:00
bt_filter = gtk_button_new_from_stock ( WIRESHARK_STOCK_PREPARE_FILTER ) ;
2005-02-01 12:12:35 +00:00
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_filter ) ;
gtk_tooltips_set_tip ( tooltips , bt_filter , " Prepare a display filter of the selected conversation " , NULL ) ;
2009-11-15 20:13:08 +00:00
bt_graph = gtk_button_new_from_stock ( WIRESHARK_STOCK_VOIP_FLOW ) ;
2005-02-01 12:12:35 +00:00
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_graph ) ;
2005-06-27 06:20:23 +00:00
gtk_widget_show ( bt_graph ) ;
2008-04-11 23:16:06 +00:00
g_signal_connect ( bt_graph , " clicked " , G_CALLBACK ( on_graph_bt_clicked ) , NULL ) ;
2005-02-22 07:31:19 +00:00
gtk_tooltips_set_tip ( tooltips , bt_graph , " Show a flow graph of the selected calls. " , NULL ) ;
2005-02-01 12:12:35 +00:00
2006-10-20 20:05:27 +00:00
# ifdef HAVE_LIBPORTAUDIO
2009-11-15 20:13:08 +00:00
bt_player = gtk_button_new_from_stock ( WIRESHARK_STOCK_AUDIO_PLAYER ) ;
2006-08-30 21:51:31 +00:00
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_player ) ;
gtk_widget_show ( bt_player ) ;
2008-04-11 23:16:06 +00:00
g_signal_connect ( bt_player , " clicked " , G_CALLBACK ( on_player_bt_clicked ) , NULL ) ;
2006-08-30 21:51:31 +00:00
gtk_tooltips_set_tip ( tooltips , bt_player , " Launch the RTP player to listen the selected calls. " , NULL ) ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2006-08-30 21:51:31 +00:00
2009-11-16 05:23:12 +00:00
# if GTK_CHECK_VERSION(2,10,0)
bt_select_all = gtk_button_new_from_stock ( GTK_STOCK_SELECT_ALL ) ;
# else
bt_select_all = gtk_button_new_with_label ( " Select All " ) ;
# endif
2007-10-08 00:31:26 +00:00
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_select_all ) ;
GTK_WIDGET_SET_FLAGS ( bt_select_all , GTK_CAN_DEFAULT ) ;
gtk_tooltips_set_tip ( tooltips , bt_select_all , " Select all the calls " , NULL ) ;
2008-04-11 18:58:19 +00:00
bt_close = gtk_button_new_from_stock ( GTK_STOCK_CLOSE ) ;
2005-02-01 12:12:35 +00:00
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_close ) ;
GTK_WIDGET_SET_FLAGS ( bt_close , GTK_CAN_DEFAULT ) ;
gtk_tooltips_set_tip ( tooltips , bt_close , " Close this dialog " , NULL ) ;
2008-04-11 23:16:06 +00:00
g_signal_connect ( clist , " select_row " , G_CALLBACK ( voip_calls_on_select_row ) , NULL ) ;
g_signal_connect ( clist , " unselect_row " , G_CALLBACK ( voip_calls_on_unselect_row ) , NULL ) ;
/*g_signal_connect(bt_unselect, "clicked", G_CALLBACK(voip_calls_on_unselect), NULL);*/
g_signal_connect ( bt_filter , " clicked " , G_CALLBACK ( voip_calls_on_filter ) , NULL ) ;
2005-02-01 12:12:35 +00:00
window_set_cancel_button ( voip_calls_dlg_w , bt_close , window_cancel_button_cb ) ;
2008-04-11 23:16:06 +00:00
g_signal_connect ( voip_calls_dlg_w , " delete_event " , G_CALLBACK ( window_delete_event_cb ) , NULL ) ;
g_signal_connect ( voip_calls_dlg_w , " destroy " , G_CALLBACK ( voip_calls_on_destroy ) , NULL ) ;
g_signal_connect ( bt_select_all , " clicked " , G_CALLBACK ( voip_calls_on_select_all ) , NULL ) ;
2005-02-01 12:12:35 +00:00
gtk_widget_show_all ( voip_calls_dlg_w ) ;
window_present ( voip_calls_dlg_w ) ;
voip_calls_on_unselect ( NULL , NULL ) ;
voip_calls_dlg = voip_calls_dlg_w ;
2007-10-08 00:31:26 +00:00
g_free ( win_name ) ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
/* PUBLIC */
/****************************************************************************/
/****************************************************************************/
/* update the contents of the dialog box clist */
/* list: pointer to list of voip_calls_info_t* */
void voip_calls_dlg_update ( GList * list )
{
gchar label_text [ 256 ] ;
if ( voip_calls_dlg ! = NULL ) {
calls_nb = 0 ;
calls_ns = 0 ;
2006-10-20 18:36:42 +00:00
g_snprintf ( label_text , 256 ,
" Total: Calls: %d Start packets: %d Completed calls: %d Rejected calls: %d " ,
2008-01-09 08:34:58 +00:00
g_list_length ( voip_calls_get_info ( ) - > callsinfo_list ) ,
2006-10-20 18:36:42 +00:00
voip_calls_get_info ( ) - > start_packets ,
voip_calls_get_info ( ) - > completed_calls ,
voip_calls_get_info ( ) - > rejected_calls ) ;
2009-02-26 21:11:06 +00:00
gtk_label_set_text ( GTK_LABEL ( status_label ) , label_text ) ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
gtk_clist_freeze ( GTK_CLIST ( clist ) ) ;
gtk_clist_clear ( GTK_CLIST ( clist ) ) ;
2005-02-01 12:12:35 +00:00
list = g_list_first ( list ) ;
while ( list )
{
add_to_clist ( ( voip_calls_info_t * ) ( list - > data ) ) ;
list = g_list_next ( list ) ;
}
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
gtk_clist_thaw ( GTK_CLIST ( clist ) ) ;
2005-02-01 12:12:35 +00:00
g_snprintf ( label_text , 256 ,
" Detected %d VoIP %s. Selected %d %s. " ,
calls_nb ,
plurality ( calls_nb , " Call " , " Calls " ) ,
calls_ns ,
plurality ( calls_ns , " Call " , " Calls " ) ) ;
2009-02-26 21:11:06 +00:00
gtk_label_set_text ( GTK_LABEL ( top_label ) , label_text ) ;
2005-02-01 12:12:35 +00:00
}
last_list = list ;
}
/****************************************************************************/
2005-02-02 01:02:09 +00:00
/* draw function for tap listeners to keep the window up to date */
void voip_calls_dlg_draw ( void * ptr _U_ )
2005-02-01 12:12:35 +00:00
{
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
if ( voip_calls_get_info ( ) - > redraw ) {
2008-01-09 08:34:58 +00:00
voip_calls_dlg_update ( voip_calls_get_info ( ) - > callsinfo_list ) ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
voip_calls_get_info ( ) - > redraw = FALSE ;
}
2005-02-02 01:02:09 +00:00
}
/* reset function for tap listeners to clear window, if necessary */
void voip_calls_dlg_reset ( void * ptr _U_ )
{
/* Clean up memory used by calls tap */
voip_calls_reset ( ( voip_calls_tapinfo_t * ) voip_calls_get_info ( ) ) ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
/* close the graph window if open */
2007-03-18 23:15:19 +00:00
if ( graph_analysis_data & & graph_analysis_data - > dlg . window ! = NULL ) {
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
window_cancel_button_cb ( NULL , graph_analysis_data - > dlg . window ) ;
graph_analysis_data - > dlg . window = NULL ;
}
2005-02-01 12:12:35 +00:00
}
/* init function for tap */
2006-01-15 15:01:14 +00:00
/* Made extern only for "Fax T38 Analysis..." */
void
2006-02-11 13:05:24 +00:00
voip_calls_init_tap ( const char * dummy _U_ , void * userdata _U_ )
2005-02-01 12:12:35 +00:00
{
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
gint c ;
gchar * data [ NUM_COLS ] ;
gchar field [ NUM_COLS ] [ 50 ] ;
if ( graph_analysis_data = = NULL ) {
graph_analysis_data_init ( ) ;
/* init the Graph Analysys */
graph_analysis_data = graph_analysis_init ( ) ;
graph_analysis_data - > graph_info = voip_calls_get_info ( ) - > graph_analysis ;
}
2005-02-01 12:12:35 +00:00
/* Clean up memory used by calls tap */
voip_calls_reset ( ( voip_calls_tapinfo_t * ) voip_calls_get_info ( ) ) ;
/* Register the tap listener */
sip_calls_init_tap ( ) ;
mtp3_calls_init_tap ( ) ;
isup_calls_init_tap ( ) ;
h225_calls_init_tap ( ) ;
h245dg_calls_init_tap ( ) ;
q931_calls_init_tap ( ) ;
2007-03-18 22:14:12 +00:00
h248_calls_init_tap ( ) ;
2007-03-21 00:59:00 +00:00
sccp_calls_init_tap ( ) ;
2005-02-01 12:12:35 +00:00
sdp_calls_init_tap ( ) ;
2007-09-10 07:21:27 +00:00
/* We don't register this tap, if we don't have the unistim plugin loaded.*/
if ( find_tap_id ( " unistim " ) ) {
unistim_calls_init_tap ( ) ;
}
2007-10-24 08:30:46 +00:00
if ( find_tap_id ( " voip " ) ) {
VoIPcalls_init_tap ( ) ;
}
2005-02-05 11:07:21 +00:00
rtp_init_tap ( ) ;
2005-03-10 19:32:22 +00:00
rtp_event_init_tap ( ) ;
2008-11-25 06:41:15 +00:00
mgcp_calls_init_tap ( ) ;
2005-06-27 06:20:23 +00:00
actrace_calls_init_tap ( ) ;
2006-01-15 15:01:14 +00:00
t38_init_tap ( ) ;
2009-01-30 21:25:52 +00:00
skinny_calls_init_tap ( ) ;
2009-03-11 06:43:46 +00:00
iax2_calls_init_tap ( ) ;
2005-02-01 12:12:35 +00:00
2005-02-02 01:02:09 +00:00
/* create dialog box if necessary */
if ( voip_calls_dlg = = NULL ) {
voip_calls_dlg_create ( ) ;
} else {
/* There's already a dialog box; reactivate it. */
reactivate_window ( voip_calls_dlg ) ;
}
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
voip_calls_get_info ( ) - > redraw = TRUE ;
voip_calls_dlg_draw ( NULL ) ;
voip_calls_get_info ( ) - > redraw = TRUE ;
for ( c = 0 ; c < NUM_COLS ; c + + ) {
data [ c ] = & field [ c ] [ 0 ] ;
2005-07-07 04:05:01 +00:00
field [ c ] [ 0 ] = ' \0 ' ;
From Alejandro Vaquero
- avoid the clist of the calls dlg to be refreshed multiple times when
first appear.
- destroy the Graph window when the data is not valid anymore.
- fixes an H245 packet count error
- resizing the Graph windows when is displayed (up to 5 columns).
With a change to leave static voip_calls_tapinfo_t the_tapinfo_struct =
{0, NULL, 0, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0};
alone.
svn path=/trunk/; revision=14852
2005-07-05 05:16:28 +00:00
}
g_snprintf ( field [ 3 ] , 50 , " Please wait... " ) ;
gtk_clist_append ( GTK_CLIST ( clist ) , data ) ;
2005-02-02 01:02:09 +00:00
2005-02-01 12:12:35 +00:00
/* Scan for VoIP calls calls (redissect all packets) */
2009-06-05 22:42:47 +00:00
cf_retap_packets ( & cfile ) ;
2008-10-13 18:59:21 +00:00
gdk_window_raise ( voip_calls_dlg - > window ) ;
2005-02-01 12:12:35 +00:00
/* Tap listener will be removed and cleaned up in voip_calls_on_destroy */
}
/****************************************************************************/
/* entry point when called via the GTK menu */
2005-08-20 14:02:00 +00:00
static void voip_calls_launch ( GtkWidget * w _U_ , gpointer data _U_ )
2005-02-01 12:12:35 +00:00
{
2006-02-11 13:05:24 +00:00
voip_calls_init_tap ( " " , NULL ) ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
void
register_tap_listener_voip_calls_dlg ( void )
{
2006-02-11 13:05:24 +00:00
register_stat_cmd_arg ( " voip,calls " , voip_calls_init_tap , NULL ) ;
2009-11-15 20:13:08 +00:00
/*register_stat_menu_item("_VoIP Calls", REGISTER_STAT_GROUP_TELEPHONY,
voip_calls_launch , NULL , NULL , NULL ) ; */
register_stat_menu_item_stock ( " _VoIP Calls... " ,
REGISTER_STAT_GROUP_TELEPHONY , WIRESHARK_STOCK_TELEPHONE ,
voip_calls_launch , NULL , NULL , NULL ) ;
2005-02-01 12:12:35 +00:00
}