diff options
-rw-r--r-- | gtk/Makefile.am | 3 | ||||
-rw-r--r-- | gtk/endpoint_talkers_table.c | 563 | ||||
-rw-r--r-- | gtk/endpoint_talkers_table.h | 22 | ||||
-rw-r--r-- | gtk/hostlist_table.c | 96 | ||||
-rw-r--r-- | gtk/hostlist_table.h | 19 | ||||
-rw-r--r-- | gtk/menu.c | 18 | ||||
-rw-r--r-- | gtk/proto_draw.h | 9 | ||||
-rw-r--r-- | gtk/sat.h | 41 |
8 files changed, 410 insertions, 361 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am index 22de60aa88..639e3591ca 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for the GTK interface routines for Ethereal # -# $Id: Makefile.am,v 1.99 2004/05/31 13:42:17 ulfl Exp $ +# $Id: Makefile.am,v 1.100 2004/06/03 21:46:27 guy Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs <gerald@ethereal.com> @@ -77,6 +77,7 @@ noinst_HEADERS = \ rtp_analysis.h \ rtp_stream.h \ rtp_stream_dlg.h \ + sat.h \ service_response_time_table.h \ stream_prefs.h \ summary_dlg.h \ diff --git a/gtk/endpoint_talkers_table.c b/gtk/endpoint_talkers_table.c index 8754954e9f..46f312b4fc 100644 --- a/gtk/endpoint_talkers_table.c +++ b/gtk/endpoint_talkers_table.c @@ -4,22 +4,22 @@ * endpoint_talkers_table 2003 Ronnie Sahlberg * Helper routines common to all endpoint talkers tap. * - * $Id: endpoint_talkers_table.c,v 1.44 2004/06/02 07:12:09 ulfl Exp $ + * $Id: endpoint_talkers_table.c,v 1.45 2004/06/03 21:46:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> * 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. @@ -40,6 +40,7 @@ #include "epan/packet_info.h" #include "epan/to_str.h" #include "epan/resolv.h" +#include "sat.h" #include "endpoint_talkers_table.h" #include "image/clist_ascend.xpm" #include "image/clist_descend.xpm" @@ -94,7 +95,7 @@ ett_port_to_str(int port_type, guint32 port) return a string for the filter name some addresses, like AT_ETHER may actually be any of multiple types - of protocols, either ethernet, tokenring, fddi etc so we must be more + of protocols, either ethernet, tokenring, fddi etc so we must be more specific there thats why we need specific_addr_type */ static char * @@ -209,33 +210,33 @@ typedef struct column_arrows { static void reset_ett_table_data(endpoints_table *et) { - guint32 i; - char title[256]; + guint32 i; + char title[256]; if(et->page_lb) { - g_snprintf(title, 255, "Conversations: %s", cf_get_display_name(&cfile)); - gtk_window_set_title(GTK_WINDOW(et->win), title); - g_snprintf(title, 255, "%s", et->name); - gtk_label_set_text(GTK_LABEL(et->page_lb), title); + g_snprintf(title, 255, "Conversations: %s", cf_get_display_name(&cfile)); + gtk_window_set_title(GTK_WINDOW(et->win), title); + g_snprintf(title, 255, "%s", et->name); + gtk_label_set_text(GTK_LABEL(et->page_lb), title); gtk_widget_set_sensitive(et->page_lb, FALSE); } else { - g_snprintf(title, 255, "%s Conversations: %s", et->name, cf_get_display_name(&cfile)); - gtk_window_set_title(GTK_WINDOW(et->win), title); + g_snprintf(title, 255, "%s Conversations: %s", et->name, cf_get_display_name(&cfile)); + gtk_window_set_title(GTK_WINDOW(et->win), title); } - /* remove all entries from the clist */ - for(i=0;i<et->num_endpoints;i++){ - gtk_clist_remove(et->table, et->num_endpoints-i-1); - } + /* remove all entries from the clist */ + for(i=0;i<et->num_endpoints;i++){ + gtk_clist_remove(et->table, et->num_endpoints-i-1); + } - /* delete all endpoints */ - for(i=0;i<et->num_endpoints;i++){ - g_free((gpointer)et->endpoints[i].src_address.data); - g_free((gpointer)et->endpoints[i].dst_address.data); - } - g_free(et->endpoints); - et->endpoints=NULL; - et->num_endpoints=0; + /* delete all endpoints */ + for(i=0;i<et->num_endpoints;i++){ + g_free((gpointer)et->endpoints[i].src_address.data); + g_free((gpointer)et->endpoints[i].dst_address.data); + } + g_free(et->endpoints); + et->endpoints=NULL; + et->num_endpoints=0; } @@ -322,7 +323,7 @@ ett_click_column_cb(GtkCList *clist, gint column, gpointer data) } -/* action is encoded as +/* action is encoded as filter_action*65536+filter_type*256+filter_direction filter_action: @@ -577,7 +578,7 @@ ett_show_popup_menu_cb(void *widg _U_, GdkEvent *event, endpoints_table *et) gtk_clist_unselect_all(et->table); gtk_clist_select_row(et->table, row, -1); - gtk_menu_popup(GTK_MENU(et->menu), NULL, NULL, NULL, NULL, + gtk_menu_popup(GTK_MENU(et->menu), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } } @@ -932,20 +933,20 @@ ett_create_popup_menu(endpoints_table *et) /* XXX should freeze/thaw table here and in the srt thingy? */ -static void +static void draw_ett_table_addresses(endpoints_table *et) { - guint32 i; - int j; + guint32 i; + int j; - for(i=0;i<et->num_endpoints;i++){ - char *entry; - char *port; + for(i=0;i<et->num_endpoints;i++){ + char *entry; + char *port; address_type at; guint32 pt; - j=gtk_clist_find_row_from_data(et->table, (gpointer)i); + j=gtk_clist_find_row_from_data(et->table, (gpointer)i); at = et->endpoints[i].src_address.type; if(!et->resolve_names) at = AT_NONE; @@ -959,7 +960,7 @@ draw_ett_table_addresses(endpoints_table *et) default: entry=address_to_str(&et->endpoints[i].src_address); } - gtk_clist_set_text(et->table, j, 0, entry); + gtk_clist_set_text(et->table, j, 0, entry); pt = et->endpoints[i].port_type; if(!et->resolve_names) pt = PT_NONE; @@ -971,10 +972,10 @@ draw_ett_table_addresses(endpoints_table *et) entry=get_udp_port(et->endpoints[i].src_port); break; default: - port=ett_port_to_str(et->endpoints[i].port_type, et->endpoints[i].src_port); - entry=port?port:""; + port=ett_port_to_str(et->endpoints[i].port_type, et->endpoints[i].src_port); + entry=port?port:""; } - gtk_clist_set_text(et->table, j, 1, entry); + gtk_clist_set_text(et->table, j, 1, entry); at = et->endpoints[i].dst_address.type; if(!et->resolve_names) at = AT_NONE; @@ -986,9 +987,9 @@ draw_ett_table_addresses(endpoints_table *et) entry=get_ether_name(et->endpoints[i].dst_address.data); break; default: - entry=address_to_str(&et->endpoints[i].dst_address); + entry=address_to_str(&et->endpoints[i].dst_address); } - gtk_clist_set_text(et->table, j, 2, entry); + gtk_clist_set_text(et->table, j, 2, entry); switch(pt) { case(PT_TCP): @@ -998,57 +999,57 @@ draw_ett_table_addresses(endpoints_table *et) entry=get_udp_port(et->endpoints[i].dst_port); break; default: - port=ett_port_to_str(et->endpoints[i].port_type, et->endpoints[i].dst_port); + port=ett_port_to_str(et->endpoints[i].port_type, et->endpoints[i].dst_port); entry=port?port:""; } - gtk_clist_set_text(et->table, j, 3, entry); - } + gtk_clist_set_text(et->table, j, 3, entry); + } } /* XXX should freeze/thaw table here and in the srt thingy? */ -static void +static void draw_ett_table_data(endpoints_table *et) { - guint32 i; - int j; - char title[256]; + guint32 i; + int j; + char title[256]; if (et->page_lb) { if(et->num_endpoints) { - g_snprintf(title, 255, "%s: %u", et->name, et->num_endpoints); + g_snprintf(title, 255, "%s: %u", et->name, et->num_endpoints); } else { - g_snprintf(title, 255, "%s", et->name); + g_snprintf(title, 255, "%s", et->name); } - gtk_label_set_text(GTK_LABEL(et->page_lb), title); + gtk_label_set_text(GTK_LABEL(et->page_lb), title); gtk_widget_set_sensitive(et->page_lb, et->num_endpoints); } - for(i=0;i<et->num_endpoints;i++){ - char str[16]; + for(i=0;i<et->num_endpoints;i++){ + char str[16]; - j=gtk_clist_find_row_from_data(et->table, (gpointer)i); + j=gtk_clist_find_row_from_data(et->table, (gpointer)i); - g_snprintf(str, 16, "%u", et->endpoints[i].tx_frames+et->endpoints[i].rx_frames); - gtk_clist_set_text(et->table, j, 4, str); - g_snprintf(str, 16, "%u", et->endpoints[i].tx_bytes+et->endpoints[i].rx_bytes); - gtk_clist_set_text(et->table, j, 5, str); + g_snprintf(str, 16, "%u", et->endpoints[i].tx_frames+et->endpoints[i].rx_frames); + gtk_clist_set_text(et->table, j, 4, str); + g_snprintf(str, 16, "%u", et->endpoints[i].tx_bytes+et->endpoints[i].rx_bytes); + gtk_clist_set_text(et->table, j, 5, str); - g_snprintf(str, 16, "%u", et->endpoints[i].tx_frames); - gtk_clist_set_text(et->table, j, 6, str); - g_snprintf(str, 16, "%u", et->endpoints[i].tx_bytes); - gtk_clist_set_text(et->table, j, 7, str); + g_snprintf(str, 16, "%u", et->endpoints[i].tx_frames); + gtk_clist_set_text(et->table, j, 6, str); + g_snprintf(str, 16, "%u", et->endpoints[i].tx_bytes); + gtk_clist_set_text(et->table, j, 7, str); - g_snprintf(str, 16, "%u", et->endpoints[i].rx_frames); - gtk_clist_set_text(et->table, j, 8, str); - g_snprintf(str, 16, "%u", et->endpoints[i].rx_bytes); - gtk_clist_set_text(et->table, j, 9, str); + g_snprintf(str, 16, "%u", et->endpoints[i].rx_frames); + gtk_clist_set_text(et->table, j, 8, str); + g_snprintf(str, 16, "%u", et->endpoints[i].rx_bytes); + gtk_clist_set_text(et->table, j, 9, str); - } - gtk_clist_sort(et->table); + } + gtk_clist_sort(et->table); /* update table, so resolved addresses will be shown now */ draw_ett_table_addresses(et); @@ -1058,51 +1059,51 @@ draw_ett_table_data(endpoints_table *et) gboolean init_ett_table_page(endpoints_table *talkers, GtkWidget *vbox, gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) { - int i; - column_arrows *col_arrows; - GtkStyle *win_style; - GtkWidget *column_lb; - GString *error_string; - GtkWidget *label; - char title[256]; - char *default_titles[] = { "Address A", "Port A", "Address B", "Port B", "Packets", "Bytes", "-> Packets", "-> Bytes", "<- Packets", "<- Bytes" }; + int i; + column_arrows *col_arrows; + GtkStyle *win_style; + GtkWidget *column_lb; + GString *error_string; + GtkWidget *label; + char title[256]; + char *default_titles[] = { "Address A", "Port A", "Address B", "Port B", "Packets", "Bytes", "-> Packets", "-> Bytes", "<- Packets", "<- Bytes" }; - g_snprintf(title, 255, "%s Conversations", table_name); - label=gtk_label_new(title); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + g_snprintf(title, 255, "%s Conversations", table_name); + label=gtk_label_new(title); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - talkers->scrolled_window=scrolled_window_new(NULL, NULL); - gtk_box_pack_start(GTK_BOX(vbox), talkers->scrolled_window, TRUE, TRUE, 0); + talkers->scrolled_window=scrolled_window_new(NULL, NULL); + gtk_box_pack_start(GTK_BOX(vbox), talkers->scrolled_window, TRUE, TRUE, 0); - talkers->table=(GtkCList *)gtk_clist_new(NUM_COLS); + talkers->table=(GtkCList *)gtk_clist_new(NUM_COLS); - col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * NUM_COLS); - win_style = gtk_widget_get_style(talkers->scrolled_window); - for (i = 0; i < NUM_COLS; i++) { - col_arrows[i].table = gtk_table_new(2, 2, FALSE); - gtk_table_set_col_spacings(GTK_TABLE(col_arrows[i].table), 5); - column_lb = gtk_label_new(default_titles[i]); - gtk_table_attach(GTK_TABLE(col_arrows[i].table), column_lb, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - gtk_widget_show(column_lb); + col_arrows = (column_arrows *) g_malloc(sizeof(column_arrows) * NUM_COLS); + win_style = gtk_widget_get_style(talkers->scrolled_window); + for (i = 0; i < NUM_COLS; i++) { + col_arrows[i].table = gtk_table_new(2, 2, FALSE); + gtk_table_set_col_spacings(GTK_TABLE(col_arrows[i].table), 5); + column_lb = gtk_label_new(default_titles[i]); + gtk_table_attach(GTK_TABLE(col_arrows[i].table), column_lb, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); + gtk_widget_show(column_lb); col_arrows[i].ascend_pm = xpm_to_widget((const char **) clist_ascend_xpm); - gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); - col_arrows[i].descend_pm = xpm_to_widget((const char **) clist_descend_xpm); - gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); - /* make total frames be the default sort order */ - if (i == 4) { - gtk_widget_show(col_arrows[i].descend_pm); - } - gtk_clist_set_column_widget(GTK_CLIST(talkers->table), i, col_arrows[i].table); - gtk_widget_show(col_arrows[i].table); - } - gtk_clist_column_titles_show(GTK_CLIST(talkers->table)); + gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].ascend_pm, 1, 2, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0); + col_arrows[i].descend_pm = xpm_to_widget((const char **) clist_descend_xpm); + gtk_table_attach(GTK_TABLE(col_arrows[i].table), col_arrows[i].descend_pm, 1, 2, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0); + /* make total frames be the default sort order */ + if (i == 4) { + gtk_widget_show(col_arrows[i].descend_pm); + } + gtk_clist_set_column_widget(GTK_CLIST(talkers->table), i, col_arrows[i].table); + gtk_widget_show(col_arrows[i].table); + } + gtk_clist_column_titles_show(GTK_CLIST(talkers->table)); - gtk_clist_set_compare_func(talkers->table, ett_sort_column); - gtk_clist_set_sort_column(talkers->table, 4); - gtk_clist_set_sort_type(talkers->table, GTK_SORT_DESCENDING); + gtk_clist_set_compare_func(talkers->table, ett_sort_column); + gtk_clist_set_sort_column(talkers->table, 4); + gtk_clist_set_sort_type(talkers->table, GTK_SORT_DESCENDING); gtk_clist_set_column_auto_resize(talkers->table, 0, TRUE); @@ -1117,46 +1118,46 @@ init_ett_table_page(endpoints_table *talkers, GtkWidget *vbox, gboolean hide_por gtk_clist_set_column_auto_resize(talkers->table, 9, TRUE); #if 0 - /*XXX instead of this we should probably have some code to - dynamically adjust the width of the columns */ - gtk_clist_set_column_width(talkers->table, 0, 100); - gtk_clist_set_column_width(talkers->table, 1, 40); - gtk_clist_set_column_width(talkers->table, 2, 100); - gtk_clist_set_column_width(talkers->table, 3, 40); - gtk_clist_set_column_width(talkers->table, 4, 70); - gtk_clist_set_column_width(talkers->table, 5, 60); - gtk_clist_set_column_width(talkers->table, 6, 70); - gtk_clist_set_column_width(talkers->table, 7, 60); - gtk_clist_set_column_width(talkers->table, 8, 70); - gtk_clist_set_column_width(talkers->table, 9, 60); + /*XXX instead of this we should probably have some code to + dynamically adjust the width of the columns */ + gtk_clist_set_column_width(talkers->table, 0, 100); + gtk_clist_set_column_width(talkers->table, 1, 40); + gtk_clist_set_column_width(talkers->table, 2, 100); + gtk_clist_set_column_width(talkers->table, 3, 40); + gtk_clist_set_column_width(talkers->table, 4, 70); + gtk_clist_set_column_width(talkers->table, 5, 60); + gtk_clist_set_column_width(talkers->table, 6, 70); + gtk_clist_set_column_width(talkers->table, 7, 60); + gtk_clist_set_column_width(talkers->table, 8, 70); + gtk_clist_set_column_width(talkers->table, 9, 60); #endif - gtk_clist_set_shadow_type(talkers->table, GTK_SHADOW_IN); - gtk_clist_column_titles_show(talkers->table); - gtk_container_add(GTK_CONTAINER(talkers->scrolled_window), (GtkWidget *)talkers->table); + gtk_clist_set_shadow_type(talkers->table, GTK_SHADOW_IN); + gtk_clist_column_titles_show(talkers->table); + gtk_container_add(GTK_CONTAINER(talkers->scrolled_window), (GtkWidget *)talkers->table); - SIGNAL_CONNECT(talkers->table, "click-column", ett_click_column_cb, col_arrows); + SIGNAL_CONNECT(talkers->table, "click-column", ett_click_column_cb, col_arrows); - talkers->num_endpoints=0; - talkers->endpoints=NULL; + talkers->num_endpoints=0; + talkers->endpoints=NULL; - /* hide srcport and dstport if we don't use ports */ - if(hide_ports){ - gtk_clist_set_column_visibility(talkers->table, 1, FALSE); - gtk_clist_set_column_visibility(talkers->table, 3, FALSE); - } + /* hide srcport and dstport if we don't use ports */ + if(hide_ports){ + gtk_clist_set_column_visibility(talkers->table, 1, FALSE); + gtk_clist_set_column_visibility(talkers->table, 3, FALSE); + } - /* create popup menu for this table */ - ett_create_popup_menu(talkers); + /* create popup menu for this table */ + ett_create_popup_menu(talkers); - /* register the tap and rerun the taps on the packet list */ - error_string=register_tap_listener(tap_name, talkers, filter, (void *)reset_ett_table_data, packet_func, (void *)draw_ett_table_data); - if(error_string){ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); - g_string_free(error_string, TRUE); - return FALSE; - } + /* register the tap and rerun the taps on the packet list */ + error_string=register_tap_listener(tap_name, talkers, filter, (void *)reset_ett_table_data, packet_func, (void *)draw_ett_table_data); + if(error_string){ + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); + g_string_free(error_string, TRUE); + return FALSE; + } return TRUE; } @@ -1165,47 +1166,47 @@ init_ett_table_page(endpoints_table *talkers, GtkWidget *vbox, gboolean hide_por void init_ett_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) { - endpoints_table *talkers; - char title[256]; + endpoints_table *talkers; + char title[256]; GtkWidget *vbox; GtkWidget *bbox; GtkWidget *close_bt; gboolean ret; - + talkers=g_malloc(sizeof(endpoints_table)); - talkers->name=table_name; - g_snprintf(title, 255, "%s Conversations: %s", table_name, cf_get_display_name(&cfile)); - talkers->win=window_new(GTK_WINDOW_TOPLEVEL, title); - talkers->page_lb=NULL; + talkers->name=table_name; + g_snprintf(title, 255, "%s Conversations: %s", table_name, cf_get_display_name(&cfile)); + talkers->win=window_new(GTK_WINDOW_TOPLEVEL, title); + talkers->page_lb=NULL; talkers->resolve_names=TRUE; gtk_window_set_default_size(GTK_WINDOW(talkers->win), 750, 400); - vbox=gtk_vbox_new(FALSE, 3); - gtk_container_add(GTK_CONTAINER(talkers->win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); + vbox=gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(talkers->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); ret = init_ett_table_page(talkers, vbox, hide_ports, table_name, tap_name, filter, packet_func); if(ret == FALSE) { - g_free(talkers); + g_free(talkers); return; } - /* Button row. */ - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); + close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); window_set_cancel_button(talkers->win, close_bt, window_cancel_button_cb); SIGNAL_CONNECT(talkers->win, "delete_event", window_delete_event_cb, NULL); - SIGNAL_CONNECT(talkers->win, "destroy", ett_win_destroy_cb, talkers); + SIGNAL_CONNECT(talkers->win, "destroy", ett_win_destroy_cb, talkers); - gtk_widget_show_all(talkers->win); + gtk_widget_show_all(talkers->win); window_present(talkers->win); - retap_packets(&cfile); + retap_packets(&cfile); /* after retapping, redraw table */ draw_ett_table_data(talkers); @@ -1228,24 +1229,24 @@ ett_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) -endpoints_table * +static endpoints_table * init_ett_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) { gboolean ret; GtkWidget *page_vbox; - endpoints_table *talkers; + endpoints_table *talkers; talkers=g_malloc(sizeof(endpoints_table)); - talkers->name=table_name; + talkers->name=table_name; talkers->resolve_names=TRUE; page_vbox=gtk_vbox_new(FALSE, 6); talkers->win = page_vbox; - gtk_container_set_border_width(GTK_CONTAINER(page_vbox), 6); + gtk_container_set_border_width(GTK_CONTAINER(page_vbox), 6); ret = init_ett_table_page(talkers, page_vbox, hide_ports, table_name, tap_name, filter, packet_func); if(ret == FALSE) { - g_free(talkers); + g_free(talkers); return NULL; } @@ -1262,7 +1263,7 @@ typedef struct { } register_ett_t; -GSList *registered_ett_tables = NULL; +static GSList *registered_ett_tables = NULL; void register_ett_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) @@ -1287,7 +1288,7 @@ ett_resolve_toggle_dest(GtkWidget *widget, gpointer data) int page; void ** pages = data; gboolean resolve_names; - endpoints_table *talkers; + endpoints_table *talkers; resolve_names = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (widget)); @@ -1303,8 +1304,8 @@ ett_resolve_toggle_dest(GtkWidget *widget, gpointer data) void init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) { - endpoints_table *talkers; - char title[256]; + endpoints_table *talkers; + char title[256]; GtkWidget *vbox; GtkWidget *hbox; GtkWidget *bbox; @@ -1322,16 +1323,16 @@ init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) pages = g_malloc(sizeof(void *) * (g_slist_length(registered_ett_tables) + 1)); - g_snprintf(title, 255, "Conversations: %s", cf_get_display_name(&cfile)); - win=window_new(GTK_WINDOW_TOPLEVEL, title); - gtk_window_set_default_size(GTK_WINDOW(win), 750, 400); + g_snprintf(title, 255, "Conversations: %s", cf_get_display_name(&cfile)); + win=window_new(GTK_WINDOW_TOPLEVEL, title); + gtk_window_set_default_size(GTK_WINDOW(win), 750, 400); vbox=gtk_vbox_new(FALSE, 6); - gtk_container_add(GTK_CONTAINER(win), vbox); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); + gtk_container_add(GTK_CONTAINER(win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); nb = gtk_notebook_new(); - gtk_container_add(GTK_CONTAINER(vbox), nb); + gtk_container_add(GTK_CONTAINER(vbox), nb); page = 0; @@ -1339,11 +1340,11 @@ init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) while(current_table) { registered = current_table->data; page_lb = gtk_label_new(""); - talkers = init_ett_notebook_page_cb(registered->hide_ports, registered->table_name, registered->tap_name, + talkers = init_ett_notebook_page_cb(registered->hide_ports, registered->table_name, registered->tap_name, registered->filter, registered->packet_func); gtk_notebook_append_page(GTK_NOTEBOOK(nb), talkers->win, page_lb); talkers->win = win; - talkers->page_lb = page_lb; + talkers->page_lb = page_lb; pages[++page] = talkers; current_table = g_slist_next(current_table); @@ -1352,27 +1353,27 @@ init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) pages[0] = GINT_TO_POINTER(page); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); resolv_cb = CHECK_BUTTON_NEW_WITH_MNEMONIC("Name resolution", NULL); - gtk_container_add(GTK_CONTAINER(hbox), resolv_cb); + gtk_container_add(GTK_CONTAINER(hbox), resolv_cb); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(resolv_cb), TRUE); gtk_tooltips_set_tip(tooltips, resolv_cb, "Show results of name resolutions rather than the \"raw\" values. " "Please note: The corresponding name resolution must be enabled.", NULL); SIGNAL_CONNECT(resolv_cb, "toggled", ett_resolve_toggle_dest, pages); - /* Button row. */ - bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); - gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); + /* Button row. */ + bbox = dlg_button_row_new(GTK_STOCK_CLOSE, NULL); + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); - close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); + close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE); window_set_cancel_button(win, close_bt, window_cancel_button_cb); SIGNAL_CONNECT(win, "delete_event", window_delete_event_cb, NULL); - SIGNAL_CONNECT(win, "destroy", ett_win_destroy_notebook_cb, pages); + SIGNAL_CONNECT(win, "destroy", ett_win_destroy_notebook_cb, pages); - gtk_widget_show_all(win); + gtk_widget_show_all(win); window_present(win); retap_packets(&cfile); @@ -1384,104 +1385,104 @@ init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_) } -void +void add_ett_table_data(endpoints_table *et, address *src, address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, SAT_E sat, int port_type) { - address *addr1, *addr2; - guint32 port1, port2; - endpoint_talker_t *talker=NULL; - int talker_idx=0; - gboolean new_talker; - - if(src_port>dst_port){ - addr1=src; - addr2=dst; - port1=src_port; - port2=dst_port; - } else if(src_port<dst_port){ - addr2=src; - addr1=dst; - port2=src_port; - port1=dst_port; - } else if(CMP_ADDRESS(src, dst)<0){ - addr1=src; - addr2=dst; - port1=src_port; - port2=dst_port; - } else { - addr2=src; - addr1=dst; - port2=src_port; - port1=dst_port; - } + address *addr1, *addr2; + guint32 port1, port2; + endpoint_talker_t *talker=NULL; + int talker_idx=0; + gboolean new_talker; + + if(src_port>dst_port){ + addr1=src; + addr2=dst; + port1=src_port; + port2=dst_port; + } else if(src_port<dst_port){ + addr2=src; + addr1=dst; + port2=src_port; + port1=dst_port; + } else if(CMP_ADDRESS(src, dst)<0){ + addr1=src; + addr2=dst; + port1=src_port; + port2=dst_port; + } else { + addr2=src; + addr1=dst; + port2=src_port; + port1=dst_port; + } - new_talker=FALSE; - /* XXX should be optimized to allocate n extra entries at a time - instead of just one */ - /* if we dont have any entries at all yet */ - if(et->endpoints==NULL){ - et->endpoints=g_malloc(sizeof(endpoint_talker_t)); - et->num_endpoints=1; - talker=&et->endpoints[0]; - talker_idx=0; - new_talker=TRUE; - } + new_talker=FALSE; + /* XXX should be optimized to allocate n extra entries at a time + instead of just one */ + /* if we dont have any entries at all yet */ + if(et->endpoints==NULL){ + et->endpoints=g_malloc(sizeof(endpoint_talker_t)); + et->num_endpoints=1; + talker=&et->endpoints[0]; + talker_idx=0; + new_talker=TRUE; + } - /* try to find it among the existing known talkers */ - if(talker==NULL){ - guint32 i; - for(i=0;i<et->num_endpoints;i++){ - if( (!CMP_ADDRESS(&et->endpoints[i].src_address, addr1))&&(!CMP_ADDRESS(&et->endpoints[i].dst_address, addr2))&&(et->endpoints[i].src_port==port1)&&(et->endpoints[i].dst_port==port2) ){ - talker=&et->endpoints[i]; - talker_idx=i; - break; - } - if( (!CMP_ADDRESS(&et->endpoints[i].src_address, addr2))&&(!CMP_ADDRESS(&et->endpoints[i].dst_address, addr1))&&(et->endpoints[i].src_port==port2)&&(et->endpoints[i].dst_port==port1) ){ - talker=&et->endpoints[i]; - talker_idx=i; - break; - } - } - } + /* try to find it among the existing known talkers */ + if(talker==NULL){ + guint32 i; + for(i=0;i<et->num_endpoints;i++){ + if( (!CMP_ADDRESS(&et->endpoints[i].src_address, addr1))&&(!CMP_ADDRESS(&et->endpoints[i].dst_address, addr2))&&(et->endpoints[i].src_port==port1)&&(et->endpoints[i].dst_port==port2) ){ + talker=&et->endpoints[i]; + talker_idx=i; + break; + } + if( (!CMP_ADDRESS(&et->endpoints[i].src_address, addr2))&&(!CMP_ADDRESS(&et->endpoints[i].dst_address, addr1))&&(et->endpoints[i].src_port==port2)&&(et->endpoints[i].dst_port==port1) ){ + talker=&et->endpoints[i]; + talker_idx=i; + break; + } + } + } - /* if we still dont know what talker this is it has to be a new one - and we have to allocate it and append it to the end of the list */ - if(talker==NULL){ - new_talker=TRUE; - et->num_endpoints++; - et->endpoints=g_realloc(et->endpoints, et->num_endpoints*sizeof(endpoint_talker_t)); - talker=&et->endpoints[et->num_endpoints-1]; - talker_idx=et->num_endpoints-1; - } + /* if we still dont know what talker this is it has to be a new one + and we have to allocate it and append it to the end of the list */ + if(talker==NULL){ + new_talker=TRUE; + et->num_endpoints++; + et->endpoints=g_realloc(et->endpoints, et->num_endpoints*sizeof(endpoint_talker_t)); + talker=&et->endpoints[et->num_endpoints-1]; + talker_idx=et->num_endpoints-1; + } - /* if this is a new talker we need to initialize the struct */ - if(new_talker){ - COPY_ADDRESS(&talker->src_address, addr1); - COPY_ADDRESS(&talker->dst_address, addr2); - talker->sat=sat; - talker->port_type=port_type; - talker->src_port=port1; - talker->dst_port=port2; - talker->rx_frames=0; - talker->tx_frames=0; - talker->rx_bytes=0; - talker->tx_bytes=0; - } + /* if this is a new talker we need to initialize the struct */ + if(new_talker){ + COPY_ADDRESS(&talker->src_address, addr1); + COPY_ADDRESS(&talker->dst_address, addr2); + talker->sat=sat; + talker->port_type=port_type; + talker->src_port=port1; + talker->dst_port=port2; + talker->rx_frames=0; + talker->tx_frames=0; + talker->rx_bytes=0; + talker->tx_bytes=0; + } - /* update the talker struct */ - if( (!CMP_ADDRESS(src, addr1))&&(!CMP_ADDRESS(dst, addr2))&&(src_port==port1)&&(dst_port==port2) ){ - talker->tx_frames+=num_frames; - talker->tx_bytes+=num_bytes; - } else { - talker->rx_frames+=num_frames; - talker->rx_bytes+=num_bytes; - } + /* update the talker struct */ + if( (!CMP_ADDRESS(src, addr1))&&(!CMP_ADDRESS(dst, addr2))&&(src_port==port1)&&(dst_port==port2) ){ + talker->tx_frames+=num_frames; + talker->tx_bytes+=num_bytes; + } else { + talker->rx_frames+=num_frames; + talker->rx_bytes+=num_bytes; + } - /* if this was a new talker we have to create a clist row for it */ - if(new_talker){ - char *entries[NUM_COLS]; - char frames[16],bytes[16],txframes[16],txbytes[16],rxframes[16],rxbytes[16]; + /* if this was a new talker we have to create a clist row for it */ + if(new_talker){ + char *entries[NUM_COLS]; + char frames[16],bytes[16],txframes[16],txbytes[16],rxframes[16],rxbytes[16]; /* these values will be filled by call to draw_ett_table_addresses() below */ @@ -1490,23 +1491,23 @@ add_ett_table_data(endpoints_table *et, address *src, address *dst, guint32 src_ entries[2] = ""; entries[3] = ""; - g_snprintf(frames, 16, "%u", talker->tx_frames+talker->rx_frames); - entries[4]=frames; - g_snprintf(bytes, 16, "%u", talker->tx_bytes+talker->rx_bytes); - entries[5]=bytes; + g_snprintf(frames, 16, "%u", talker->tx_frames+talker->rx_frames); + entries[4]=frames; + g_snprintf(bytes, 16, "%u", talker->tx_bytes+talker->rx_bytes); + entries[5]=bytes; - g_snprintf(txframes, 16, "%u", talker->tx_frames); - entries[6]=txframes; - g_snprintf(txbytes, 16, "%u", talker->tx_bytes); - entries[7]=txbytes; + g_snprintf(txframes, 16, "%u", talker->tx_frames); + entries[6]=txframes; + g_snprintf(txbytes, 16, "%u", talker->tx_bytes); + entries[7]=txbytes; - g_snprintf(rxframes, 16, "%u", talker->rx_frames); - entries[8]=rxframes; - g_snprintf(rxbytes, 16, "%u", talker->rx_bytes); - entries[9]=rxbytes; + g_snprintf(rxframes, 16, "%u", talker->rx_frames); + entries[8]=rxframes; + g_snprintf(rxbytes, 16, "%u", talker->rx_bytes); + entries[9]=rxbytes; - gtk_clist_insert(et->table, talker_idx, entries); - gtk_clist_set_row_data(et->table, talker_idx, (gpointer) talker_idx); + gtk_clist_insert(et->table, talker_idx, entries); + gtk_clist_set_row_data(et->table, talker_idx, (gpointer) talker_idx); draw_ett_table_addresses(et); } diff --git a/gtk/endpoint_talkers_table.h b/gtk/endpoint_talkers_table.h index 30e4ca00dc..54ff0eda5b 100644 --- a/gtk/endpoint_talkers_table.h +++ b/gtk/endpoint_talkers_table.h @@ -2,7 +2,7 @@ * endpoint_talkers_table 2003 Ronnie Sahlberg * Helper routines common to all endpoint talkers taps. * - * $Id: endpoint_talkers_table.h,v 1.12 2004/06/01 20:37:09 ulfl Exp $ + * $Id: endpoint_talkers_table.h,v 1.13 2004/06/03 21:46:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -23,18 +23,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sat.h" + /** @file * Conversation definitions. */ -/** Address type */ -typedef enum { - SAT_NONE, /**< no address type */ - SAT_ETHER, /**< ethernet */ - SAT_FDDI, /**< fddi */ - SAT_TOKENRING /**< token ring */ -} SAT_E; - /** Conversation information */ typedef struct _endpoint_talker_t { address src_address; /**< source address */ @@ -55,7 +49,7 @@ typedef struct _endpoints_table { char *name; /**< the name of the table */ GtkWidget *win; /**< GTK window */ GtkWidget *page_lb; /**< label */ - GtkWidget *scrolled_window; /**< the scrolled window */ + GtkWidget *scrolled_window; /**< the scrolled window */ GtkCList *table; /**< the GTK table */ GtkWidget *menu; /**< context menu */ gboolean has_ports; /**< table has ports */ @@ -85,6 +79,13 @@ extern void register_ett_table(gboolean hide_ports, char *table_name, char *tap_ */ extern void init_ett_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func); +/** Callback for "Conversations" statistics item. + * + * @param w unused + * @param d unused + */ +extern void init_ett_notebook_cb(GtkWidget *w, gpointer d); + /** Add some data to the table. * * @param et the table to add the data to @@ -99,4 +100,3 @@ extern void init_ett_table(gboolean hide_ports, char *table_name, char *tap_name */ extern void add_ett_table_data(endpoints_table *et, address *src, address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes, SAT_E sat, int port_type); - diff --git a/gtk/hostlist_table.c b/gtk/hostlist_table.c index 13af4ace3f..35e640258d 100644 --- a/gtk/hostlist_table.c +++ b/gtk/hostlist_table.c @@ -2,22 +2,22 @@ * modified from endpoint_talkers_table.c 2003 Ronnie Sahlberg * Helper routines common to all host list taps. * - * $Id: hostlist_table.c,v 1.16 2004/06/02 07:12:10 ulfl Exp $ + * $Id: hostlist_table.c,v 1.17 2004/06/03 21:46:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> * 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. @@ -87,7 +87,7 @@ hostlist_port_to_str(int port_type, guint32 port) return a string for the filter name some addresses, like AT_ETHER may actually be any of multiple types - of protocols, either ethernet, tokenring, fddi etc so we must be more + of protocols, either ethernet, tokenring, fddi etc so we must be more specific there thats why we need specific_addr_type */ static char * @@ -141,32 +141,32 @@ typedef struct column_arrows { static void reset_hostlist_table_data(hostlist_table *hosts) { - guint32 i; - char title[256]; + guint32 i; + char title[256]; if(hosts->page_lb) { - g_snprintf(title, 255, "Endpoints: %s", cf_get_display_name(&cfile)); - gtk_window_set_title(GTK_WINDOW(hosts->win), title); - g_snprintf(title, 255, "%s", hosts->name); - gtk_label_set_text(GTK_LABEL(hosts->page_lb), title); + g_snprintf(title, 255, "Endpoints: %s", cf_get_display_name(&cfile)); + gtk_window_set_title(GTK_WINDOW(hosts->win), title); + g_snprintf(title, 255, "%s", hosts->name); + gtk_label_set_text(GTK_LABEL(hosts->page_lb), title); gtk_widget_set_sensitive(hosts->page_lb, FALSE); } else { - g_snprintf(title, 255, "%s Endpoints: %s", hosts->name, cf_get_display_name(&cfile)); - gtk_window_set_title(GTK_WINDOW(hosts->win), title); + g_snprintf(title, 255, "%s Endpoints: %s", hosts->name, cf_get_display_name(&cfile)); + gtk_window_set_title(GTK_WINDOW(hosts->win), title); } - /* remove all entries from the clist */ - for(i=0;i<hosts->num_hosts;i++){ - gtk_clist_remove(hosts->table, hosts->num_hosts-i-1); - } + /* remove all entries from the clist */ + for(i=0;i<hosts->num_hosts;i++){ + gtk_clist_remove(hosts->table, hosts->num_hosts-i-1); + } - /* delete all hosts */ - for(i=0;i<hosts->num_hosts;i++){ - g_free((gpointer)hosts->hosts[i].address.data); - } - g_free(hosts->hosts); - hosts->hosts=NULL; - hosts->num_hosts=0; + /* delete all hosts */ + for(i=0;i<hosts->num_hosts;i++){ + g_free((gpointer)hosts->hosts[i].address.data); + } + g_free(hosts->hosts); + hosts->hosts=NULL; + hosts->num_hosts=0; } @@ -249,7 +249,7 @@ hostlist_click_column_cb(GtkCList *clist, gint column, gpointer data) } -/* action is encoded as +/* action is encoded as filter_action*256+filter_type filter_action: @@ -292,7 +292,7 @@ hostlist_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint c sport=hostlist_port_to_str(hl->hosts[selection].port_type, hl->hosts[selection].port); g_snprintf(dirstr, 127, "%s==%s %s%s%s%s", - hostlist_get_filter_name(&hl->hosts[selection].address, + hostlist_get_filter_name(&hl->hosts[selection].address, hl->hosts[selection].sat, hl->hosts[selection].port_type, FN_ANY_ADDRESS), address_to_str(&hl->hosts[selection].address), sport?" && ":"", @@ -375,7 +375,7 @@ hostlist_show_popup_menu_cb(void *widg _U_, GdkEvent *event, hostlist_table *et) gtk_clist_unselect_all(et->table); gtk_clist_select_row(et->table, row, -1); - gtk_menu_popup(GTK_MENU(et->menu), NULL, NULL, NULL, NULL, + gtk_menu_popup(GTK_MENU(et->menu), NULL, NULL, NULL, NULL, bevent->button, bevent->time); } } @@ -387,32 +387,32 @@ static GtkItemFactoryEntry hostlist_list_menu_items[] = { /* Match */ ITEM_FACTORY_ENTRY("/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL), - ITEM_FACTORY_ENTRY("/Apply as Filter/Selected", NULL, + ITEM_FACTORY_ENTRY("/Apply as Filter/Selected", NULL, hostlist_select_filter_cb, 0*256+0, NULL, NULL), - ITEM_FACTORY_ENTRY("/Apply as Filter/Not Selected", NULL, + ITEM_FACTORY_ENTRY("/Apply as Filter/Not Selected", NULL, hostlist_select_filter_cb, 0*256+1, NULL, NULL), - ITEM_FACTORY_ENTRY("/Apply as Filter/... and Selected", NULL, + ITEM_FACTORY_ENTRY("/Apply as Filter/... and Selected", NULL, hostlist_select_filter_cb, 0*256+2, NULL, NULL), - ITEM_FACTORY_ENTRY("/Apply as Filter/... or Selected", NULL, + ITEM_FACTORY_ENTRY("/Apply as Filter/... or Selected", NULL, hostlist_select_filter_cb, 0*256+3, NULL, NULL), - ITEM_FACTORY_ENTRY("/Apply as Filter/... and not Selected", NULL, + ITEM_FACTORY_ENTRY("/Apply as Filter/... and not Selected", NULL, hostlist_select_filter_cb, 0*256+4, NULL, NULL), - ITEM_FACTORY_ENTRY("/Apply as Filter/... or not Selected", NULL, + ITEM_FACTORY_ENTRY("/Apply as Filter/... or not Selected", NULL, hostlist_select_filter_cb, 0*256+5, NULL, NULL), /* Prepare */ ITEM_FACTORY_ENTRY("/Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL), - ITEM_FACTORY_ENTRY("/Prepare a Filter/Selected", NULL, + ITEM_FACTORY_ENTRY("/Prepare a Filter/Selected", NULL, hostlist_select_filter_cb, 1*256+0, NULL, NULL), - ITEM_FACTORY_ENTRY("/Prepare a Filter/Not Selected", NULL, + ITEM_FACTORY_ENTRY("/Prepare a Filter/Not Selected", NULL, hostlist_select_filter_cb, 1*256+1, NULL, NULL), - ITEM_FACTORY_ENTRY("/Prepare a Filter/... and Selected", NULL, + ITEM_FACTORY_ENTRY("/Prepare a Filter/... and Selected", NULL, hostlist_select_filter_cb, 1*256+2, NULL, NULL), - ITEM_FACTORY_ENTRY("/Prepare a Filter/... or Selected", NULL, + ITEM_FACTORY_ENTRY("/Prepare a Filter/... or Selected", NULL, hostlist_select_filter_cb, 1*256+3, NULL, NULL), - ITEM_FACTORY_ENTRY("/Prepare a Filter/... and not Selected", NULL, + ITEM_FACTORY_ENTRY("/Prepare a Filter/... and not Selected", NULL, hostlist_select_filter_cb, 1*256+4, NULL, NULL), - ITEM_FACTORY_ENTRY("/Prepare a Filter/... or not Selected", NULL, + ITEM_FACTORY_ENTRY("/Prepare a Filter/... or not Selected", NULL, hostlist_select_filter_cb, 1*256+5, NULL, NULL), /* Find Frame */ @@ -446,7 +446,7 @@ hostlist_create_popup_menu(hostlist_table *hl) /* XXX should freeze/thaw table here and in the srt thingy? */ -static void +static void draw_hostlist_table_addresses(hostlist_table *hl) { guint32 i; @@ -494,7 +494,7 @@ draw_hostlist_table_addresses(hostlist_table *hl) /* XXX should freeze/thaw table here and in the srt thingy? */ -static void +static void draw_hostlist_table_data(hostlist_table *hl) { guint32 i; @@ -540,7 +540,7 @@ draw_hostlist_table_data(hostlist_table *hl) draw_hostlist_table_addresses(hl); } -gboolean +static gboolean init_hostlist_table_page(hostlist_table *hosttable, GtkWidget *vbox, gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) { int i; @@ -652,7 +652,7 @@ init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char GtkWidget *close_bt; gboolean ret; - + hosttable=g_malloc(sizeof(hostlist_table)); hosttable->name=table_name; @@ -707,7 +707,7 @@ hostlist_win_destroy_notebook_cb(GtkWindow *win _U_, gpointer data) -hostlist_table * +static hostlist_table * init_hostlist_notebook_page_cb(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) { gboolean ret; @@ -741,7 +741,7 @@ typedef struct { } register_hostlist_t; -GSList *registered_hostlist_tables = NULL; +static GSList *registered_hostlist_tables = NULL; void register_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func) @@ -820,7 +820,7 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) while(current_table) { registered = current_table->data; page_lb = gtk_label_new(""); - hosttable = init_hostlist_notebook_page_cb(registered->hide_ports, registered->table_name, registered->tap_name, + hosttable = init_hostlist_notebook_page_cb(registered->hide_ports, registered->table_name, registered->tap_name, registered->filter, registered->packet_func); gtk_notebook_append_page(GTK_NOTEBOOK(nb), hosttable->win, page_lb); hosttable->win = win; @@ -866,13 +866,13 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_) -void +void add_hostlist_table_data(hostlist_table *hl, address *addr, guint32 port, gboolean sender, int num_frames, int num_bytes, SAT_E sat, int port_type) { hostlist_talker_t *talker=NULL; int talker_idx=0; gboolean new_talker; - + new_talker=FALSE; /* XXX should be optimized to allocate n extra entries at a time instead of just one */ diff --git a/gtk/hostlist_table.h b/gtk/hostlist_table.h index a63aacab63..f0d13ca719 100644 --- a/gtk/hostlist_table.h +++ b/gtk/hostlist_table.h @@ -2,7 +2,7 @@ * modified from endpoint_talkers_table 2003 Ronnie Sahlberg * Helper routines common to all host talkers taps. * - * $Id: hostlist_table.h,v 1.6 2004/06/02 06:44:40 ulfl Exp $ + * $Id: hostlist_table.h,v 1.7 2004/06/03 21:46:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -23,18 +23,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include "sat.h" + /** @file * Hostlist definitions. */ -/** Address type */ -typedef enum { - SAT_NONE, /**< no address type */ - SAT_ETHER, /**< ethernet */ - SAT_FDDI, /**< fddi */ - SAT_TOKENRING /**< token ring */ -} SAT_E; - /** Hostlist information */ typedef struct _hostlist_talker_t { address address; /**< address */ @@ -83,6 +77,13 @@ extern void register_hostlist_table(gboolean hide_ports, char *table_name, char */ extern void init_hostlist_table(gboolean hide_ports, char *table_name, char *tap_name, char *filter, void *packet_func); +/** Callback for "Endpoints" statistics item. + * + * @param w unused + * @param d unused + */ +extern void init_hostlist_notebook_cb(GtkWidget *w, gpointer d); + /** Add some data to the table. * * @param hl the table to add the data to diff --git a/gtk/menu.c b/gtk/menu.c index ae27232aec..c9b7c60bdf 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.200 2004/06/03 02:14:50 guy Exp $ + * $Id: menu.c,v 1.201 2004/06/03 21:46:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -69,27 +69,25 @@ #include "recent.h" #include "../ui_util.h" #include "proto_draw.h" +#include "endpoint_talkers_table.h" +#include "hostlist_table.h" #include "simple_dialog.h" #include <epan/timestamp.h> GtkWidget *popup_menu_object; -extern void savehex_cb(GtkWidget * w, gpointer data _U_); -extern void init_ett_notebook_cb(GtkWidget *w _U_, gpointer d _U_); -extern void init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_); - static void clear_menu_recent_capture_file_cmd_cb(GtkWidget *w, gpointer unused _U_); typedef struct _menu_item { - char *name; + char *name; gint group; - gboolean enabled; + gboolean enabled; GtkItemFactoryCallback callback; gpointer callback_data; - gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *); - gboolean (*selected_tree_row_enabled)(field_info *); - GList *children; + gboolean (*selected_packet_enabled)(frame_data *, epan_dissect_t *); + gboolean (*selected_tree_row_enabled)(field_info *); + GList *children; } menu_item_t; static GList *tap_menu_tree_root = NULL; diff --git a/gtk/proto_draw.h b/gtk/proto_draw.h index 6bcce228b4..bca8e5e77d 100644 --- a/gtk/proto_draw.h +++ b/gtk/proto_draw.h @@ -1,7 +1,7 @@ /* proto_draw.h * Definitions for GTK+ packet display structures and routines * - * $Id: proto_draw.h,v 1.26 2004/06/02 20:14:51 ulfl Exp $ + * $Id: proto_draw.h,v 1.27 2004/06/03 21:46:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -89,6 +89,13 @@ extern void add_byte_views(epan_dissect_t *edt, GtkWidget *tree_view, */ extern gboolean byte_view_select(GtkWidget *widget, GdkEventButton *event); +/** Callback for "Export Selected Packet Bytes" operation. + * + * @param w unused + * @param data unused + */ +extern void savehex_cb(GtkWidget * w, gpointer data); + #if GTK_MAJOR_VERSION < 2 /** Redraw a given byte view window. * diff --git a/gtk/sat.h b/gtk/sat.h new file mode 100644 index 0000000000..a0f6b950bd --- /dev/null +++ b/gtk/sat.h @@ -0,0 +1,41 @@ +/* sat.h + * 2003 Ronnie Sahlberg + * Sub-address types for MAC addresses + * + * $Id: sat.h,v 1.1 2004/06/03 21:46:27 guy Exp $ + * + * Ethereal - Network traffic analyzer + * By Gerald Combs <gerald@ethereal.com> + * 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. + */ + +#ifndef __GTK_SAT_H__ +#define __GTK_SAT_H__ + +/** @file + * Sub-address type definitions. + */ + +/** Address type */ +typedef enum { + SAT_NONE, /**< no address type */ + SAT_ETHER, /**< Ethernet */ + SAT_FDDI, /**< FDDI */ + SAT_TOKENRING /**< Token Ring */ +} SAT_E; + +#endif /* __GTK_SAT_H__ */ |