aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2003-08-27 12:10:21 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2003-08-27 12:10:21 +0000
commitd3562c0480240333a99315699992e3165702a369 (patch)
tree7914be1b9feaa01d92d29eeb5744bb1b9f2df86a
parent982ece89cf2d31d509dfe270578d86c62459c776 (diff)
Updates for the endpoint talkers thing
The table now has a popup menu with Match display filter Selected EP1 <-> EP2 EP1 --> EP2 EP1 <-- EP2 EP1 --> ANY EP1 <-- ANY EP2 --> ANY EP2 <-- ANY Not Selected ... ... Prepare Display Filter ... Self explanatory. Now the bad news. I set the display filter box in the main window and i call redissect_packet which redissects the packet list but the displayfilter does not take or affect the main window until i click the apply button. Some signal needs to be raised to some object me thinks. Please feel free to fix it if you know what is missing. svn path=/trunk/; revision=8279
-rw-r--r--gtk/endpoint_talkers_eth.c12
-rw-r--r--gtk/endpoint_talkers_fc.c12
-rw-r--r--gtk/endpoint_talkers_ip.c15
-rw-r--r--gtk/endpoint_talkers_ipx.c12
-rw-r--r--gtk/endpoint_talkers_table.c438
-rw-r--r--gtk/endpoint_talkers_table.h8
-rw-r--r--gtk/endpoint_talkers_tcpip.c15
-rw-r--r--gtk/endpoint_talkers_tr.c12
-rw-r--r--gtk/endpoint_talkers_udpip.c14
9 files changed, 515 insertions, 23 deletions
diff --git a/gtk/endpoint_talkers_eth.c b/gtk/endpoint_talkers_eth.c
index 1b32124d39..e65af4314f 100644
--- a/gtk/endpoint_talkers_eth.c
+++ b/gtk/endpoint_talkers_eth.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_eth.c
* endpoint_talkers_eth 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_eth.c,v 1.5 2003/08/26 01:46:22 guy Exp $
+ * $Id: endpoint_talkers_eth.c,v 1.6 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -111,6 +111,14 @@ gtk_eth_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ static char *filter_names[] = {
+ "eth.addr",
+ "eth.src",
+ "eth.dst",
+ NULL,
+ NULL,
+ NULL
+ };
if(!strncmp(optarg,"talkers,eth,",12)){
filter=optarg+12;
@@ -139,7 +147,7 @@ gtk_eth_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(eth_talkers->win);
- init_ett_table(&eth_talkers->talkers, vbox, NULL);
+ init_ett_table(&eth_talkers->talkers, vbox, NULL, filter_names);
error_string=register_tap_listener("eth", eth_talkers, filter, eth_talkers_reset, eth_talkers_packet, eth_talkers_draw);
if(error_string){
diff --git a/gtk/endpoint_talkers_fc.c b/gtk/endpoint_talkers_fc.c
index c88002c687..4d008cbb8b 100644
--- a/gtk/endpoint_talkers_fc.c
+++ b/gtk/endpoint_talkers_fc.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_fc.c
* endpoint_talkers_fc 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_fc.c,v 1.5 2003/08/26 01:46:22 guy Exp $
+ * $Id: endpoint_talkers_fc.c,v 1.6 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -110,6 +110,14 @@ gtk_fc_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ static char *filter_names[] = {
+ "fc.id",
+ "fc.s_id",
+ "fc.d_id",
+ NULL,
+ NULL,
+ NULL
+ };
if(!strncmp(optarg,"talkers,fc,",11)){
filter=optarg+11;
@@ -138,7 +146,7 @@ gtk_fc_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(fc_talkers->win);
- init_ett_table(&fc_talkers->talkers, vbox, NULL);
+ init_ett_table(&fc_talkers->talkers, vbox, NULL, filter_names);
error_string=register_tap_listener("fc", fc_talkers, filter, fc_talkers_reset, fc_talkers_packet, fc_talkers_draw);
if(error_string){
diff --git a/gtk/endpoint_talkers_ip.c b/gtk/endpoint_talkers_ip.c
index c56e63a179..d9a299cb70 100644
--- a/gtk/endpoint_talkers_ip.c
+++ b/gtk/endpoint_talkers_ip.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_ip.c
* endpoint_talkers_ip 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_ip.c,v 1.6 2003/08/26 01:46:22 guy Exp $
+ * $Id: endpoint_talkers_ip.c,v 1.7 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -99,8 +99,6 @@ ip_talkers_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, void *
return 1;
}
-
-
static void
gtk_ip_talkers_init(char *optarg)
{
@@ -110,6 +108,15 @@ gtk_ip_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ static char *filter_names[] = {
+ "ip.addr",
+ "ip.src",
+ "ip.dst",
+ NULL,
+ NULL,
+ NULL
+ };
+
if(!strncmp(optarg,"talkers,ip,",11)){
filter=optarg+11;
@@ -138,7 +145,7 @@ gtk_ip_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(ip_talkers->win);
- init_ett_table(&ip_talkers->talkers, vbox, NULL);
+ init_ett_table(&ip_talkers->talkers, vbox, NULL, filter_names);
error_string=register_tap_listener("ip", ip_talkers, filter, ip_talkers_reset, ip_talkers_packet, ip_talkers_draw);
if(error_string){
diff --git a/gtk/endpoint_talkers_ipx.c b/gtk/endpoint_talkers_ipx.c
index 3bef2e4b52..6b7218f841 100644
--- a/gtk/endpoint_talkers_ipx.c
+++ b/gtk/endpoint_talkers_ipx.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_ipx.c
* endpoint_talkers_ipx 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_ipx.c,v 1.4 2003/08/26 01:46:22 guy Exp $
+ * $Id: endpoint_talkers_ipx.c,v 1.5 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -110,6 +110,14 @@ gtk_ipx_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ static char *filter_names[] = {
+ "ipx.node",
+ "ipx.src.node",
+ "ipx.dst.node",
+ NULL,
+ NULL,
+ NULL
+ };
if(!strncmp(optarg,"talkers,ipx,",12)){
filter=optarg+12;
@@ -138,7 +146,7 @@ gtk_ipx_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(ipx_talkers->win);
- init_ett_table(&ipx_talkers->talkers, vbox, NULL);
+ init_ett_table(&ipx_talkers->talkers, vbox, NULL, filter_names);
error_string=register_tap_listener("ipx", ipx_talkers, filter, ipx_talkers_reset, ipx_talkers_packet, ipx_talkers_draw);
if(error_string){
diff --git a/gtk/endpoint_talkers_table.c b/gtk/endpoint_talkers_table.c
index 868535264e..39dd86e072 100644
--- a/gtk/endpoint_talkers_table.c
+++ b/gtk/endpoint_talkers_table.c
@@ -4,7 +4,7 @@
* endpoint_talkers_table 2003 Ronnie Sahlberg
* Helper routines common to all endpoint talkers tap.
*
- * $Id: endpoint_talkers_table.c,v 1.3 2003/08/26 01:46:22 guy Exp $
+ * $Id: endpoint_talkers_table.c,v 1.4 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -40,7 +40,12 @@
#include "endpoint_talkers_table.h"
#include "image/clist_ascend.xpm"
#include "image/clist_descend.xpm"
+#include "simple_dialog.h"
+#include "globals.h"
+extern GtkWidget *main_display_filter_widget;
+
+#define GTK_MENU_FUNC(a) ((GtkItemFactoryCallback)(a))
#define NUM_COLS 10
@@ -57,11 +62,9 @@ reset_ett_table_data(endpoints_table *et)
guint32 i;
/* remove all entries from the clist */
- gtk_clist_freeze(et->table);
for(i=0;i<et->num_endpoints;i++){
gtk_clist_remove(et->table, et->num_endpoints-1-i);
}
- gtk_clist_thaw(et->table);
/* delete all endpoints */
for(i=0;i<et->num_endpoints;i++){
@@ -139,8 +142,425 @@ ett_click_column_cb(GtkCList *clist, gint column, gpointer data)
}
+/* action is encoded as
+ filter_action*65536+filter_type*256+filter_direction
+
+ filter_action:
+ 0: Match
+ 1: Prepare
+ filter_type:
+ 0: Selected
+ 1: Not Selected
+ 2: And Selected
+ 3: Or Selected
+ 4: And Not Selected
+ 5: Or Not Selected
+ filter_direction:
+ 0: EP1 To/From EP2
+ 1: EP1 To EP2
+ 2: EP1 From EP2
+ 3: EP1 To ANY
+ 4: EP1 From ANY
+ 5: EP2 To ANY
+ 6: EP2 From ANY
+*/
+static void
+ett_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint callback_action)
+{
+ int action, type, direction;
+ int selection;
+ endpoints_table *et = (endpoints_table *)callback_data;
+ char dirstr[128];
+ char str[256];
+ char *current_filter;
+
+ action=(callback_action>>16)&0xff;
+ type=(callback_action>>8)&0xff;
+ direction=callback_action&0xff;
+
+
+ selection=GPOINTER_TO_INT(g_list_nth_data(GTK_CLIST(et->table)->selection, 0));
+ if(selection>=(int)et->num_endpoints){
+ simple_dialog(ESD_TYPE_WARN, NULL, "No conversation selected");
+ return;
+ }
+ /* translate it back from row index to index in enndpoint array */
+ selection=gtk_clist_find_row_from_data(et->table, (gpointer)selection);
+
+
+ switch(direction){
+ case 0:
+ /* EP1 <-> EP2 */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s && %s==%s %s%s%s%s",
+ et->filter_names[0],
+ address_to_str(&et->endpoints[selection].src_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[3]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].src_port):"",
+ et->filter_names[0],
+ address_to_str(&et->endpoints[selection].dst_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[3]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].dst_port):""
+ );
+ break;
+ case 1:
+ /* EP1 --> EP2 */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s && %s==%s %s%s%s%s",
+ et->filter_names[1],
+ address_to_str(&et->endpoints[selection].src_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[4]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].src_port):"",
+ et->filter_names[2],
+ address_to_str(&et->endpoints[selection].dst_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[5]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].dst_port):""
+ );
+ break;
+ case 2:
+ /* EP1 <-- EP2 */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s && %s==%s %s%s%s%s",
+ et->filter_names[2],
+ address_to_str(&et->endpoints[selection].src_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[5]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].src_port):"",
+ et->filter_names[1],
+ address_to_str(&et->endpoints[selection].dst_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[4]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].dst_port):""
+ );
+ break;
+ case 3:
+ /* EP1 --> ANY */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s",
+ et->filter_names[1],
+ address_to_str(&et->endpoints[selection].src_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[4]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].src_port):""
+ );
+ break;
+ case 4:
+ /* EP1 <-- ANY */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s",
+ et->filter_names[2],
+ address_to_str(&et->endpoints[selection].src_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[5]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].src_port):""
+ );
+ break;
+ case 5:
+ /* EP2 --> ANY */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s",
+ et->filter_names[1],
+ address_to_str(&et->endpoints[selection].dst_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[4]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].dst_port):""
+ );
+ break;
+ case 6:
+ /* EP2 <-- ANY */
+ snprintf(dirstr, 127, "%s==%s %s%s%s%s",
+ et->filter_names[2],
+ address_to_str(&et->endpoints[selection].dst_address),
+ (et->port_to_str)?" && ":"",
+ (et->port_to_str)?et->filter_names[5]:"",
+ (et->port_to_str)?"==":"",
+ (et->port_to_str)?et->port_to_str(et->endpoints[selection].dst_port):""
+ );
+ break;
+ }
+
+ current_filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
+ switch(type){
+ case 0:
+ /* selected */
+ snprintf(str, 255, "%s", dirstr);
+ break;
+ case 1:
+ /* not selected */
+ snprintf(str, 255, "!(%s)", dirstr);
+ break;
+ case 2:
+ /* and selected */
+ snprintf(str, 255, "(%s) && (%s)", current_filter, dirstr);
+ break;
+ case 3:
+ /* or selected */
+ snprintf(str, 255, "(%s) || (%s)", current_filter, dirstr);
+ break;
+ case 4:
+ /* and not selected */
+ snprintf(str, 255, "(%s) && !(%s)", current_filter, dirstr);
+ break;
+ case 5:
+ /* or not selected */
+ snprintf(str, 255, "(%s) || !(%s)", current_filter, dirstr);
+ break;
+ }
+
+ gtk_entry_set_text(GTK_ENTRY(main_display_filter_widget), str);
+
+ switch(action){
+ case 0:
+ /* match */
+ /* XXX FIXME, this is not enough to make the dispplay filters
+ reapply to the main window */
+ redissect_packets(&cfile);
+ case 1:
+ /* prepare */
+ /* do nothing */
+ break;
+ }
+
+}
+
+static gint
+ett_show_popup_menu_cb(endpoints_table *et, GdkEvent *event, gpointer vet)
+{
+ GdkEventButton *bevent = (GdkEventButton *)event;
+
+ if(event->type==GDK_BUTTON_PRESS && bevent->button==3){
+ gtk_menu_popup(GTK_MENU(et->menu), NULL, NULL, NULL, NULL,
+ bevent->button, bevent->time);
+ }
+
+ return FALSE;
+}
+
+static GtkItemFactoryEntry ett_list_menu_items[] =
+{
+ /* Match */
+ ITEM_FACTORY_ENTRY("/Match Display Filter", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 0*65536+0*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 0*65536+0*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 0*65536+0*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+0*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+0*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+0*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+0*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 0*65536+1*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 0*65536+1*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 0*65536+1*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+1*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+1*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+1*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Not Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+1*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 0*65536+2*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 0*65536+2*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 0*65536+2*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+2*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+2*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+2*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+2*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 0*65536+3*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 0*65536+3*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 0*65536+3*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+3*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+3*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+3*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+3*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 0*65536+4*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 0*65536+4*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 0*65536+4*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+4*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+4*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+4*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/And Not Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+4*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 0*65536+5*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 0*65536+5*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 0*65536+5*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+5*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+5*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 0*65536+5*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Match Display Filter/Or Not Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 0*65536+5*256+6, NULL, NULL),
+
+ /* Prepare */
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 1*65536+0*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 1*65536+0*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 1*65536+0*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+0*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+0*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+0*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+0*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 1*65536+1*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 1*65536+1*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 1*65536+1*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+1*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+1*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+1*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Not Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+1*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 1*65536+2*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 1*65536+2*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 1*65536+2*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+2*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+2*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+2*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+2*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 1*65536+3*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 1*65536+3*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 1*65536+3*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+3*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+3*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+3*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+3*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 1*65536+4*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 1*65536+4*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 1*65536+4*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+4*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+4*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+4*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/And Not Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+4*256+6, NULL, NULL),
+
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected", NULL, NULL, 0, "<Branch>", NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP1 <-> EP2", NULL,
+ ett_select_filter_cb, 1*65536+5*256+0, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP1 --> EP2", NULL,
+ ett_select_filter_cb, 1*65536+5*256+1, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP1 <-- EP2", NULL,
+ ett_select_filter_cb, 1*65536+5*256+2, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP1 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+5*256+3, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP1 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+5*256+4, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP2 --> ANY", NULL,
+ ett_select_filter_cb, 1*65536+5*256+5, NULL, NULL),
+ ITEM_FACTORY_ENTRY("/Prepare Display Filter/Or Not Selected/EP2 <-- ANY", NULL,
+ ett_select_filter_cb, 1*65536+5*256+6, NULL, NULL),
+
+
+};
+
+static void
+ett_create_popup_menu(endpoints_table *et)
+{
+ et->item_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
+
+ gtk_item_factory_create_items_ac(et->item_factory, sizeof(ett_list_menu_items)/sizeof(ett_list_menu_items[0]), ett_list_menu_items, et, 2);
+
+ et->menu = gtk_item_factory_get_widget(et->item_factory, "<main>");
+ gtk_signal_connect_object(GTK_OBJECT(et->table), "button_press_event", GTK_SIGNAL_FUNC(ett_show_popup_menu_cb), GTK_OBJECT(et));
+}
+
+
+
+
+
void
-init_ett_table(endpoints_table *et, GtkWidget *vbox, char *(*port_to_str)(guint32))
+init_ett_table(endpoints_table *et, GtkWidget *vbox, char *(*port_to_str)(guint32), char **filter_names)
{
int i;
column_arrows *col_arrows;
@@ -148,7 +568,7 @@ init_ett_table(endpoints_table *et, GtkWidget *vbox, char *(*port_to_str)(guint3
GdkPixmap *ascend_pm, *descend_pm;
GtkStyle *win_style;
GtkWidget *column_lb;
- char *default_titles[] = { "Address", "Port", "Address", "Port", "Frames", "Bytes", "-> Frames", "-> Bytes", "<- Frames", "<- Bytes" };
+ char *default_titles[] = { "EP1 Address", "Port", "EP2 Address", "Port", "Frames", "Bytes", "-> Frames", "-> Bytes", "<- Frames", "<- Bytes" };
et->scrolled_window=gtk_scrolled_window_new(NULL, NULL);
@@ -221,12 +641,16 @@ init_ett_table(endpoints_table *et, GtkWidget *vbox, char *(*port_to_str)(guint3
et->num_endpoints=0;
et->endpoints=NULL;
et->port_to_str=port_to_str;
+ et->filter_names=filter_names;
/* hide srcport and dstport if we dont use ports */
if(!port_to_str){
gtk_clist_set_column_visibility(et->table, 1, FALSE);
gtk_clist_set_column_visibility(et->table, 3, FALSE);
}
+
+ /* create popup menu for this table */
+ ett_create_popup_menu(et);
}
@@ -355,6 +779,10 @@ add_ett_table_data(endpoints_table *et, address *src, address *dst, guint32 src_
gtk_clist_insert(et->table, talker_idx, entries);
gtk_clist_set_row_data(et->table, talker_idx, (gpointer) talker_idx);
}
+
+ if(et->num_endpoints==1){
+ gtk_clist_select_row(et->table, 0, 0);
+ }
}
diff --git a/gtk/endpoint_talkers_table.h b/gtk/endpoint_talkers_table.h
index 441bdd481f..0b61fa3f72 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.2 2003/08/26 01:46:23 guy Exp $
+ * $Id: endpoint_talkers_table.h,v 1.3 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -40,15 +40,19 @@ typedef struct _endpoint_talker_t {
typedef struct _endpoints_table {
GtkWidget *scrolled_window;
GtkCList *table;
+ GtkItemFactory *item_factory;
+ GtkWidget *menu;
gboolean has_ports;
guint32 num_endpoints;
endpoint_talker_t *endpoints;
char *(*port_to_str)(guint32);
+ char **filter_names;
} endpoints_table;
void reset_ett_table_data(endpoints_table *et);
-void init_ett_table(endpoints_table *et, GtkWidget *vbox, char *(*port_to_str)(guint32));
+void init_ett_table(endpoints_table *et, GtkWidget *vbox, char *(*port_to_str)(guint32), char **filter_names);
+
void add_ett_table_data(endpoints_table *et, address *src, address *dst, guint32 src_port, guint32 dst_port, int num_frames, int num_bytes);
diff --git a/gtk/endpoint_talkers_tcpip.c b/gtk/endpoint_talkers_tcpip.c
index a4c49eb7af..f7bfaafe4c 100644
--- a/gtk/endpoint_talkers_tcpip.c
+++ b/gtk/endpoint_talkers_tcpip.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_tcpip.c
* endpoint_talkers_tcpip 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_tcpip.c,v 1.7 2003/08/26 01:46:23 guy Exp $
+ * $Id: endpoint_talkers_tcpip.c,v 1.8 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -127,6 +127,17 @@ gtk_tcpip_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ /* XXX crap, once again we get visibility of the type of transport */
+ /* XXX fixme or fix the api to make ipv6 work */
+ static char *filter_names[] = {
+ "ip.addr",
+ "ip.src",
+ "ip.dst",
+ "tcp.port",
+ "tcp.srcport",
+ "tcp.dstport"
+ };
+
if(!strncmp(optarg,"talkers,tcp,",12)){
filter=optarg+12;
@@ -155,7 +166,7 @@ gtk_tcpip_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(tcpip_talkers->win);
- init_ett_table(&tcpip_talkers->talkers, vbox, tcpip_port_to_str);
+ init_ett_table(&tcpip_talkers->talkers, vbox, tcpip_port_to_str, filter_names);
error_string=register_tap_listener("tcp", tcpip_talkers, filter, tcpip_talkers_reset, tcpip_talkers_packet, tcpip_talkers_draw);
if(error_string){
diff --git a/gtk/endpoint_talkers_tr.c b/gtk/endpoint_talkers_tr.c
index e9165f7950..8014e3f3ee 100644
--- a/gtk/endpoint_talkers_tr.c
+++ b/gtk/endpoint_talkers_tr.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_tr.c
* endpoint_talkers_tr 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_tr.c,v 1.6 2003/08/26 01:46:23 guy Exp $
+ * $Id: endpoint_talkers_tr.c,v 1.7 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -110,6 +110,14 @@ gtk_tr_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ static char *filter_names[] = {
+ "tr.addr",
+ "tr.src",
+ "tr.dst",
+ NULL,
+ NULL,
+ NULL
+ };
if(!strncmp(optarg,"talkers,tr,",11)){
filter=optarg+11;
@@ -138,7 +146,7 @@ gtk_tr_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(tr_talkers->win);
- init_ett_table(&tr_talkers->talkers, vbox, NULL);
+ init_ett_table(&tr_talkers->talkers, vbox, NULL, filter_names);
error_string=register_tap_listener("tr", tr_talkers, filter, tr_talkers_reset, tr_talkers_packet, tr_talkers_draw);
if(error_string){
diff --git a/gtk/endpoint_talkers_udpip.c b/gtk/endpoint_talkers_udpip.c
index 8d088fabbb..5f6f7c7e31 100644
--- a/gtk/endpoint_talkers_udpip.c
+++ b/gtk/endpoint_talkers_udpip.c
@@ -1,7 +1,7 @@
/* endpoint_talkers_udpip.c
* endpoint_talkers_udpip 2003 Ronnie Sahlberg
*
- * $Id: endpoint_talkers_udpip.c,v 1.7 2003/08/26 01:46:23 guy Exp $
+ * $Id: endpoint_talkers_udpip.c,v 1.8 2003/08/27 12:10:21 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -127,6 +127,16 @@ gtk_udpip_talkers_init(char *optarg)
GtkWidget *label;
GString *error_string;
char title[256];
+ /* XXX crap, once again we get visibility of the type of transport */
+ /* XXX fixme or fix the api to make ipv6 work */
+ static char *filter_names[] = {
+ "ip.addr",
+ "ip.src",
+ "ip.dst",
+ "udp.port",
+ "udp.srcport",
+ "udp.dstport"
+ };
if(!strncmp(optarg,"talkers,udp,",12)){
filter=optarg+12;
@@ -155,7 +165,7 @@ gtk_udpip_talkers_init(char *optarg)
/* We must display TOP LEVEL Widget before calling init_ett_table() */
gtk_widget_show(udpip_talkers->win);
- init_ett_table(&udpip_talkers->talkers, vbox, udpip_port_to_str);
+ init_ett_table(&udpip_talkers->talkers, vbox, udpip_port_to_str, filter_names);
error_string=register_tap_listener("udp", udpip_talkers, filter, udpip_talkers_reset, udpip_talkers_packet, udpip_talkers_draw);
if(error_string){