aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2006-03-02 20:50:33 +0000
committerAnders Broman <anders.broman@ericsson.com>2006-03-02 20:50:33 +0000
commitac21800c67db12a2f889bbac3fc46d2c06d97456 (patch)
tree27f8ac62526c31ed92695c7874966a04e4b26154 /gtk
parent5db299677d52b0073b277f751a0995b066c14945 (diff)
From Greg Morris:
- Change to display NCP connection for each conversation - New NCP Endpoints. Please apply expert_comp_table - Use local variable space instead of pointer. The previous implementation utilized pointers and the values would change the table data. svn path=/trunk/; revision=17446
Diffstat (limited to 'gtk')
-rw-r--r--gtk/Makefile.common1
-rw-r--r--gtk/conversations_ncp.c9
-rw-r--r--gtk/conversations_table.c4
-rw-r--r--gtk/expert_comp_table.c6
-rw-r--r--gtk/hostlist_ncp.c91
5 files changed, 104 insertions, 7 deletions
diff --git a/gtk/Makefile.common b/gtk/Makefile.common
index 07e7040af6..2279a33503 100644
--- a/gtk/Makefile.common
+++ b/gtk/Makefile.common
@@ -141,6 +141,7 @@ ETHEREAL_TAP_SRC = \
hostlist_ip.c \
hostlist_ipx.c \
hostlist_jxta.c \
+ hostlist_ncp.c \
hostlist_tcpip.c \
hostlist_tr.c \
hostlist_udpip.c \
diff --git a/gtk/conversations_ncp.c b/gtk/conversations_ncp.c
index 456289ece3..46cb8b792a 100644
--- a/gtk/conversations_ncp.c
+++ b/gtk/conversations_ncp.c
@@ -49,8 +49,9 @@ ncp_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_,
guint32 connection;
connection = (ncph->conn_high * 256)+ncph->conn_low;
-
- add_conversation_table_data((conversations_table *)pct, &pinfo->src, &pinfo->dst, connection, connection, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NCP);
+ if (connection < 65535) {
+ add_conversation_table_data((conversations_table *)pct, &pinfo->src, &pinfo->dst, connection, connection, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NCP);
+ }
return 1;
}
@@ -66,7 +67,7 @@ ncp_conversation_init(const char *optarg, void* userdata _U_)
filter=NULL;
}
- init_conversation_table(TRUE, "NCP", "ncp_hdr", filter, ncp_conversation_packet);
+ init_conversation_table(FALSE, "NCP", "ncp_hdr", filter, ncp_conversation_packet);
}
@@ -85,5 +86,5 @@ register_tap_listener_ncp_conversation(void)
register_stat_menu_item("NCP", REGISTER_STAT_GROUP_CONVERSATION_LIST,
ncp_endpoints_cb, NULL, NULL, NULL);
- register_conversation_table(TRUE, "NCP", "ncp_hdr", NULL /*filter*/, ncp_conversation_packet);
+ register_conversation_table(FALSE, "NCP", "ncp_hdr", NULL /*filter*/, ncp_conversation_packet);
}
diff --git a/gtk/conversations_table.c b/gtk/conversations_table.c
index cd9afa7899..254ccfaab9 100644
--- a/gtk/conversations_table.c
+++ b/gtk/conversations_table.c
@@ -1209,6 +1209,10 @@ init_ct_table_page(conversations_table *conversations, GtkWidget *vbox, gboolean
conversations->default_titles[7]="Bytes A->B";
conversations->default_titles[8]="Packets A<-B";
conversations->default_titles[9]="Bytes A<-B";
+ if (strcmp(table_name, "NCP")==0) {
+ conversations->default_titles[1]="Connection A";
+ conversations->default_titles[3]="Connection B";
+ }
g_snprintf(title, 255, "%s Conversations", table_name);
label=gtk_label_new(title);
diff --git a/gtk/expert_comp_table.c b/gtk/expert_comp_table.c
index b4b9df8fce..1a1ccf25d6 100644
--- a/gtk/expert_comp_table.c
+++ b/gtk/expert_comp_table.c
@@ -573,9 +573,9 @@ init_error_table_row(error_equiv_table *err, const expert_info_t *expert_data)
}
err->procedures[err->num_procs].packet_num = (guint32)expert_data->packet_num; /* First packet num */
}
- err->procedures[err->num_procs].entries[0]=(char *)val_to_str(expert_data->group, expert_group_vals,"Unknown group (%u)"); /* Group */
- err->procedures[err->num_procs].entries[1]=(char *)expert_data->protocol; /* Protocol */
- err->procedures[err->num_procs].entries[2]=(char *)expert_data->summary; /* Summary */
+ err->procedures[err->num_procs].entries[0]=(char *)g_strdup_printf("%s", val_to_str(expert_data->group, expert_group_vals,"Unknown group (%u)"), NULL); /* Group */
+ err->procedures[err->num_procs].entries[1]=(char *)g_strdup_printf("%s", expert_data->protocol, NULL); /* Protocol */
+ err->procedures[err->num_procs].entries[2]=(char *)g_strdup_printf("%s", expert_data->summary, NULL); /* Summary */
err->procedures[err->num_procs].entries[3]=(char *)g_strdup_printf("%d", err->procedures[row].count); /* Count */
err->procedures[err->num_procs].fvalue_value = NULL;
if (expert_data->pitem && strcmp(expert_data->pitem->finfo->value.ftype->name,"FT_NONE")!=0) {
diff --git a/gtk/hostlist_ncp.c b/gtk/hostlist_ncp.c
new file mode 100644
index 0000000000..7757de2714
--- /dev/null
+++ b/gtk/hostlist_ncp.c
@@ -0,0 +1,91 @@
+/* hostlist_ncp.c 2006 Greg Morris
+ * modified from endpoint_talkers_eth.c 2003 Ronnie Sahlberg
+ *
+ * $Id: hostlist_ncp.c
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <string.h>
+#include "epan/packet.h"
+#include <epan/stat_cmd_args.h>
+#include "../stat_menu.h"
+#include "gui_stat_menu.h"
+#include <epan/tap.h>
+#include "../register.h"
+#include "hostlist_table.h"
+/*#include <epan/dissectors/packet-ncp-int.h>*/
+
+
+static int
+ncp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
+{
+ hostlist_table *hosts=(hostlist_table *)pit;
+ /*const ncp_common_header *ncphdr=vip;*/
+
+ /* Take two "add" passes per packet, adding for each direction, ensures that all
+ packets are counted properly (even if address is sending to itself)
+ XXX - this could probably be done more efficiently inside hostlist_table */
+ add_hostlist_table_data(hosts, &pinfo->src, 0, TRUE, 1, pinfo->fd->pkt_len, SAT_ETHER, PT_NCP);
+ add_hostlist_table_data(hosts, &pinfo->dst, 0, FALSE, 1, pinfo->fd->pkt_len, SAT_ETHER, PT_NCP);
+
+ return 1;
+}
+
+static void
+gtk_ncp_hostlist_init(const char *optarg, void* userdata _U_)
+{
+ const char *filter=NULL;
+
+ if(!strncmp(optarg,"hosts,ncp,",11)){
+ filter=optarg+11;
+ } else {
+ filter=NULL;
+ }
+
+ init_hostlist_table(TRUE, "NCP", "ncp_hdr", filter, ncp_hostlist_packet);
+
+}
+
+
+static void
+gtk_ncp_hostlist_cb(GtkWidget *w _U_, gpointer d _U_)
+{
+ gtk_ncp_hostlist_init("hosts,ncp",NULL);
+}
+
+
+void
+register_tap_listener_ncp_hostlist(void)
+{
+ register_stat_cmd_arg("hosts,ncp", gtk_ncp_hostlist_init,NULL);
+
+ register_stat_menu_item("NCP", REGISTER_STAT_GROUP_ENDPOINT_LIST,
+ gtk_ncp_hostlist_cb, NULL, NULL, NULL);
+
+ register_hostlist_table(TRUE, "NCP", "ncp_hdr", NULL /*filter*/, ncp_hostlist_packet);
+}