diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2005-10-19 14:45:24 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2005-10-19 14:45:24 +0000 |
commit | 05bdac4d3ab17081b17c442830399ca715e1b5d7 (patch) | |
tree | 7dd93bc3ddd6a293c9ae9e31ce915552c479d3e8 /gtk | |
parent | 804c13c2134222680d6456e87eb963ec73cdbc95 (diff) |
From Greg Morris.
Adds NCP data to conversations and SRT.
svn path=/trunk/; revision=16269
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/Makefile.common | 2 | ||||
-rw-r--r-- | gtk/conversations_ncp.c | 89 | ||||
-rw-r--r-- | gtk/ncp_stat.c | 676 |
3 files changed, 767 insertions, 0 deletions
diff --git a/gtk/Makefile.common b/gtk/Makefile.common index e1393bde76..cbb9975325 100644 --- a/gtk/Makefile.common +++ b/gtk/Makefile.common @@ -120,6 +120,7 @@ ETHEREAL_TAP_SRC = \ conversations_tr.c \ conversations_udpip.c \ conversations_wlan.c \ + conversations_ncp.c \ conversations_rsvp.c \ dcerpc_stat.c \ expert_dlg.c \ @@ -146,6 +147,7 @@ ETHEREAL_TAP_SRC = \ mgcp_stat.c \ mtp3_stat.c \ mtp3_summary.c \ + ncp_stat.c \ rpc_progs.c \ rpc_stat.c \ rtp_analysis.c \ diff --git a/gtk/conversations_ncp.c b/gtk/conversations_ncp.c new file mode 100644 index 0000000000..dc933a1af2 --- /dev/null +++ b/gtk/conversations_ncp.c @@ -0,0 +1,89 @@ +/* conversations_ncp.c 2005 Greg Morris + * modified from conversations_eth.c 2003 Ronnie Sahlberg + * + * $Id: conversations_wlan.c 15501 2005-08-21 19:24:11Z guy $ + * + * 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 "conversations_table.h" +#include <epan/dissectors/packet-ncp-int.h> + + +static int +ncp_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) +{ + const struct ncp_common_header *ncph=vip; + 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); + + return 1; +} + +static void +ncp_conversation_init(const char *optarg) +{ + const char *filter=NULL; + + if(!strncmp(optarg,"conv,ncp,",9)){ + filter=optarg+9; + } else { + filter=NULL; + } + + init_conversation_table(TRUE, "NCP", "ncp_hdr", filter, ncp_conversation_packet); +} + + +static void +ncp_endpoints_cb(GtkWidget *w _U_, gpointer d _U_) +{ + ncp_conversation_init("conv,ncp"); +} + + +void +register_tap_listener_ncp_conversation(void) +{ + register_stat_cmd_arg("conv,ncp", ncp_conversation_init); + + 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); +} diff --git a/gtk/ncp_stat.c b/gtk/ncp_stat.c new file mode 100644 index 0000000000..5e5fdfd3cb --- /dev/null +++ b/gtk/ncp_stat.c @@ -0,0 +1,676 @@ +/* ncp_stat.c + * ncp_stat 2005 Greg Morris + * + * $Id: ncp_stat.c 00000 2005-09-22 11:09:36Z xxx $ + * + * 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 <string.h> + +#include <gtk/gtk.h> + +#include <epan/packet_info.h> +#include <epan/epan.h> +#include <epan/value_string.h> + +#include <epan/tap.h> +#include <epan/dissectors/packet-ncp-int.h> +#include "../register.h" +#include "../timestats.h" +#include "compat_macros.h" +#include "../simple_dialog.h" +#include "gui_utils.h" +#include "dlg_utils.h" +#include "../file.h" +#include "../globals.h" +#include "filter_dlg.h" +#include "service_response_time_table.h" +#include "../stat_menu.h" +#include "../tap_dfilter_dlg.h" +#include "gtkglobals.h" + + +/* used to keep track of the statistics for an entire program interface */ +typedef struct _ncpstat_t { + GtkWidget *win; + srt_stat_table ncp_srt_table; + srt_stat_table nds_srt_table; + srt_stat_table func_srt_table; + srt_stat_table sss_srt_table; + srt_stat_table nmas_srt_table; + srt_stat_table sub_17_srt_table; + srt_stat_table sub_21_srt_table; + srt_stat_table sub_22_srt_table; + srt_stat_table sub_23_srt_table; + srt_stat_table sub_32_srt_table; + srt_stat_table sub_34_srt_table; + srt_stat_table sub_35_srt_table; + srt_stat_table sub_36_srt_table; + srt_stat_table sub_86_srt_table; + srt_stat_table sub_87_srt_table; + srt_stat_table sub_89_srt_table; + srt_stat_table sub_90_srt_table; + srt_stat_table sub_92_srt_table; + srt_stat_table sub_94_srt_table; + srt_stat_table sub_104_srt_table; + srt_stat_table sub_111_srt_table; + srt_stat_table sub_114_srt_table; + srt_stat_table sub_123_srt_table; + srt_stat_table sub_131_srt_table; +} ncpstat_t; + +static const value_string ncp_group_vals[] = { + { 0, "File" }, + { 1, "Queue Management System (QMS)" }, + { 2, "Connection" }, + { 3, "File Server" }, + { 4, "Message" }, + { 5, "Bindery" }, + { 6, "Novell Directory Services" }, + { 7, "Accounting" }, + { 8, "Server Statistics" }, + { 9, "Transaction Tracking" }, + { 10, "AFP" }, + { 11, "Auditing" }, + { 12, "Novell Modular Authentication Service" }, + { 13, "SecretStore Services" }, + { 14, "Communication" } +}; + +static const value_string sss_verb_enum[] = { + { 0x00000000, "Query Server" }, + { 0x00000001, "Read App Secrets" }, + { 0x00000002, "Write App Secrets" }, + { 0x00000003, "Add Secret ID" }, + { 0x00000004, "Remove Secret ID" }, + { 0x00000005, "Remove SecretStore" }, + { 0x00000006, "Enumerate Secret IDs" }, + { 0x00000007, "Unlock Store" }, + { 0x00000008, "Set Master Password" }, + { 0x00000009, "Get Service Information" }, + { 0x000000ff, "Fragment"}, +}; + +static const value_string nmas_subverb_enum[] = { + { 0, "Fragmented Ping" }, + { 2, "Client Put Data" }, + { 4, "Client Get Data" }, + { 6, "Client Get User NDS Credentials" }, + { 8, "Login Store Management" }, + { 10, "Writable Object Check" }, + { 1242, "Message Handler" }, +}; + +static const value_string ncp_nds_verb_vals[] = { + { 1, "Resolve Name" }, + { 2, "Read Entry Information" }, + { 3, "Read" }, + { 4, "Compare" }, + { 5, "List" }, + { 6, "Search Entries" }, + { 7, "Add Entry" }, + { 8, "Remove Entry" }, + { 9, "Modify Entry" }, + { 10, "Modify RDN" }, + { 11, "Create Attribute" }, + { 12, "Read Attribute Definition" }, + { 13, "Remove Attribute Definition" }, + { 14, "Define Class" }, + { 15, "Read Class Definition" }, + { 16, "Modify Class Definition" }, + { 17, "Remove Class Definition" }, + { 18, "List Containable Classes" }, + { 19, "Get Effective Rights" }, + { 20, "Add Partition" }, + { 21, "Remove Partition" }, + { 22, "List Partitions" }, + { 23, "Split Partition" }, + { 24, "Join Partitions" }, + { 25, "Add Replica" }, + { 26, "Remove Replica" }, + { 27, "Open Stream" }, + { 28, "Search Filter" }, + { 29, "Create Subordinate Reference" }, + { 30, "Link Replica" }, + { 31, "Change Replica Type" }, + { 32, "Start Update Schema" }, + { 33, "End Update Schema" }, + { 34, "Update Schema" }, + { 35, "Start Update Replica" }, + { 36, "End Update Replica" }, + { 37, "Update Replica" }, + { 38, "Synchronize Partition" }, + { 39, "Synchronize Schema" }, + { 40, "Read Syntaxes" }, + { 41, "Get Replica Root ID" }, + { 42, "Begin Move Entry" }, + { 43, "Finish Move Entry" }, + { 44, "Release Moved Entry" }, + { 45, "Backup Entry" }, + { 46, "Restore Entry" }, + { 47, "Save DIB" }, + { 48, "Control" }, + { 49, "Remove Backlink" }, + { 50, "Close Iteration" }, + { 51, "Unused" }, + { 52, "Audit Skulking" }, + { 53, "Get Server Address" }, + { 54, "Set Keys" }, + { 55, "Change Password" }, + { 56, "Verify Password" }, + { 57, "Begin Login" }, + { 58, "Finish Login" }, + { 59, "Begin Authentication" }, + { 60, "Finish Authentication" }, + { 61, "Logout" }, + { 62, "Repair Ring" }, + { 63, "Repair Timestamps" }, + { 64, "Create Back Link" }, + { 65, "Delete External Reference" }, + { 66, "Rename External Reference" }, + { 67, "Create Directory Entry" }, + { 68, "Remove Directory Entry" }, + { 69, "Designate New Master" }, + { 70, "Change Tree Name" }, + { 71, "Partition Entry Count" }, + { 72, "Check Login Restrictions" }, + { 73, "Start Join" }, + { 74, "Low Level Split" }, + { 75, "Low Level Join" }, + { 76, "Abort Low Level Join" }, + { 77, "Get All Servers" }, + { 110, "NDS Fragment" }, + { 240, "NDS Ping" }, + { 255, "EDirectory Call" }, + { 0, NULL } +}; + +static void +ncpstat_set_title(ncpstat_t *ss) +{ + char *title; + + title = g_strdup_printf("NCP Service Response Time statistics: %s", + cf_get_display_name(&cfile)); + gtk_window_set_title(GTK_WINDOW(ss->win), title); + g_free(title); +} + +static void +ncpstat_reset(void *pss) +{ + ncpstat_t *ss=(ncpstat_t *)pss; + + reset_srt_table_data(&ss->ncp_srt_table); + reset_srt_table_data(&ss->func_srt_table); + reset_srt_table_data(&ss->nds_srt_table); + reset_srt_table_data(&ss->sss_srt_table); + reset_srt_table_data(&ss->nmas_srt_table); + reset_srt_table_data(&ss->sub_17_srt_table); + reset_srt_table_data(&ss->sub_21_srt_table); + reset_srt_table_data(&ss->sub_22_srt_table); + reset_srt_table_data(&ss->sub_23_srt_table); + reset_srt_table_data(&ss->sub_32_srt_table); + reset_srt_table_data(&ss->sub_34_srt_table); + reset_srt_table_data(&ss->sub_35_srt_table); + reset_srt_table_data(&ss->sub_36_srt_table); + reset_srt_table_data(&ss->sub_86_srt_table); + reset_srt_table_data(&ss->sub_87_srt_table); + reset_srt_table_data(&ss->sub_89_srt_table); + reset_srt_table_data(&ss->sub_90_srt_table); + reset_srt_table_data(&ss->sub_92_srt_table); + reset_srt_table_data(&ss->sub_94_srt_table); + reset_srt_table_data(&ss->sub_104_srt_table); + reset_srt_table_data(&ss->sub_111_srt_table); + reset_srt_table_data(&ss->sub_114_srt_table); + reset_srt_table_data(&ss->sub_123_srt_table); + reset_srt_table_data(&ss->sub_131_srt_table); + ncpstat_set_title(ss); +} + +static int +ncpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv) +{ + ncpstat_t *ss=(ncpstat_t *)pss; + const ncp_req_hash_value *request_val=prv; + + /* if we havent seen the request, just ignore it */ + if(!request_val || request_val->ncp_rec==0){ + return 0; + } + /* By Group */ + init_srt_table_row(&ss->ncp_srt_table, request_val->ncp_rec->group, val_to_str(request_val->ncp_rec->group, ncp_group_vals, "Unknown(%u)")); + add_srt_table_data(&ss->ncp_srt_table, request_val->ncp_rec->group, &request_val->req_frame_time, pinfo); + /* By NCP number without subfunction*/ + if (request_val->ncp_rec->subfunc==0) { + init_srt_table_row(&ss->func_srt_table, request_val->ncp_rec->func, request_val->ncp_rec->name); + add_srt_table_data(&ss->func_srt_table, request_val->ncp_rec->func, &request_val->req_frame_time, pinfo); + } + /* By Subfunction number */ + if(request_val->ncp_rec->subfunc!=0){ + if (request_val->ncp_rec->func==17) { + init_srt_table_row(&ss->sub_17_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_17_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==21) { + init_srt_table_row(&ss->sub_21_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_21_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==22) { + init_srt_table_row(&ss->sub_22_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_22_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==23) { + init_srt_table_row(&ss->sub_23_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_23_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==32) { + init_srt_table_row(&ss->sub_32_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_32_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==34) { + init_srt_table_row(&ss->sub_34_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_34_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==35) { + init_srt_table_row(&ss->sub_35_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_35_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==36) { + init_srt_table_row(&ss->sub_36_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_36_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==86) { + init_srt_table_row(&ss->sub_86_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_86_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==87) { + init_srt_table_row(&ss->sub_87_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_87_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==89) { + init_srt_table_row(&ss->sub_89_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_89_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==90) { + init_srt_table_row(&ss->sub_90_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_90_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==92) { + init_srt_table_row(&ss->sub_92_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_92_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==94) { + init_srt_table_row(&ss->sub_94_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_94_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==104) { + init_srt_table_row(&ss->sub_104_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_104_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==111) { + init_srt_table_row(&ss->sub_111_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_111_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==114) { + init_srt_table_row(&ss->sub_114_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_114_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==123) { + init_srt_table_row(&ss->sub_123_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_123_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==131) { + init_srt_table_row(&ss->sub_131_srt_table, (request_val->ncp_rec->subfunc), request_val->ncp_rec->name); + add_srt_table_data(&ss->sub_131_srt_table, (request_val->ncp_rec->subfunc), &request_val->req_frame_time, pinfo); + } + } + /* By NDS verb */ + if (request_val->ncp_rec->func==0x68) { + init_srt_table_row(&ss->nds_srt_table, (request_val->nds_request_verb), val_to_str(request_val->nds_request_verb, ncp_nds_verb_vals, "Unknown(%u)")); + add_srt_table_data(&ss->nds_srt_table, (request_val->nds_request_verb), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==0x5c) { + init_srt_table_row(&ss->sss_srt_table, (request_val->req_nds_flags), val_to_str(request_val->req_nds_flags, sss_verb_enum, "Unknown(%u)")); + add_srt_table_data(&ss->sss_srt_table, (request_val->req_nds_flags), &request_val->req_frame_time, pinfo); + } + if (request_val->ncp_rec->func==0x5e) { + init_srt_table_row(&ss->nmas_srt_table, (request_val->req_nds_flags), val_to_str(request_val->req_nds_flags, nmas_subverb_enum, "Unknown(%u)")); + add_srt_table_data(&ss->nmas_srt_table, (request_val->req_nds_flags), &request_val->req_frame_time, pinfo); + } + return 1; +} + + + +static void +ncpstat_draw(void *pss) +{ + ncpstat_t *ss=(ncpstat_t *)pss; + + draw_srt_table_data(&ss->ncp_srt_table); + draw_srt_table_data(&ss->func_srt_table); + draw_srt_table_data(&ss->nds_srt_table); + draw_srt_table_data(&ss->sss_srt_table); + draw_srt_table_data(&ss->nmas_srt_table); + draw_srt_table_data(&ss->sub_17_srt_table); + draw_srt_table_data(&ss->sub_21_srt_table); + draw_srt_table_data(&ss->sub_22_srt_table); + draw_srt_table_data(&ss->sub_23_srt_table); + draw_srt_table_data(&ss->sub_32_srt_table); + draw_srt_table_data(&ss->sub_34_srt_table); + draw_srt_table_data(&ss->sub_35_srt_table); + draw_srt_table_data(&ss->sub_36_srt_table); + draw_srt_table_data(&ss->sub_86_srt_table); + draw_srt_table_data(&ss->sub_87_srt_table); + draw_srt_table_data(&ss->sub_89_srt_table); + draw_srt_table_data(&ss->sub_90_srt_table); + draw_srt_table_data(&ss->sub_92_srt_table); + draw_srt_table_data(&ss->sub_94_srt_table); + draw_srt_table_data(&ss->sub_104_srt_table); + draw_srt_table_data(&ss->sub_111_srt_table); + draw_srt_table_data(&ss->sub_114_srt_table); + draw_srt_table_data(&ss->sub_123_srt_table); + 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) +{ + ncpstat_t *ss=(ncpstat_t *)data; + + protect_thread_critical_region(); + remove_tap_listener(ss); + unprotect_thread_critical_region(); + + free_srt_table_data(&ss->ncp_srt_table); + free_srt_table_data(&ss->func_srt_table); + free_srt_table_data(&ss->nds_srt_table); + free_srt_table_data(&ss->sss_srt_table); + free_srt_table_data(&ss->nmas_srt_table); + free_srt_table_data(&ss->sub_17_srt_table); + free_srt_table_data(&ss->sub_21_srt_table); + free_srt_table_data(&ss->sub_22_srt_table); + free_srt_table_data(&ss->sub_23_srt_table); + free_srt_table_data(&ss->sub_32_srt_table); + free_srt_table_data(&ss->sub_34_srt_table); + free_srt_table_data(&ss->sub_35_srt_table); + free_srt_table_data(&ss->sub_36_srt_table); + free_srt_table_data(&ss->sub_86_srt_table); + free_srt_table_data(&ss->sub_87_srt_table); + free_srt_table_data(&ss->sub_89_srt_table); + free_srt_table_data(&ss->sub_90_srt_table); + free_srt_table_data(&ss->sub_92_srt_table); + free_srt_table_data(&ss->sub_94_srt_table); + free_srt_table_data(&ss->sub_104_srt_table); + free_srt_table_data(&ss->sub_111_srt_table); + free_srt_table_data(&ss->sub_114_srt_table); + free_srt_table_data(&ss->sub_123_srt_table); + free_srt_table_data(&ss->sub_131_srt_table); + g_free(ss); +} + + +static void +gtk_ncpstat_init(const char *optarg) +{ + ncpstat_t *ss; + const char *filter=NULL; + GtkWidget *label; + char filter_string[256]; + GString *error_string; + GtkWidget *temp_page; + GtkWidget *main_nb; + GtkWidget *vbox; + GtkWidget *bbox; + GtkWidget *close_bt; + + if(!strncmp(optarg,"ncp,srt,",8)){ + filter=optarg+8; + } else { + filter=NULL; + } + + ss=g_malloc(sizeof(ncpstat_t)); + + ss->win=window_new(GTK_WINDOW_TOPLEVEL, "ncp-stat"); + gtk_window_set_default_size(GTK_WINDOW(ss->win), 300, 400); + + ncpstat_set_title(ss); + + vbox=gtk_vbox_new(FALSE, 3); + gtk_container_add(GTK_CONTAINER(ss->win), vbox); + gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); + + label=gtk_label_new("NCP Service Response Time Statistics"); + gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); + + g_snprintf(filter_string,255,"Filter:%s",filter?filter:""); + label=gtk_label_new(filter_string); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); + + main_nb = gtk_notebook_new(); + gtk_box_pack_start(GTK_BOX(vbox), main_nb, TRUE, TRUE, 0); + temp_page = gtk_vbox_new(FALSE, 6); + label = gtk_label_new("Groups"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + + /* NCP Groups */ + /* We must display TOP LEVEL Widget before calling init_srt_table() */ + gtk_widget_show_all(ss->win); + 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"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("NCP Functions without Subfunctions"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->func_srt_table, 256, temp_page, "ncp.func"); + + /* NCP Subfunctions */ + + temp_page = gtk_vbox_new(FALSE, 6); + label = gtk_label_new("17"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 17"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_17_srt_table, 256, temp_page, "ncp.func==17 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("21"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 21"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_21_srt_table, 256, temp_page, "ncp.func==21 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("22"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 22"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_22_srt_table, 256, temp_page, "ncp.func==22 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("23"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 23"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_23_srt_table, 256, temp_page, "ncp.func==23 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("32"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 32"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_32_srt_table, 256, temp_page, "ncp.func==32 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("34"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 34"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_34_srt_table, 256, temp_page, "ncp.func==34 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("35"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 35"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_35_srt_table, 256, temp_page, "ncp.func==35 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("36"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 36"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_36_srt_table, 256, temp_page, "ncp.func==36 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("86"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 86"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_86_srt_table, 256, temp_page, "ncp.func==86 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("87"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 87"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_87_srt_table, 256, temp_page, "ncp.func==87 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("89"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 89 (Extended NCP's with UTF8 Support)"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_89_srt_table, 256, temp_page, "ncp.func==89 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("90"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 90"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_90_srt_table, 256, temp_page, "ncp.func==90 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("92"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 92 (Secret Store Services)"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_92_srt_table, 256, temp_page, "ncp.func==92 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("94"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 94 (Novell Modular Authentication Services)"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_94_srt_table, 256, temp_page, "ncp.func==94 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("104"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 104"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_104_srt_table, 256, temp_page, "ncp.func==104 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("111"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 111"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_111_srt_table, 256, temp_page, "ncp.func==111 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("114"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 114"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_114_srt_table, 256, temp_page, "ncp.func==114 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("123"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 123"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_123_srt_table, 256, temp_page, "ncp.func==123 && ncp.subfunc"); + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("131"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Subfunctions for NCP 131"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sub_131_srt_table, 256, temp_page, "ncp.func==131 && ncp.subfunc"); + + /* NDS Verbs */ + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("NDS"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("NDS Verbs"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->nds_srt_table, 256, temp_page, "ncp.ndsverb"); + /* Secret Store Verbs */ + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("SSS"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("Secret Store Verbs"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->sss_srt_table, 256, temp_page, "sss.subverb"); + /* NMAS Verbs */ + temp_page = gtk_vbox_new(FALSE, 6); + label=gtk_label_new("NMAS"); + gtk_notebook_append_page(GTK_NOTEBOOK(main_nb), temp_page, label); + label=gtk_label_new("NMAS Verbs"); + gtk_box_pack_start(GTK_BOX(temp_page), label, FALSE, FALSE, 0); + init_srt_table(&ss->nmas_srt_table, 256, temp_page, "nmas.subverb"); + + /* Register the tap listener */ + error_string=register_tap_listener("ncp_srt", ss, filter, ncpstat_reset, ncpstat_packet, ncpstat_draw); + if(error_string){ + simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, error_string->str); + g_string_free(error_string, TRUE); + g_free(ss); + return; + } + + /* 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); + window_set_cancel_button(ss->win, close_bt, window_cancel_button_cb); + + SIGNAL_CONNECT(ss->win, "delete_event", window_delete_event_cb, NULL); + SIGNAL_CONNECT(ss->win, "destroy", win_destroy_cb, ss); + + gtk_widget_show_all(ss->win); + window_present(ss->win); + + cf_redissect_packets(&cfile); +} + +static tap_dfilter_dlg ncp_stat_dlg = { + "NCP SRT Statistics", + "ncp,srt", + gtk_ncpstat_init, + -1 +}; + +void +register_tap_listener_gtkncpstat(void) +{ + register_dfilter_stat(&ncp_stat_dlg, "NCP", + REGISTER_STAT_GROUP_RESPONSE_TIME); +} |