Don't put (non-extern'd) prototypes for protect_thread_critical_region() and

unprotect_thread_critical_region() in every module in gtk/: instead have those
modules include main.h (which has the properly extern'd prototype).

This should fix the link error on HP-UX described in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2702

svn path=/trunk/; revision=25933
This commit is contained in:
Jeff Morriss 2008-08-05 17:33:14 +00:00
parent 10260fb76b
commit dd6a15e1c7
30 changed files with 618 additions and 673 deletions

View File

@ -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);
}

View File

@ -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,

View File

@ -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,

View File

@ -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)
{

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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)
{

View File

@ -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);
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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");

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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,

View File

@ -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)

View File

@ -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);

View File

@ -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)

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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,

File diff suppressed because it is too large Load Diff

View File

@ -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);
}

View File

@ -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);
}