aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/afp_stat.c7
-rw-r--r--gtk/bootp_stat.c31
-rw-r--r--gtk/camel_counter.c45
-rw-r--r--gtk/conversations_table.c3
-rw-r--r--gtk/dcerpc_stat.c19
-rw-r--r--gtk/expert_comp_dlg.c17
-rw-r--r--gtk/expert_dlg.c28
-rw-r--r--gtk/fc_stat.c3
-rw-r--r--gtk/flow_graph.c72
-rw-r--r--gtk/h225_counter.c5
-rw-r--r--gtk/h225_ras_srt.c25
-rw-r--r--gtk/hostlist_table.c41
-rw-r--r--gtk/io_stat.c128
-rw-r--r--gtk/ldap_stat.c7
-rw-r--r--gtk/mcast_stream.c5
-rw-r--r--gtk/mgcp_stat.c5
-rw-r--r--gtk/ncp_stat.c5
-rw-r--r--gtk/radius_stat.c11
-rw-r--r--gtk/rpc_progs.c15
-rw-r--r--gtk/rtp_analysis.c8
-rw-r--r--gtk/rtp_stream.c5
-rw-r--r--gtk/sctp_chunk_stat.c21
-rw-r--r--gtk/sctp_stat.c75
-rw-r--r--gtk/sip_stat.c10
-rw-r--r--gtk/smb2_stat.c5
-rw-r--r--gtk/smb_stat.c5
-rw-r--r--gtk/stats_tree_stat.c80
-rw-r--r--gtk/voip_calls.c494
-rw-r--r--gtk/wlan_stat_dlg.c67
-rw-r--r--gtk/wsp_stat.c49
30 files changed, 618 insertions, 673 deletions
diff --git a/gtk/afp_stat.c b/gtk/afp_stat.c
index 8eb492eebc..2084a81205 100644
--- a/gtk/afp_stat.c
+++ b/gtk/afp_stat.c
@@ -48,11 +48,12 @@
#include "../globals.h"
#include "../stat_menu.h"
-#include "gtk/gui_utils.h"
+#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/filter_dlg.h"
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -108,8 +109,6 @@ afpstat_draw(void *pss)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -194,7 +193,7 @@ gtk_afpstat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(ss->win);
window_present(ss->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/bootp_stat.c b/gtk/bootp_stat.c
index e3f98ce10f..0dff28532a 100644
--- a/gtk/bootp_stat.c
+++ b/gtk/bootp_stat.c
@@ -6,17 +6,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
@@ -42,6 +42,7 @@
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
+#include "gtk/main.h"
typedef const char* bootp_info_value_t;
@@ -68,8 +69,8 @@ dhcp_free_hash( gpointer key _U_ , gpointer value, gpointer user_data _U_ )
g_free(value);
}
static void
-dhcp_reset_hash(gchar *key _U_ , dhcp_message_type_t *data, gpointer ptr _U_ )
-{
+dhcp_reset_hash(gchar *key _U_ , dhcp_message_type_t *data, gpointer ptr _U_ )
+{
data->packets = 0;
}
@@ -113,7 +114,7 @@ static void
dhcpstat_reset(void *psp)
{
dhcpstat_t *sp=psp;
- g_hash_table_foreach( sp->hash, (GHFunc)dhcp_reset_hash, NULL);
+ g_hash_table_foreach( sp->hash, (GHFunc)dhcp_reset_hash, NULL);
}
static int
dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *pri)
@@ -124,8 +125,8 @@ dhcpstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
if (sp==NULL)
return 0;
- sc = g_hash_table_lookup(
- sp->hash,
+ sc = g_hash_table_lookup(
+ sp->hash,
value);
if (!sc) {
/*g_warning("%s:%d What's Wrong for %s, doc ?", __FILE__, __LINE__, value);*/
@@ -159,7 +160,7 @@ dhcpstat_draw(void *psp)
* let's resize the table */
gtk_table_resize ( GTK_TABLE(sp->table_message_type), sp->index % 2 , 4);
}
-
+
}
@@ -170,8 +171,6 @@ dhcpstat_draw(void *psp)
*
* there should not be any other critical regions in gtk2
*/
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -183,7 +182,7 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data)
g_free(sp->filter);
g_hash_table_foreach( sp->hash, (GHFunc)dhcp_free_hash, NULL);
- g_hash_table_destroy( sp->hash);
+ g_hash_table_destroy( sp->hash);
g_free(sp);
}
@@ -201,13 +200,13 @@ dhcpstat_init(const char *optarg, void *userdata _U_)
GtkWidget *vbox;
GtkWidget *bt_close;
GtkWidget *bbox;
-
+
if (strncmp (optarg, "bootp,stat,", 11) == 0){
filter=optarg+11;
} else {
filter=NULL;
}
-
+
sp = g_malloc( sizeof(dhcpstat_t) );
sp->hash = g_hash_table_new( g_str_hash, g_str_equal);
if(filter){
@@ -230,7 +229,7 @@ dhcpstat_init(const char *optarg, void *userdata _U_)
message_type_fr = gtk_frame_new("DHCP Message Type");
gtk_container_add(GTK_CONTAINER(vbox), message_type_fr);
gtk_widget_show(message_type_fr);
-
+
sp->table_message_type = gtk_table_new( 0, 4, FALSE);
gtk_table_set_col_spacings( GTK_TABLE(sp->table_message_type), 10);
gtk_container_add( GTK_CONTAINER( message_type_fr), sp->table_message_type);
@@ -238,7 +237,7 @@ dhcpstat_init(const char *optarg, void *userdata _U_)
sp->index = 0; /* Nothing to display yet */
- error_string = register_tap_listener(
+ error_string = register_tap_listener(
"bootp",
sp,
filter,
diff --git a/gtk/camel_counter.c b/gtk/camel_counter.c
index e8980b7111..3a23b3a52d 100644
--- a/gtk/camel_counter.c
+++ b/gtk/camel_counter.c
@@ -58,7 +58,7 @@
static void gtk_camelcounter_reset(void *phs);
static int gtk_camelcounter_packet(void *phs,
packet_info *pinfo _U_,
- epan_dissect_t *edt _U_,
+ epan_dissect_t *edt _U_,
const void *phi);
static void gtk_camelcounter_draw(void *phs);
static void win_destroy_cb(GtkWindow *win _U_, gpointer data);
@@ -80,10 +80,10 @@ static void gtk_camelcounter_reset(void *phs)
{
struct camelcounter_t * p_counter= ( struct camelcounter_t *) phs;
int i;
-
+
/* Erase Message Type count */
for(i=0;i<camel_MAX_NUM_OPR_CODES;i++) {
- p_counter->camel_msg[i]=0;
+ p_counter->camel_msg[i]=0;
}
}
@@ -93,14 +93,14 @@ static void gtk_camelcounter_reset(void *phs)
*/
static int gtk_camelcounter_packet(void *phs,
packet_info *pinfo _U_,
- epan_dissect_t *edt _U_,
+ epan_dissect_t *edt _U_,
const void *phi)
{
struct camelcounter_t * p_counter =(struct camelcounter_t *)phs;
const struct camelsrt_info_t * pi=phi;
if (pi->opcode != 255)
p_counter->camel_msg[pi->opcode]++;
-
+
return 1;
}
@@ -109,38 +109,35 @@ static void gtk_camelcounter_draw(void *phs)
struct camelcounter_t *p_counter=(struct camelcounter_t *)phs;
int i;
char *str[2];
-
+
for(i=0;i<2;i++) {
str[i]=g_malloc(sizeof(char[256]));
}
/* Now print Message and Reason Counter Table */
/* clear list before printing */
gtk_clist_clear(p_counter->table);
-
+
for(i=0;i<camel_MAX_NUM_OPR_CODES;i++) {
/* Message counter */
if(p_counter->camel_msg[i]!=0) {
- g_snprintf(str[0], sizeof(char[256]),
+ g_snprintf(str[0], sizeof(char[256]),
"Request %s", val_to_str(i,camel_opr_code_strings,"Unknown message "));
g_snprintf(str[1], sizeof(char[256]),
"%d", p_counter->camel_msg[i]);
gtk_clist_append(p_counter->table, str);
- }
+ }
} /* Message Type */
gtk_widget_show(GTK_WIDGET(p_counter->table));
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
static void win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
struct camelcounter_t *hs=(struct camelcounter_t *)data;
-
+
protect_thread_critical_region();
remove_tap_listener(hs);
unprotect_thread_critical_region();
-
+
if(hs->filter){
g_free(hs->filter);
hs->filter=NULL;
@@ -155,36 +152,36 @@ static const gchar *titles[]={
static void gtk_camelcounter_init(const char *optarg, void *userdata _U_)
{
struct camelcounter_t *p_camelcounter;
- const char *filter=NULL;
- const char *emptyfilter="";
+ const char *filter=NULL;
+ const char *emptyfilter="";
GString *error_string;
GtkWidget *bbox;
GtkWidget *close_bt;
-
+
if(strncmp(optarg,"camel,counter,",14) == 0){
filter=optarg+14;
} else {
filter=NULL;
}
-
+
p_camelcounter=g_malloc(sizeof(struct camelcounter_t));
p_camelcounter->filter=g_strdup(filter);
-
+
gtk_camelcounter_reset(p_camelcounter);
-
+
p_camelcounter->win=window_new(GTK_WINDOW_TOPLEVEL, "Wireshark: CAMEL counters");
gtk_window_set_default_size(GTK_WINDOW(p_camelcounter->win), 500, 300);
-
+
p_camelcounter->vbox=gtk_vbox_new(FALSE, 3);
gtk_container_set_border_width(GTK_CONTAINER(p_camelcounter->vbox), 12);
-
+
init_main_stat_window(p_camelcounter->win, p_camelcounter->vbox, "CAMEL Messages Counters", filter);
-
+
/* init a scrolled window*/
p_camelcounter->scrolled_window = scrolled_window_new(NULL, NULL);
p_camelcounter->table = create_stat_table(p_camelcounter->scrolled_window, p_camelcounter->vbox, 2, titles);
-
+
if (filter) {
error_string=register_tap_listener("CAMEL", p_camelcounter, filter,
gtk_camelcounter_reset,
diff --git a/gtk/conversations_table.c b/gtk/conversations_table.c
index dcd1d3c8df..3ac95b6a5c 100644
--- a/gtk/conversations_table.c
+++ b/gtk/conversations_table.c
@@ -55,6 +55,7 @@
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/help_dlg.h"
+#include "gtk/main.h"
#include "image/clist_ascend.xpm"
#include "image/clist_descend.xpm"
@@ -353,8 +354,6 @@ reset_ct_table_data_cb(void *arg)
reset_ct_table_data(arg);
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
ct_win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
diff --git a/gtk/dcerpc_stat.c b/gtk/dcerpc_stat.c
index 553ce382c4..5280a443ea 100644
--- a/gtk/dcerpc_stat.c
+++ b/gtk/dcerpc_stat.c
@@ -6,17 +6,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
@@ -55,6 +55,7 @@
#include "gtk/stock_icons.h"
#include "gtk/service_response_time_table.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -167,8 +168,6 @@ dcerpcstat_draw(void *rs_arg)
*
* there should not be any other critical regions in gtk2
*/
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -437,7 +436,7 @@ static GtkWidget *program_submenu_item;
static GtkWidget *program_submenu_label;
static int program_subitem_index;
static const char *first_menu_name;
-static void
+static void
dcerpcstat_add_program_to_menu(dcerpc_uuid_key *k, dcerpc_uuid_value *v)
{
GtkWidget *program_menu_item;
@@ -452,7 +451,7 @@ dcerpcstat_add_program_to_menu(dcerpc_uuid_key *k, dcerpc_uuid_value *v)
program_submenu_item=gtk_menu_item_new();
box=gtk_hbox_new(TRUE,0);
gtk_container_add(GTK_CONTAINER(program_submenu_item), box);
-
+
program_submenu_label=gtk_label_new(str);
gtk_box_pack_start(GTK_BOX(box), program_submenu_label, TRUE, TRUE, 0);
gtk_widget_show(program_submenu_label);
@@ -470,7 +469,7 @@ dcerpcstat_add_program_to_menu(dcerpc_uuid_key *k, dcerpc_uuid_value *v)
break;
/*qqq*/
}
- program_subitem_index++;
+ program_subitem_index++;
program_menu_item=gtk_menu_item_new_with_label(v->name);
g_signal_connect(program_menu_item, "activate", G_CALLBACK(dcerpcstat_program_select), k);
@@ -641,7 +640,7 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_entry_set_text(GTK_ENTRY(filter_entry), filter);
}
gtk_widget_show(filter_entry);
-
+
gtk_box_pack_start(GTK_BOX(dlg_box), filter_box, TRUE, TRUE, 0);
gtk_widget_show(filter_box);
@@ -653,7 +652,7 @@ gtk_dcerpcstat_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_widget_show(bbox);
start_button = g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_CREATE_STAT);
- g_signal_connect_swapped(start_button, "clicked",
+ g_signal_connect_swapped(start_button, "clicked",
G_CALLBACK(dcerpcstat_start_button_clicked), NULL);
cancel_button = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
diff --git a/gtk/expert_comp_dlg.c b/gtk/expert_comp_dlg.c
index cd817cf6b6..baccd3944f 100644
--- a/gtk/expert_comp_dlg.c
+++ b/gtk/expert_comp_dlg.c
@@ -49,6 +49,7 @@
#include "gtk/help_dlg.h"
#include "gtk/expert_comp_dlg.h"
#include "gtk/stock_icons.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -131,8 +132,6 @@ error_packet(void *pss, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const v
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -153,8 +152,6 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
expert_dlg_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -181,7 +178,7 @@ expert_comp_init(const char *optarg _U_, void* userdata _U_)
GtkWidget *help_bt;
expert_tapdata_t *etd;
GtkTooltips *tooltips = gtk_tooltips_new();
-
+
ss=g_malloc(sizeof(expert_comp_dlg_t));
etd=g_malloc(sizeof(expert_tapdata_t));
@@ -282,13 +279,13 @@ expert_comp_init(const char *optarg _U_, void* userdata _U_)
gtk_widget_show_all(ss->win);
window_present(ss->win);
-
+
/* We currently cannot just retap the packets because we will not be able
* to acquire the fvalue data. The expert items would already have been
* cleared and we will not be able to perform any filtering of data.
* So we force a redissect so that all data is valid.
- * If someone can figure out why the expert_item value is null when
- * performing a retap then this call to
+ * If someone can figure out why the expert_item value is null when
+ * performing a retap then this call to
* cf_redissect_packets(&cfile);
* can be changed to...
* cf_retap_packets(&cfile, NULL);
@@ -297,7 +294,7 @@ expert_comp_init(const char *optarg _U_, void* userdata _U_)
cf_redissect_packets(&cfile);
}
-void
+void
expert_comp_dlg_cb(GtkWidget *w _U_, gpointer d _U_)
{
expert_comp_init("", NULL);
@@ -307,7 +304,7 @@ void
register_tap_listener_expert_comp(void)
{
register_stat_cmd_arg("expert_comp", expert_comp_init,NULL);
- register_stat_menu_item_stock("Expert Info _Composite",
+ register_stat_menu_item_stock("Expert Info _Composite",
REGISTER_ANALYZE_GROUP_UNSORTED, WIRESHARK_STOCK_EXPERT_INFO,
expert_comp_dlg_cb, NULL, NULL, NULL);
}
diff --git a/gtk/expert_dlg.c b/gtk/expert_dlg.c
index a379ead037..d9ac91082d 100644
--- a/gtk/expert_dlg.c
+++ b/gtk/expert_dlg.c
@@ -1,6 +1,6 @@
/* expert_dlg.c
* Display of Expert information.
- *
+ *
* Implemented as a tap listener to the "expert" tap.
*
* $Id$
@@ -93,7 +93,7 @@ static void expert_dlg_display_reset(expert_tapdata_t * etd)
gtk_clist_clear(etd->table);
gtk_clist_columns_autosize(etd->table);
- gtk_window_set_title(GTK_WINDOW(etd->win), "Wireshark: ? Expert Infos");
+ gtk_window_set_title(GTK_WINDOW(etd->win), "Wireshark: ? Expert Infos");
if(etd->label) {
gtk_label_set_text(GTK_LABEL(etd->label), "Please wait ...");
}
@@ -121,10 +121,10 @@ int expert_dlg_packet(void *tapdata, packet_info *pinfo _U_, epan_dissect_t *edt
{
expert_info_t *ei = se_memdup(pointer,sizeof(expert_info_t));
expert_tapdata_t * etd = tapdata;
-
+
ei->protocol = se_strdup(ei->protocol);
ei->summary = se_strdup(ei->summary);
-
+
switch(ei->severity) {
case(PI_CHAT):
etd->chat_events++;
@@ -168,8 +168,8 @@ expert_dlg_draw(void *data)
if(etd->label) {
if(etd->new_events != NULL) {
- title = g_strdup_printf("Adding: %u new messages",
- g_list_length(etd->new_events));
+ title = g_strdup_printf("Adding: %u new messages",
+ g_list_length(etd->new_events));
gtk_label_set_text(GTK_LABEL(etd->label), title);
g_free(title);
}
@@ -205,7 +205,7 @@ expert_dlg_draw(void *data)
/* severity */
entries[1] = val_to_str(ei->severity, expert_severity_vals, "Unknown severity (%u)");
-
+
/* group */
entries[2] = val_to_str(ei->group, expert_group_vals, "Unknown group (%u)");
@@ -246,7 +246,7 @@ expert_dlg_draw(void *data)
gtk_clist_sort(etd->table);
/* column autosizing is very slow for large number of entries,
- * so do it only for the first 1000 of it
+ * so do it only for the first 1000 of it
* (there might be no large changes behind this amount) */
if(etd->disp_events < 1000)
gtk_clist_columns_autosize(etd->table);
@@ -254,14 +254,14 @@ expert_dlg_draw(void *data)
etd->disp_events - 1, -1, 1.0, 1.0);
gtk_clist_thaw(etd->table);
- if(etd->label) {
- title = g_strdup_printf("Errors: %u Warnings: %u Notes: %u Chats: %u",
+ if(etd->label) {
+ title = g_strdup_printf("Errors: %u Warnings: %u Notes: %u Chats: %u",
etd->error_events, etd->warn_events, etd->note_events, etd->chat_events);
gtk_label_set_text(GTK_LABEL(etd->label), title);
g_free(title);
}
- title = g_strdup_printf("Wireshark: %u Expert Info%s",
+ title = g_strdup_printf("Wireshark: %u Expert Info%s",
etd->disp_events,
plurality(etd->disp_events, "", "s"));
gtk_window_set_title(GTK_WINDOW(etd->win), title);
@@ -424,8 +424,6 @@ expert_dlg_init_table(expert_tapdata_t * etd, GtkWidget *vbox)
}*/
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
expert_dlg_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -570,12 +568,12 @@ expert_dlg_init(const char *optarg, void* userdata _U_)
gtk_widget_show_all(etd->win);
window_present(etd->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
-static void
+static void
expert_dlg_cb(GtkWidget *w _U_, gpointer d _U_)
{
expert_dlg_init("", NULL);
diff --git a/gtk/fc_stat.c b/gtk/fc_stat.c
index 1f548ddca4..5b9f54ea4a 100644
--- a/gtk/fc_stat.c
+++ b/gtk/fc_stat.c
@@ -55,6 +55,7 @@
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -114,8 +115,6 @@ fcstat_draw(void *pfc)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
diff --git a/gtk/flow_graph.c b/gtk/flow_graph.c
index d903eea47c..edf9a38dde 100644
--- a/gtk/flow_graph.c
+++ b/gtk/flow_graph.c
@@ -52,6 +52,7 @@
#include "gtk/gui_utils.h"
#include "gtk/stock_icons.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
@@ -91,7 +92,7 @@ static void flow_graph_reset(void *ptr _U_)
{
graph_analysis_item_t *graph_item;
-
+
GList* list;
if (graph_analysis !=NULL){
@@ -121,9 +122,6 @@ void flow_graph_data_init(void) {
return;
}
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
/****************************************************************************/
static void
@@ -154,7 +152,7 @@ flow_graph_on_destroy(GtkObject *object _U_, gpointer user_data _U_)
flow_graph_dlg = NULL;
}
-
+
/****************************************************************************/
static void
toggle_select_all(GtkWidget *widget _U_, gpointer user_data _U_)
@@ -223,7 +221,7 @@ static int flow_graph_frame_add_to_graph(packet_info *pinfo)
int i;
gchar *protocol;
gchar *colinfo;
-
+
protocol=NULL;
colinfo=NULL;
@@ -234,7 +232,7 @@ static int flow_graph_frame_add_to_graph(packet_info *pinfo)
COPY_ADDRESS(&(gai->dst_addr),&(pinfo->net_dst));
}
else return 0;
-
+
} else {
if (pinfo->src.type!=AT_NONE && pinfo->dst.type!=AT_NONE) {
gai = g_malloc(sizeof(graph_analysis_item_t));
@@ -262,20 +260,20 @@ static int flow_graph_frame_add_to_graph(packet_info *pinfo)
if(pinfo->cinfo) {
if (pinfo->cinfo->col_first[COL_INFO]>=0){
-
+
for (i = pinfo->cinfo->col_first[COL_INFO]; i <= pinfo->cinfo->col_last[COL_INFO]; i++) {
if (pinfo->cinfo->fmt_matx[i][COL_INFO]) {
colinfo = g_strdup(pinfo->cinfo->col_data[i]);
}
}
}
-
+
if (pinfo->cinfo->col_first[COL_PROTOCOL]>=0){
-
+
for (i = pinfo->cinfo->col_first[COL_PROTOCOL]; i <= pinfo->cinfo->col_last[COL_PROTOCOL]; i++) {
if (pinfo->cinfo->fmt_matx[i][COL_PROTOCOL]) {
protocol = g_strdup(pinfo->cinfo->col_data[i]);
-
+
}
}
}
@@ -299,7 +297,7 @@ static int flow_graph_frame_add_to_graph(packet_info *pinfo)
gai->comment = NULL;
}
}
-
+
if (protocol!=NULL){
g_free(protocol);
}
@@ -379,35 +377,35 @@ static int flow_graph_tcp_add_to_graph(packet_info *pinfo, const struct tcpheade
/****************************************************************************/
/* whenever a frame packet is seen by the tap listener */
-static int
+static int
flow_graph_frame_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *dummy _U_)
{
if ((type_of_packets == ALL)||(pinfo->fd->flags.passed_dfilter==1)){
- flow_graph_frame_add_to_graph(pinfo);
+ flow_graph_frame_add_to_graph(pinfo);
}
-
+
return 1;
}
/****************************************************************************/
/* whenever a TCP packet is seen by the tap listener */
-static int
+static int
flow_graph_tcp_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *tcp_info)
{
const struct tcpheader *tcph = tcp_info;
if ((type_of_packets == ALL)||(pinfo->fd->flags.passed_dfilter==1)){
- flow_graph_tcp_add_to_graph(pinfo,tcph);
+ flow_graph_tcp_add_to_graph(pinfo,tcph);
}
-
+
return 1;
}
static void flow_graph_packet_draw(void *prs _U_)
{
- return;
+ return;
}
/****************************************************************************/
@@ -418,11 +416,11 @@ flow_graph_on_ok (GtkButton *button _U_,
if ((have_frame_tap_listener==TRUE)
||(have_tcp_tap_listener==TRUE))
- {
+ {
/* remove_tap_listeners */
remove_tap_listener_flow_graph();
}
-
+
/* Scan for displayed packets (retap all packets) */
if (type_of_flow == GENERAL){
@@ -432,8 +430,8 @@ flow_graph_on_ok (GtkButton *button _U_,
{
/* don't register tap listener, if we have it already */
register_tap_listener("frame", &tap_identifier, NULL,
- flow_graph_reset,
- flow_graph_frame_packet,
+ flow_graph_reset,
+ flow_graph_frame_packet,
flow_graph_packet_draw
);
have_frame_tap_listener=TRUE;
@@ -448,8 +446,8 @@ flow_graph_on_ok (GtkButton *button _U_,
{
/* don't register tap listener, if we have it already */
register_tap_listener("tcp", &tap_identifier, NULL,
- flow_graph_reset,
- flow_graph_tcp_packet,
+ flow_graph_reset,
+ flow_graph_tcp_packet,
flow_graph_packet_draw
);
have_tcp_tap_listener=TRUE;
@@ -475,7 +473,7 @@ flow_graph_on_ok (GtkButton *button _U_,
static void flow_graph_dlg_create (void)
{
-
+
GtkWidget *flow_graph_dlg_w;
GtkWidget *main_vb;
GtkWidget *hbuttonbox;
@@ -500,7 +498,7 @@ static void flow_graph_dlg_create (void)
top_label = gtk_label_new ("Choose packets to include in the graph");
gtk_box_pack_start (GTK_BOX (main_vb), top_label, FALSE, FALSE, 8);
#endif
-
+
gtk_widget_show(flow_graph_dlg_w);
/*** Packet range frame ***/
@@ -513,7 +511,7 @@ static void flow_graph_dlg_create (void)
/* Process all packets */
select_all_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_All packets");
- gtk_tooltips_set_tip (tooltips, select_all_rb,
+ gtk_tooltips_set_tip (tooltips, select_all_rb,
("Process all packets"), NULL);
g_signal_connect(select_all_rb, "toggled", G_CALLBACK(toggle_select_all), NULL);
gtk_table_attach_defaults(GTK_TABLE(range_tb), select_all_rb, 0, 1, 0, 1);
@@ -524,7 +522,7 @@ static void flow_graph_dlg_create (void)
/* Process displayed packets */
select_displayed_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(select_all_rb), "_Displayed packets");
- gtk_tooltips_set_tip (tooltips, select_displayed_rb,
+ gtk_tooltips_set_tip (tooltips, select_displayed_rb,
("Process displayed packets"), NULL);
g_signal_connect(select_displayed_rb, "toggled", G_CALLBACK(toggle_select_displayed), NULL);
gtk_table_attach_defaults(GTK_TABLE(range_tb), select_displayed_rb, 1, 2, 0, 1);
@@ -547,7 +545,7 @@ static void flow_graph_dlg_create (void)
/* General information */
select_general_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_General flow");
- gtk_tooltips_set_tip (tooltips, select_general_rb,
+ gtk_tooltips_set_tip (tooltips, select_general_rb,
("Show all packets, with general information"), NULL);
g_signal_connect(select_general_rb, "toggled", G_CALLBACK(toggle_select_general), NULL);
gtk_table_attach_defaults(GTK_TABLE(flow_type_tb), select_general_rb, 0, 1, 0, 1);
@@ -558,7 +556,7 @@ static void flow_graph_dlg_create (void)
/* TCP specific information */
select_tcp_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(select_general_rb), "_TCP flow");
- gtk_tooltips_set_tip (tooltips, select_tcp_rb,
+ gtk_tooltips_set_tip (tooltips, select_tcp_rb,
("Show only TCP packets, with TCP specific information"), NULL);
g_signal_connect(select_tcp_rb, "toggled", G_CALLBACK(toggle_select_tcp), NULL);
gtk_table_attach_defaults(GTK_TABLE(flow_type_tb), select_tcp_rb, 1, 2, 0, 1);
@@ -581,7 +579,7 @@ static void flow_graph_dlg_create (void)
/* Source / Dest address */
src_dst_rb = gtk_radio_button_new_with_mnemonic_from_widget(NULL, "_Standard source/destination addresses");
- gtk_tooltips_set_tip (tooltips, src_dst_rb,
+ gtk_tooltips_set_tip (tooltips, src_dst_rb,
("Nodes in the diagram are identified with source and destination addresses"), NULL);
g_signal_connect(src_dst_rb, "toggled", G_CALLBACK(toggle_select_srcdst), NULL);
gtk_table_attach_defaults(GTK_TABLE(node_addr_tb), src_dst_rb, 0, 1, 0, 1);
@@ -592,7 +590,7 @@ static void flow_graph_dlg_create (void)
/* Network source / dest address */
net_src_dst_rb = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(src_dst_rb), "_Network source/destination addresses");
- gtk_tooltips_set_tip (tooltips, net_src_dst_rb,
+ gtk_tooltips_set_tip (tooltips, net_src_dst_rb,
("Nodes in the diagram are identified with network source and destination addresses"), NULL);
g_signal_connect(net_src_dst_rb, "toggled", G_CALLBACK(toggle_select_netsrcdst), NULL);
gtk_table_attach_defaults(GTK_TABLE(node_addr_tb), net_src_dst_rb, 1, 2, 0, 1);
@@ -630,7 +628,7 @@ static void flow_graph_dlg_create (void)
window_present(flow_graph_dlg_w);
flow_graph_dlg = flow_graph_dlg_w;
-}
+}
/****************************************************************************/
/* PUBLIC */
@@ -643,7 +641,7 @@ flow_graph_init_tap(const char *dummy _U_, void* userdata _U_)
/* initialize graph items store */
flow_graph_data_init();
-
+
/* init the Graph Analysys */
graph_analysis_data = graph_analysis_init();
graph_analysis_data->graph_info = graph_analysis;
@@ -671,9 +669,9 @@ void
register_tap_listener_flow_graph(void)
{
register_stat_cmd_arg("flow_graph",flow_graph_init_tap,NULL);
- register_stat_menu_item_stock("Flo_w Graph...",
+ register_stat_menu_item_stock("Flo_w Graph...",
REGISTER_STAT_GROUP_UNSORTED, WIRESHARK_STOCK_FLOW_GRAPH,
flow_graph_launch, NULL, NULL, NULL);
-
+
}
diff --git a/gtk/h225_counter.c b/gtk/h225_counter.c
index 8ca1a5504a..4838391efa 100644
--- a/gtk/h225_counter.c
+++ b/gtk/h225_counter.c
@@ -52,6 +52,7 @@
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gui_utils.h"
+#include "gtk/main.h"
static void gtk_h225counter_init(const char *optarg, void *userdata);
@@ -311,7 +312,7 @@ h225counter_draw(void *phs)
for(i=0;i<=RAS_MSG_TYPES;i++) {
if(hs->ras_msg[i]!=0) {
- g_snprintf(str[0], sizeof(char[256]),
+ g_snprintf(str[0], sizeof(char[256]),
"%s", val_to_str(i,h225_RasMessage_vals,"unknown ras-messages "));
g_snprintf(str[1], sizeof(char[256]),
"%d", hs->ras_msg[i]);
@@ -478,8 +479,6 @@ h225counter_draw(void *phs)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
diff --git a/gtk/h225_ras_srt.c b/gtk/h225_ras_srt.c
index 172c33699f..6ff02504a9 100644
--- a/gtk/h225_ras_srt.c
+++ b/gtk/h225_ras_srt.c
@@ -53,6 +53,7 @@
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gui_utils.h"
+#include "gtk/main.h"
static void gtk_h225rassrt_init(const char *optarg, void *userdata);
@@ -220,27 +221,27 @@ h225rassrt_draw(void *phs)
continue;
}
- g_snprintf(str[0], sizeof(char[256]),
+ g_snprintf(str[0], sizeof(char[256]),
"%s", val_to_str(i,ras_message_category,"Other"));
- g_snprintf(str[1], sizeof(char[256]),
+ g_snprintf(str[1], sizeof(char[256]),
"%7d", hs->ras_rtd[i].stats.num);
- g_snprintf(str[2], sizeof(char[256]),
+ g_snprintf(str[2], sizeof(char[256]),
"%8.2f msec", nstime_to_msec(&(hs->ras_rtd[i].stats.min)));
- g_snprintf(str[3], sizeof(char[256]),
+ g_snprintf(str[3], sizeof(char[256]),
"%8.2f msec", nstime_to_msec(&(hs->ras_rtd[i].stats.max)));;
- g_snprintf(str[4], sizeof(char[256]),
+ g_snprintf(str[4], sizeof(char[256]),
"%8.2f msec", get_average(&(hs->ras_rtd[i].stats.tot), hs->ras_rtd[i].stats.num));
- g_snprintf(str[5], sizeof(char[256]),
+ g_snprintf(str[5], sizeof(char[256]),
"%6u", hs->ras_rtd[i].stats.min_num);
- g_snprintf(str[6], sizeof(char[256]),
+ g_snprintf(str[6], sizeof(char[256]),
"%6u", hs->ras_rtd[i].stats.max_num);
- g_snprintf(str[7], sizeof(char[256]),
+ g_snprintf(str[7], sizeof(char[256]),
"%4u", hs->ras_rtd[i].open_req_num);
- g_snprintf(str[8], sizeof(char[256]),
+ g_snprintf(str[8], sizeof(char[256]),
"%4u", hs->ras_rtd[i].disc_rsp_num);
- g_snprintf(str[9], sizeof(char[256]),
+ g_snprintf(str[9], sizeof(char[256]),
"%4u", hs->ras_rtd[i].req_dup_num);
- g_snprintf(str[10], sizeof(char[256]),
+ g_snprintf(str[10], sizeof(char[256]),
"%4u", hs->ras_rtd[i].rsp_dup_num);
gtk_clist_append(GTK_CLIST(hs->table), str);
}
@@ -249,8 +250,6 @@ h225rassrt_draw(void *phs)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c
index 2e4d19421e..80af8c67f4 100644
--- a/gtk/hostlist_table.c
+++ b/gtk/hostlist_table.c
@@ -50,6 +50,7 @@
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/help_dlg.h"
+#include "gtk/main.h"
#include "image/clist_ascend.xpm"
#include "image/clist_descend.xpm"
@@ -179,7 +180,7 @@ reset_hostlist_table_data(hostlist_table *hosts)
g_string_free(error_string, TRUE);
return;
}
-
+
/* Allow clist to update */
gtk_clist_thaw(hosts->table);
@@ -223,8 +224,6 @@ reset_hostlist_table_data_cb(void *arg)
reset_hostlist_table_data(arg);
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
hostlist_win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -268,12 +267,12 @@ hostlist_sort_column(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
return (gint) (i1-i2);
}
g_assert_not_reached();
-
+
/* Allow clist to redraw */
-
+
gtk_clist_thaw(clist);
gtk_clist_freeze(clist);
-
+
return 0;
}
@@ -525,9 +524,9 @@ draw_hostlist_table_data(hostlist_table *hl)
gtk_clist_set_text(hl->table, j, 7, str);
}
-
+
draw_hostlist_table_addresses(hl);
-
+
gtk_clist_sort(hl->table);
/* Allow table to redraw. */
@@ -546,13 +545,13 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_)
{
guint32 i,j;
gchar *table_entry;
- GtkClipboard *cb;
+ GtkClipboard *cb;
GString *CSV_str = g_string_new("");
-
+
hostlist_table *hosts=g_object_get_data(G_OBJECT(copy_bt), HOST_PTR_KEY);
if (!hosts)
return;
-
+
/* Add the column headers to the CSV data */
for(i=0;i<hosts->num_columns;i++){ /* all columns */
if(i==1 && !hosts->has_ports) continue; /* Don't add the port column if it's empty */
@@ -561,7 +560,7 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_)
g_string_append(CSV_str,",");
}
g_string_append(CSV_str,"\n"); /* new row */
-
+
/* Add the column values to the CSV data */
for(i=0;i<hosts->num_hosts;i++){ /* all rows */
for(j=0;j<hosts->num_columns;j++){ /* all columns */
@@ -570,15 +569,15 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_)
g_string_append(CSV_str,table_entry); /* add the table entry to the CSV string */
if(j!=hosts->num_columns-1)
g_string_append(CSV_str,",");
- }
- g_string_append(CSV_str,"\n"); /* new row */
+ }
+ g_string_append(CSV_str,"\n"); /* new row */
}
/* Now that we have the CSV data, copy it into the default clipboard */
cb = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); /* Get the default clipboard */
gtk_clipboard_set_text(cb, CSV_str->str, -1); /* Copy the CSV data into the clipboard */
g_string_free(CSV_str, TRUE); /* Free the memory */
-}
+}
static gboolean
@@ -591,7 +590,7 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi
GString *error_string;
char title[256];
- hosttable->num_columns=NUM_COLS;
+ hosttable->num_columns=NUM_COLS;
hosttable->default_titles[0] = "Address";
hosttable->default_titles[1] = "Port";
hosttable->default_titles[2] = "Packets";
@@ -609,8 +608,8 @@ init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hi
hosttable->resolve_names=TRUE;
hosttable->page_lb = NULL;
- g_snprintf(title, 255, "%s Endpoints", table_name);
- hosttable->name_lb = gtk_label_new(title);
+ g_snprintf(title, 255, "%s Endpoints", table_name);
+ hosttable->name_lb = gtk_label_new(title);
gtk_box_pack_start(GTK_BOX(vbox), hosttable->name_lb, FALSE, FALSE, 0);
hosttable->scrolled_window=scrolled_window_new(NULL, NULL);
@@ -698,7 +697,7 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap
hosttable->use_dfilter=FALSE;
g_snprintf(title, 255, "%s Endpoints: %s", table_name, cf_get_display_name(&cfile));
hosttable->win=window_new(GTK_WINDOW_TOPLEVEL, title);
-
+
gtk_window_set_default_size(GTK_WINDOW(hosttable->win), 750, 400);
vbox=gtk_vbox_new(FALSE, 3);
@@ -722,7 +721,7 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap
window_set_cancel_button(hosttable->win, close_bt, window_cancel_button_cb);
copy_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY);
- gtk_tooltips_set_tip(tooltips, copy_bt,
+ gtk_tooltips_set_tip(tooltips, copy_bt,
"Copy all statistical values of this page to the clipboard in CSV (Comma Seperated Values) format.", NULL);
g_object_set_data(G_OBJECT(copy_bt), HOST_PTR_KEY, hosttable);
g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), NULL);
@@ -737,7 +736,7 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap
window_present(hosttable->win);
cf_retap_packets(&cfile, FALSE);
-
+
/* Keep clist frozen to cause modifications to the clist (inserts, appends, others that are extremely slow
in GTK2) to not be drawn, allow refreshes to occur at strategic points for performance */
gtk_clist_freeze(hosttable->table);
diff --git a/gtk/io_stat.c b/gtk/io_stat.c
index 34b86b4f3b..d2b3306c25 100644
--- a/gtk/io_stat.c
+++ b/gtk/io_stat.c
@@ -6,17 +6,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
@@ -58,11 +58,9 @@
#include "gtk/filter_dlg.h"
#include "gtk/help_dlg.h"
#include "gtk/pixmap_save.h"
+#include "gtk/main.h"
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
#define MAX_GRAPHS 5
#define MAX_YSCALE 28
@@ -152,7 +150,7 @@ typedef struct _io_stat_graph_t {
typedef struct _io_stat_t {
gboolean needs_redraw;
gint32 interval; /* measurement interval in ms */
- guint32 last_interval;
+ guint32 last_interval;
guint32 max_interval; /* XXX max_interval and num_items are redundant */
guint32 num_items;
guint32 left_x_border;
@@ -173,7 +171,7 @@ typedef struct _io_stat_t {
int pixels_per_tick;
int max_y_units;
int count_type;
-} io_stat_t;
+} io_stat_t;
static void init_io_stat_window(io_stat_t *io);
@@ -251,7 +249,7 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, const void *
git->io->needs_redraw=TRUE;
- /*
+ /*
* Find which interval this is supposed to go in and store the
* interval index as idx
*/
@@ -289,7 +287,7 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, const void *
git->io->last_frame_num=pinfo->fd->num;
/*
- * Find the appropriate io_item_t structure
+ * Find the appropriate io_item_t structure
*/
it=&git->items[idx];
@@ -307,9 +305,9 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, const void *
return FALSE;
}
- /* update the appropriate counters, make sure that if
+ /* update the appropriate counters, make sure that if
* fields==0 then this is the first seen value so
- * set any min/max values accordingly
+ * set any min/max values accordingly
*/
for(i=0;i<gp->len;i++){
int new_int;
@@ -352,9 +350,9 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, const void *
guint64 t, pt; /* time in us */
int i;
case CALC_TYPE_LOAD:
- /* it is a LOAD calculation of a relative time field.
+ /* it is a LOAD calculation of a relative time field.
* add the time this call spanned to each
- * interval it spanned according to its contribution
+ * interval it spanned according to its contribution
* to that interval.
*/
t=new_time->secs;
@@ -407,7 +405,7 @@ gtk_iostat_packet(void *g, packet_info *pinfo, epan_dissect_t *edt, const void *
it->frames++;
it->bytes+=pinfo->fd->pkt_len;
-
+
return TRUE;
}
@@ -426,8 +424,8 @@ get_frame_num(io_stat_t *io, guint32 idx, gboolean first)
if (frame_num==0) {
/*
- * If first frame not found we select the last
- * frame in the previous interval
+ * If first frame not found we select the last
+ * frame in the previous interval
*
* If selecting the last frame we select the frame
* before the first frame in the next interval
@@ -439,7 +437,7 @@ get_frame_num(io_stat_t *io, guint32 idx, gboolean first)
}
}
- /*
+ /*
* If not found we select the last frame
*/
frame_num=io->last_frame_num;
@@ -629,7 +627,7 @@ io_stat_draw(io_stat_t *io)
io->needs_redraw=FALSE;
- /*
+ /*
* Find the length of the intervals we have data for
* so we know how large arrays we need to malloc()
*/
@@ -642,7 +640,7 @@ io_stat_draw(io_stat_t *io)
}
- /*
+ /*
* find the max value so we can autoscale the y axis
*/
max_value=0;
@@ -666,7 +664,7 @@ io_stat_draw(io_stat_t *io)
- /*
+ /*
* Clear out old plot
*/
gdk_draw_rectangle(io->pixmap,
@@ -737,8 +735,8 @@ io_stat_draw(io_stat_t *io)
- /*
- * Calculate size of borders surrounding the plot
+ /*
+ * Calculate size of borders surrounding the plot
* The border on the right side needs to be adjusted depending
* on the width of the text labels. For simplicity we assume that the
* top y scale label will be the widest one
@@ -776,19 +774,19 @@ io_stat_draw(io_stat_t *io)
g_snprintf (label_string, 45, "Warning: Graph limited to %d entries", NUM_IO_ITEMS);
pango_layout_set_text(layout, label_string, -1);
gdk_draw_layout(io->pixmap,
- io->draw_area->style->black_gc, 5,
+ io->draw_area->style->black_gc, 5,
io->pixmap_height-bottom_y_border-draw_height-label_height/2,
layout);
}
- /*
+ /*
* Draw the y axis and labels
* (we always draw the y scale with 11 ticks along the axis)
*/
gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
- io->pixmap_width-io->right_x_border+1,
+ io->pixmap_width-io->right_x_border+1,
top_y_border,
- io->pixmap_width-io->right_x_border+1,
+ io->pixmap_width-io->right_x_border+1,
io->pixmap_height-bottom_y_border);
if(io->max_y_units==LOGARITHMIC_YSCALE){
@@ -810,18 +808,18 @@ io_stat_draw(io_stat_t *io)
ypos=io->pixmap_height-bottom_y_border;
} else if(i==tics) {
/* position for the top value, do not draw logarithmic tics above graph */
- ypos=io->pixmap_height-bottom_y_border-draw_height;
+ ypos=io->pixmap_height-bottom_y_border-draw_height;
} else {
int j;
/* draw the logarithmic tics */
for(j=2;j<10;j++) {
ypos=(int)(io->pixmap_height-bottom_y_border-(draw_height-ystart)*(i+log10((double)j))/tics-ystart);
/* draw the tick */
- gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
+ gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
io->pixmap_width-io->right_x_border+1, ypos,
io->pixmap_width-io->right_x_border+1+xwidth, ypos);
}
- ypos=io->pixmap_height-bottom_y_border-(draw_height-ystart)*i/tics-ystart;
+ ypos=io->pixmap_height-bottom_y_border-(draw_height-ystart)*i/tics-ystart;
}
/* all "main" logarithmic lines are slightly longer */
xwidth=10;
@@ -833,7 +831,7 @@ io_stat_draw(io_stat_t *io)
ypos=io->pixmap_height-bottom_y_border-draw_height*i/10;
}
/* draw the tick */
- gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
+ gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
io->pixmap_width-io->right_x_border+1, ypos,
io->pixmap_width-io->right_x_border+1+xwidth, ypos);
/* draw the labels */
@@ -866,7 +864,7 @@ io_stat_draw(io_stat_t *io)
}
- /*
+ /*
* if we have not specified the last_interval via the gui,
* then just pick the current end of the capture so that is scrolls
* nicely when doing live captures
@@ -876,7 +874,7 @@ io_stat_draw(io_stat_t *io)
} else {
last_interval=io->last_interval;
}
-
+
@@ -911,9 +909,9 @@ io_stat_draw(io_stat_t *io)
}
x=draw_width+io->left_x_border-((last_interval-current_interval)/io->interval)*io->pixels_per_tick;
- gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
+ gdk_draw_line(io->pixmap, io->draw_area->style->black_gc,
x-1-io->pixels_per_tick/2,
- io->pixmap_height-bottom_y_border+1,
+ io->pixmap_height-bottom_y_border+1,
x-1-io->pixels_per_tick/2,
io->pixmap_height-bottom_y_border+xlen+1);
@@ -942,8 +940,8 @@ io_stat_draw(io_stat_t *io)
g_object_unref(G_OBJECT(layout));
- /*
- * Loop over all graphs and draw them
+ /*
+ * Loop over all graphs and draw them
*/
for(i=MAX_GRAPHS-1;i>=0;i--){
guint64 val;
@@ -997,7 +995,7 @@ io_stat_draw(io_stat_t *io)
break;
case PLOT_STYLE_IMPULSE:
if(val){
- gdk_draw_line(io->pixmap, io->graphs[i].gc,
+ gdk_draw_line(io->pixmap, io->graphs[i].gc,
x_pos, draw_height-1+top_y_border,
x_pos, y_pos);
}
@@ -1066,12 +1064,12 @@ gtk_iostat_draw(void *g)
}
-/* ok we get called with both the filter and the field.
+/* ok we get called with both the filter and the field.
make sure the field is part of the filter.
(make sure and make sure just append it)
the field MUST be part of the filter or else we wont
be able to pick up the field values after the edt tree has been
- pruned
+ pruned
*/
static GString *
enable_graph(io_stat_graph_t *gio, const char *filter, const char *field)
@@ -1079,7 +1077,7 @@ enable_graph(io_stat_graph_t *gio, const char *filter, const char *field)
char real_filter[262];
gio->display=TRUE;
-
+
real_filter[0]=0;
if(filter){
/* skip all whitespaces */
@@ -1204,8 +1202,8 @@ gtk_iostat_init(const char *optarg _U_, void* userdata _U_)
io->graphs[0].filter_field=NULL;
io->graphs[0].advanced_buttons=NULL;
exit(10);
- }
-
+ }
+
/* build the GUI */
init_io_stat_window(io);
@@ -1251,7 +1249,7 @@ pixmap_clicked_event(GtkWidget *widget, GdkEventButton *event)
}
draw_width=io->pixmap_width-io->right_x_border-io->left_x_border;
-
+
if ((event->x <= (draw_width+io->left_x_border+1-(draw_width/io->pixels_per_tick)*io->pixels_per_tick)) ||
(event->x >= (draw_width+io->left_x_border-io->pixels_per_tick/2))) {
/* Outside draw area */
@@ -1311,7 +1309,7 @@ configure_event(GtkWidget *widget, GdkEventConfigure *event _U_)
g_object_set_data(G_OBJECT(save_bt), "pixmap", io->pixmap);
gtk_widget_set_sensitive(save_bt, TRUE);
#endif
-
+
gdk_draw_rectangle(io->pixmap,
widget->style->white_gc,
TRUE,
@@ -1440,7 +1438,7 @@ plot_style_select(GtkWidget *item, gpointer key)
io_stat_redraw(ppt->io);
}
-static void
+static void
create_pixels_per_tick_menu_items(io_stat_t *io, GtkWidget *menu)
{
char str[5];
@@ -1475,7 +1473,7 @@ yscale_select(GtkWidget *item, gpointer key)
io_stat_redraw(io);
}
-static void
+static void
create_tick_interval_menu_items(io_stat_t *io, GtkWidget *menu)
{
char str[15];
@@ -1506,7 +1504,7 @@ create_tick_interval_menu_items(io_stat_t *io, GtkWidget *menu)
return;
}
-static void
+static void
create_yscale_max_menu_items(io_stat_t *io, GtkWidget *menu)
{
char str[15];
@@ -1570,7 +1568,7 @@ gtk_widget_draw(io->window, &update_rect);
}
}
-static void
+static void
create_frames_or_bytes_menu_items(io_stat_t *io, GtkWidget *menu)
{
GtkWidget *menu_item;
@@ -1798,7 +1796,7 @@ filter_callback(GtkWidget *widget _U_, io_stat_graph_t *gio)
protect_thread_critical_region();
remove_tap_listener(gio);
unprotect_thread_critical_region();
-
+
io_stat_reset(gio->io);
enable_graph(gio, filter, field);
cf_retap_packets(&cfile, FALSE);
@@ -1821,7 +1819,7 @@ calc_type_select(GtkWidget *item _U_, gpointer key)
}
-static void
+static void
create_calc_types_menu_items(io_stat_graph_t *gio, GtkWidget *menu)
{
GtkWidget *menu_item;
@@ -1929,11 +1927,11 @@ create_filter_box(io_stat_graph_t *gio, GtkWidget *box, int num)
gtk_widget_show(label);
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gio->color);
- gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &gio->color);
- gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &gio->color);
- gtk_widget_modify_fg(label, GTK_STATE_SELECTED, &gio->color);
- gtk_widget_modify_fg(label, GTK_STATE_INSENSITIVE, &gio->color);
+ gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &gio->color);
+ gtk_widget_modify_fg(label, GTK_STATE_ACTIVE, &gio->color);
+ gtk_widget_modify_fg(label, GTK_STATE_PRELIGHT, &gio->color);
+ gtk_widget_modify_fg(label, GTK_STATE_SELECTED, &gio->color);
+ gtk_widget_modify_fg(label, GTK_STATE_INSENSITIVE, &gio->color);
/* g_signal_connect(gio->display_button, "toggled", filter_callback, gio);*/
@@ -1944,7 +1942,7 @@ create_filter_box(io_stat_graph_t *gio, GtkWidget *box, int num)
if(gio->args->title){
g_free( (gpointer) (gio->args->title) );
}
- gio->args->title=g_strdup(str);
+ gio->args->title=g_strdup(str);
g_signal_connect(gio->filter_bt, "clicked", G_CALLBACK(filter_button_clicked), gio);
g_signal_connect(gio->filter_bt, "destroy", G_CALLBACK(filter_button_destroy_cb), NULL);
@@ -2023,10 +2021,10 @@ copy_as_csv_cb(GtkWindow *copy_bt _U_, gpointer data)
{
guint32 i, interval, val;
char string[15];
- GtkClipboard *cb;
+ GtkClipboard *cb;
GString *CSV_str=g_string_new("");
io_stat_t *io=(io_stat_t *)data;
-
+
g_string_append(CSV_str, "Interval start");
for(i=0;i<MAX_GRAPHS;i++) {
if (io->graphs[i].display) {
@@ -2051,10 +2049,10 @@ copy_as_csv_cb(GtkWindow *copy_bt _U_, gpointer data)
cb = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); /* Get the default clipboard */
gtk_clipboard_set_text(cb, CSV_str->str, -1); /* Copy the CSV data into the clipboard */
g_string_free(CSV_str, TRUE); /* Free the memory */
-}
+}
-static void
+static void
init_io_stat_window(io_stat_t *io)
{
GtkWidget *vbox;
@@ -2091,7 +2089,7 @@ init_io_stat_window(io_stat_t *io)
bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_SAVE,
GTK_STOCK_COPY, GTK_STOCK_HELP, NULL);
#else
- bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY,
+ bbox = dlg_button_row_new(GTK_STOCK_CLOSE, GTK_STOCK_COPY,
GTK_STOCK_HELP, NULL);
#endif
gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
@@ -2110,7 +2108,7 @@ init_io_stat_window(io_stat_t *io)
#endif
copy_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY);
- gtk_tooltips_set_tip(tooltips, copy_bt,
+ gtk_tooltips_set_tip(tooltips, copy_bt,
"Copy values from selected graphs to the clipboard in CSV (Comma Seperated Values) format", NULL);
g_signal_connect(copy_bt, "clicked", G_CALLBACK(copy_as_csv_cb), io);
@@ -2125,7 +2123,7 @@ init_io_stat_window(io_stat_t *io)
}
-static void
+static void
gtk_iostat_cb(GtkWidget *w _U_, gpointer d _U_)
{
gtk_iostat_init(NULL,NULL);
@@ -2139,7 +2137,7 @@ register_tap_listener_gtk_iostat(void)
{
register_stat_cmd_arg("io,stat", gtk_iostat_init,NULL);
- register_stat_menu_item_stock("_IO Graphs",
+ register_stat_menu_item_stock("_IO Graphs",
REGISTER_STAT_GROUP_GENERIC, WIRESHARK_STOCK_GRAPHS,
gtk_iostat_cb, NULL, NULL, NULL);
}
diff --git a/gtk/ldap_stat.c b/gtk/ldap_stat.c
index baecf4b1e3..b9d272204e 100644
--- a/gtk/ldap_stat.c
+++ b/gtk/ldap_stat.c
@@ -53,6 +53,7 @@
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -92,7 +93,7 @@ ldapstat_packet(void *pldap, packet_info *pinfo, epan_dissect_t *edt _U_, const
return 0;
}
/* if we havnt seen the request, just ignore it */
- if(!ldap->req_frame){
+ if(!ldap->req_frame){
return 0;
}
@@ -127,8 +128,6 @@ ldapstat_draw(void *pldap)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -233,7 +232,7 @@ gtk_ldapstat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(ldap->win);
window_present(ldap->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/mcast_stream.c b/gtk/mcast_stream.c
index 17f219a4c6..c4ab045644 100644
--- a/gtk/mcast_stream.c
+++ b/gtk/mcast_stream.c
@@ -57,6 +57,7 @@
#include "gtk/mcast_stream.h"
#include "gtk/mcast_stream_dlg.h"
+#include "gtk/main.h"
@@ -316,10 +317,6 @@ const mcaststream_tapinfo_t* mcaststream_get_info(void)
/* TAP INTERFACE */
/****************************************************************************/
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/****************************************************************************/
void
remove_tap_listener_mcast_stream(void)
diff --git a/gtk/mgcp_stat.c b/gtk/mgcp_stat.c
index 0d1f8d2267..03eb11884d 100644
--- a/gtk/mgcp_stat.c
+++ b/gtk/mgcp_stat.c
@@ -52,6 +52,7 @@
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gui_utils.h"
+#include "gtk/main.h"
#define NUM_TIMESTATS 10
@@ -220,8 +221,6 @@ mgcpstat_draw(void *pms)
}
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -300,7 +299,7 @@ gtk_mgcpstat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(ms->win);
window_present(ms->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/ncp_stat.c b/gtk/ncp_stat.c
index 4e9662b725..2be8fb88f2 100644
--- a/gtk/ncp_stat.c
+++ b/gtk/ncp_stat.c
@@ -53,6 +53,7 @@
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -458,8 +459,6 @@ ncpstat_draw(void *pss)
draw_srt_table_data(&ss->sub_131_srt_table);
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -550,7 +549,7 @@ gtk_ncpstat_init(const char *optarg, void *userdata _U_)
label=gtk_label_new("NCP by Group Type");
gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0);
init_srt_table(&ss->ncp_srt_table, 256, temp_page, "ncp.group");
-
+
/* NCP Functions */
temp_page = gtk_vbox_new(FALSE, 6);
label = gtk_label_new("Functions");
diff --git a/gtk/radius_stat.c b/gtk/radius_stat.c
index ab5e49dde3..28d37c7b98 100644
--- a/gtk/radius_stat.c
+++ b/gtk/radius_stat.c
@@ -52,6 +52,7 @@
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gui_utils.h"
+#include "gtk/main.h"
#define NUM_TIMESTATS 8
@@ -134,7 +135,7 @@ radiusstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const
radius_category radius_cat = OTHERS;
int ret = 0;
- switch (ri->code) {
+ switch (ri->code) {
case RADIUS_ACCESS_REQUEST:
case RADIUS_ACCESS_ACCEPT:
case RADIUS_ACCESS_REJECT:
@@ -253,9 +254,9 @@ radiusstat_draw(void *prs)
g_snprintf(str[6], sizeof(char[256]), "%6u", rs->radius_rtd[i].stats.max_num);
g_snprintf(str[7], sizeof(char[256]), "%4u", rs->radius_rtd[i].open_req_num);
g_snprintf(str[8], sizeof(char[256]), "%4u", rs->radius_rtd[i].disc_rsp_num);
- g_snprintf(str[9], sizeof(char[256]), "%4u (%4.2f%%)", rs->radius_rtd[i].req_dup_num,
+ g_snprintf(str[9], sizeof(char[256]), "%4u (%4.2f%%)", rs->radius_rtd[i].req_dup_num,
rs->radius_rtd[i].stats.num?((double)rs->radius_rtd[i].req_dup_num*100)/(double)rs->radius_rtd[i].stats.num:0);
- g_snprintf(str[10], sizeof(char[256]), "%4u (%4.2f%%)", rs->radius_rtd[i].rsp_dup_num,
+ g_snprintf(str[10], sizeof(char[256]), "%4u (%4.2f%%)", rs->radius_rtd[i].rsp_dup_num,
rs->radius_rtd[i].stats.num?((double)rs->radius_rtd[i].rsp_dup_num*100)/(double)rs->radius_rtd[i].stats.num:0);
gtk_clist_append(rs->table, str);
@@ -267,8 +268,6 @@ radiusstat_draw(void *prs)
}
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -351,7 +350,7 @@ gtk_radiusstat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(rs->win);
window_present(rs->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/rpc_progs.c b/gtk/rpc_progs.c
index 2a335a242a..643d46462c 100644
--- a/gtk/rpc_progs.c
+++ b/gtk/rpc_progs.c
@@ -6,17 +6,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
@@ -47,6 +47,7 @@
#include "gtk/gui_stat_menu.h"
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
+#include "gtk/main.h"
static GtkWidget *win=NULL;
@@ -209,7 +210,7 @@ rpcprogs_packet(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
}
}
-
+
/* we are only interested in reply packets */
if(ri->request){
return 0;
@@ -243,7 +244,7 @@ rpcprogs_packet(void *dummy _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
rp->max.secs=delta.secs;
rp->max.nsecs=delta.nsecs;
}
-
+
rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
if(rp->tot.nsecs>1000000000){
@@ -305,8 +306,6 @@ rpcprogs_draw(void *dummy _U_)
*
* there should not be any other critical regions in gtk2
*/
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(void *dummy _U_, gpointer data _U_)
{
@@ -403,7 +402,7 @@ gtk_rpcprogs_init(const char *optarg _U_, void* userdata _U_)
gtk_widget_show_all(win);
window_present(win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c
index ccdee23b44..716f2d7d45 100644
--- a/gtk/rtp_analysis.c
+++ b/gtk/rtp_analysis.c
@@ -692,10 +692,6 @@ static int rtp_packet_save_payload(tap_rtp_save_info_t *saveinfo,
/* CALLBACKS */
/****************************************************************************/
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/****************************************************************************/
/* close the dialog window and remove the tap listener */
@@ -3229,10 +3225,6 @@ static gboolean get_int_value_from_proto_tree(proto_tree *protocol_tree,
}
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/****************************************************************************/
void rtp_analysis(
address *ip_src_fwd,
diff --git a/gtk/rtp_stream.c b/gtk/rtp_stream.c
index 2b4c52cf13..efca6b83fc 100644
--- a/gtk/rtp_stream.c
+++ b/gtk/rtp_stream.c
@@ -54,6 +54,7 @@
#include "gtk/rtp_stream.h"
#include "gtk/rtp_stream_dlg.h"
+#include "gtk/main.h"
/****************************************************************************/
@@ -158,10 +159,6 @@ const rtpstream_tapinfo_t* rtpstream_get_info(void)
/* TAP INTERFACE */
/****************************************************************************/
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/****************************************************************************/
void
remove_tap_listener_rtp_stream(void)
diff --git a/gtk/sctp_chunk_stat.c b/gtk/sctp_chunk_stat.c
index da0839142b..e93e6e9590 100644
--- a/gtk/sctp_chunk_stat.c
+++ b/gtk/sctp_chunk_stat.c
@@ -51,6 +51,7 @@
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gui_utils.h"
+#include "gtk/main.h"
static void sctpstat_init(const char *optarg, void *userdata);
@@ -116,7 +117,7 @@ sctpstat_reset(void *phs)
sctp_ep_t* list = (sctp_ep_t*)sctp_stat->ep_list;
sctp_ep_t* tmp = NULL;
guint16 chunk_type;
-
+
if(!list)
return;
@@ -137,7 +138,7 @@ static sctp_ep_t* alloc_sctp_ep(struct _sctp_info *si)
if (!(ep = g_malloc(sizeof(sctp_ep_t))))
return NULL;
-
+
COPY_ADDRESS(&ep->src,&si->ip_src);
COPY_ADDRESS(&ep->dst,&si->ip_dst);
ep->sport = si->sport;
@@ -157,10 +158,10 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
struct _sctp_info *si = (struct _sctp_info *) phi;
guint32 tvb_number;
guint8 chunk_type;
-
+
if (!hs)
return (0);
-
+
hs->number_of_packets++;
if(!hs->ep_list) {
hs->ep_list = alloc_sctp_ep(si);
@@ -186,7 +187,7 @@ sctpstat_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, cons
if(!te)
return (0);
-
+
if (si->number_of_tvbs > 0) {
chunk_type = CHUNK_TYPE(si->tvb[0]);
if ((chunk_type == SCTP_INIT_CHUNK_ID) ||
@@ -219,7 +220,7 @@ sctpstat_draw(void *phs)
for(tmp = list ; tmp ; tmp=tmp->next) {
-
+
g_snprintf(str[0], sizeof(char[256]),"%s", address_to_str(&tmp->src));
g_snprintf(str[1], sizeof(char[256]),"%u", tmp->sport);
g_snprintf(str[2], sizeof(char[256]),"%s", address_to_str(&tmp->dst));
@@ -242,8 +243,6 @@ sctpstat_draw(void *phs)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -311,9 +310,9 @@ sctpstat_init(const char *optarg, void *userdata _U_)
hs->table = create_stat_table(hs->scrolled_window, hs->vbox, 14, titles);
- error_string=register_tap_listener("sctp", hs, filter,
- sctpstat_reset,
- sctpstat_packet,
+ error_string=register_tap_listener("sctp", hs, filter,
+ sctpstat_reset,
+ sctpstat_packet,
sctpstat_draw);
if(error_string){
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
diff --git a/gtk/sctp_stat.c b/gtk/sctp_stat.c
index 73da5b1d18..9661f1de7e 100644
--- a/gtk/sctp_stat.c
+++ b/gtk/sctp_stat.c
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2004, Irene Ruengeler <i.ruengeler [AT] fh-muenster.de>
*
* $Id$
@@ -21,7 +21,7 @@
* 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
@@ -42,6 +42,7 @@
#include "gtk/dlg_utils.h"
#include "gtk/sctp_stat.h"
+#include "gtk/main.h"
#define SCTP_HEARTBEAT_CHUNK_ID 4
@@ -90,12 +91,12 @@
INIT_CHUNK_ADV_REC_WINDOW_CREDIT_LENGTH + \
INIT_CHUNK_NUMBER_OF_OUTBOUND_STREAMS_LENGTH + \
INIT_CHUNK_NUMBER_OF_INBOUND_STREAMS_LENGTH + \
- INIT_CHUNK_INITIAL_TSN_LENGTH)
+ INIT_CHUNK_INITIAL_TSN_LENGTH)
#define CHUNK_HEADER_LENGTH (CHUNK_TYPE_LENGTH + \
CHUNK_FLAGS_LENGTH + \
CHUNK_LENGTH_LENGTH)
#define INIT_CHUNK_VARIABLE_LENGTH_PARAMETER_OFFSET (INIT_CHUNK_INITIAL_TSN_OFFSET + \
- INIT_CHUNK_INITIAL_TSN_LENGTH )
+ INIT_CHUNK_INITIAL_TSN_LENGTH )
static const value_string chunk_type_values[] = {
{ SCTP_DATA_CHUNK_ID, "DATA" },
@@ -317,14 +318,14 @@ static gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb)
if ((a->port1 == b->port1) &&
(a->port2 == b->port2) &&
(a->verification_tag1 == b->verification_tag1) &&
- ((a->verification_tag1 != 0 ||
+ ((a->verification_tag1 != 0 ||
(b->verification_tag2 != 0))))
return(FORWARD_STREAM);
/* ABORT, vtag reflected */
if ((a->port1 == b->port1) &&
(a->port2 == b->port2) &&
- (a->verification_tag2 == b->verification_tag2) &&
+ (a->verification_tag2 == b->verification_tag2) &&
(a->verification_tag1 == 0 && b->verification_tag1 != 0))
return(FORWARD_STREAM);
@@ -333,7 +334,7 @@ static gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb)
(a->verification_tag1 == b->verification_tag2) &&
(a->verification_tag1 != 0))
return(BACKWARD_STREAM);
-
+
if ((a->port1 == b->port2) &&
(a->port2 == b->port1) &&
(a->verification_tag2 == b->verification_tag1) &&
@@ -343,7 +344,7 @@ static gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb)
/* ABORT, vtag reflected */
if ((a->port1 == b->port2) &&
(a->port2 == b->port1) &&
- (a->verification_tag2 == b->verification_tag1) &&
+ (a->verification_tag2 == b->verification_tag1) &&
(a->verification_tag1 == 0 && b->verification_tag2 != 0))
return(BACKWARD_STREAM);
@@ -354,13 +355,13 @@ static gint sctp_assoc_vtag_cmp(gconstpointer aa, gconstpointer bb)
(b->verification_tag1 == 0) &&
(b->verification_tag2 !=0))
return (FORWARD_ADD_FORWARD_VTAG);
-
+
if ((a->port1 == b->port2) &&
(a->port2 == b->port1) &&
(a->verification_tag1 == b->verification_tag2) &&
(b->verification_tag1 == 0))
return (BACKWARD_ADD_FORWARD_VTAG);
-
+
/*backward stream verification tag can be added */
if ((a->port1 == b->port2) &&
(a->port2 == b->port1) &&
@@ -415,7 +416,7 @@ static sctp_assoc_info_t * find_assoc(sctp_tmp_info_t * needle)
info->verification_tag2=needle->verification_tag1;
info->direction = 2;
return info;
- case ADDRESS_FORWARD_STREAM:
+ case ADDRESS_FORWARD_STREAM:
info = (sctp_assoc_info_t*)(list->data);
info->direction = 1;
info->check_address=TRUE;
@@ -460,7 +461,7 @@ static sctp_assoc_info_t * add_chunk_count(address * vadd, sctp_assoc_info_t * i
int i;
list = g_list_first(info->addr_chunk_count);
-
+
while (list)
{
ch = (sctp_addr_chunk *)(list->data);
@@ -482,7 +483,7 @@ static sctp_assoc_info_t * add_chunk_count(address * vadd, sctp_assoc_info_t * i
}
ch = g_malloc(sizeof(sctp_addr_chunk));
ch->direction = direction;
- ch->addr = g_malloc(sizeof(address));
+ ch->addr = g_malloc(sizeof(address));
ch->addr->type = vadd->type;
ch->addr->len = vadd->len;
dat = g_malloc(vadd->len);
@@ -492,7 +493,7 @@ static sctp_assoc_info_t * add_chunk_count(address * vadd, sctp_assoc_info_t * i
ch->addr_count[i] = 0;
ch->addr_count[type]++;
info->addr_chunk_count = g_list_append(info->addr_chunk_count, ch);
-
+
return info;
}
@@ -500,12 +501,12 @@ static sctp_assoc_info_t * add_address(address * vadd, sctp_assoc_info_t *info,
{
GList *list;
address *v=NULL;
-
+
if (direction == 1)
list = g_list_first(info->addr1);
else
list = g_list_first(info->addr2);
-
+
while (list)
{
v = (address *) (list->data);
@@ -519,7 +520,7 @@ static sctp_assoc_info_t * add_address(address * vadd, sctp_assoc_info_t *info,
if (direction == 1)
info->addr1 = g_list_append(info->addr1, vadd);
else if (direction==2)
- info->addr2 = g_list_append(info->addr2, vadd);
+ info->addr2 = g_list_append(info->addr2, vadd);
return info;
}
@@ -565,7 +566,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
tmp_info.src.type = AT_IPv6;
tmp_info.src.len = 16;
}
-
+
addr = g_malloc(tmp_info.src.len);
memcpy(addr, sctp_info->ip_src.data, tmp_info.src.len);
tmp_info.src.data = addr;
@@ -582,7 +583,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
tmp_info.dst.type = AT_IPv6;
tmp_info.dst.len = 16;
}
-
+
addr = g_malloc(tmp_info.dst.len);
memcpy(addr, sctp_info->ip_dst.data, tmp_info.dst.len);
tmp_info.dst.data = addr;
@@ -677,7 +678,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
info->ep2_chunk_count[i] = 0;
}
info->addr_chunk_count = NULL;
-
+
if (((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_INIT_ACK_CHUNK_ID) ||
((tvb_get_guint8(sctp_info->tvb[0],0)) == SCTP_DATA_CHUNK_ID) ||
@@ -753,11 +754,11 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
store->type = AT_IPv6;;
store->len = 16;
store->data = g_malloc(16);
- tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(store->data),IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH);
+ tvb_memcpy(sctp_info->tvb[chunk_number], (guint8 *)(store->data),IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH);
info = add_address(store, info, 1);
}
}
-
+
if (tvb_get_guint8(sctp_info->tvb[0],0) == SCTP_INIT_CHUNK_ID)
{
info->init = TRUE;
@@ -925,7 +926,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
sack->dst.len = tsn->dst.len = tmp_info.dst.len;
addr = g_malloc(tmp_info.dst.len);
memcpy(addr, tmp_info.dst.data, tmp_info.dst.len);
- tsn->dst.data = addr;
+ tsn->dst.data = addr;
addr = g_malloc(tmp_info.dst.len);
memcpy(addr, tmp_info.dst.data, tmp_info.dst.len);
sack->dst.data = addr;
@@ -960,19 +961,19 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
addr = g_malloc(tmp_info.src.len);
memcpy(addr,(tmp_info.src.data),tmp_info.src.len);
store->data = addr;
-
+
if (info->direction == 1)
info = add_address(store, info, 1);
else if (info->direction == 2)
info = add_address(store, info, 2);
-
+
store = g_malloc(sizeof (address));
store->type = tmp_info.dst.type;
store->len = tmp_info.dst.len;
addr = g_malloc(tmp_info.dst.len);
memcpy(addr,(tmp_info.dst.data),tmp_info.dst.len);
store->data = addr;
-
+
if (info->direction == 1)
info = add_address(store, info, 2);
else if (info->direction == 2)
@@ -1096,7 +1097,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
tsn_s->offset = 0;
tsn_s->framenumber = framenumber;
tsn_s->length = length;
-
+
if (info->direction == 1)
{
if(tsnumber < info->min_tsn1)
@@ -1118,16 +1119,16 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
info->outstream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1;
if (info->initack == FALSE)
info->instream2 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1;
-
+
g_ptr_array_add(info->sort_tsn1, tsn_s);
info->n_array_tsn1++;
}
else if (info->direction == 2)
{
-
+
if(tsnumber < info->min_tsn2)
info->min_tsn2 = tsnumber;
-
+
if ((info->initack == TRUE && info->initack_dir == 2)&& tsnumber >= info->min_tsn2 && tsnumber <= info->max_tsn2)
{
length = tvb_get_ntohs(sctp_info->tvb[chunk_number], CHUNK_LENGTH_OFFSET)-DATA_CHUNK_HEADER_LENGTH;
@@ -1145,7 +1146,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
info->instream1 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1;
if (info->initack == FALSE)
info->outstream2 = tvb_get_ntohs((sctp_info->tvb)[chunk_number], DATA_CHUNK_STREAM_ID_OFFSET)+1;
-
+
g_ptr_array_add(info->sort_tsn2, tsn_s);
info->n_array_tsn2++;
}
@@ -1167,8 +1168,8 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
tsn_s->offset = 0;
tsn_s->framenumber = framenumber;
tsn_s->length = tvb_get_ntohl(sctp_info->tvb[chunk_number], SACK_CHUNK_ADV_REC_WINDOW_CREDIT_OFFSET);
-
-
+
+
if (info->direction == 2)
{
if(tsnumber < info->min_tsn1)
@@ -1182,7 +1183,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
}
else if (info->direction == 1)
{
-
+
if(tsnumber < info->min_tsn2)
info->min_tsn2 = tsnumber;
if(tsnumber > info->max_tsn2)
@@ -1192,7 +1193,7 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
g_ptr_array_add(info->sort_sack2, tsn_s);
info->n_sack_chunks_ep2++;
}
-
+
}
}
@@ -1220,10 +1221,6 @@ packet(void *tapdata _U_, packet_info *pinfo , epan_dissect_t *edt _U_ , const v
}
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/****************************************************************************/
void
remove_tap_listener_sctp_stat(void)
diff --git a/gtk/sip_stat.c b/gtk/sip_stat.c
index 1f0f9e5c9b..8ee8f86d87 100644
--- a/gtk/sip_stat.c
+++ b/gtk/sip_stat.c
@@ -43,6 +43,7 @@
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
+#include "gtk/main.h"
#define SUM_STR_MAX 1024
@@ -188,7 +189,7 @@ sip_init_hash(sipstat_t *sp)
sc->sp = sp;
g_hash_table_insert(sc->sp->hash_responses, key, sc);
}
-
+
/* Create empty requests table */
sp->hash_requests = g_hash_table_new(g_str_hash, g_str_equal);
}
@@ -205,7 +206,7 @@ sip_draw_hash_requests(gchar *key _U_ , sip_request_method_t *data, gchar * unus
{
return;
}
-
+
/* Build string showing method and count */
g_snprintf(string_buff, sizeof(string_buff),
" %-11s : %3d packets", data->response, data->packets);
@@ -469,7 +470,7 @@ sipstat_draw(void *psp)
/* Draw responses and requests from their tables */
g_hash_table_foreach(sp->hash_responses, (GHFunc)sip_draw_hash_responses, NULL);
g_hash_table_foreach(sp->hash_requests, (GHFunc)sip_draw_hash_requests, NULL);
-
+
gtk_widget_show_all(sp->win);
}
@@ -480,9 +481,6 @@ sipstat_draw(void *psp)
*
* there should not be any other critical regions in gtk2
*/
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/* When window is destroyed, clean up */
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
diff --git a/gtk/smb2_stat.c b/gtk/smb2_stat.c
index c7d5263477..8958135be8 100644
--- a/gtk/smb2_stat.c
+++ b/gtk/smb2_stat.c
@@ -52,6 +52,7 @@
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -111,8 +112,6 @@ smb2stat_draw(void *pss)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -197,7 +196,7 @@ gtk_smb2stat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(ss->win);
window_present(ss->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/smb_stat.c b/gtk/smb_stat.c
index b5af38481e..986854df4c 100644
--- a/gtk/smb_stat.c
+++ b/gtk/smb_stat.c
@@ -53,6 +53,7 @@
#include "gtk/service_response_time_table.h"
#include "gtk/tap_dfilter_dlg.h"
#include "gtk/gtkglobals.h"
+#include "gtk/main.h"
/* used to keep track of the statistics for an entire program interface */
@@ -132,8 +133,6 @@ smbstat_draw(void *pss)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -236,7 +235,7 @@ gtk_smbstat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(ss->win);
window_present(ss->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
diff --git a/gtk/stats_tree_stat.c b/gtk/stats_tree_stat.c
index b2ecb905b7..ad042f4c65 100644
--- a/gtk/stats_tree_stat.c
+++ b/gtk/stats_tree_stat.c
@@ -8,17 +8,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
@@ -41,6 +41,7 @@
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
+#include "gtk/main.h"
struct _st_node_pres {
@@ -99,10 +100,10 @@ draw_gtk_node(stat_node* node)
static gchar rate[NUM_BUF_SIZE];
static gchar percent[NUM_BUF_SIZE];
stat_node* child;
-
+
stats_tree_get_strs_from_node(node, value, rate,
percent);
-
+
if (node->st->pr->store && node->pr->iter) {
gtk_tree_store_set(node->st->pr->store, node->pr->iter,
RATE_COLUMN, rate,
@@ -110,7 +111,7 @@ draw_gtk_node(stat_node* node)
PERCENT_COLUMN, percent,
-1);
}
-
+
if (node->children) {
for (child = node->children; child; child = child->next )
draw_gtk_node(child);
@@ -136,23 +137,20 @@ draw_gtk_tree(void *psp)
}
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
static void
free_gtk_tree(GtkWindow *win _U_, stats_tree *st)
{
-
+
protect_thread_critical_region();
remove_tap_listener(st);
unprotect_thread_critical_region();
-
+
if (st->root.pr)
st->root.pr->iter = NULL;
-
+
st->cfg->in_use = FALSE;
stats_tree_free(st);
-
+
}
static void
@@ -162,7 +160,7 @@ clear_node_pr(stat_node* n)
for (c = n->children; c; c = c->next) {
clear_node_pr(c);
}
-
+
if (n->pr->iter) {
gtk_tree_store_remove(n->st->pr->store, n->pr->iter);
n->pr->iter = NULL;
@@ -177,7 +175,7 @@ reset_tap(void* p)
for (c = st->root.children; c; c = c->next) {
clear_node_pr(c);
}
-
+
st->cfg->init(st);
}
@@ -197,26 +195,26 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
GtkWidget *main_vb, *bbox, *bt_close;
GtkTreeViewColumn* column;
GtkCellRenderer* renderer;
-
+
if (abbr) {
cfg = stats_tree_get_cfg_by_abbr(abbr);
-
+
if (cfg && cfg->in_use) {
/* XXX: ! */
report_failure("cannot open more than one tree of the same type at once");
return;
}
-
+
if (cfg != NULL) {
init_strlen = strlen(cfg->pr->stat_dlg->init_string);
-
+
if (strncmp (optarg, cfg->pr->stat_dlg->init_string, init_strlen) == 0){
if (init_strlen == strlen(optarg)) {
st = stats_tree_new(cfg,pr,NULL);
- } else {
+ } else {
st = stats_tree_new(cfg,pr,(char*)optarg+init_strlen+1);
}
-
+
} else {
st = stats_tree_new(cfg,pr,NULL);
}
@@ -226,7 +224,7 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
return;
}
g_free(abbr);
-
+
} else {
report_failure("could not obtain stats_tree abbr from optarg");
g_free(pr);
@@ -234,20 +232,20 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
}
cfg->in_use = TRUE;
-
+
window_name = g_strdup_printf("%s Stats Tree", cfg->name);
-
+
st->pr->win = window_new_with_geom(GTK_WINDOW_TOPLEVEL,window_name,window_name);
gtk_window_set_default_size(GTK_WINDOW(st->pr->win), 400, 400);
g_free(window_name);
-
+
if(st->filter){
title=g_strdup_printf("%s with filter: %s",cfg->name,st->filter);
} else {
st->filter=NULL;
title=g_strdup_printf("%s", cfg->name);
}
-
+
gtk_window_set_title(GTK_WINDOW(st->pr->win), title);
g_free(title);
@@ -259,12 +257,12 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
st->pr->store = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING);
-
+
st->pr->tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (st->pr->store));
g_object_unref(G_OBJECT(st->pr->store));
gtk_container_add( GTK_CONTAINER(scr_win), st->pr->tree);
-
+
/* the columns */
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Topic / Item", renderer,
@@ -273,16 +271,16 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
gtk_tree_view_column_set_resizable (column,TRUE);
gtk_tree_view_column_set_sizing(column,GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column (GTK_TREE_VIEW (st->pr->tree), column);
-
+
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Count", renderer,
"text", COUNT_COLUMN,
NULL);
-
+
gtk_tree_view_column_set_resizable (column,TRUE);
gtk_tree_view_column_set_sizing(column,GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column (GTK_TREE_VIEW (st->pr->tree), column);
-
+
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Rate", renderer,
"text", RATE_COLUMN,
@@ -290,7 +288,7 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
gtk_tree_view_column_set_resizable (column,TRUE);
gtk_tree_view_column_set_sizing(column,GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column (GTK_TREE_VIEW (st->pr->tree), column);
-
+
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Percent", renderer,
"text", PERCENT_COLUMN,
@@ -300,14 +298,14 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
gtk_tree_view_append_column (GTK_TREE_VIEW (st->pr->tree), column);
gtk_container_add( GTK_CONTAINER(main_vb), scr_win);
-
+
error_string = register_tap_listener( cfg->tapname,
st,
st->filter,
reset_tap,
stats_tree_packet,
draw_gtk_tree);
-
+
if (error_string) {
/* error, we failed to attach to the tap. clean up */
simple_dialog( ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str );
@@ -315,7 +313,7 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
report_failure("stats_tree for: %s failed to attach to the tap: %s",cfg->name,error_string->str);
g_string_free(error_string, TRUE);
}
-
+
/* Button row. */
bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL);
gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 0);
@@ -325,10 +323,10 @@ init_gtk_tree(const char* optarg, void *userdata _U_)
g_signal_connect(GTK_WINDOW(st->pr->win), "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
g_signal_connect(GTK_WINDOW(st->pr->win), "destroy", G_CALLBACK(free_gtk_tree), st);
-
+
gtk_widget_show_all(st->pr->win);
window_present(st->pr->win);
-
+
cf_retap_packets(&cfile, FALSE);
}
@@ -339,14 +337,14 @@ register_gtk_stats_tree_tap (gpointer k _U_, gpointer v, gpointer p _U_)
stats_tree_cfg* cfg = v;
cfg->pr = g_malloc(sizeof(tree_pres));
-
+
cfg->pr->stat_dlg = g_malloc(sizeof(tap_dfilter_dlg));
-
+
cfg->pr->stat_dlg->win_title = g_strdup_printf("%s Stats Tree",cfg->name);
cfg->pr->stat_dlg->init_string = g_strdup_printf("%s,tree",cfg->abbr);
cfg->pr->stat_dlg->tap_init_cb = init_gtk_tree;
cfg->pr->stat_dlg->index = -1;
-
+
register_dfilter_stat(cfg->pr->stat_dlg, cfg->name,
REGISTER_STAT_GROUP_UNSORTED);
}
@@ -360,7 +358,7 @@ free_tree_presentation(stats_tree* st)
void
register_tap_listener_stats_tree_stat(void)
{
-
+
stats_tree_presentation(register_gtk_stats_tree_tap,
setup_gtk_node_pr,
NULL,
diff --git a/gtk/voip_calls.c b/gtk/voip_calls.c
index 5edebaa7e2..ac7cf57fe2 100644
--- a/gtk/voip_calls.c
+++ b/gtk/voip_calls.c
@@ -9,7 +9,7 @@
* based on h323_calls.c
* Copyright 2004, Iskratel, Ltd, Kranj
* By Miha Jemec <m.jemec@iskratel.si>
- *
+ *
* H323, RTP, RTP Event, MGCP, AudioCodes (ISDN PRI and CAS), T38 and Graph Support
* By Alejandro Vaquero, alejandro.vaquero@verso.com
* Copyright 2005, Verso Technologies Inc.
@@ -147,16 +147,16 @@ void voip_calls_reset(voip_calls_tapinfo_t *tapinfo)
while (list)
{
callsinfo = list->data;
- if (callsinfo->call_id)
+ if (callsinfo->call_id)
g_free(callsinfo->call_id);
g_free(callsinfo->from_identity);
g_free(callsinfo->to_identity);
g_free((void *)(callsinfo->initial_speaker.data));
- if (callsinfo->protocol_name)
+ if (callsinfo->protocol_name)
g_free(callsinfo->protocol_name);
- if (callsinfo->call_comment)
+ if (callsinfo->call_comment)
g_free(callsinfo->call_comment);
-
+
if (callsinfo->free_prot_info && callsinfo->prot_info)
callsinfo->free_prot_info(callsinfo->prot_info);
@@ -372,7 +372,7 @@ void insert_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, cons
new_gai->line_style=line_style;
new_gai->display=FALSE;
- item_num = 0;
+ item_num = 0;
inserted = FALSE;
list = g_list_first(tapinfo->graph_analysis->list);
while (list)
@@ -401,7 +401,7 @@ static gboolean rtp_evt_end = FALSE;
/****************************************************************************/
/* whenever a rtp event packet is seen by the tap listener */
-static int
+static int
rtp_event_packet(void *ptr _U_, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *rtp_event_info)
{
const struct _rtp_event_info *pi = rtp_event_info;
@@ -435,7 +435,7 @@ rtp_event_init_tap(void)
rtp_event_packet,
NULL
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -483,7 +483,7 @@ static void voip_rtp_reset(void *ptr _U_)
/****************************************************************************/
/* whenever a RTP packet is seen by the tap listener */
-static int
+static int
RTP_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, void const *RTPinfo)
{
voip_rtp_tapinfo_t *tapinfo = &the_tapinfo_rtp_struct;
@@ -503,16 +503,16 @@ RTP_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, void con
#ifdef HAVE_LIBPORTAUDIO
add_rtp_packet(pi, pinfo);
#endif
-
+
/* check wether we already have a RTP stream with this setup frame and ssrc in the list */
list = g_list_first(tapinfo->list);
while (list)
{
tmp_listinfo=list->data;
- if ( (tmp_listinfo->setup_frame_number == pi->info_setup_frame_num)
+ if ( (tmp_listinfo->setup_frame_number == pi->info_setup_frame_num)
&& (tmp_listinfo->ssrc == pi->info_sync_src) && (tmp_listinfo->end_stream == FALSE)){
/* if the payload type has changed, we mark the stream as finished to create a new one
- this is to show multiple payload changes in the Graph for example for DTMF RFC2833 */
+ this is to show multiple payload changes in the Graph for example for DTMF RFC2833 */
if ( tmp_listinfo->pt != pi->info_payload_type ) {
tmp_listinfo->end_stream = TRUE;
} else {
@@ -600,7 +600,7 @@ static void RTP_packet_draw(void *prs _U_)
/* using the setup frame number of the RTP stream, we get the call number that it belongs */
voip_calls_graph_list = g_list_first(the_tapinfo_struct.graph_analysis->list);
while (voip_calls_graph_list)
- {
+ {
gai = voip_calls_graph_list->data;
conv_num = gai->conv_num;
/* if we get the setup frame number, then get the time position to graph the RTP arrow */
@@ -614,8 +614,8 @@ static void RTP_packet_draw(void *prs _U_)
if (rtp_listinfo->first_frame_num == gai->frame_num){
duration = (rtp_listinfo->stop_rel_sec*1000000 + rtp_listinfo->stop_rel_usec) - (rtp_listinfo->start_rel_sec*1000000 + rtp_listinfo->start_rel_usec);
g_free(gai->comment);
- gai->comment = g_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X",
- (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->npackets,
+ gai->comment = g_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X",
+ (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->npackets,
duration/1000000,(duration%1000000)/1000, rtp_listinfo->ssrc);
break;
}
@@ -634,9 +634,9 @@ static void RTP_packet_draw(void *prs _U_)
new_gai->port_src = rtp_listinfo->src_port;
new_gai->port_dst = rtp_listinfo->dest_port;
duration = (rtp_listinfo->stop_rel_sec*1000000 + rtp_listinfo->stop_rel_usec) - (rtp_listinfo->start_rel_sec*1000000 + rtp_listinfo->start_rel_usec);
- new_gai->frame_label = g_strdup_printf("%s (%s) %s", (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->pt_str, (rtp_listinfo->rtp_event == -1)?"":val_to_str(rtp_listinfo->rtp_event, rtp_event_type_values, "Unknown RTP Event"));
- new_gai->comment = g_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X",
- (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->npackets,
+ new_gai->frame_label = g_strdup_printf("%s (%s) %s", (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->pt_str, (rtp_listinfo->rtp_event == -1)?"":val_to_str(rtp_listinfo->rtp_event, rtp_event_type_values, "Unknown RTP Event"));
+ new_gai->comment = g_strdup_printf("%s Num packets:%u Duration:%u.%03us SSRC:0x%X",
+ (rtp_listinfo->is_srtp)?"SRTP":"RTP", rtp_listinfo->npackets,
duration/1000000,(duration%1000000)/1000, rtp_listinfo->ssrc);
new_gai->conv_num = conv_num;
new_gai->display=FALSE;
@@ -665,8 +665,8 @@ rtp_init_tap(void)
{
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("rtp", &(the_tapinfo_rtp_struct.rtp_dummy), NULL,
- voip_rtp_reset,
- RTP_packet,
+ voip_rtp_reset,
+ RTP_packet,
RTP_packet_draw
);
if (error_string != NULL) {
@@ -690,17 +690,13 @@ remove_tap_listener_rtp(void)
have_RTP_tap_listener=FALSE;
}
-/* XXX just copied from gtk/rpc_stat.c */
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
-
/****************************************************************************/
/******************************TAP for T38 **********************************/
/****************************************************************************/
/****************************************************************************/
/* whenever a T38 packet is seen by the tap listener */
-static int
+static int
T38_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *T38info)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -722,7 +718,7 @@ T38_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
/* using the setup frame number of the T38 packet, we get the call number that it belongs */
voip_calls_graph_list = g_list_first(tapinfo->graph_analysis->list);
while (voip_calls_graph_list)
- {
+ {
tmp_gai = voip_calls_graph_list->data;
if (pi->setup_frame_number == tmp_gai->frame_num){
gai = tmp_gai;
@@ -733,10 +729,10 @@ T38_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
if (gai) conv_num = (int) gai->conv_num;
}
- /* if setup_frame_number in the t38 packet is 0, it means it was not set using an SDP or H245 sesion, which means we don't
+ /* if setup_frame_number in the t38 packet is 0, it means it was not set using an SDP or H245 sesion, which means we don't
* have the associated Voip calls. It probably means the the packet was decoded using the default t38 port, or using "Decode as.."
* in this case we create a "voip" call that only have t38 media (no signaling)
- * OR if we have not found the Setup message in the graph.
+ * OR if we have not found the Setup message in the graph.
*/
if ( (pi->setup_frame_number == 0) || (gai == NULL) ){
/* check whether we already have a call with these parameters in the list */
@@ -816,7 +812,7 @@ T38_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const vo
g_free(comment);
g_free(frame_label);
-
+
tapinfo->redraw = TRUE;
return 1; /* refresh output */
@@ -833,8 +829,8 @@ t38_init_tap(void)
{
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("t38", &(the_tapinfo_struct.t38_dummy), NULL,
- voip_calls_dlg_reset,
- T38_packet,
+ voip_calls_dlg_reset,
+ T38_packet,
voip_calls_dlg_draw
);
if (error_string != NULL) {
@@ -870,14 +866,14 @@ static guint32 sdp_frame_num = 0;
static void free_sip_info(gpointer p) {
sip_calls_info_t *si = p;
-
+
if (si->call_identifier) g_free(si->call_identifier);
g_free(si);
}
/****************************************************************************/
/* whenever a SIP packet is seen by the tap listener */
-static int
+static int
SIPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *SIPinfo)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -946,7 +942,7 @@ SIPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
COPY_ADDRESS(&(tmp_src), &(pinfo->src));
COPY_ADDRESS(&(tmp_dst), &(pinfo->dst));
-
+
if (pi->request_method == NULL){
frame_label = g_strdup_printf("%u %s", pi->response_code, pi->reason_phrase );
comment = g_strdup_printf("SIP Status");
@@ -999,7 +995,7 @@ SIPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
++(tapinfo->npackets);
/* add to the graph */
- add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
g_free(comment);
g_free(frame_label);
g_free((void *)tmp_src.data);
@@ -1040,8 +1036,8 @@ sip_calls_init_tap(void)
{
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("sip", &(the_tapinfo_struct.sip_dummy), NULL,
- voip_calls_dlg_reset,
- SIPcalls_packet,
+ voip_calls_dlg_reset,
+ SIPcalls_packet,
voip_calls_dlg_draw
);
if (error_string != NULL) {
@@ -1076,7 +1072,7 @@ static guint32 mtp3_frame_num;
/****************************************************************************/
/* whenever a isup_ packet is seen by the tap listener */
-static int
+static int
isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *isup_info _U_)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -1093,10 +1089,10 @@ isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
/*voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct; unused */
const isup_tap_rec_t *pi = isup_info;
-
+
/* check if the lower layer is MTP matching the frame number */
if (mtp3_frame_num != pinfo->fd->num) return 0;
-
+
/* check whether we already have a call with these parameters in the list */
list = g_list_first(tapinfo->callsinfo_list);
while (list)
@@ -1113,7 +1109,7 @@ isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
} else{
right_pair = FALSE;
}
-
+
if (right_pair){
/* if there is an IAM for a call that is not in setup state, that means the previous call in the same
cic is no longer active */
@@ -1125,7 +1121,7 @@ isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
tmp_listinfo->call_active_state=VOIP_INACTIVE;
}
}
-
+
if (found){
callsinfo = (voip_calls_info_t*)(list->data);
break;
@@ -1167,7 +1163,7 @@ isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
}
-
+
if (callsinfo!=NULL){
callsinfo->stop_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs/1000;
@@ -1241,7 +1237,7 @@ isup_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
++(tapinfo->npackets);
/* add to the graph */
- add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
g_free(comment);
g_free(frame_label);
}
@@ -1265,11 +1261,11 @@ isup_calls_init_tap(void)
{
error_string = register_tap_listener("isup", &(the_tapinfo_struct.isup_dummy),
NULL,
- voip_calls_dlg_reset,
- isup_calls_packet,
+ voip_calls_dlg_reset,
+ isup_calls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -1300,7 +1296,7 @@ remove_tap_listener_isup_calls(void)
/****************************************************************************/
/* whenever a mtp3_ packet is seen by the tap listener */
-static int
+static int
mtp3_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *mtp3_info _U_)
{
const mtp3_tap_rec_t *pi = mtp3_info;
@@ -1330,8 +1326,8 @@ mtp3_calls_init_tap(void)
{
error_string = register_tap_listener("mtp3", &(the_tapinfo_struct.mtp3_dummy),
NULL,
- voip_calls_dlg_reset,
- mtp3_calls_packet,
+ voip_calls_dlg_reset,
+ mtp3_calls_packet,
voip_calls_dlg_draw
);
@@ -1343,16 +1339,16 @@ mtp3_calls_init_tap(void)
}
have_mtp3_tap_listener=TRUE;
}
-
+
if(have_m3ua_tap_listener==FALSE)
{
error_string = register_tap_listener("m3ua", &(the_tapinfo_struct.mtp3_dummy),
NULL,
- voip_calls_dlg_reset,
- mtp3_calls_packet,
+ voip_calls_dlg_reset,
+ mtp3_calls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -1361,7 +1357,7 @@ mtp3_calls_init_tap(void)
}
have_m3ua_tap_listener=TRUE;
}
-
+
}
/****************************************************************************/
@@ -1403,11 +1399,11 @@ static gint32 actrace_direction = 0;
/****************************************************************************/
/* whenever a q931_ packet is seen by the tap listener */
-static int
+static int
q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *q931_info _U_)
{
GList *list,*list2;
- voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
+ voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
h323_calls_info_t *tmp_h323info,*tmp2_h323info;
actrace_isdn_calls_info_t *tmp_actrace_isdn_info;
voip_calls_info_t *tmp_listinfo;
@@ -1420,7 +1416,7 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
/* free previously allocated q931_calling/ed_number */
g_free(q931_calling_number);
g_free(q931_called_number);
-
+
if (pi->calling_number!=NULL)
q931_calling_number = g_strdup(pi->calling_number);
else
@@ -1471,8 +1467,8 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
}
/* check if there is an LRQ/LCF that match this Setup */
- /* TODO: we are just checking the DialedNumer in LRQ/LCF agains the Setup
- we should also check if the h225 signaling IP and port match the destination
+ /* TODO: we are just checking the DialedNumer in LRQ/LCF agains the Setup
+ we should also check if the h225 signaling IP and port match the destination
Setup ip and port */
list = g_list_first(tapinfo->callsinfo_list);
while (list)
@@ -1480,18 +1476,18 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
tmp_listinfo=list->data;
if (tmp_listinfo->protocol == VOIP_H323){
tmp2_h323info = tmp_listinfo->prot_info;
-
+
/* check if the called number match a LRQ/LCF */
- if ( (strcmp(callsinfo->to_identity, tmp_listinfo->to_identity)==0)
- && (memcmp(&tmp2_h323info->guid, &guid_allzero, GUID_LEN) == 0) ){
+ if ( (strcmp(callsinfo->to_identity, tmp_listinfo->to_identity)==0)
+ && (memcmp(&tmp2_h323info->guid, &guid_allzero, GUID_LEN) == 0) ){
/* change the call graph to the LRQ/LCF to belong to this call */
callsinfo->npackets += change_call_num_graph(tapinfo, tmp_listinfo->call_num, callsinfo->call_num);
-
+
/* remove this LRQ/LCF call entry because we have found the Setup that match them */
g_free(tmp_listinfo->from_identity);
g_free(tmp_listinfo->to_identity);
g_free(tmp2_h323info->guid);
-
+
list2 = g_list_first(tmp2_h323info->h245_list);
while (list2)
{
@@ -1510,11 +1506,11 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
list = g_list_next (list);
}
- comment = g_strdup_printf("H225 From: %s To:%s TunnH245:%s FS:%s", callsinfo->from_identity, callsinfo->to_identity, (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
+ comment = g_strdup_printf("H225 From: %s To:%s TunnH245:%s FS:%s", callsinfo->from_identity, callsinfo->to_identity, (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
(h225_is_faststart==TRUE?"on":"off"));
} else if (h225_cstype == H225_RELEASE_COMPLET) {
/* get the Q931 Release cause code */
- if (q931_cause_value != 0xFF){
+ if (q931_cause_value != 0xFF){
comment = g_strdup_printf("H225 Q931 Rel Cause (%i):%s", q931_cause_value, val_to_str(q931_cause_value, q931_cause_code_vals, "<unknown>"));
} else { /* Cause not set */
comment = g_strdup("H225 No Q931 Rel Cause");
@@ -1532,8 +1528,8 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
/* add staff to H245 */
} else if (h245_labels.frame_num == q931_frame_num) {
- /* there are empty H225 frames that don't have guid (guaid=0) but they have h245 info,
- so the only way to match those frames is with the Q931 CRV number */
+ /* there are empty H225 frames that don't have guid (guaid=0) but they have h245 info,
+ so the only way to match those frames is with the Q931 CRV number */
list = g_list_first(tapinfo->callsinfo_list);
while (list)
{
@@ -1552,7 +1548,7 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
/* increment the packets counter of all calls */
++(tapinfo->npackets);
}
-
+
/* Add the H245 info if exists to the Graph */
h245_add_to_graph(pinfo->fd->num);
g_free(comment);
@@ -1638,7 +1634,7 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
callsinfo->call_state=VOIP_COMPLETED;
tapinfo->completed_calls++;
}
- if (q931_cause_value != 0xFF){
+ if (q931_cause_value != 0xFF){
comment = g_strdup_printf("AC_ISDN trunk:%u Q931 Rel Cause (%i):%s", actrace_trunk, q931_cause_value, val_to_str(q931_cause_value, q931_cause_code_vals, "<unknown>"));
} else { /* Cause not set */
comment = g_strdup("AC_ISDN No Q931 Rel Cause");
@@ -1649,7 +1645,7 @@ q931_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
if (!comment)
comment = g_strdup_printf("AC_ISDN trunk:%u", actrace_trunk );
- add_to_graph(tapinfo, pinfo, val_to_str(pi->message_type, q931_message_type_vals, "<unknown>") , comment, callsinfo->call_num,
+ add_to_graph(tapinfo, pinfo, val_to_str(pi->message_type, q931_message_type_vals, "<unknown>") , comment, callsinfo->call_num,
actrace_direction?&pstn_add:&(pinfo->src),
actrace_direction?&(pinfo->src):&pstn_add,
1 );
@@ -1680,7 +1676,7 @@ q931_calls_init_tap(void)
q931_calls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -1709,7 +1705,7 @@ remove_tap_listener_q931_calls(void)
static void add_h245_Address(h323_calls_info_t *h323info, h245_address_t *h245_address)
{
- h323info->h245_list = g_list_append(h323info->h245_list, h245_address);
+ h323info->h245_list = g_list_append(h323info->h245_list, h245_address);
}
@@ -1727,16 +1723,16 @@ static void free_h225_info(gpointer p) {
g_free(list2->data);
list2 = g_list_next(list2);
}
-
+
g_list_free(tmp_h323info->h245_list);
-
+
}
-
+
g_free(p);
}
/****************************************************************************/
/* whenever a H225 packet is seen by the tap listener */
-static int
+static int
H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *H225info)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -1748,20 +1744,20 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
GList *list;
address tmp_src, tmp_dst;
h245_address_t *h245_add = NULL;
-
+
const h225_packet_info *pi = H225info;
-
+
/* if not guid and RAS and not LRQ, LCF or LRJ return because did not belong to a call */
/* OR, if not guid and is H225 return because doesn't belong to a call */
if ((memcmp(&pi->guid, &guid_allzero, GUID_LEN) == 0))
if ( ((pi->msg_type == H225_RAS) && ((pi->msg_tag < 18) || (pi->msg_tag > 20))) || (pi->msg_type != H225_RAS) )
return 0;
-
+
/* if it is RAS LCF or LRJ*/
- if ( (pi->msg_type == H225_RAS) && ((pi->msg_tag == 19) || (pi->msg_tag == 20))) {
+ if ( (pi->msg_type == H225_RAS) && ((pi->msg_tag == 19) || (pi->msg_tag == 20))) {
/* if the LCF/LRJ doesn't match to a LRQ, just return */
if (!pi->request_available) return 0;
-
+
/* check whether we already have a call with this request SeqNum */
list = g_list_first(tapinfo->callsinfo_list);
while (list)
@@ -1786,7 +1782,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
if (tmp_listinfo->protocol == VOIP_H323){
tmp_h323info = tmp_listinfo->prot_info;
g_assert(tmp_h323info != NULL);
- if ( (memcmp(tmp_h323info->guid, &guid_allzero, GUID_LEN) != 0) && (memcmp(tmp_h323info->guid, &pi->guid,GUID_LEN)==0) ){
+ if ( (memcmp(tmp_h323info->guid, &guid_allzero, GUID_LEN) != 0) && (memcmp(tmp_h323info->guid, &pi->guid,GUID_LEN)==0) ){
callsinfo = (voip_calls_info_t*)(list->data);
break;
}
@@ -1794,7 +1790,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
list = g_list_next (list);
}
}
-
+
h225_cstype = pi->cs_type;
h225_is_faststart = pi->is_faststart;
@@ -1813,7 +1809,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
callsinfo->protocol=VOIP_H323;
callsinfo->prot_info=g_malloc(sizeof(h323_calls_info_t));
callsinfo->free_prot_info = free_h225_info;
-
+
tmp_h323info = callsinfo->prot_info;
g_assert(tmp_h323info != NULL);
tmp_h323info->guid = g_memdup(&pi->guid, sizeof pi->guid);
@@ -1829,8 +1825,8 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
tmp_h323info->requestSeqNum = 0;
callsinfo->call_num = tapinfo->ncalls++;
callsinfo->npackets = 0;
-
- tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
+
+ tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
}
if (callsinfo!=NULL){
@@ -1877,16 +1873,16 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
tmp_h323info->is_faststart_Setup = pi->is_faststart;
/* Set the Setup address if it was not set */
- if (tmp_h323info->h225SetupAddr.type == AT_NONE)
+ if (tmp_h323info->h225SetupAddr.type == AT_NONE)
COPY_ADDRESS(&(tmp_h323info->h225SetupAddr), &(pinfo->src));
callsinfo->call_state=VOIP_CALL_SETUP;
- comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
+ comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
(pi->is_faststart==TRUE?"on":"off"));
break;
case H225_CONNECT:
callsinfo->call_state=VOIP_IN_CALL;
if (pi->is_faststart == TRUE) tmp_h323info->is_faststart_Proc = TRUE;
- comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
+ comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
(pi->is_faststart==TRUE?"on":"off"));
break;
case H225_RELEASE_COMPLET:
@@ -1909,15 +1905,15 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
case H225_ALERTING:
case H225_CALL_PROCEDING:
if (pi->is_faststart == TRUE) tmp_h323info->is_faststart_Proc = TRUE;
- comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
+ comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
(pi->is_faststart==TRUE?"on":"off"));
break;
default:
- comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
+ comment = g_strdup_printf("H225 TunnH245:%s FS:%s", (tmp_h323info->is_h245Tunneling==TRUE?"on":"off"),
(pi->is_faststart==TRUE?"on":"off"));
-
- }
- }
+
+ }
+ }
else if (pi->msg_type == H225_RAS){
switch(pi->msg_tag){
case 18: /* LRQ */
@@ -1927,7 +1923,7 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
tmp_h323info->requestSeqNum = pi->requestSeqNum;
}
case 19: /* LCF */
- if (strlen(pi->dialedDigits))
+ if (strlen(pi->dialedDigits))
comment = g_strdup_printf("H225 RAS dialedDigits: %s", pi->dialedDigits);
else
comment = g_strdup("H225 RAS");
@@ -1956,9 +1952,9 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
g_free(frame_label);
g_free(comment);
-
- }
-
+
+ }
+
tapinfo->redraw = TRUE;
return 1; /* refresh output */
@@ -1979,11 +1975,11 @@ h225_calls_init_tap(void)
{
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("h225", &(the_tapinfo_struct.h225_dummy), NULL,
- voip_calls_dlg_reset,
- H225calls_packet,
+ voip_calls_dlg_reset,
+ H225calls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -2005,11 +2001,11 @@ remove_tap_listener_h225_calls(void)
have_H225_tap_listener=FALSE;
}
-/* Add the h245 label info to the graph */
+/* Add the h245 label info to the graph */
void h245_add_to_graph(guint32 new_frame_num)
{
gint8 n;
-
+
if (new_frame_num != h245_labels.frame_num) return;
for (n=0; n<h245_labels.labels_count; n++) {
@@ -2023,11 +2019,11 @@ void h245_add_to_graph(guint32 new_frame_num)
h245_labels.labels_count = 0;
}
-/* free the h245_labels if the frame number is different */
+/* free the h245_labels if the frame number is different */
static void h245_free_labels(guint32 new_frame_num)
{
gint8 n;
-
+
if (new_frame_num == h245_labels.frame_num) return;
for (n=0; n<h245_labels.labels_count; n++) {
@@ -2040,7 +2036,7 @@ static void h245_free_labels(guint32 new_frame_num)
h245_labels.labels_count = 0;
}
-/* add the frame_label and comment to h245_labels and free the actual one if it is different frame num */
+/* add the frame_label and comment to h245_labels and free the actual one if it is different frame num */
static void h245_add_label(guint32 new_frame_num, const gchar *frame_label, const gchar *comment)
{
h245_free_labels(new_frame_num);
@@ -2056,7 +2052,7 @@ static void h245_add_label(guint32 new_frame_num, const gchar *frame_label, cons
/****************************************************************************/
/* whenever a H245dg packet is seen by the tap listener (when H245 tunneling is ON) */
-static int
+static int
H245dgcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *H245info)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -2095,7 +2091,7 @@ H245dgcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
++(tapinfo->npackets);
break;
- }
+ }
list2 = g_list_next(list2);
}
if (callsinfo!=NULL) break;
@@ -2119,11 +2115,11 @@ H245dgcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c
}
g_free(frame_label);
g_free(comment);
- } else {
- /* Tunnel is ON, so we save the label info to use it into h225 or q931 tap. OR may be
- tunnel OFF but we did not matched the h245 add, in this case nobady will set this label
- since the frame_num will not match */
-
+ } else {
+ /* Tunnel is ON, so we save the label info to use it into h225 or q931 tap. OR may be
+ tunnel OFF but we did not matched the h245 add, in this case nobady will set this label
+ since the frame_num will not match */
+
h245_add_label(pinfo->fd->num, (gchar *) pi->frame_label, (gchar *) pi->comment);
}
@@ -2148,10 +2144,10 @@ h245dg_calls_init_tap(void)
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("h245dg", &(the_tapinfo_struct.h245dg_dummy), NULL,
voip_calls_dlg_reset,
- H245dgcalls_packet,
+ H245dgcalls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -2177,7 +2173,7 @@ remove_tap_listener_h245dg_calls(void)
/****************************TAP for SDP PROTOCOL ***************************/
/****************************************************************************/
/* whenever a SDP packet is seen by the tap listener */
-static int
+static int
SDPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *SDPinfo)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -2185,7 +2181,7 @@ SDPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, cons
/* There are protocols like MGCP/SIP where the SDP is called before the tap for the
MGCP/SIP packet, in those cases we assign the SPD summary to global lastSDPsummary
- to use it later
+ to use it later
*/
g_free(sdp_summary);
sdp_frame_num = pinfo->fd->num;
@@ -2213,11 +2209,11 @@ sdp_calls_init_tap(void)
{
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("sdp", &(the_tapinfo_struct.sdp_dummy), NULL,
- voip_calls_dlg_reset,
- SDPcalls_packet,
+ voip_calls_dlg_reset,
+ SDPcalls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -2247,13 +2243,13 @@ remove_tap_listener_sdp_calls(void)
/*
This function will look for a signal/event in the SignalReq/ObsEvent string
- and return true if it is found
+ and return true if it is found
*/
static gboolean isSignal(const gchar *signal, const gchar *signalStr)
{
- gint i;
+ gint i;
gchar **resultArray;
-
+
/* if there is no signalStr, just return false */
if (signalStr == NULL) return FALSE;
@@ -2269,7 +2265,7 @@ static gboolean isSignal(const gchar *signal, const gchar *signalStr)
}
g_strfreev(resultArray);
-
+
return FALSE;
}
@@ -2280,7 +2276,7 @@ static gboolean isSignal(const gchar *signal, const gchar *signalStr)
static void mgcpCallerID(gchar *signalStr, gchar **callerId)
{
gchar **arrayStr;
-
+
/* if there is no signalStr, just return false */
if (signalStr == NULL) return;
@@ -2308,13 +2304,13 @@ static void mgcpDialedDigits(gchar *signalStr, gchar **dialedDigits)
{
gchar *tmpStr;
gchar resultStr[50];
- gint i,j;
+ gint i,j;
/* if there is no signalStr, just return false */
if (signalStr == NULL) return;
tmpStr = g_strdup(signalStr);
-
+
for ( i = 0 ; tmpStr[i] ; i++) {
switch (tmpStr[i]) {
case '0' : case '1' : case '2' : case '3' : case '4' :
@@ -2326,7 +2322,7 @@ static void mgcpDialedDigits(gchar *signalStr, gchar **dialedDigits)
break;
}
}
-
+
for (i = 0, j = 0; tmpStr[i] && i<50; i++) {
if (tmpStr[i] != '?')
resultStr[j++] = tmpStr[i];
@@ -2334,7 +2330,7 @@ static void mgcpDialedDigits(gchar *signalStr, gchar **dialedDigits)
resultStr[j] = '\0';
if (*resultStr == '\0') return;
-
+
g_free(*dialedDigits);
*dialedDigits = g_strdup(resultStr);
g_free(tmpStr);
@@ -2346,7 +2342,7 @@ static void mgcpDialedDigits(gchar *signalStr, gchar **dialedDigits)
/****************************************************************************/
/* whenever a MGCP packet is seen by the tap listener */
-static int
+static int
MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *MGCPinfo)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -2396,11 +2392,11 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
}
list = g_list_next (list);
}
-
+
/* there is no call with this Endpoint, lets see if this a new call or not */
if (callsinfo == NULL){
if ( (strcmp(pi->code, "NTFY") == 0) && isSignal("hd", pi->observedEvents) ){ /* off hook transition */
- /* this is a new call from the Endpoint */
+ /* this is a new call from the Endpoint */
fromEndpoint = TRUE;
new = TRUE;
} else if (strcmp(pi->code, "CRCX") == 0){
@@ -2409,7 +2405,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
new = TRUE;
}
if (!new) return 0;
- }
+ }
} else if ( ((pi->mgcp_type == MGCP_RESPONSE) && pi->request_available) ||
((pi->mgcp_type == MGCP_REQUEST) && pi->is_duplicate) ) {
/* if it is a response OR if it is a duplicated Request, lets look in the Graph to see
@@ -2483,7 +2479,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
if (callsinfo->to_identity[0] == '\0') mgcpDialedDigits(pi->observedEvents, &(callsinfo->to_identity));
/* from MGC and the user picked up, the call is connected */
- } else if (isSignal("hd", pi->observedEvents))
+ } else if (isSignal("hd", pi->observedEvents))
callsinfo->call_state=VOIP_IN_CALL;
/* hung up signal */
@@ -2493,21 +2489,21 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
} else {
callsinfo->call_state = VOIP_COMPLETED;
}
- }
-
+ }
+
} else if (strcmp(pi->code, "RQNT") == 0) {
/* for calls from Endpoint: if there is a "no signal" RQNT and the call was RINGING, we assume this is the CONNECT */
- if ( tmp_mgcpinfo->fromEndpoint && isSignal("", pi->signalReq) && (callsinfo->call_state == VOIP_RINGING) ) {
+ if ( tmp_mgcpinfo->fromEndpoint && isSignal("", pi->signalReq) && (callsinfo->call_state == VOIP_RINGING) ) {
callsinfo->call_state = VOIP_IN_CALL;
}
/* if there is ringback or ring tone, change state to ringing */
- if ( isSignal("rg", pi->signalReq) || isSignal("rt", pi->signalReq) ) {
+ if ( isSignal("rg", pi->signalReq) || isSignal("rt", pi->signalReq) ) {
callsinfo->call_state = VOIP_RINGING;
}
/* if there is a Busy or ReorderTone, and the call was Ringing or Setup the call is Rejected */
- if ( (isSignal("ro", pi->signalReq) || isSignal("bz", pi->signalReq)) && ((callsinfo->call_state == VOIP_CALL_SETUP) || (callsinfo->call_state = VOIP_RINGING)) ) {
+ if ( (isSignal("ro", pi->signalReq) || isSignal("bz", pi->signalReq)) && ((callsinfo->call_state == VOIP_CALL_SETUP) || (callsinfo->call_state = VOIP_RINGING)) ) {
callsinfo->call_state = VOIP_REJECTED;
}
@@ -2515,7 +2511,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
frame_label = g_strdup_printf("%s%sSigReq:%s",pi->code, (pi->hasDigitMap == TRUE)?" DigitMap ":"", pi->signalReq);
else
frame_label = g_strdup_printf("%s%s",pi->code, (pi->hasDigitMap == TRUE)?" DigitMap ":"");
-
+
/* use the CallerID info to fill the "From" for the call */
if (!tmp_mgcpinfo->fromEndpoint) mgcpCallerID(pi->signalReq, &(callsinfo->from_identity));
@@ -2527,8 +2523,8 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
if (!tmp_mgcpinfo->fromEndpoint){
if ((callsinfo->call_state == VOIP_CALL_SETUP) || (callsinfo->call_state == VOIP_RINGING)){
callsinfo->call_state = VOIP_CANCELLED;
- }
- }
+ }
+ }
}
if (frame_label == NULL) frame_label = g_strdup_printf("%s",pi->code);
@@ -2552,7 +2548,7 @@ MGCPcalls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, co
++(tapinfo->npackets);
/* add to the graph */
- add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
g_free(comment);
g_free(frame_label);
@@ -2584,8 +2580,8 @@ mgcp_calls_init_tap(void)
/* don't register tap listener, if we have it already */
/* we send an empty filter, to force a non null "tree" in the mgcp dissector */
error_string = register_tap_listener("mgcp", &(the_tapinfo_struct.mgcp_dummy), g_strdup(""),
- voip_calls_dlg_reset,
- MGCPcalls_packet,
+ voip_calls_dlg_reset,
+ MGCPcalls_packet,
voip_calls_dlg_draw
);
if (error_string != NULL) {
@@ -2615,7 +2611,7 @@ remove_tap_listener_mgcp_calls(void)
/****************************************************************************/
/* whenever a ACTRACE packet is seen by the tap listener */
-static int
+static int
ACTRACEcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *ACTRACEinfo)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -2667,7 +2663,7 @@ ACTRACEcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
callsinfo->protocol=VOIP_AC_CAS;
callsinfo->prot_info=g_malloc(sizeof(actrace_cas_calls_info_t));
callsinfo->free_prot_info = g_free;
-
+
tmp_actrace_cas_info=callsinfo->prot_info;
tmp_actrace_cas_info->bchannel=pi->cas_bchannel;
tmp_actrace_cas_info->trunk=actrace_trunk;
@@ -2686,7 +2682,7 @@ ACTRACEcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
if (!comment)
comment = g_strdup_printf("AC_CAS trunk:%u", actrace_trunk );
- add_to_graph(tapinfo, pinfo, pi->cas_frame_label , comment, callsinfo->call_num,
+ add_to_graph(tapinfo, pinfo, pi->cas_frame_label , comment, callsinfo->call_num,
actrace_direction?&pstn_add:&(pinfo->src),
actrace_direction?&(pinfo->src):&pstn_add,
1 );
@@ -2715,11 +2711,11 @@ actrace_calls_init_tap(void)
{
/* don't register tap listener, if we have it already */
error_string = register_tap_listener("actrace", &(the_tapinfo_struct.actrace_dummy), NULL,
- voip_calls_dlg_reset,
- ACTRACEcalls_packet,
+ voip_calls_dlg_reset,
+ ACTRACEcalls_packet,
voip_calls_dlg_draw
);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
@@ -2762,11 +2758,11 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
address* mgw;
address* mgc;
gchar mgw_addr[128];
-
+
if (cmd->ctx->id == NULL_CONTEXT || cmd->ctx->id == ALL_CONTEXTS ) {
return 0;
}
-
+
if ( gcp_is_req(cmd->type) ) {
mgw = &(pinfo->dst);
mgc = &(pinfo->src);
@@ -2774,15 +2770,15 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
mgc = &(pinfo->dst);
mgw = &(pinfo->src);
}
-
+
address_to_str_buf(mgw, mgw_addr, 128);
-
+
/* check whether we already have this context in the list */
list = g_list_first(tapinfo->callsinfo_list);
while (list)
{
voip_calls_info_t* tmp_listinfo = list->data;
-
+
if (tmp_listinfo->protocol == TEL_H248){
if (tmp_listinfo->prot_info == cmd->ctx){
callsinfo = (voip_calls_info_t*)(list->data);
@@ -2791,9 +2787,9 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
}
list = g_list_next (list);
}
-
+
if (callsinfo==NULL){
-
+
callsinfo = g_malloc0(sizeof(voip_calls_info_t));
callsinfo->call_state = VOIP_NO_STATE;
callsinfo->call_active_state = VOIP_ACTIVE;
@@ -2801,13 +2797,13 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
callsinfo->to_identity = g_strdup("");
callsinfo->prot_info = cmd->ctx;
callsinfo->free_prot_info = NULL;
-
+
callsinfo->npackets = 1;
callsinfo->first_frame_num=pinfo->fd->num;
callsinfo->last_frame_num=pinfo->fd->num;
COPY_ADDRESS(&(callsinfo->initial_speaker), mgc);
-
+
callsinfo->protocol = TEL_H248;
callsinfo->call_num = tapinfo->ncalls++;
callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
@@ -2816,7 +2812,7 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs;
callsinfo->selected = FALSE;
-
+
tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
} else {
@@ -2835,32 +2831,32 @@ static int h248_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *
g_string_append_printf(s," %s",ctx_term->term->str);
}
}
-
+
callsinfo->to_identity = s->str;
g_string_free(s,FALSE);
-
+
callsinfo->stop_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs;
callsinfo->last_frame_num=pinfo->fd->num;
++(callsinfo->npackets);
}
-
+
add_to_graph(tapinfo, pinfo, cmd->str ? cmd->str : "unknown Msg",
ep_strdup_printf("TrxId = %u, CtxId = %.8x",cmd->trx->id,cmd->ctx->id),
callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
-
+
++(tapinfo->npackets);
tapinfo->redraw = TRUE;
-
+
return 1;
}
void h248_calls_init_tap(void)
{
GString *error_string;
-
-
+
+
if(have_megaco_tap_listener==FALSE)
{
error_string = register_tap_listener("megaco", &(the_tapinfo_struct.megaco_dummy),
@@ -2868,17 +2864,17 @@ void h248_calls_init_tap(void)
voip_calls_dlg_reset,
h248_calls_packet,
voip_calls_dlg_draw);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
-
+
have_megaco_tap_listener=TRUE;
}
-
+
if(have_h248_tap_listener==FALSE)
{
error_string = register_tap_listener("h248", &(the_tapinfo_struct.h248_dummy),
@@ -2886,14 +2882,14 @@ void h248_calls_init_tap(void)
voip_calls_dlg_reset,
h248_calls_packet,
voip_calls_dlg_draw);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
-
+
have_h248_tap_listener=TRUE;
}
}
@@ -2905,7 +2901,7 @@ remove_tap_listener_h248_calls(void)
remove_tap_listener(&(the_tapinfo_struct.h248_dummy));
remove_tap_listener(&(the_tapinfo_struct.megaco_dummy));
unprotect_thread_critical_region();
-
+
have_megaco_tap_listener=FALSE;
have_h248_tap_listener=FALSE;
}
@@ -2940,7 +2936,7 @@ static int sccp_calls(packet_info *pinfo, const void *prot_info) {
break;
}
}
-
+
if (callsinfo==NULL){
callsinfo = g_malloc0(sizeof(voip_calls_info_t));
callsinfo->call_state = VOIP_CALL_SETUP;
@@ -2950,50 +2946,50 @@ static int sccp_calls(packet_info *pinfo, const void *prot_info) {
} else {
callsinfo->from_identity = g_strdup("Unknown");
}
-
+
if ( assoc->called_party ) {
callsinfo->to_identity = g_strdup(assoc->called_party);
} else {
callsinfo->to_identity = g_strdup("Unknown");
}
-
+
callsinfo->prot_info = (void*)assoc;
callsinfo->free_prot_info = NULL;
-
+
callsinfo->npackets = 1;
callsinfo->first_frame_num=pinfo->fd->num;
callsinfo->last_frame_num=pinfo->fd->num;
-
+
COPY_ADDRESS(&(callsinfo->initial_speaker), &(pinfo->src));
-
+
callsinfo->protocol = SP2VP(assoc->payload);
callsinfo->start_sec=(gint32) pinfo->fd->rel_ts.secs;
callsinfo->start_usec=pinfo->fd->rel_ts.nsecs;
callsinfo->stop_sec=(gint32) pinfo->fd->rel_ts.secs;
callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs;
-
+
callsinfo->selected = FALSE;
callsinfo->call_num = tapinfo->ncalls++;
-
+
tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
} else {
-
+
if ( assoc->calling_party ) {
if (callsinfo->from_identity) g_free(callsinfo->from_identity );
callsinfo->from_identity = g_strdup(assoc->calling_party);
}
-
+
if ( assoc->called_party ) {
if (callsinfo->to_identity) g_free(callsinfo->to_identity );
callsinfo->to_identity = g_strdup(assoc->called_party);
}
-
+
callsinfo->protocol = SP2VP(assoc->payload);
callsinfo->stop_sec=(gint32) pinfo->fd->rel_ts.secs;
callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs;
callsinfo->last_frame_num=pinfo->fd->num;
++(callsinfo->npackets);
-
+
switch (msg->type) {
case SCCP_MSG_TYPE_CC:
callsinfo->call_state = VOIP_IN_CALL;
@@ -3006,25 +3002,25 @@ static int sccp_calls(packet_info *pinfo, const void *prot_info) {
break;
}
}
-
+
if (msg->data.co.label) {
label = msg->data.co.label;
} else {
label = val_to_str(msg->type, sccp_payload_values, "Unknown(%d)");
}
-
+
if (msg->data.co.comment) {
comment = msg->data.co.comment;
} else {
comment = "";
}
-
+
add_to_graph(tapinfo, pinfo, label,(void*) comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
-
+
++(tapinfo->npackets);
tapinfo->redraw = TRUE;
-
+
return 1;
}
@@ -3043,7 +3039,7 @@ static int sua_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *e
void sccp_calls_init_tap(void)
{
GString *error_string;
-
+
if(have_sccp_tap_listener==FALSE)
{
error_string = register_tap_listener("sccp", &(the_tapinfo_struct.sccp_dummy),
@@ -3051,14 +3047,14 @@ void sccp_calls_init_tap(void)
voip_calls_dlg_reset,
sccp_calls_packet,
voip_calls_dlg_draw);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
-
+
have_sccp_tap_listener=TRUE;
}
@@ -3069,17 +3065,17 @@ void sccp_calls_init_tap(void)
voip_calls_dlg_reset,
sua_calls_packet,
voip_calls_dlg_draw);
-
+
if (error_string != NULL) {
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
error_string->str);
g_string_free(error_string, TRUE);
exit(1);
}
-
+
have_sua_tap_listener=TRUE;
}
-
+
}
void
@@ -3088,7 +3084,7 @@ remove_tap_listener_sccp_calls(void)
protect_thread_critical_region();
remove_tap_listener(&(the_tapinfo_struct.sccp_dummy));
unprotect_thread_critical_region();
-
+
have_sccp_tap_listener=FALSE;
have_sua_tap_listener=FALSE;
}
@@ -3098,7 +3094,7 @@ remove_tap_listener_sccp_calls(void)
/****************************TAP for UNISTIM ********************************/
/****************************************************************************/
-static int
+static int
unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *unistim_info)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -3109,7 +3105,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
GString *g_tmp = NULL;
gchar *frame_label = NULL;
gchar *comment = NULL;
-
+
/* Fetch specific packet infos */
const unistim_info_t *pi = unistim_info;
@@ -3147,7 +3143,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
callsinfo = (voip_calls_info_t*)(list->data);
break;
}
- }
+ }
else if(ADDRESSES_EQUAL(&tmp_unistim_info->it_ip, &pinfo->src) && ADDRESSES_EQUAL(&tmp_unistim_info->ni_ip,&pinfo->dst) && (tmp_unistim_info->it_port == pinfo->srcport)) {
if(tmp_listinfo->call_state == VOIP_COMPLETED || tmp_listinfo->call_state == VOIP_UNKNOWN){
/* Do nothing, it ain't our call.. */
@@ -3158,7 +3154,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
}
}
}
-
+
/* Otherwise, go to the next one.. */
list = g_list_next(list);
}
@@ -3167,7 +3163,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
if(pi->key_state == 1 || pi->hook_state == 1){
- /* If the user hits a button,
+ /* If the user hits a button,
Session will be SETUP */
/* If new add to list */
@@ -3181,17 +3177,17 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
COPY_ADDRESS(&(callsinfo->initial_speaker),&(pinfo->src));
callsinfo->first_frame_num=pinfo->fd->num;
callsinfo->selected=FALSE;
-
+
/* Set this on init of struct so in case the call doesn't complete, we'll have a ref. */
/* Otherwise if the call is completed we'll have the open/close streams to ref actual call duration */
callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->start_usec=pinfo->fd->rel_ts.nsecs/1000;
-
+
callsinfo->protocol=VOIP_UNISTIM;
callsinfo->prot_info=g_malloc(sizeof(unistim_info_t));
-
+
tmp_unistim_info = callsinfo->prot_info;
-
+
/* Clear tap struct */
tmp_unistim_info->rudp_type = 0;
tmp_unistim_info->payload_type = 0;
@@ -3205,7 +3201,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
tmp_unistim_info->set_termid = -1;
tmp_unistim_info->string_data = NULL;
tmp_unistim_info->key_buffer = NULL;
-
+
COPY_ADDRESS(&(tmp_unistim_info->it_ip),&(pi->it_ip));
COPY_ADDRESS(&(tmp_unistim_info->ni_ip),&(pi->ni_ip));
tmp_unistim_info->it_port = pi->it_port;
@@ -3229,10 +3225,10 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
/* This is a valid packet so increment counter */
++(callsinfo->npackets);
-
+
/* increment the packets counter of all calls */
++(tapinfo->npackets);
-
+
/* Key was depressed.. update key buffer.. */
if(pi->key_val >= 0 && pi->key_val <= 11){
@@ -3287,7 +3283,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Manipulate the data */
g_string_truncate(g_tmp,g_tmp->len-1);
-
+
/* Insert new data */
tmp_unistim_info->key_buffer = g_strdup_printf("%s",g_tmp->str);
}
@@ -3304,17 +3300,17 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
/* User pressed the soft key 2 */
/* On cs2k phones, soft key 2 is backspace. */
if(pi->key_buffer != NULL) {
-
+
/* Get data */
g_string_assign(g_tmp,pi->key_buffer);
/* Manipulate the data */
g_string_truncate(g_tmp,g_tmp->len-1);
-
+
/* Insert new data */
tmp_unistim_info->key_buffer = g_strdup_printf("%s",g_tmp->str);
}
-
+
/* add label and comment */
comment = g_strdup_printf("Key Input Sent: S2 (%d)", pi->sequence);
} else if(pi->key_val == 28) {
@@ -3366,7 +3362,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
comment = g_strdup_printf("Off Hook (%d)", pi->sequence);
/* add to the graph */
- add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
} else if(pi->hook_state == 0) {
/* Phone is on hook */
@@ -3374,7 +3370,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
comment = g_strdup_printf("On Hook (%d)", pi->sequence);
/* add to the graph */
- add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
}
}
@@ -3382,11 +3378,11 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
/* Open stream was sent from server */
if(pi->stream_connect == 1 && callsinfo != NULL) {
- /* Open stream */
+ /* Open stream */
/* Signifies the start of the call so set start_sec & start_usec */
callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->start_usec=pinfo->fd->rel_ts.nsecs/1000;
-
+
/* Local packets too */
++(callsinfo->npackets);
@@ -3394,7 +3390,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
++(tapinfo->npackets);
/* ?? means we're not quite sure if this is accurate. Since Unistim isn't a true
- Call control protocol, we can only guess at the destination by messing with
+ Call control protocol, we can only guess at the destination by messing with
key buffers. */
if(tmp_unistim_info->key_buffer != NULL){
callsinfo->to_identity = g_strdup_printf("?? %s",tmp_unistim_info->key_buffer);
@@ -3402,7 +3398,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
/* change sequence number for ACK detection */
tmp_unistim_info->sequence = pi->sequence;
-
+
/* State changes too */
callsinfo->call_active_state = VOIP_ACTIVE;
callsinfo->call_state = VOIP_IN_CALL;
@@ -3412,16 +3408,16 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
comment = g_strdup_printf("Stream Opened (%d)",pi->sequence);
/* add to the graph */
- add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
+ add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
/* Redraw the scree */
tapinfo->redraw = TRUE;
return 1;
} else if(pi->stream_connect == 1 && callsinfo == NULL) {
-
+
/* Research indicates some nortel products initiate stream first
- * without keypresses. therefore creating this solely on a keypress is
+ * without keypresses. therefore creating this solely on a keypress is
* ineffective.
* Sometimes calls start immediately with open stream.
*/
@@ -3433,17 +3429,17 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
COPY_ADDRESS(&(callsinfo->initial_speaker),&(pinfo->src));
callsinfo->first_frame_num=pinfo->fd->num;
callsinfo->selected=FALSE;
-
+
/* Set this on init of struct so in case the call doesn't complete, we'll have a ref. */
/* Otherwise if the call is completed we'll have the open/close streams to ref actual call duration */
callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->start_usec=pinfo->fd->rel_ts.nsecs/1000;
-
+
callsinfo->protocol=VOIP_UNISTIM;
callsinfo->prot_info=g_malloc(sizeof(unistim_info_t));
-
+
tmp_unistim_info = callsinfo->prot_info;
-
+
/* Clear tap struct */
tmp_unistim_info->rudp_type = 0;
tmp_unistim_info->payload_type = 0;
@@ -3457,7 +3453,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
tmp_unistim_info->set_termid = -1;
tmp_unistim_info->string_data = NULL;
tmp_unistim_info->key_buffer = NULL;
-
+
COPY_ADDRESS(&(tmp_unistim_info->it_ip),&(pi->it_ip));
COPY_ADDRESS(&(tmp_unistim_info->ni_ip),&(pi->ni_ip));
tmp_unistim_info->it_port = pi->it_port;
@@ -3467,11 +3463,11 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
callsinfo->call_num = tapinfo->ncalls++;
tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
- /* Open stream */
+ /* Open stream */
/* Signifies the start of the call so set start_sec & start_usec */
callsinfo->start_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->start_usec=pinfo->fd->rel_ts.nsecs/1000;
-
+
/* Local packets too */
++(callsinfo->npackets);
@@ -3479,7 +3475,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
++(tapinfo->npackets);
/* ?? means we're not quite sure if this is accurate. Since Unistim isn't a true
- Call control protocol, we can only guess at the destination by messing with
+ Call control protocol, we can only guess at the destination by messing with
key buffers. */
if(tmp_unistim_info->key_buffer != NULL){
callsinfo->to_identity = g_strdup_printf("?? %s",tmp_unistim_info->key_buffer);
@@ -3487,7 +3483,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
/* change sequence number for ACK detection */
tmp_unistim_info->sequence = pi->sequence;
-
+
/* State changes too */
callsinfo->call_active_state = VOIP_ACTIVE;
callsinfo->call_state = VOIP_IN_CALL;
@@ -3506,14 +3502,14 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
} else if(pi->stream_connect == 0 && callsinfo != NULL) {
/* Close Stream */
-
+
/* Set stop seconds + usec */
callsinfo->stop_sec=(gint32) (pinfo->fd->rel_ts.secs);
callsinfo->stop_usec=pinfo->fd->rel_ts.nsecs/1000;
callsinfo->last_frame_num=pinfo->fd->num;
-
+
tmp_unistim_info->sequence = pi->sequence;
-
+
if(callsinfo->call_state == VOIP_IN_CALL){
callsinfo->call_active_state = VOIP_INACTIVE;
callsinfo->call_state = VOIP_COMPLETED;
@@ -3521,7 +3517,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
callsinfo->call_state = VOIP_UNKNOWN;
callsinfo->call_active_state = VOIP_INACTIVE;
}
-
+
frame_label = g_strdup_printf("STREAM CLOSED");
comment = g_strdup_printf("Stream Closed (%d)",pi->sequence);
@@ -3544,7 +3540,7 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
}
} else if(pi->rudp_type == 0 && callsinfo != NULL) {
-
+
/* NAK */
frame_label = g_strdup_printf("NAK");
comment = g_strdup_printf("NAK for sequence %d",pi->sequence);
@@ -3553,11 +3549,11 @@ unistim_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_,
add_to_graph(tapinfo, pinfo, frame_label, comment, callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1);
}
-
+
/* free dataz */
g_free(frame_label);
g_free(comment);
-
+
tapinfo->redraw = TRUE;
return 1;
@@ -3578,7 +3574,7 @@ unistim_calls_init_tap(void){
error_string = register_tap_listener("unistim", &(the_tapinfo_struct.unistim_dummy),
NULL,
voip_calls_dlg_reset,
- unistim_calls_packet,
+ unistim_calls_packet,
voip_calls_dlg_draw
);
@@ -3608,7 +3604,7 @@ remove_tap_listener_unistim_calls(void)
/* ***************************TAP for OTHER PROTOCOL **********************************/
/****************************************************************************/
-static int
+static int
VoIPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *VoIPinfo _U_)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -3647,11 +3643,11 @@ VoIPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
callsinfo->call_comment=g_strdup((pi->call_comment)?pi->call_comment:"");
callsinfo->prot_info=NULL;
callsinfo->free_prot_info = NULL;
-
+
callsinfo->call_num = tapinfo->ncalls++;
callsinfo->npackets = 0;
-
- tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
+
+ tapinfo->callsinfo_list = g_list_append(tapinfo->callsinfo_list, callsinfo);
}
if (callsinfo != NULL) {
@@ -3687,7 +3683,7 @@ VoIPcalls_init_tap(void)
error_string = register_tap_listener("voip", &(the_tapinfo_struct.voip_dummy),
NULL,
voip_calls_dlg_reset,
- VoIPcalls_packet,
+ VoIPcalls_packet,
voip_calls_dlg_draw
);
@@ -3719,7 +3715,7 @@ remove_tap_listener_voip_calls(void)
/****************************************************************************/
/* whenever a prot_ packet is seen by the tap listener */
/*
-static int
+static int
prot_calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prot_info _U_)
{
voip_calls_tapinfo_t *tapinfo = &the_tapinfo_struct;
@@ -3750,7 +3746,7 @@ prot_calls_init_tap(void)
error_string = register_tap_listener("prot_", &(the_tapinfo_struct.prot__dummy),
NULL,
voip_calls_dlg_reset,
- prot__calls_packet,
+ prot__calls_packet,
voip_calls_dlg_draw
);
diff --git a/gtk/wlan_stat_dlg.c b/gtk/wlan_stat_dlg.c
index 67f5ca7a88..db9e5ad35a 100644
--- a/gtk/wlan_stat_dlg.c
+++ b/gtk/wlan_stat_dlg.c
@@ -54,6 +54,7 @@
#include "gtk/gui_utils.h"
#include "gtk/recent.h"
#include "gtk/help_dlg.h"
+#include "gtk/main.h"
enum {
BSSID_COLUMN,
@@ -73,7 +74,7 @@ enum {
NUM_COLUMNS
};
-static const gchar *titles[] = { "BSSID", "Ch.", "SSID", "% Packets", "Beacons", "Data Packets",
+static const gchar *titles[] = { "BSSID", "Ch.", "SSID", "% Packets", "Beacons", "Data Packets",
"Probe Req", "Probe Resp", "Auth", "Deauth", "Other", "Protection" };
enum {
@@ -92,7 +93,7 @@ enum {
NUM_DETAIL_COLUMNS
};
-static const gchar *detail_titles[] = { "Address", "% Packets", "Data Sent", "Data Received",
+static const gchar *detail_titles[] = { "Address", "% Packets", "Data Sent", "Data Received",
"Probe Req", "Probe Resp", "Auth", "Deauth", "Other", "Comment" };
typedef struct wlan_details_ep {
@@ -141,7 +142,7 @@ typedef struct _wlan_stat_t {
wlan_ep_t* ep_list;
} wlanstat_t;
-static void
+static void
dealloc_wlan_details_ep (wlan_details_ep_t *details)
{
wlan_details_ep_t *tmp;
@@ -165,7 +166,7 @@ wlanstat_reset (void *phs)
const char *filter = NULL;
if (wlanstat_dlg_w != NULL) {
- g_snprintf (title, 255, "Wireshark: WLAN Traffic Statistics: %s",
+ g_snprintf (title, 255, "Wireshark: WLAN Traffic Statistics: %s",
cf_get_display_name(&cfile));
gtk_window_set_title(GTK_WINDOW(wlanstat_dlg_w), title);
}
@@ -228,7 +229,7 @@ invalidate_detail_iters (wlanstat_t *hs)
}
}
-static wlan_ep_t*
+static wlan_ep_t*
alloc_wlan_ep (struct _wlan_hdr *si, packet_info *pinfo _U_)
{
wlan_ep_t* ep;
@@ -238,7 +239,7 @@ alloc_wlan_ep (struct _wlan_hdr *si, packet_info *pinfo _U_)
if (!(ep = g_malloc (sizeof(wlan_ep_t))))
return NULL;
-
+
SE_COPY_ADDRESS (&ep->bssid, &si->bssid);
ep->stats.channel = si->stats.channel;
memcpy (ep->stats.ssid, si->stats.ssid, MAX_SSID_LEN);
@@ -254,7 +255,7 @@ alloc_wlan_ep (struct _wlan_hdr *si, packet_info *pinfo _U_)
return ep;
}
-static wlan_details_ep_t*
+static wlan_details_ep_t*
alloc_wlan_details_ep (address *address)
{
wlan_details_ep_t* d_ep;
@@ -264,7 +265,7 @@ alloc_wlan_details_ep (address *address)
if (!(d_ep = g_malloc (sizeof(wlan_details_ep_t))))
return NULL;
-
+
SE_COPY_ADDRESS (&d_ep->address, address);
d_ep->probe_req = 0;
d_ep->probe_rsp = 0;
@@ -295,7 +296,7 @@ get_details_ep (wlan_ep_t *te, address *address)
break;
}
}
-
+
if (!d_te) {
if ((d_te = alloc_wlan_details_ep (address)) != NULL) {
d_te->next = te->details;
@@ -348,7 +349,7 @@ wlanstat_packet_details (wlan_ep_t *te, guint32 type, address *address, gboolean
d_te->other++;
break;
}
-
+
if (type != 0x08) {
/* Do not count beacons in details */
d_te->number_of_packets++;
@@ -373,12 +374,12 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v
} else {
for (tmp = hs->ep_list; tmp; tmp = tmp->next) {
if (((si->type == 0x04) &&
- (((tmp->stats.ssid_len == 0) && (si->stats.ssid_len == 0) &&
+ (((tmp->stats.ssid_len == 0) && (si->stats.ssid_len == 0) &&
(strcmp (get_addr_name(&tmp->bssid), "Broadcast") == 0)) ||
(si->stats.ssid_len != 0 &&
- (tmp->stats.ssid_len == si->stats.ssid_len) &&
+ (tmp->stats.ssid_len == si->stats.ssid_len) &&
(memcmp (tmp->stats.ssid, si->stats.ssid, si->stats.ssid_len) == 0)))) ||
- ((si->type != 0x04) &&
+ ((si->type != 0x04) &&
(!CMP_ADDRESS (&tmp->bssid, &si->bssid)))) {
te = tmp;
break;
@@ -392,11 +393,11 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v
}
}
- if (!te->probe_req_searched && (si->type != 0x04) && (te->type[0x04] == 0) &&
+ if (!te->probe_req_searched && (si->type != 0x04) && (te->type[0x04] == 0) &&
(si->stats.ssid_len > 1 || si->stats.ssid[0] != 0)) {
- /*
- * We have found a matching entry without Probe Requests.
- * Search the rest of the entries for a corresponding entry
+ /*
+ * We have found a matching entry without Probe Requests.
+ * Search the rest of the entries for a corresponding entry
* matching the SSID and BSSID == Broadcast.
*
* This is because we can have a hidden SSID or Probe Request
@@ -409,9 +410,9 @@ wlanstat_packet (void *phs, packet_info *pinfo, epan_dissect_t *edt _U_, const v
if ((si->stats.ssid_len == tmp->stats.ssid_len) &&
(memcmp (si->stats.ssid, tmp->stats.ssid, tmp->stats.ssid_len) == 0) &&
(strcmp (get_addr_name(&tmp->bssid), "Broadcast") == 0)) {
- /*
+ /*
* Found a matching entry. Merge with the previous
- * found entry and remove from list.
+ * found entry and remove from list.
*/
te->type[0x04] += tmp->type[0x04];
te->number_of_packets += tmp->number_of_packets;
@@ -556,7 +557,7 @@ wlanstat_draw(void *phs)
data = tmp->type[0x20] + tmp->type[0x21] + tmp->type[0x22] + tmp->type[0x23] +
tmp->type[0x28] + tmp->type[0x29] + tmp->type[0x2A] + tmp->type[0x2B];
- other = tmp->number_of_packets - data - tmp->type[0x08] - tmp->type[0x04] -
+ other = tmp->number_of_packets - data - tmp->type[0x08] - tmp->type[0x04] -
tmp->type[0x05] - tmp->type[0x0B] - tmp->type[0x0C];
f = (float)(((float)tmp->number_of_packets * 100.0) / hs->number_of_packets);
@@ -606,7 +607,7 @@ wlanstat_draw(void *phs)
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(hs->table));
if (gtk_tree_selection_get_selected (sel, &model, &iter)) {
wlan_ep_t *ep;
-
+
gtk_tree_model_get (model, &iter, TABLE_COLUMN, &ep, -1);
wlanstat_details (hs, ep, FALSE);
}
@@ -668,7 +669,7 @@ csv_handle(GtkTreeModel *model, GtkTreePath *path _U_, GtkTreeIter *iter,
int i;
for (i=0; i<=PROTECTION_COLUMN; i++) {
- if (i == BSSID_COLUMN || i == CHANNEL_COLUMN || i == SSID_COLUMN ||
+ if (i == BSSID_COLUMN || i == CHANNEL_COLUMN || i == SSID_COLUMN ||
i == PERCENT_COLUMN || i == PROTECTION_COLUMN) {
gtk_tree_model_get(model, iter, i, &table_text, -1);
g_string_append(CSV_str, table_text);
@@ -680,7 +681,7 @@ csv_handle(GtkTreeModel *model, GtkTreePath *path _U_, GtkTreeIter *iter,
g_string_append(CSV_str,",");
}
g_string_append(CSV_str,"\n");
-
+
return FALSE;
}
@@ -711,8 +712,6 @@ wlan_copy_as_csv(GtkWindow *win _U_, gpointer data)
g_string_free(CSV_str, TRUE);
}
-void protect_thread_critical_region (void);
-void unprotect_thread_critical_region (void);
static void
win_destroy_cb (GtkWindow *win _U_, gpointer data)
{
@@ -729,7 +728,7 @@ win_destroy_cb (GtkWindow *win _U_, gpointer data)
wlanstat_reset (hs);
g_free (hs);
- recent.gui_geometry_wlan_stats_pane =
+ recent.gui_geometry_wlan_stats_pane =
gtk_paned_get_position(GTK_PANED(wlanstat_pane));
}
@@ -755,7 +754,7 @@ wlan_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint callb
gtk_tree_model_get (model, &iter, TABLE_COLUMN, &ep, -1);
value = FILTER_EXTRA(callback_action);
-
+
switch (value) {
case VALUE_BSSID_ONLY:
str = g_strdup_printf("wlan.bssid==%s", address_to_str(&ep->bssid));
@@ -1113,7 +1112,7 @@ wlanstat_dlg_create (void)
hs->use_dfilter = FALSE;
hs->show_only_existing = FALSE;
- g_snprintf (title, 255, "Wireshark: WLAN Traffic Statistics: %s",
+ g_snprintf (title, 255, "Wireshark: WLAN Traffic Statistics: %s",
cf_get_display_name(&cfile));
wlanstat_dlg_w = window_new_with_geom (GTK_WINDOW_TOPLEVEL, title, "WLAN Statistics");
gtk_window_set_default_size (GTK_WINDOW(wlanstat_dlg_w), 750, 400);
@@ -1140,7 +1139,7 @@ wlanstat_dlg_create (void)
GTK_SHADOW_IN);
store = gtk_list_store_new(NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT,
+ G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT,
G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT,
G_TYPE_STRING, G_TYPE_FLOAT, G_TYPE_POINTER);
hs->table = GTK_TREE_VIEW(tree_view_new(GTK_TREE_MODEL(store)));
@@ -1167,7 +1166,7 @@ wlanstat_dlg_create (void)
#endif
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(titles[i], renderer,
- "text", i,
+ "text", i,
NULL);
gtk_tree_view_column_set_sort_column_id(column, i);
}
@@ -1230,7 +1229,7 @@ wlanstat_dlg_create (void)
#endif
renderer = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(detail_titles[i], renderer,
- "text", i,
+ "text", i,
NULL);
gtk_tree_view_column_set_sort_column_id(column, i);
}
@@ -1256,7 +1255,7 @@ wlanstat_dlg_create (void)
wlan_create_popup_menu(hs);
wlan_details_create_popup_menu(hs);
- error_string=register_tap_listener ("wlan", hs, NULL, wlanstat_reset,
+ error_string=register_tap_listener ("wlan", hs, NULL, wlanstat_reset,
wlanstat_packet, wlanstat_draw);
if (error_string) {
simple_dialog (ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str);
@@ -1299,7 +1298,7 @@ wlanstat_dlg_create (void)
copy_bt = g_object_get_data(G_OBJECT(bbox), GTK_STOCK_COPY);
/* gtk_button_set_label(GTK_BUTTON(copy_bt), "Copy Overview"); */
- gtk_tooltips_set_tip(tooltips, copy_bt,
+ gtk_tooltips_set_tip(tooltips, copy_bt,
"Copy all statistical values of this page to the clipboard in CSV (Comma Seperated Values) format.", NULL);
g_signal_connect(copy_bt, "clicked", G_CALLBACK(wlan_copy_as_csv), hs->table);
@@ -1328,6 +1327,6 @@ wlanstat_launch (GtkWidget *w _U_, gpointer data _U_)
void
register_tap_listener_wlanstat (void)
{
- register_stat_menu_item ("WLAN Traffic...", REGISTER_STAT_GROUP_UNSORTED,
+ register_stat_menu_item ("WLAN Traffic...", REGISTER_STAT_GROUP_UNSORTED,
wlanstat_launch, NULL, NULL, NULL);
}
diff --git a/gtk/wsp_stat.c b/gtk/wsp_stat.c
index ea246a2e94..8499ebd521 100644
--- a/gtk/wsp_stat.c
+++ b/gtk/wsp_stat.c
@@ -6,17 +6,17 @@
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* 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.
@@ -44,6 +44,7 @@
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/tap_dfilter_dlg.h"
+#include "gtk/main.h"
/* used to keep track of the stats for a specific PDU type*/
@@ -59,7 +60,7 @@ typedef struct _wsp_stats_t {
guint32 num_pdus;
GtkWidget *win;
GHashTable *hash;
- GtkWidget *table_pdu_types;
+ GtkWidget *table_pdu_types;
GtkWidget *table_status_code;
guint index; /* Number of status code to display */
} wspstat_t;
@@ -78,8 +79,8 @@ wsp_free_hash( gpointer key, gpointer value, gpointer user_data _U_ )
g_free(value);
}
static void
-wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_ )
-{
+wsp_reset_hash(gchar *key _U_ , wsp_status_code_t *data, gpointer ptr _U_ )
+{
data->packets = 0;
}
@@ -129,9 +130,9 @@ wspstat_reset(void *psp)
{
sp->pdu_stats[i].packets=0;
}
- g_hash_table_foreach( sp->hash, (GHFunc)wsp_reset_hash, NULL);
+ g_hash_table_foreach( sp->hash, (GHFunc)wsp_reset_hash, NULL);
}
-static gint
+static gint
pdut2index(gint pdut)
{
if (pdut<=0x09) return pdut;
@@ -168,8 +169,8 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
gint *key=g_malloc( sizeof(gint) );
wsp_status_code_t *sc;
*key=value->status_code ;
- sc = g_hash_table_lookup(
- sp->hash,
+ sc = g_hash_table_lookup(
+ sp->hash,
key);
if (!sc) {
g_warning("%s:%d What's Wrong, doc ?\n", __FILE__, __LINE__);
@@ -188,7 +189,7 @@ wspstat_packet(void *psp, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const
retour=1;
}
-
+
if (index!=0) {
sp->pdu_stats[ index ].packets++;
@@ -221,7 +222,7 @@ wspstat_draw(void *psp)
* let's resize the table */
gtk_table_resize ( GTK_TABLE(sp->table_status_code), sp->index % 2 , 4);
}
-
+
}
@@ -232,8 +233,6 @@ wspstat_draw(void *psp)
*
* there should not be any other critical regions in gtk2
*/
-void protect_thread_critical_region(void);
-void unprotect_thread_critical_region(void);
static void
win_destroy_cb(GtkWindow *win _U_, gpointer data)
{
@@ -246,7 +245,7 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data)
g_free(sp->pdu_stats);
g_free(sp->filter);
g_hash_table_foreach( sp->hash, (GHFunc)wsp_free_hash, NULL);
- g_hash_table_destroy( sp->hash);
+ g_hash_table_destroy( sp->hash);
g_free(sp);
}
@@ -271,7 +270,7 @@ wsp_init_table(wspstat_t *sp)
int pos=0;
guint32 i;
/* gchar buffer[51]; */
-
+
add_table_entry( sp, "PDU Type " , 0, pos, 0);
add_table_entry( sp, "packets " , 1, pos, 0);
add_table_entry( sp, "PDU Type " , 2, pos, 0);
@@ -285,7 +284,7 @@ wsp_init_table(wspstat_t *sp)
}
/* Maybe we should display the hexadecimal value ? */
/* g_snprintf(buffer, 50, "%s (0X%x)", match_strval( index2pdut( i ), vals_pdu_type), index2pdut(i) );*/
- add_table_entry( sp,
+ add_table_entry( sp,
match_strval(index2pdut(i), vals_pdu_type), /* or buffer, */
x,
pos,
@@ -293,7 +292,7 @@ wsp_init_table(wspstat_t *sp)
);
add_table_entry( sp, "0", x+1, pos
, i /* keep a pointer to this widget to update it in _draw() */
- );
+ );
pos++;
if (i== (sp->num_pdus+1) /2) {
pos=1;
@@ -315,14 +314,14 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_)
GtkWidget *bbox;
guint32 i;
wsp_status_code_t *sc;
-
-
+
+
if (strncmp (optarg, "wsp,stat,", 9) == 0){
filter=optarg+9;
} else {
filter=NULL;
}
-
+
sp = g_malloc( sizeof(wspstat_t) );
sp->win = window_new(GTK_WINDOW_TOPLEVEL, "wsp-stat");
sp->hash = g_hash_table_new( g_int_hash, g_int_equal);
@@ -366,7 +365,7 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_)
/* PDU Types frame */
pdutypes_fr = gtk_frame_new("Summary of PDU Types (wsp.pdu_type)");
gtk_container_add(GTK_CONTAINER(main_vb), pdutypes_fr);
-
+
sp->table_pdu_types = gtk_table_new( (sp->num_pdus+1) / 2 + 1, 4, FALSE);
gtk_container_add( GTK_CONTAINER( pdutypes_fr), sp->table_pdu_types);
gtk_container_set_border_width( GTK_CONTAINER(sp->table_pdu_types) , 10);
@@ -376,13 +375,13 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_)
/* Status Codes frame */
statuscode_fr = gtk_frame_new("Summary of Status Code (wsp.reply.status)");
gtk_container_add(GTK_CONTAINER(main_vb), statuscode_fr);
-
+
sp->table_status_code = gtk_table_new( 0, 4, FALSE);
gtk_container_add( GTK_CONTAINER( statuscode_fr), sp->table_status_code);
gtk_container_set_border_width( GTK_CONTAINER(sp->table_status_code) , 10);
sp->index = 0; /* No answers to display yet */
- error_string = register_tap_listener(
+ error_string = register_tap_listener(
"wsp",
sp,
filter,
@@ -411,7 +410,7 @@ gtk_wspstat_init(const char *optarg, void *userdata _U_)
gtk_widget_show_all(sp->win);
window_present(sp->win);
-
+
cf_retap_packets(&cfile, FALSE);
}