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
2012-06-28 22:56:06 +00:00
* Foundation , Inc . , 51 Franklin Street , Fifth Floor , Boston , MA 02110 - 1301 USA .
2005-02-01 12:12:35 +00:00
*/
2012-09-20 01:48:30 +00:00
# include "config.h"
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>
2012-01-15 21:59:11 +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>
2013-11-17 02:55:14 +00:00
# include "wsutil/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 "../globals.h"
2005-08-21 09:48:27 +00:00
# include "../stat_menu.h"
2008-04-13 03:32:24 +00:00
2012-01-15 21:59:11 +00:00
# include "ui/gtk/graph_analysis.h"
# include "ui/gtk/voip_calls_dlg.h"
# include "ui/gtk/voip_calls.h"
# include "ui/gtk/gui_stat_menu.h"
# include "ui/gtk/dlg_utils.h"
# include "ui/gtk/gui_utils.h"
# include "ui/gtk/gtkglobals.h"
# include "ui/gtk/stock_icons.h"
2005-02-01 12:12:35 +00:00
2006-09-05 07:58:14 +00:00
# ifdef HAVE_LIBPORTAUDIO
2013-10-24 23:47:30 +00:00
# include "ui/rtp_analysis.h"
2012-01-15 21:59:11 +00:00
# include "ui/gtk/rtp_player.h"
2006-09-05 07:58:14 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2012-01-15 21:59:11 +00:00
# include "ui/gtk/old-gtk-compat.h"
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/* pointer to the one and only dialog window */
static GtkWidget * voip_calls_dlg = NULL ;
2010-07-22 18:44:11 +00:00
static GtkListStore * list_store = NULL ;
2010-03-19 22:06:48 +00:00
static GtkTreeIter list_iter ;
2010-07-22 18:44:11 +00:00
static GtkWidget * list = NULL ;
2010-03-19 22:06:48 +00:00
2010-07-22 18:44:11 +00:00
static GtkWidget * top_label = NULL ;
static GtkWidget * status_label = NULL ;
2005-02-01 12:12:35 +00:00
2010-07-22 18:44:11 +00:00
/*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
2010-07-22 18:44:11 +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 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
{
2010-07-22 18:44:11 +00:00
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_DATA ,
NUM_COLS /* The number of columns */
2010-02-19 19:00:06 +00:00
} ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +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 ( ) ;
2010-03-19 22:06:48 +00:00
if ( find_tap_id ( " unistim " ) ) { /* The plugin may be missing */
2007-09-10 07:21:27 +00:00
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 ( ) ;
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 ( ) ;
2010-09-01 19:42:59 +00:00
remove_tap_listener_t38 ( ) ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
/* CALLBACKS */
/****************************************************************************/
static void
2011-08-04 22:56:36 +00:00
voip_calls_on_destroy ( GObject * object _U_ , gpointer user_data _U_ )
2005-02-01 12:12:35 +00:00
{
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
2010-03-19 22:06:48 +00:00
/* Clean up graph analysis memory */
g_free ( graph_analysis_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
graph_analysis_data = NULL ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
static void
2010-03-19 22:06:48 +00:00
voip_calls_on_unselect ( GtkButton * button _U_ , gpointer user_data _U_ )
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
2010-03-19 22:06:48 +00:00
voip_calls_on_filter ( GtkButton * button _U_ , gpointer user_data _U_ )
2005-02-01 12:12:35 +00:00
{
2010-03-19 22:06:48 +00:00
gchar * filter_string ;
2005-02-02 08:53:08 +00:00
GString * filter_string_fwd ;
2005-08-06 14:03:14 +00:00
const gchar * filter_prepend ;
2010-03-19 22:06:48 +00:00
gboolean is_first = TRUE ;
2010-03-21 18:13:49 +00:00
GList * lista ;
GList * listb ;
2010-03-19 22:06:48 +00:00
voip_calls_info_t * listinfo ;
2013-10-24 22:52:30 +00:00
seq_analysis_item_t * gai ;
2010-03-19 22:06:48 +00:00
size_t filter_length ;
size_t max_filter_length = 2048 ; /* What's this based on ? */
2009-12-29 19:23:39 +00:00
int pos ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
const sip_calls_info_t * sipinfo ;
const isup_calls_info_t * isupinfo ;
const h323_calls_info_t * h323info ;
const h245_address_t * h245_add = NULL ;
const gcp_ctx_t * ctx ;
2005-02-24 04:15:40 +00:00
2010-03-19 22:06:48 +00:00
filter_string = g_strdup ( gtk_entry_get_text ( GTK_ENTRY ( main_display_filter_widget ) ) ) ;
2010-03-19 22:38:17 +00:00
filter_length = strlen ( filter_string ) ;
pos = ( int ) filter_length ; /* we assume the filter won't be more than 2^31-1 octets long */
2010-03-19 22:06:48 +00:00
g_strstrip ( filter_string ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
if ( strlen ( filter_string ) > 0 )
filter_prepend = " or " ;
else
filter_prepend = " " ;
g_free ( filter_string ) ;
2009-12-29 19:23:39 +00:00
2005-02-02 08:53:08 +00:00
filter_string_fwd = g_string_new ( filter_prepend ) ;
2010-03-19 22:06:48 +00:00
2005-02-24 04:15:40 +00:00
/* look in the Graph and get all the frame_num for this call */
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd , " ( " ) ;
/* Build a new filter based on frame numbers */
2010-03-21 18:13:49 +00:00
lista = g_list_first ( voip_calls_get_info ( ) - > callsinfo_list ) ;
while ( lista ) {
2013-03-21 02:58:59 +00:00
listinfo = ( voip_calls_info_t * ) lista - > data ;
2010-03-19 22:06:48 +00:00
if ( listinfo - > selected ) {
2010-03-21 18:13:49 +00:00
listb = g_list_first ( voip_calls_get_info ( ) - > graph_analysis - > list ) ;
while ( listb ) {
2013-10-24 22:52:30 +00:00
gai = ( seq_analysis_item_t * ) listb - > data ;
2010-03-19 22:06:48 +00:00
if ( gai - > conv_num = = listinfo - > call_num ) {
2011-09-13 12:39:11 +00:00
g_string_append_printf ( filter_string_fwd , " %sframe.number == %u " , is_first ? " " : " or " , gai - > fd - > num ) ;
2010-03-19 22:06:48 +00:00
is_first = FALSE ;
}
2010-03-21 18:13:49 +00:00
listb = g_list_next ( listb ) ;
2010-03-19 22:06:48 +00:00
}
}
2010-03-21 18:13:49 +00:00
lista = g_list_next ( lista ) ;
2005-02-01 12:12:35 +00:00
}
2005-02-24 04:15:40 +00:00
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd , " ) " ) ;
filter_length + = filter_string_fwd - > len ;
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 ) ;
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd , " ( " ) ;
is_first = TRUE ;
/* Build a new filter based on protocol fields */
2010-03-21 18:13:49 +00:00
lista = g_list_first ( voip_calls_get_info ( ) - > callsinfo_list ) ;
while ( lista ) {
2013-03-21 02:58:59 +00:00
listinfo = ( voip_calls_info_t * ) lista - > data ;
2010-03-19 22:06:48 +00:00
if ( listinfo - > selected ) {
if ( ! is_first )
g_string_append_printf ( filter_string_fwd , " or " ) ;
switch ( listinfo - > protocol ) {
case VOIP_SIP :
2013-03-21 02:58:59 +00:00
sipinfo = ( sip_calls_info_t * ) listinfo - > prot_info ;
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd ,
" (sip.Call-ID == \" %s \" ) " ,
sipinfo - > call_identifier
) ;
break ;
case VOIP_ISUP :
2013-03-21 02:58:59 +00:00
isupinfo = ( isup_calls_info_t * ) listinfo - > prot_info ;
2010-03-19 22:06:48 +00:00
g_string_append_printf ( 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))) " ,
2011-09-13 05:29:56 +00:00
isupinfo - > cic , listinfo - > start_fd - > num ,
listinfo - > stop_fd - > num ,
2010-03-19 22:06:48 +00:00
isupinfo - > ni , isupinfo - > dpc , isupinfo - > opc ,
isupinfo - > opc , isupinfo - > dpc
) ;
break ;
case VOIP_H323 :
2013-03-21 02:58:59 +00:00
h323info = ( h323_calls_info_t * ) listinfo - > prot_info ;
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd ,
" ((h225.guid == %s || q931.call_ref == %x:%x || q931.call_ref == %x:%x) " ,
2013-12-19 16:28:39 +00:00
guid_to_ep_str ( & h323info - > guid [ 0 ] ) ,
2010-03-19 22:06:48 +00:00
( guint8 ) ( h323info - > q931_crv & 0x00ff ) ,
( guint8 ) ( ( h323info - > q931_crv & 0xff00 ) > > 8 ) ,
( guint8 ) ( h323info - > q931_crv2 & 0x00ff ) ,
( guint8 ) ( ( h323info - > q931_crv2 & 0xff00 ) > > 8 ) ) ;
2010-03-21 18:13:49 +00:00
listb = g_list_first ( h323info - > h245_list ) ;
while ( listb ) {
2013-03-21 02:58:59 +00:00
h245_add = ( h245_address_t * ) listb - > data ;
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd ,
" || (ip.addr == %s && tcp.port == %d && h245) " ,
2010-09-22 16:35:02 +00:00
ip_to_str ( ( guint8 * ) ( h245_add - > h245_address . data ) ) , h245_add - > h245_port ) ;
2010-03-21 18:13:49 +00:00
listb = g_list_next ( listb ) ;
2010-03-19 22:06:48 +00:00
}
g_string_append_printf ( filter_string_fwd , " ) " ) ;
break ;
case TEL_H248 :
2013-03-21 02:58:59 +00:00
ctx = ( gcp_ctx_t * ) listinfo - > prot_info ;
2008-05-06 05:50:31 +00:00
g_string_append_printf ( filter_string_fwd ,
2010-03-19 22:06:48 +00:00
" (h248.ctx == 0x%x) " , ctx - > id ) ;
break ;
default :
/* placeholder to assure valid display filter expression */
g_string_append_printf ( filter_string_fwd ,
" (frame) " ) ;
break ;
2005-03-09 10:12:05 +00:00
}
2010-03-19 22:06:48 +00:00
is_first = FALSE ;
2007-03-18 22:14:12 +00:00
}
2010-03-21 18:13:49 +00:00
lista = g_list_next ( lista ) ;
2005-03-09 10:12:05 +00:00
}
2010-03-19 22:06:48 +00:00
g_string_append_printf ( filter_string_fwd , " ) " ) ;
gtk_editable_insert_text ( GTK_EDITABLE ( main_display_filter_widget ) , filter_string_fwd - > str , - 1 , & pos ) ;
2005-03-09 10:12:05 +00:00
}
2010-03-19 22:06:48 +00:00
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
2010-03-19 22:06:48 +00:00
voip_calls_on_select_all ( GtkButton * button _U_ , gpointer user_data _U_ )
2007-10-08 00:31:26 +00:00
{
2010-03-19 22:06:48 +00:00
GtkTreeSelection * selection = gtk_tree_view_get_selection ( GTK_TREE_VIEW ( list ) ) ;
gtk_tree_selection_select_all ( selection ) ;
2007-10-08 00:31:26 +00:00
}
2005-02-01 12:12:35 +00:00
2012-03-14 09:53:33 +00:00
/* compare two list entries by packet no */
static gint
graph_analysis_sort_compare ( gconstpointer a , gconstpointer b )
{
2013-10-24 22:52:30 +00:00
const seq_analysis_item_t * entry_a = ( const seq_analysis_item_t * ) a ;
const seq_analysis_item_t * entry_b = ( const seq_analysis_item_t * ) b ;
2012-03-14 09:53:33 +00:00
if ( entry_a - > fd - > num < entry_b - > fd - > num )
return - 1 ;
if ( entry_a - > fd - > num > entry_b - > fd - > num )
return 1 ;
return 0 ;
}
2005-02-01 12:12:35 +00:00
/****************************************************************************/
static void
2010-03-19 22:06:48 +00:00
on_graph_bt_clicked ( GtkButton * button _U_ , gpointer user_data _U_ )
2005-02-01 12:12:35 +00:00
{
2013-10-24 22:52:30 +00:00
seq_analysis_item_t * gai ;
2010-03-21 18:13:49 +00:00
GList * lista ;
GList * listb ;
2010-03-19 22:06:48 +00:00
voip_calls_info_t * listinfo ;
2005-02-01 12:12:35 +00:00
2012-02-06 17:23:04 +00:00
if ( ! voip_calls_get_info ( ) - > reversed ) {
voip_calls_get_info ( ) - > callsinfo_list =
g_list_reverse ( voip_calls_get_info ( ) - > callsinfo_list ) ;
voip_calls_get_info ( ) - > graph_analysis - > list =
2012-03-14 09:53:33 +00:00
g_list_sort ( voip_calls_get_info ( ) - > graph_analysis - > list , graph_analysis_sort_compare ) ;
2012-02-06 17:23:04 +00:00
voip_calls_get_info ( ) - > reversed = 1 ;
}
2005-02-01 12:12:35 +00:00
/* reset the "display" parameter in graph analysis */
2010-03-21 18:13:49 +00:00
listb = g_list_first ( voip_calls_get_info ( ) - > graph_analysis - > list ) ;
while ( listb ) {
2013-10-24 22:52:30 +00:00
gai = ( seq_analysis_item_t * ) listb - > data ;
2005-02-01 12:12:35 +00:00
gai - > display = FALSE ;
2010-03-21 18:13:49 +00:00
listb = g_list_next ( listb ) ;
2005-02-01 12:12:35 +00:00
}
/* set the display for selected calls */
2010-03-21 18:13:49 +00:00
lista = g_list_first ( voip_calls_get_info ( ) - > callsinfo_list ) ;
while ( lista ) {
2013-03-21 02:58:59 +00:00
listinfo = ( voip_calls_info_t * ) lista - > data ;
2010-03-19 22:06:48 +00:00
if ( listinfo - > selected ) {
2010-03-21 18:13:49 +00:00
listb = g_list_first ( voip_calls_get_info ( ) - > graph_analysis - > list ) ;
while ( listb ) {
2013-10-24 22:52:30 +00:00
gai = ( seq_analysis_item_t * ) listb - > data ;
2010-03-19 22:06:48 +00:00
if ( gai - > conv_num = = listinfo - > call_num ) {
2005-02-01 12:12:35 +00:00
gai - > display = TRUE ;
}
2010-03-21 18:13:49 +00:00
listb = g_list_next ( listb ) ;
2005-02-01 12:12:35 +00:00
}
}
2010-03-21 18:13:49 +00:00
lista = g_list_next ( lista ) ;
2005-02-01 12:12:35 +00:00
}
/* create or refresh the graph windows */
2010-03-19 22:06:48 +00:00
if ( graph_analysis_data - > dlg . window = = NULL )
graph_analysis_create ( graph_analysis_data ) ; /* create the window */
2005-02-01 12:12:35 +00:00
else
2010-03-19 22:06:48 +00:00
graph_analysis_update ( graph_analysis_data ) ; /* refresh it */
2005-02-01 12:12:35 +00:00
}
2006-08-30 21:51:31 +00:00
/****************************************************************************/
2010-03-19 22:06:48 +00:00
# ifdef HAVE_LIBPORTAUDIO
2006-08-30 21:51:31 +00:00
static void
2010-03-19 22:06:48 +00:00
on_player_bt_clicked ( GtkButton * button _U_ , gpointer user_data _U_ )
2006-08-30 21:51:31 +00:00
{
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 */
2010-03-19 22:06:48 +00:00
static gboolean
voip_calls_mark_selected ( GtkTreeModel * model , GtkTreePath * path _U_ , GtkTreeIter * iter , gpointer data )
2005-02-01 12:12:35 +00:00
{
2010-03-19 22:06:48 +00:00
GtkTreeSelection * selection = ( GtkTreeSelection * ) data ;
voip_calls_info_t * strinfo ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
gtk_tree_model_get ( model , iter , CALL_COL_DATA , & strinfo , - 1 ) ;
strinfo - > selected = gtk_tree_selection_iter_is_selected ( selection , iter ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
return FALSE ;
2007-10-08 00:31:26 +00:00
}
static void
2010-03-19 22:06:48 +00:00
voip_calls_on_select_row_cb ( GtkTreeSelection * selection , gpointer data _U_ )
2007-10-08 00:31:26 +00:00
{
gchar label_text [ 80 ] ;
2010-03-19 22:06:48 +00:00
gtk_tree_model_foreach ( GTK_TREE_MODEL ( list_store ) , voip_calls_mark_selected , selection ) ;
2007-10-08 00:31:26 +00:00
2010-03-19 22:06:48 +00:00
calls_ns = gtk_tree_selection_count_selected_rows ( selection ) ;
2007-10-08 00:31:26 +00:00
g_snprintf ( label_text , 80 ,
2010-03-19 22:06:48 +00:00
" Detected %u VoIP %s. Selected %u %s. " ,
calls_nb ,
plurality ( calls_nb , " Call " , " Calls " ) ,
2007-10-08 00:31:26 +00:00
calls_ns ,
plurality ( calls_ns , " Call " , " Calls " ) ) ;
2010-03-19 22:06:48 +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
2010-03-19 22:06:48 +00:00
gtk_widget_set_sensitive ( bt_filter , calls_ns ? TRUE : FALSE ) ;
gtk_widget_set_sensitive ( bt_graph , calls_ns ? TRUE : FALSE ) ;
2006-08-30 21:51:31 +00:00
# ifdef HAVE_LIBPORTAUDIO
2010-03-19 22:06:48 +00:00
gtk_widget_set_sensitive ( bt_player , calls_ns ? TRUE : FALSE ) ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
2010-03-19 22:06:48 +00:00
/* Tree view constructors */
2005-02-01 12:12:35 +00:00
/****************************************************************************/
2010-03-19 22:06:48 +00:00
/* append a line to list */
2005-02-01 12:12:35 +00:00
static void
2010-03-19 22:06:48 +00:00
add_to_list_store ( voip_calls_info_t * strinfo )
2005-02-01 12:12:35 +00:00
{
2010-03-19 22:06:48 +00:00
gchar field [ NUM_COLS ] [ 50 ] ;
isup_calls_info_t * isupinfo ;
h323_calls_info_t * h323info ;
gboolean flag = FALSE ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
g_snprintf ( field [ CALL_COL_INITIAL_SPEAKER ] , 30 , " %s " , get_addr_name ( & ( strinfo - > initial_speaker ) ) ) ;
2010-07-22 18:44:11 +00:00
g_snprintf ( field [ CALL_COL_FROM ] , 50 , " %s " , strinfo - > from_identity ) ;
g_snprintf ( field [ CALL_COL_TO ] , 50 , " %s " , strinfo - > to_identity ) ;
2010-08-30 16:10:01 +00:00
g_snprintf ( field [ CALL_COL_PROTOCOL ] , 15 , " %s " ,
2010-07-22 18:44:11 +00:00
( ( strinfo - > protocol = = VOIP_COMMON ) & & strinfo - > protocol_name ) ?
strinfo - > protocol_name : voip_protocol_name [ strinfo - > protocol ] ) ;
g_snprintf ( field [ CALL_COL_STATE ] , 15 , " %s " , voip_call_state_name [ strinfo - > call_state ] ) ;
2010-03-19 22:06:48 +00:00
/* Add comments based on the protocol */
switch ( strinfo - > protocol ) {
case VOIP_ISUP :
2013-03-21 02:58:59 +00:00
isupinfo = ( isup_calls_info_t * ) strinfo - > prot_info ;
2010-03-19 22:06:48 +00:00
g_snprintf ( field [ CALL_COL_COMMENTS ] , 30 , " %i-%i -> %i-%i " , isupinfo - > ni , isupinfo - > opc ,
isupinfo - > ni , isupinfo - > dpc ) ;
break ;
case VOIP_H323 :
2013-03-21 02:58:59 +00:00
h323info = ( h323_calls_info_t * ) strinfo - > prot_info ;
2010-03-19 22:06:48 +00:00
if ( strinfo - > call_state = = VOIP_CALL_SETUP )
flag = h323info - > is_faststart_Setup ;
else
2010-07-22 18:44:11 +00:00
if ( ( h323info - > is_faststart_Setup = = TRUE ) & & ( h323info - > is_faststart_Proc = = TRUE ) )
flag = TRUE ;
g_snprintf ( field [ CALL_COL_COMMENTS ] , 35 , " Tunneling: %s Fast Start: %s " ,
( h323info - > is_h245Tunneling = = TRUE ? " ON " : " OFF " ) ,
( flag = = TRUE ? " ON " : " OFF " ) ) ;
2010-03-19 22:06:48 +00:00
break ;
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 ;
default :
field [ CALL_COL_COMMENTS ] [ 0 ] = ' \0 ' ;
2005-02-01 12:12:35 +00:00
}
2010-03-19 22:06:48 +00:00
/* Acquire an iterator */
gtk_list_store_append ( list_store , & list_iter ) ;
/* Fill the new row */
gtk_list_store_set ( list_store , & list_iter ,
2013-07-21 23:07:33 +00:00
CALL_COL_START_TIME , nstime_to_sec ( & strinfo - > start_rel_ts ) ,
CALL_COL_STOP_TIME , nstime_to_sec ( & strinfo - > stop_rel_ts ) ,
2010-07-22 18:44:11 +00:00
CALL_COL_INITIAL_SPEAKER , & field [ CALL_COL_INITIAL_SPEAKER ] [ 0 ] ,
CALL_COL_FROM , & field [ CALL_COL_FROM ] [ 0 ] ,
CALL_COL_TO , & field [ CALL_COL_TO ] [ 0 ] ,
CALL_COL_PROTOCOL , & field [ CALL_COL_PROTOCOL ] [ 0 ] ,
CALL_COL_PACKETS , strinfo - > npackets ,
CALL_COL_STATE , & field [ CALL_COL_STATE ] [ 0 ] ,
CALL_COL_COMMENTS , & field [ CALL_COL_COMMENTS ] [ 0 ] ,
CALL_COL_DATA , strinfo ,
2010-03-19 22:06:48 +00:00
- 1 ) ;
2005-02-01 12:12:35 +00:00
2010-07-22 18:44:11 +00:00
calls_nb + = 1 ;
2005-02-01 12:12:35 +00:00
}
2010-02-19 19:00:06 +00:00
2010-03-19 22:06:48 +00:00
/****************************************************************************/
/* Create list view */
static void
create_list_view ( void )
{
GtkTreeViewColumn * column ;
GtkCellRenderer * renderer ;
GtkTreeSortable * sortable ;
GtkTreeView * list_view ;
GtkTreeSelection * selection ;
/* Create the store */
list_store = gtk_list_store_new ( NUM_COLS , /* Total number of columns XXX */
2010-07-22 18:44:11 +00:00
G_TYPE_DOUBLE , /* Start Time */
G_TYPE_DOUBLE , /* Stop Time */
2010-03-19 22:06:48 +00:00
G_TYPE_STRING , /* Initial Speaker */
G_TYPE_STRING , /* From */
G_TYPE_STRING , /* To */
G_TYPE_STRING , /* Protocol */
2010-07-22 18:44:11 +00:00
G_TYPE_UINT , /* Packets */
2010-03-19 22:06:48 +00:00
G_TYPE_STRING , /* State */
G_TYPE_STRING , /* Comments */
G_TYPE_POINTER /* Data */
) ;
/* Create a view */
list = gtk_tree_view_new_with_model ( GTK_TREE_MODEL ( list_store ) ) ;
2010-07-22 18:44:11 +00:00
/* The view now holds a reference. We can get rid of our own reference */
g_object_unref ( G_OBJECT ( list_store ) ) ;
2010-03-19 22:06:48 +00:00
list_view = GTK_TREE_VIEW ( list ) ;
sortable = GTK_TREE_SORTABLE ( list_store ) ;
2010-02-19 19:00:06 +00:00
2010-03-19 22:06:48 +00:00
/* Speed up the list display */
gtk_tree_view_set_fixed_height_mode ( list_view , TRUE ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +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 ) ;
2010-07-22 18:44:11 +00:00
/* Start Time */
2010-03-19 22:06:48 +00:00
renderer = gtk_cell_renderer_text_new ( ) ;
2010-07-22 18:44:11 +00:00
g_object_set ( G_OBJECT ( renderer ) , " xalign " , 1.0 , NULL ) ; /* right align */
g_object_set ( G_OBJECT ( renderer ) , " xpad " , 10 , NULL ) ;
2010-03-19 22:06:48 +00:00
column = gtk_tree_view_column_new_with_attributes ( " Start Time " , renderer ,
2010-07-22 18:44:11 +00:00
" text " , CALL_COL_START_TIME ,
2010-03-19 22:06:48 +00:00
NULL ) ;
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 ) ;
gtk_tree_view_column_set_fixed_width ( column , 100 ) ;
/* Add the column to the view. */
gtk_tree_view_append_column ( list_view , column ) ;
/* Stop Time */
renderer = gtk_cell_renderer_text_new ( ) ;
2010-07-22 18:44:11 +00:00
g_object_set ( G_OBJECT ( renderer ) , " xalign " , 1.0 , NULL ) ; /* right align */
g_object_set ( G_OBJECT ( renderer ) , " xpad " , 10 , NULL ) ;
2010-03-19 22:06:48 +00:00
column = gtk_tree_view_column_new_with_attributes ( " Stop Time " , renderer ,
" text " , CALL_COL_STOP_TIME ,
NULL ) ;
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 ) ;
gtk_tree_view_column_set_fixed_width ( column , 100 ) ;
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 ,
" text " , CALL_COL_INITIAL_SPEAKER ,
NULL ) ;
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 ) ;
gtk_tree_view_column_set_fixed_width ( column , 120 ) ;
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 ,
" text " , CALL_COL_FROM ,
NULL ) ;
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 ) ;
gtk_tree_view_column_set_fixed_width ( column , 140 ) ;
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 ,
" text " , CALL_COL_TO ,
NULL ) ;
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 ) ;
gtk_tree_view_column_set_fixed_width ( column , 140 ) ;
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 ,
" text " , CALL_COL_PROTOCOL ,
NULL ) ;
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_column_set_fixed_width ( column , 80 ) ;
gtk_tree_view_append_column ( list_view , column ) ;
/* Packets */
renderer = gtk_cell_renderer_text_new ( ) ;
2010-07-22 18:44:11 +00:00
g_object_set ( G_OBJECT ( renderer ) , " xalign " , 1.0 , NULL ) ; /* right align numbers */
g_object_set ( G_OBJECT ( renderer ) , " xpad " , 10 , NULL ) ;
2010-03-19 22:06:48 +00:00
column = gtk_tree_view_column_new_with_attributes ( " Packets " , renderer ,
" text " , CALL_COL_PACKETS ,
NULL ) ;
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_column_set_fixed_width ( column , 80 ) ;
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 ,
" text " , CALL_COL_STATE ,
NULL ) ;
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 ) ;
gtk_tree_view_column_set_fixed_width ( column , 80 ) ;
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 ,
" text " , CALL_COL_COMMENTS ,
NULL ) ;
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_column_set_fixed_width ( column , 140 ) ;
gtk_tree_view_append_column ( list_view , column ) ;
/* Now enable the sorting of each column */
gtk_tree_view_set_rules_hint ( list_view , TRUE ) ;
gtk_tree_view_set_headers_clickable ( list_view , TRUE ) ;
/* Setup the selection handler */
selection = gtk_tree_view_get_selection ( list_view ) ;
gtk_tree_selection_set_mode ( selection , GTK_SELECTION_MULTIPLE ) ;
g_signal_connect ( G_OBJECT ( selection ) , " changed " , /* select_row */
G_CALLBACK ( voip_calls_on_select_row_cb ) ,
NULL ) ;
2010-02-19 19:00:06 +00:00
}
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/* INTERFACE */
/****************************************************************************/
2010-03-19 22:06:48 +00:00
static void
voip_calls_dlg_create ( void )
2005-02-01 12:12:35 +00:00
{
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 ;
2012-06-03 22:03:05 +00:00
gchar * title_name_ptr ;
2010-03-19 22:06:48 +00:00
gchar * win_name ;
2005-02-01 12:12:35 +00:00
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 ) ;
2012-06-03 22:03:05 +00:00
g_free ( title_name_ptr ) ;
2009-06-22 15:22:37 +00:00
voip_calls_dlg_w = dlg_window_new ( win_name ) ; /* transient_for top_level */
2010-03-19 22:06:48 +00:00
gtk_window_set_destroy_with_parent ( GTK_WINDOW ( voip_calls_dlg_w ) , TRUE ) ;
2005-02-01 12:12:35 +00:00
2010-07-22 18:44:11 +00:00
gtk_window_set_default_size ( GTK_WINDOW ( voip_calls_dlg_w ) , 1000 , 350 ) ;
2005-02-01 12:12:35 +00:00
2012-04-21 16:40:14 +00:00
main_vb = ws_gtk_box_new ( GTK_ORIENTATION_VERTICAL , 0 , FALSE ) ;
2005-02-01 12:12:35 +00:00
gtk_container_add ( GTK_CONTAINER ( voip_calls_dlg_w ) , main_vb ) ;
2010-03-19 22:06:48 +00:00
gtk_container_set_border_width ( GTK_CONTAINER ( main_vb ) , 12 ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
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 ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
scrolledwindow = scrolled_window_new ( NULL , NULL ) ;
gtk_box_pack_start ( GTK_BOX ( main_vb ) , scrolledwindow , TRUE , TRUE , 0 ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
create_list_view ( ) ;
gtk_container_add ( GTK_CONTAINER ( scrolledwindow ) , list ) ;
2005-02-01 12:12:35 +00:00
gtk_widget_show ( voip_calls_dlg_w ) ;
2010-03-19 22:06:48 +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 ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
/* button row */
2012-04-21 21:13:13 +00:00
hbuttonbox = gtk_button_box_new ( GTK_ORIENTATION_HORIZONTAL ) ;
2010-03-19 22:06:48 +00:00
gtk_box_pack_start ( GTK_BOX ( main_vb ) , hbuttonbox , FALSE , FALSE , 0 ) ;
gtk_button_box_set_layout ( GTK_BUTTON_BOX ( hbuttonbox ) , GTK_BUTTONBOX_SPREAD ) ;
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 ) ;
2011-07-13 08:48:13 +00:00
gtk_widget_set_tooltip_text ( bt_unselect , " Unselect this conversation " ) ; */
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +00:00
bt_filter = gtk_button_new_from_stock ( WIRESHARK_STOCK_PREPARE_FILTER ) ;
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_filter ) ;
2011-07-13 08:48:13 +00:00
gtk_widget_set_tooltip_text ( bt_filter , " Prepare a display filter of the selected conversation " ) ;
2005-02-01 12:12:35 +00:00
2010-03-19 22:06:48 +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 ) ;
2011-07-13 08:48:13 +00:00
gtk_widget_set_tooltip_text ( bt_graph , " Show a flow graph of the selected calls. " ) ;
2005-02-01 12:12:35 +00:00
2006-10-20 20:05:27 +00:00
# ifdef HAVE_LIBPORTAUDIO
2010-03-19 22:06:48 +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 ) ;
2011-07-13 08:48:13 +00:00
gtk_widget_set_tooltip_text ( bt_player , " Launch the RTP player to listen the selected calls. " ) ;
2006-10-20 20:05:27 +00:00
# endif /* HAVE_LIBPORTAUDIO */
2006-08-30 21:51:31 +00:00
2010-03-19 22:06:48 +00:00
bt_select_all = gtk_button_new_from_stock ( GTK_STOCK_SELECT_ALL ) ;
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_select_all ) ;
2011-07-14 00:04:37 +00:00
gtk_widget_set_can_default ( bt_select_all , TRUE ) ;
2011-07-13 08:48:13 +00:00
gtk_widget_set_tooltip_text ( bt_select_all , " Select all the calls " ) ;
2007-10-08 00:31:26 +00:00
2008-04-11 18:58:19 +00:00
bt_close = gtk_button_new_from_stock ( GTK_STOCK_CLOSE ) ;
2010-03-19 22:06:48 +00:00
gtk_container_add ( GTK_CONTAINER ( hbuttonbox ) , bt_close ) ;
2011-07-14 00:04:37 +00:00
gtk_widget_set_can_default ( bt_close , TRUE ) ;
2011-07-13 08:48:13 +00:00
gtk_widget_set_tooltip_text ( bt_close , " Close this dialog " ) ;
2005-02-01 12:12:35 +00:00
2008-04-11 23:16:06 +00:00
/*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
2010-07-22 18:44:11 +00:00
g_free ( win_name ) ;
2005-02-01 12:12:35 +00:00
}
/****************************************************************************/
2010-03-19 22:06:48 +00:00
/* PUBLIC */
2005-02-01 12:12:35 +00:00
/****************************************************************************/
/****************************************************************************/
2010-03-19 22:06:48 +00:00
/* update the contents of the list view */
2005-02-01 12:12:35 +00:00
/* list: pointer to list of voip_calls_info_t* */
2010-03-19 22:06:48 +00:00
void
2010-03-21 18:13:49 +00:00
voip_calls_dlg_update ( GList * listx )
2005-02-01 12:12:35 +00:00
{
2012-02-07 09:06:44 +00:00
/* GtkTreeView *list_view; */
2012-02-06 17:23:04 +00:00
GtkTreeSortable * sortable ;
2005-02-01 12:12:35 +00:00
gchar label_text [ 256 ] ;
2012-02-06 17:23:04 +00:00
2012-02-07 09:06:44 +00:00
/* list_view = GTK_TREE_VIEW(list); */
2012-02-06 17:23:04 +00:00
sortable = GTK_TREE_SORTABLE ( list_store ) ;
2005-02-01 12:12:35 +00:00
if ( voip_calls_dlg ! = NULL ) {
calls_nb = 0 ;
calls_ns = 0 ;
2010-04-06 07:19:29 +00:00
gtk_list_store_clear ( list_store ) ;
2005-02-01 12:12:35 +00:00
2010-07-22 18:44:11 +00:00
g_snprintf ( label_text , sizeof ( label_text ) ,
2010-03-19 22:06:48 +00:00
" Total: Calls: %u Start packets: %u Completed calls: %u Rejected calls: %u " ,
2008-01-09 08:34:58 +00:00
g_list_length ( voip_calls_get_info ( ) - > callsinfo_list ) ,
2010-07-22 18:44:11 +00:00
voip_calls_get_info ( ) - > start_packets ,
2006-10-20 18:36:42 +00:00
voip_calls_get_info ( ) - > completed_calls ,
voip_calls_get_info ( ) - > rejected_calls ) ;
2010-03-19 22:06:48 +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
2012-02-04 12:22:06 +00:00
/* Disable the re-ordering */
2012-02-06 17:23:04 +00:00
gtk_tree_sortable_set_sort_column_id ( sortable , GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID , GTK_SORT_ASCENDING ) ;
2012-02-04 12:22:06 +00:00
2010-03-21 18:13:49 +00:00
listx = g_list_first ( listx ) ;
while ( listx ) {
add_to_list_store ( ( voip_calls_info_t * ) ( listx - > data ) ) ;
listx = g_list_next ( listx ) ;
2005-02-01 12:12:35 +00:00
}
2012-02-04 12:22:06 +00:00
/* Enable the re-ordering */
2012-02-06 17:23:04 +00:00
gtk_tree_sortable_set_sort_column_id ( sortable , CALL_COL_START_TIME , GTK_SORT_ASCENDING ) ;
2005-02-01 12:12:35 +00:00
2010-07-22 18:44:11 +00:00
g_snprintf ( label_text , sizeof ( label_text ) ,
2010-03-19 22:06:48 +00:00
" Detected %u VoIP %s. Selected %u %s. " ,
2010-07-22 18:44:11 +00:00
calls_nb ,
2005-02-01 12:12:35 +00:00
plurality ( calls_nb , " Call " , " Calls " ) ,
calls_ns ,
plurality ( calls_ns , " Call " , " Calls " ) ) ;
2010-03-19 22:06:48 +00:00
gtk_label_set_text ( GTK_LABEL ( top_label ) , label_text ) ;
2005-02-01 12:12:35 +00:00
}
}
/****************************************************************************/
2005-02-02 01:02:09 +00:00
/* draw function for tap listeners to keep the window up to date */
2010-03-19 22:06:48 +00:00
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
}
2010-03-19 22:06:48 +00:00
/****************************************************************************/
2005-02-02 01:02:09 +00:00
/* reset function for tap listeners to clear window, if necessary */
2010-03-19 22:06:48 +00:00
void
voip_calls_dlg_reset ( void * ptr _U_ )
2005-02-02 01:02:09 +00:00
{
2013-06-19 22:57:39 +00:00
/* Clear gtk list store */
if ( graph_analysis_data ) {
gtk_list_store_clear ( list_store ) ;
}
2005-02-02 01:02:09 +00:00
/* Clean up memory used by calls tap */
2010-03-19 22:06:48 +00:00
voip_calls_reset ( 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
}
2010-03-19 22:06:48 +00:00
/****************************************************************************/
2005-02-01 12:12:35 +00:00
/* init function for tap */
2010-03-19 22:06:48 +00:00
static 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
if ( graph_analysis_data = = NULL ) {
graph_analysis_data_init ( ) ;
/* init the Graph Analysys */
2013-10-24 22:52:30 +00:00
graph_analysis_data = graph_analysis_init ( voip_calls_get_info ( ) - > graph_analysis ) ;
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
/* Clean up memory used by calls tap */
2010-03-19 22:06:48 +00:00
voip_calls_reset ( voip_calls_get_info ( ) ) ;
2005-02-01 12:12:35 +00:00
/* 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 ( ) ;
2009-01-30 21:25:52 +00:00
skinny_calls_init_tap ( ) ;
2009-03-11 06:43:46 +00:00
iax2_calls_init_tap ( ) ;
2010-09-01 19:42:59 +00:00
t38_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 ;
2010-03-19 22:06:48 +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 ) ;
2011-07-21 20:12:08 +00:00
gdk_window_raise ( gtk_widget_get_window ( voip_calls_dlg ) ) ;
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 */
2011-05-10 05:31:45 +00:00
void
2011-05-03 16:45:37 +00:00
voip_calls_launch ( GtkAction * action _U_ , gpointer user_data _U_ )
{
voip_calls_init_tap ( " " , NULL ) ;
}
2005-02-01 12:12:35 +00:00
/****************************************************************************/
void
register_tap_listener_voip_calls_dlg ( void )
{
2010-03-19 22:06:48 +00:00
register_stat_cmd_arg ( " voip,calls " , voip_calls_init_tap , NULL ) ;
2005-02-01 12:12:35 +00:00
}
2011-09-25 21:19:45 +00:00