summaryrefslogtreecommitdiff
path: root/ui/cli
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-06-16 17:07:04 -0400
committerMichael Mann <mmann78@netscape.net>2015-06-21 03:35:13 +0000
commit6de6f7f0f8f8b79c4fc7473c7e54dad433c7b61b (patch)
tree20b4b81b49467f5685f51c6b75e240c41ca6cb32 /ui/cli
parent2895d58dc38321a72c82e1bf77d165ef4acbc73a (diff)
downloadwireshark-6de6f7f0f8f8b79c4fc7473c7e54dad433c7b61b.tar.gz
Further refactor SRT stats.
Create "common" SRT tap data collection intended for all GUIs. Refactor/merge functionality of existing dissectors that have SRT support (AFP, DCERPC, Diameter, FC, GTP, LDAP, NCP, RPC, SCIS, SMB, and SMB2) for both TShark and GTK. SMB and DCERPC "tap packet filtering" were different between TShark and GTK, so I went with GTK filter logic. CAMEL "tap packet filtering" was different between TShark and GTK, so GTK filtering logic was pushed to the dissector and the TShark tap was left alone. Change-Id: I7d6eaad0673fe628ef337f9165d7ed94f4a5e1cc Reviewed-on: https://code.wireshark.org/review/8894 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Gerald Combs <gerald@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/cli')
-rw-r--r--ui/cli/Makefile.common12
-rw-r--r--ui/cli/cli_service_response_time_table.c166
-rw-r--r--ui/cli/cli_service_response_time_table.h99
-rw-r--r--ui/cli/tap-afpstat.c133
-rw-r--r--ui/cli/tap-dcerpcstat.c317
-rw-r--r--ui/cli/tap-ldapstat.c149
-rw-r--r--ui/cli/tap-ncpstat.c440
-rw-r--r--ui/cli/tap-rpcstat.c257
-rw-r--r--ui/cli/tap-scsistat.c185
-rw-r--r--ui/cli/tap-smb2stat.c144
-rw-r--r--ui/cli/tap-smbstat.c162
-rw-r--r--ui/cli/tap-srt.c196
-rw-r--r--ui/cli/tap-srt.h43
-rw-r--r--ui/cli/tshark-tap.h1
14 files changed, 242 insertions, 2062 deletions
diff --git a/ui/cli/Makefile.common b/ui/cli/Makefile.common
index 0d5ee86976..60d9fcbf40 100644
--- a/ui/cli/Makefile.common
+++ b/ui/cli/Makefile.common
@@ -38,14 +38,11 @@ GENERATOR_FILES =
# sources for TShark taps
TSHARK_TAP_SRC = \
- cli_service_response_time_table.c \
- tap-afpstat.c \
tap-ansi_astat.c \
tap-bootpstat.c \
tap-camelcounter.c \
tap-camelsrt.c \
tap-comparestat.c \
- tap-dcerpcstat.c \
tap-diameter-avp.c \
tap-endpoints.c \
tap-expert.c \
@@ -60,29 +57,24 @@ TSHARK_TAP_SRC = \
tap-icmpv6stat.c \
tap-iostat.c \
tap-iousers.c \
- tap-ldapstat.c \
tap-macltestat.c \
tap-megacostat.c \
tap-mgcpstat.c \
- tap-ncpstat.c \
tap-protocolinfo.c \
tap-protohierstat.c \
tap-radiusstat.c \
tap-rlcltestat.c \
tap-rpcprogs.c \
- tap-rpcstat.c \
tap-rtp.c \
tap-rtspstat.c \
- tap-scsistat.c \
tap-sctpchunkstat.c \
tap-sipstat.c \
tap-smbsids.c \
- tap-smb2stat.c \
- tap-smbstat.c \
+ tap-srt.c \
tap-stats_tree.c \
tap-sv.c \
tap-wspstat.c
noinst_HEADERS = \
tshark-tap.h \
- cli_service_response_time_table.h
+ tap-srt.h
diff --git a/ui/cli/cli_service_response_time_table.c b/ui/cli/cli_service_response_time_table.c
deleted file mode 100644
index d061069c88..0000000000
--- a/ui/cli/cli_service_response_time_table.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* cli_service_response_time_table.c
- * TShark service_response_time_table based on GTK version by Ronnie Sahlberg
- * Helper routines common to all service response time statistics
- * tap.
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#include "epan/packet_info.h"
-#include "epan/value_string.h"
-
-#include "ui/cli/cli_service_response_time_table.h"
-
-#define NANOSECS_PER_SEC 1000000000
-
-
-void
-init_srt_table(const char *name, srt_stat_table *rst, int num_procs, const char* proc_column_name, const char *filter_string)
-{
- int i;
-
- if(filter_string){
- rst->filter_string=g_strdup(filter_string);
- } else {
- rst->filter_string=NULL;
- }
-
- rst->name = name;
- rst->proc_column_name = proc_column_name;
- rst->num_procs=num_procs;
- rst->procedures=(srt_procedure_t *)g_malloc(sizeof(srt_procedure_t)*num_procs);
- for(i=0;i<num_procs;i++){
- time_stat_init(&rst->procedures[i].stats);
- rst->procedures[i].index = 0;
- rst->procedures[i].procedure = NULL;
- }
-}
-
-void
-init_srt_table_row(srt_stat_table *rst, int indx, const char *procedure)
-{
- /* we have discovered a new procedure. Extend the table accordingly */
- if(indx>=rst->num_procs){
- int old_num_procs=rst->num_procs;
- int i;
-
- rst->num_procs=indx+1;
- rst->procedures=(srt_procedure_t *)g_realloc(rst->procedures, sizeof(srt_procedure_t)*(rst->num_procs));
- for(i=old_num_procs;i<rst->num_procs;i++){
- time_stat_init(&rst->procedures[i].stats);
- rst->procedures[i].index = i;
- rst->procedures[i].procedure=NULL;
- }
- }
- rst->procedures[indx].index = indx;
- rst->procedures[indx].procedure=g_strdup(procedure);
-}
-
-void
-add_srt_table_data(srt_stat_table *rst, int indx, const nstime_t *req_time, packet_info *pinfo)
-{
- srt_procedure_t *rp;
- nstime_t t, delta;
-
- g_assert(indx >= 0 && indx < rst->num_procs);
- rp=&rst->procedures[indx];
-
- /* calculate time delta between request and reply */
- t=pinfo->fd->abs_ts;
- nstime_delta(&delta, &t, req_time);
-
- time_stat_update(&rp->stats, &delta, pinfo);
-}
-
-void
-draw_srt_table_data(srt_stat_table *rst, gboolean draw_header, gboolean draw_footer)
-{
- int i;
- guint64 td;
- guint64 sum;
-
- if (draw_header) {
- printf("\n");
- printf("===================================================================\n");
- printf("%s SRT Statistics:\n", rst->name);
- printf("Filter: %s\n", rst->filter_string ? rst->filter_string : "");
- }
-
- printf("Index %-22s Calls Min SRT Max SRT Avg SRT Sum SRT\n", (rst->proc_column_name != NULL) ? rst->proc_column_name : "Procedure");
- for(i=0;i<rst->num_procs;i++){
- /* ignore procedures with no calls (they don't have rows) */
- if(rst->procedures[i].stats.num==0){
- continue;
- }
- /* Scale the average SRT in units of 1us and round to the nearest us.
- tot.secs is a time_t which may be 32 or 64 bits (or even floating)
- depending uon the platform. After casting tot.secs to 64 bits, it
- would take a capture with a duration of over 136 *years* to
- overflow the secs portion of td. */
- td = ((guint64)(rst->procedures[i].stats.tot.secs))*NANOSECS_PER_SEC + rst->procedures[i].stats.tot.nsecs;
- sum = (td + 500) / 1000;
- td = ((td / rst->procedures[i].stats.num) + 500) / 1000;
-
- printf("%5u %-22s %6u %3d.%06d %3d.%06d %3d.%06d %3d.%06d\n",
- i, rst->procedures[i].procedure,
- rst->procedures[i].stats.num,
- (int)rst->procedures[i].stats.min.secs, (rst->procedures[i].stats.min.nsecs+500)/1000,
- (int)rst->procedures[i].stats.max.secs, (rst->procedures[i].stats.max.nsecs+500)/1000,
- (int)(td/1000000), (int)(td%1000000),
- (int)(sum/1000000), (int)(sum%1000000)
- );
- }
-
- if (draw_footer)
- printf("==================================================================\n");
-}
-
-void
-free_srt_table_data(srt_stat_table *rst)
-{
- int i;
-
- for(i=0;i<rst->num_procs;i++){
- g_free(rst->procedures[i].procedure);
- rst->procedures[i].procedure=NULL;
- }
- g_free(rst->filter_string);
- rst->filter_string=NULL;
- g_free(rst->procedures);
- rst->procedures=NULL;
- rst->num_procs=0;
-}
-
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/cli_service_response_time_table.h b/ui/cli/cli_service_response_time_table.h
deleted file mode 100644
index 4f6afe402f..0000000000
--- a/ui/cli/cli_service_response_time_table.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* cli_service_response_time_table.h
- * TShark service_response_time_table based on GTK version by Ronnie Sahlberg
- * Helper routines common to all service response time statistics
- * tap.
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef __CLI_SERVICE_RESPONSE_TIME_TABLE_H__
-#define __CLI_SERVICE_RESPONSE_TIME_TABLE_H__
-
-#include "wsutil/nstime.h"
-#include "epan/timestats.h"
-
-/** @file
- * Helper routines common to all service response time statistics tap.
- */
-
-/** Procedure data */
-typedef struct _srt_procedure_t {
- int index;
- timestat_t stats; /**< stats */
- char *procedure; /**< column entries */
-} srt_procedure_t;
-
-/** Statistics table */
-typedef struct _srt_stat_table {
- const char *name; /**< table name */
- char *filter_string; /**< append procedure number (%d) to this string
- to create a display filter */
- int num_procs; /**< number of elements on procedures array */
- const char *proc_column_name; /**< procedure column name (if different from default) */
- srt_procedure_t *procedures;/**< the procedures array */
-} srt_stat_table;
-
-/** Init an srt table data structure.
- *
- * @param name the table name
- * @param rst the srt table to init
- * @param num_procs number of procedures
- * @param proc_column_name procedure column name (if different from "Procedure")
- * @param filter_string filter string or NULL
- */
-void init_srt_table(const char *name, srt_stat_table *rst, int num_procs, const char* proc_column_name, const char *filter_string);
-
-/** Init an srt table row data structure.
- *
- * @param rst the srt table
- * @param index number of procedure
- * @param procedure the procedures name
- */
-void init_srt_table_row(srt_stat_table *rst, int index, const char *procedure);
-
-/** Add srt response to table row data. This will not draw the data!
- *
- * @param rst the srt table
- * @param index number of procedure
- * @param req_time the time of the corresponding request
- * @param pinfo current packet info
- */
-void add_srt_table_data(srt_stat_table *rst, int index, const nstime_t *req_time, packet_info *pinfo);
-
-/** Draw the srt table data.
- *
- * @param rst the srt table
- * @param draw_header draw the header
- * @param draw_footer draw the footer
- */
-void draw_srt_table_data(srt_stat_table *rst, gboolean draw_header, gboolean draw_footer);
-
-/** Reset the srt table data.
- *
- * @param rst the srt table
- */
-void reset_srt_table_data(srt_stat_table *rst);
-
-/** Free the srt table data.
- *
- * @param rst the srt table
- */
-void free_srt_table_data(srt_stat_table *rst);
-
-#endif /* __CLI_SERVICE_RESPONSE_TIME_TABLE_H__ */
diff --git a/ui/cli/tap-afpstat.c b/ui/cli/tap-afpstat.c
deleted file mode 100644
index afb8b12e47..0000000000
--- a/ui/cli/tap-afpstat.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* tap-afpstat.c
- * Based on
- * smbstat 2003 Ronnie Sahlberg
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <epan/packet_info.h>
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include <ui/cli/cli_service_response_time_table.h>
-#include <epan/value_string.h>
-#include <epan/dissectors/packet-afp.h>
-#include "epan/timestats.h"
-
-void register_tap_listener_afpstat(void);
-
-#define AFP_NUM_PROCEDURES 256
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _afpstat_t {
- srt_stat_table afp_srt_table;
-} afpstat_t;
-
-static int
-afpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *prv)
-{
- afpstat_t *ss = (afpstat_t *)pss;
- const afp_request_val *request_val = (const afp_request_val *)prv;
-
- /* if we havnt seen the request, just ignore it */
- if (!request_val) {
- return 0;
- }
-
- add_srt_table_data(&ss->afp_srt_table, request_val->command, &request_val->req_time, pinfo);
-
- return 1;
-}
-
-static void
-afpstat_draw(void *pss)
-{
- afpstat_t *ss = (afpstat_t *)pss;
-
- draw_srt_table_data(&ss->afp_srt_table, TRUE, TRUE);
-}
-
-
-static void
-afpstat_init(const char *opt_arg, void *userdata _U_)
-{
- afpstat_t *ss;
- guint32 i;
- const char *filter = NULL;
- GString *error_string;
-
- if (!strncmp(opt_arg, "afp,srt,", 8)) {
- filter = opt_arg+8;
- }
-
- ss = g_new(afpstat_t, 1);
-
- init_srt_table("AFP", &ss->afp_srt_table, AFP_NUM_PROCEDURES, NULL, filter ? g_strdup(filter) : NULL);
- for (i = 0; i < AFP_NUM_PROCEDURES; i++)
- {
- gchar* tmp_str = val_to_str_ext_wmem(NULL, i, &CommandCode_vals_ext, "Unknown(%u)");
- init_srt_table_row(&ss->afp_srt_table, i, tmp_str);
- wmem_free(NULL, tmp_str);
- }
-
- error_string = register_tap_listener("afp", ss, filter, 0, NULL, afpstat_packet, afpstat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&ss->afp_srt_table);
- g_free(ss);
-
- fprintf(stderr, "tshark: Couldn't register afp,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui afpstat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "afp,srt",
- afpstat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_afpstat(void)
-{
- register_stat_tap_ui(&afpstat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-dcerpcstat.c b/ui/cli/tap-dcerpcstat.c
deleted file mode 100644
index 0c1319d2b4..0000000000
--- a/ui/cli/tap-dcerpcstat.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/* tap-dcerpcstat.c
- * dcerpcstat 2002 Ronnie Sahlberg
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "epan/packet_info.h"
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include <epan/dissectors/packet-dcerpc.h>
-
-#define MICROSECS_PER_SEC 1000000
-#define NANOSECS_PER_SEC 1000000000
-
-void register_tap_listener_dcerpcstat(void);
-
-/* used to keep track of statistics for a specific procedure */
-typedef struct _rpc_procedure_t {
- const char *proc;
- int num;
- nstime_t min;
- nstime_t max;
- nstime_t tot;
-} rpc_procedure_t;
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _rpcstat_t {
- const char *prog;
- char *filter;
- e_guid_t uuid;
- guint16 ver;
- guint32 num_procedures;
- rpc_procedure_t *procedures;
-} rpcstat_t;
-
-
-
-static int
-dcerpcstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
-{
- const dcerpc_info *ri = (const dcerpc_info *)pri;
- rpcstat_t *rs = (rpcstat_t *)prs;
- nstime_t delta;
- rpc_procedure_t *rp;
-
- if (!ri->call_data) {
- return 0;
- }
- if (!ri->call_data->req_frame) {
- /* we have not seen the request so we don't know the delta*/
- return 0;
- }
- if (ri->call_data->opnum >= rs->num_procedures) {
- /* don't handle this since its outside of known table */
- return 0;
- }
-
- /* we are only interested in reply packets */
- if (ri->ptype != PDU_RESP) {
- return 0;
- }
-
- /* we are only interested in certain program/versions */
- if ( (ri->call_data->uuid.data1 != rs->uuid.data1)
- || (ri->call_data->uuid.data2 != rs->uuid.data2)
- || (ri->call_data->uuid.data3 != rs->uuid.data3)
- || (ri->call_data->uuid.data4[0] != rs->uuid.data4[0])
- || (ri->call_data->uuid.data4[1] != rs->uuid.data4[1])
- || (ri->call_data->uuid.data4[2] != rs->uuid.data4[2])
- || (ri->call_data->uuid.data4[3] != rs->uuid.data4[3])
- || (ri->call_data->uuid.data4[4] != rs->uuid.data4[4])
- || (ri->call_data->uuid.data4[5] != rs->uuid.data4[5])
- || (ri->call_data->uuid.data4[6] != rs->uuid.data4[6])
- || (ri->call_data->uuid.data4[7] != rs->uuid.data4[7])
- || (ri->call_data->ver != rs->ver)) {
- return 0;
- }
-
- rp = &(rs->procedures[ri->call_data->opnum]);
-
- /* calculate time delta between request and reply */
- nstime_delta(&delta, &pinfo->fd->abs_ts, &ri->call_data->req_time);
-
- if (rp->num == 0) {
- rp->max.secs = delta.secs;
- rp->max.nsecs = delta.nsecs;
- }
-
- if (rp->num == 0) {
- rp->min.secs = delta.secs;
- rp->min.nsecs = delta.nsecs;
- }
-
- if ( (delta.secs < rp->min.secs)
- || ( (delta.secs == rp->min.secs)
- && (delta.nsecs < rp->min.nsecs) ) ) {
- rp->min.secs = delta.secs;
- rp->min.nsecs = delta.nsecs;
- }
-
- if ( (delta.secs > rp->max.secs)
- || ( (delta.secs == rp->max.secs)
- && (delta.nsecs > rp->max.nsecs) ) ) {
- rp->max.secs = delta.secs;
- rp->max.nsecs = delta.nsecs;
- }
-
- rp->tot.secs += delta.secs;
- rp->tot.nsecs += delta.nsecs;
- if (rp->tot.nsecs > NANOSECS_PER_SEC) {
- rp->tot.nsecs -= NANOSECS_PER_SEC;
- rp->tot.secs++;
- }
-
- rp->num++;
-
- return 1;
-}
-
-static void
-dcerpcstat_draw(void *prs)
-{
- rpcstat_t *rs = (rpcstat_t *)prs;
- guint32 i;
- guint64 td;
- printf("\n");
- printf("=======================================================================\n");
- printf("%s Major Version %u SRT Statistics:\n", rs->prog, rs->ver);
- printf("Filter: %s\n",rs->filter ? rs->filter : "");
- printf("Procedure Calls Min SRT Max SRT Avg SRT\n");
-
- for (i=0; i<rs->num_procedures; i++) {
- /* Only display procs with non-zero calls */
- if (rs->procedures[i].num == 0) {
- continue;
- }
- /* Scale the average SRT in units of 1us and round to the nearest us. */
- td = ((guint64)(rs->procedures[i].tot.secs)) * NANOSECS_PER_SEC + rs->procedures[i].tot.nsecs;
- td = ((td / rs->procedures[i].num) + 500) / 1000;
-
- printf("%-31s %6d %3d.%06d %3d.%06d %3" G_GINT64_MODIFIER "u.%06" G_GINT64_MODIFIER "u\n",
- rs->procedures[i].proc,
- rs->procedures[i].num,
- (int)(rs->procedures[i].min.secs), (rs->procedures[i].min.nsecs+500)/1000,
- (int)(rs->procedures[i].max.secs), (rs->procedures[i].max.nsecs+500)/1000,
- td/MICROSECS_PER_SEC, td%MICROSECS_PER_SEC
- );
- }
- printf("=======================================================================\n");
-}
-
-
-
-static void
-dcerpcstat_init(const char *opt_arg, void *userdata _U_)
-{
- rpcstat_t *rs;
- guint32 i, max_procs;
- dcerpc_sub_dissector *procs;
- e_guid_t uuid;
- guint d1, d2, d3, d40, d41, d42, d43, d44, d45, d46, d47;
- int major, minor;
- guint16 ver;
- int pos = 0;
- const char *filter = NULL;
- GString *error_string;
-
- /*
- * XXX - DCE RPC statistics are maintained only by major version,
- * not by major and minor version, so the minor version number is
- * ignored.
- *
- * Should we just stop supporting minor version numbers here?
- * Or should we allow it to be omitted? Or should we keep
- * separate statistics for different minor version numbers,
- * and allow the minor version number to be omitted, and
- * report aggregate statistics for all minor version numbers
- * if it's omitted?
- */
- if (sscanf(opt_arg,
- "dcerpc,srt,%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x,%d.%d%n",
- &d1, &d2, &d3, &d40, &d41, &d42, &d43, &d44, &d45, &d46, &d47,
- &major, &minor, &pos) == 13) {
- uuid.data1 = d1;
- uuid.data2 = d2;
- uuid.data3 = d3;
- uuid.data4[0] = d40;
- uuid.data4[1] = d41;
- uuid.data4[2] = d42;
- uuid.data4[3] = d43;
- uuid.data4[4] = d44;
- uuid.data4[5] = d45;
- uuid.data4[6] = d46;
- uuid.data4[7] = d47;
- if (pos) {
- filter = opt_arg+pos;
- } else {
- filter = NULL;
- }
- } else {
- fprintf(stderr, "tshark: invalid \"-z dcerpc,srt,<uuid>,<major version>.<minor version>[,<filter>]\" argument\n");
- exit(1);
- }
- if (major < 0 || major > 65535) {
- fprintf(stderr, "tshark: dcerpcstat_init() Major version number %d is invalid - must be positive and <= 65535\n", major);
- exit(1);
- }
- if (minor < 0 || minor > 65535) {
- fprintf(stderr, "tshark: dcerpcstat_init() Minor version number %d is invalid - must be positive and <= 65535\n", minor);
- exit(1);
- }
- ver = major;
-
- rs = g_new(rpcstat_t, 1);
- rs->prog = dcerpc_get_proto_name(&uuid, ver);
- if (!rs->prog) {
- g_free(rs);
- fprintf(stderr, "tshark: dcerpcstat_init() Protocol with uuid:%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x v%u not supported\n", uuid.data1, uuid.data2, uuid.data3, uuid.data4[0], uuid.data4[1], uuid.data4[2], uuid.data4[3], uuid.data4[4], uuid.data4[5], uuid.data4[6], uuid.data4[7], ver);
- exit(1);
- }
- procs = dcerpc_get_proto_sub_dissector(&uuid, ver);
- rs->uuid = uuid;
- rs->ver = ver;
-
- if (filter) {
- rs->filter = g_strdup(filter);
- } else {
- rs->filter = NULL;
- }
-
- for (i=0,max_procs=0; procs[i].name; i++) {
- if (procs[i].num > max_procs) {
- max_procs = procs[i].num;
- }
- }
- rs->num_procedures = max_procs+1;
- rs->procedures = (rpc_procedure_t *)g_malloc(sizeof(rpc_procedure_t)*(rs->num_procedures+1));
- for (i=0; i<rs->num_procedures; i++) {
- int j;
- rs->procedures[i].proc = "unknown";
- for (j=0; procs[j].name; j++) {
- if (procs[j].num == i) {
- rs->procedures[i].proc = procs[j].name;
- }
- }
- rs->procedures[i].num = 0;
- rs->procedures[i].min.secs = 0;
- rs->procedures[i].min.nsecs = 0;
- rs->procedures[i].max.secs = 0;
- rs->procedures[i].max.nsecs = 0;
- rs->procedures[i].tot.secs = 0;
- rs->procedures[i].tot.nsecs = 0;
- }
-
- error_string = register_tap_listener("dcerpc", rs, filter, 0, NULL, dcerpcstat_packet, dcerpcstat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- g_free(rs->procedures);
- g_free(rs->filter);
- g_free(rs);
-
- fprintf(stderr, "tshark: Couldn't register dcerpc,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui dcerpcstat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "dcerpc,srt",
- dcerpcstat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_dcerpcstat(void)
-{
- register_stat_tap_ui(&dcerpcstat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-ldapstat.c b/ui/cli/tap-ldapstat.c
deleted file mode 100644
index e0021059fc..0000000000
--- a/ui/cli/tap-ldapstat.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* tap-ldapstat.c
- *
- * Based on afpstat
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <epan/packet_info.h>
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include <ui/cli/cli_service_response_time_table.h>
-#include <epan/value_string.h>
-#include <epan/dissectors/packet-ldap.h>
-#include "epan/timestats.h"
-
-void register_tap_listener_ldapstat(void);
-
-#define LDAP_NUM_PROCEDURES 24
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _ldapstat_t {
- srt_stat_table ldap_srt_table;
-} ldapstat_t;
-
-static int
-ldapstat_packet(void *pldap, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
-{
- const ldap_call_response_t *ldap=(const ldap_call_response_t *)psi;
- ldapstat_t *fs=(ldapstat_t *)pldap;
-
- /* we are only interested in reply packets */
- if(ldap->is_request){
- return 0;
- }
- /* if we havnt seen the request, just ignore it */
- if(!ldap->req_frame){
- return 0;
- }
-
- /* only use the commands we know how to handle */
- switch(ldap->protocolOpTag){
- case LDAP_REQ_BIND:
- case LDAP_REQ_SEARCH:
- case LDAP_REQ_MODIFY:
- case LDAP_REQ_ADD:
- case LDAP_REQ_DELETE:
- case LDAP_REQ_MODRDN:
- case LDAP_REQ_COMPARE:
- case LDAP_REQ_EXTENDED:
- break;
- default:
- return 0;
- }
-
- add_srt_table_data(&fs->ldap_srt_table, ldap->protocolOpTag, &ldap->req_time, pinfo);
- return 1;
-}
-
-static void
-ldapstat_draw(void *pss)
-{
- ldapstat_t *ss = (ldapstat_t *)pss;
-
- draw_srt_table_data(&ss->ldap_srt_table, TRUE, TRUE);
-}
-
-
-static void
-ldapstat_init(const char *opt_arg, void *userdata _U_)
-{
- ldapstat_t *ldap;
- const char *filter = NULL;
- GString *error_string;
- int i;
-
- if (!strncmp(opt_arg, "ldap,srt,", 9)) {
- filter = opt_arg+8;
- }
-
- ldap = g_new(ldapstat_t,1);
-
- init_srt_table("LDAP", &ldap->ldap_srt_table, LDAP_NUM_PROCEDURES, NULL, filter ? g_strdup(filter) : NULL);
- for (i = 0; i < LDAP_NUM_PROCEDURES; i++)
- {
- init_srt_table_row(&ldap->ldap_srt_table, i, val_to_str_const(i, ldap_procedure_names, "<unknown>"));
- }
-
- error_string = register_tap_listener("ldap", ldap, filter, 0, NULL, ldapstat_packet, ldapstat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&ldap->ldap_srt_table);
- g_free(ldap);
-
- fprintf(stderr, "tshark: Couldn't register ldap,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui ldapstat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "ldap,srt",
- ldapstat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_ldapstat(void)
-{
- register_stat_tap_ui(&ldapstat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-ncpstat.c b/ui/cli/tap-ncpstat.c
deleted file mode 100644
index 7455d3fadf..0000000000
--- a/ui/cli/tap-ncpstat.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* tap-ncpstat.c
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "epan/packet_info.h"
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include "epan/value_string.h"
-#include <ui/cli/cli_service_response_time_table.h>
-#include <epan/dissectors/packet-ncp-int.h>
-#include "epan/timestats.h"
-
-void register_tap_listener_ncpstat(void);
-
-#define NCP_NUM_PROCEDURES 0
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _ncpstat_t {
- 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 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=(const ncp_req_hash_value *)prv;
- gchar* tmp_str;
-
- /* if we haven't seen the request, just ignore it */
- if(!request_val || request_val->ncp_rec==0){
- return 0;
- }
- /* By Group */
- tmp_str = val_to_str_wmem(NULL, request_val->ncp_rec->group, ncp_group_vals, "Unknown(%u)");
- init_srt_table_row(&ss->ncp_srt_table, request_val->ncp_rec->group, tmp_str);
- wmem_free(NULL, tmp_str);
- 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) {
- tmp_str = val_to_str_wmem(NULL, request_val->nds_request_verb, ncp_nds_verb_vals, "Unknown(%u)");
- init_srt_table_row(&ss->nds_srt_table, (request_val->nds_request_verb), tmp_str);
- wmem_free(NULL, tmp_str);
- 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) {
- tmp_str = val_to_str_wmem(NULL, request_val->req_nds_flags, sss_verb_enum, "Unknown(%u)");
- init_srt_table_row(&ss->sss_srt_table, (request_val->req_nds_flags), tmp_str);
- wmem_free(NULL, tmp_str);
- 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) {
- tmp_str = val_to_str_wmem(NULL, request_val->req_nds_flags, nmas_subverb_enum, "Unknown(%u)");
- init_srt_table_row(&ss->nmas_srt_table, (request_val->req_nds_flags), tmp_str);
- wmem_free(NULL, tmp_str);
- 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_header(srt_stat_table *rst)
-{
- printf("%s SRT Statistics:\n", rst->name);
- printf("Filter: %s\n", rst->filter_string ? rst->filter_string : "");
-}
-
-static void
-ncpstat_draw(void *pss)
-{
- ncpstat_t *ss = (ncpstat_t *)pss;
-
- printf("\n");
- printf("===================================================================\n");
-
- /* Tables were intentionally initialized to 0 rows, so only output tables with rows > 0 */
- if (ss->ncp_srt_table.num_procs > 0) {
- ncpstat_draw_header(&ss->ncp_srt_table);
- draw_srt_table_data(&ss->ncp_srt_table, FALSE, FALSE);
- }
- if (ss->func_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->func_srt_table);
- draw_srt_table_data(&ss->func_srt_table, FALSE, FALSE);
- }
- if (ss->nds_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->nds_srt_table);
- draw_srt_table_data(&ss->nds_srt_table, FALSE, FALSE);
- }
- if (ss->sss_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sss_srt_table);
- draw_srt_table_data(&ss->sss_srt_table, FALSE, FALSE);
- }
- if (ss->nmas_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->nmas_srt_table);
- draw_srt_table_data(&ss->nmas_srt_table, FALSE, FALSE);
- }
- if (ss->sub_17_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_17_srt_table);
- draw_srt_table_data(&ss->sub_17_srt_table, FALSE, FALSE);
- }
- if (ss->sub_21_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_21_srt_table);
- draw_srt_table_data(&ss->sub_21_srt_table, FALSE, FALSE);
- }
- if (ss->sub_22_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_22_srt_table);
- draw_srt_table_data(&ss->sub_22_srt_table, FALSE, FALSE);
- }
- if (ss->sub_23_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_23_srt_table);
- draw_srt_table_data(&ss->sub_23_srt_table, FALSE, FALSE);
- }
- if (ss->sub_32_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_32_srt_table);
- draw_srt_table_data(&ss->sub_32_srt_table, FALSE, FALSE);
- }
- if (ss->sub_34_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_34_srt_table);
- draw_srt_table_data(&ss->sub_34_srt_table, FALSE, FALSE);
- }
- if (ss->sub_35_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_35_srt_table);
- draw_srt_table_data(&ss->sub_35_srt_table, FALSE, FALSE);
- }
- if (ss->sub_36_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_36_srt_table);
- draw_srt_table_data(&ss->sub_36_srt_table, FALSE, FALSE);
- }
- if (ss->sub_86_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_86_srt_table);
- draw_srt_table_data(&ss->sub_86_srt_table, FALSE, FALSE);
- }
- if (ss->sub_87_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_87_srt_table);
- draw_srt_table_data(&ss->sub_87_srt_table, FALSE, FALSE);
- }
- if (ss->sub_89_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_89_srt_table);
- draw_srt_table_data(&ss->sub_89_srt_table, FALSE, FALSE);
- }
- if (ss->sub_90_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_90_srt_table);
- draw_srt_table_data(&ss->sub_90_srt_table, FALSE, FALSE);
- }
- if (ss->sub_92_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_92_srt_table);
- draw_srt_table_data(&ss->sub_92_srt_table, FALSE, FALSE);
- }
- if (ss->sub_94_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_94_srt_table);
- draw_srt_table_data(&ss->sub_94_srt_table, FALSE, FALSE);
- }
- if (ss->sub_104_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_104_srt_table);
- draw_srt_table_data(&ss->sub_104_srt_table, FALSE, FALSE);
- }
- if (ss->sub_111_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_111_srt_table);
- draw_srt_table_data(&ss->sub_111_srt_table, FALSE, FALSE);
- }
- if (ss->sub_114_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_114_srt_table);
- draw_srt_table_data(&ss->sub_114_srt_table, FALSE, FALSE);
- }
- if (ss->sub_123_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_123_srt_table);
- draw_srt_table_data(&ss->sub_123_srt_table, FALSE, FALSE);
- }
- if (ss->sub_131_srt_table.num_procs > 0) {
- printf("\n");
- ncpstat_draw_header(&ss->sub_131_srt_table);
- draw_srt_table_data(&ss->sub_131_srt_table, FALSE, FALSE);
- }
-
- printf("===================================================================\n");
-}
-
-
-static void
-ncpstat_init(const char *opt_arg, void *userdata _U_)
-{
- ncpstat_t *ss;
- const char *filter = NULL;
- GString *error_string;
-
- if (!strncmp(opt_arg, "ncp,srt,", 8)) {
- filter = opt_arg + 8;
- }
-
- ss = g_new(ncpstat_t, 1);
-
- /* Initialize all of the SRT tables with 0 rows. That way we can "filter" the drawing
- function to only output tables with rows > 0 */
- init_srt_table("NCP", &ss->ncp_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.group");
-
- /* NCP Functions */
- init_srt_table("NCP Functions without Subfunctions", &ss->func_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func");
-
- /* NCP Subfunctions */
- init_srt_table("Subfunctions for NCP 17", &ss->sub_17_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==17 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 21", &ss->sub_21_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==21 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 22", &ss->sub_22_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==22 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 23", &ss->sub_23_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==23 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 32", &ss->sub_32_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==32 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 34", &ss->sub_34_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==34 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 35", &ss->sub_35_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==35 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 36", &ss->sub_36_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==36 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 86", &ss->sub_86_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==86 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 87", &ss->sub_87_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==87 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 89 (Extended NCP's with UTF8 Support)", &ss->sub_89_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==89 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 90", &ss->sub_90_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==90 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 92 (Secret Store Services)", &ss->sub_92_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==92 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 94 (Novell Modular Authentication Services)", &ss->sub_94_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==94 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 104", &ss->sub_104_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==104 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 111", &ss->sub_111_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==111 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 114", &ss->sub_114_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==114 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 123", &ss->sub_123_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==123 && ncp.subfunc");
- init_srt_table("Subfunctions for NCP 131", &ss->sub_131_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.func==131 && ncp.subfunc");
-
- /* NDS Verbs */
- init_srt_table("NDS Verbs", &ss->nds_srt_table, NCP_NUM_PROCEDURES, NULL, "ncp.ndsverb");
- /* Secret Store Verbs */
- init_srt_table("Secret Store Verbs", &ss->sss_srt_table, NCP_NUM_PROCEDURES, NULL, "sss.subverb");
- /* NMAS Verbs */
- init_srt_table("NMAS Verbs", &ss->nmas_srt_table, NCP_NUM_PROCEDURES, NULL, "nmas.subverb");
-
- error_string = register_tap_listener("ncp_srt", ss, filter, 0, NULL, ncpstat_packet, ncpstat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&ss->ncp_srt_table);
- free_srt_table_data(&ss->nds_srt_table);
- free_srt_table_data(&ss->func_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);
-
- fprintf(stderr, "tshark: Couldn't register ncp,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui ncpstat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "ncp,srt",
- ncpstat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_ncpstat(void)
-{
- register_stat_tap_ui(&ncpstat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=4 tabstop=4 noexpandtab:
- * :indentSize=4:tabSize=4:noTabs=false:
- */
diff --git a/ui/cli/tap-rpcstat.c b/ui/cli/tap-rpcstat.c
deleted file mode 100644
index 61dbaadb4f..0000000000
--- a/ui/cli/tap-rpcstat.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* tap-rpcstat.c
- * rpcstat 2002 Ronnie Sahlberg
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-/* This module provides rpc call/reply SRT statistics to tshark.
- * It is only used by tshark and not wireshark.
- *
- * It serves as an example on how to use the tap api.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "epan/packet_info.h"
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include <epan/dissectors/packet-rpc.h>
-#include <ui/cli/cli_service_response_time_table.h>
-
-
-void register_tap_listener_rpcstat(void);
-
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _rpcstat_t {
- const char *prog;
- guint32 program;
- guint32 version;
- srt_stat_table rpc_srt_table;
-} rpcstat_t;
-
-
-
-
-/* This callback is invoked whenever the tap system has seen a packet we might
- * be interested in. The function is to be used to only update internal state
- * information in the *tapdata structure, and if there were state changes which
- * requires the window to be redrawn, return 1 and (*draw) will be called
- * sometime later.
- *
- * This function should be as lightweight as possible since it executes
- * together with the normal wireshark dissectors. Try to push as much
- * processing as possible into (*draw) instead since that function executes
- * asynchronously and does not affect the main thread's performance.
- *
- * If it is possible, try to do all "filtering" explicitly as we do below in
- * this example since you will get MUCH better performance than applying
- * a similar display-filter in the register call.
- *
- * The third parameter is tap dependent. Since we register this one to the
- * "rpc" tap, the third parameter type is rpc_call_info_value.
- *
- * The filtering we do is just to check the rpc_call_info_value struct that we
- * were called for the proper program and version. We didn't apply a filter
- * when we registered so we will be called for ALL rpc packets and not just
- * the ones we are collecting stats for.
- *
- * function returns :
- * 0: no updates, no need to call (*draw) later
- * !0: state has changed, call (*draw) sometime later
- */
-static int
-rpcstat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
-{
- rpcstat_t *rs = (rpcstat_t *)prs;
- const rpc_call_info_value *ri = (const rpc_call_info_value *)pri;
-
- if ((int)ri->proc >= rs->rpc_srt_table.num_procs) {
- /* don't handle this since its outside of known table */
- return 0;
- }
- /* we are only interested in reply packets */
- if (ri->request) {
- return 0;
- }
- /* we are only interested in certain program/versions */
- if ( (ri->prog != rs->program) || (ri->vers != rs->version) ) {
- return 0;
- }
-
- add_srt_table_data(&rs->rpc_srt_table, ri->proc, &ri->req_time, pinfo);
- return 1;
-}
-
-/* This callback is used when tshark wants us to draw/update our data to the
- * output device. Since this is tshark, the only output is stdout.
- * TShark will only call this callback once, which is when tshark has finished
- * reading all packets and exits.
- * If used with wireshark this may be called any time, perhaps once every 3
- * seconds or so.
- * This function may even be called in parallel with (*reset) or (*draw), so
- * make sure there are no races. The data in the rpcstat_t can thus change
- * beneath us. Beware!
- */
-static void
-rpcstat_draw(void *prs)
-{
- rpcstat_t *rs = (rpcstat_t *)prs;
-
- draw_srt_table_data(&rs->rpc_srt_table, TRUE, TRUE);
-}
-
-static guint32 rpc_program = 0;
-static guint32 rpc_version = 0;
-static gint32 rpc_min_proc = -1;
-static gint32 rpc_max_proc = -1;
-
-static void *
-rpcstat_find_procs(gpointer *key, gpointer *value _U_, gpointer *user_data _U_)
-{
- rpc_proc_info_key *k = (rpc_proc_info_key *)key;
-
- if (k->prog != rpc_program) {
- return NULL;
- }
- if (k->vers != rpc_version) {
- return NULL;
- }
- if (rpc_min_proc == -1) {
- rpc_min_proc = k->proc;
- rpc_max_proc = k->proc;
- }
- if ((gint32)k->proc < rpc_min_proc) {
- rpc_min_proc = k->proc;
- }
- if ((gint32)k->proc > rpc_max_proc) {
- rpc_max_proc = k->proc;
- }
-
- return NULL;
-}
-
-
-/* When called, this function will create a new instance of rpcstat.
- *
- * program and version are which onc-rpc program/version we want to collect
- * statistics for.
- *
- * This function is called from tshark when it parses the -z rpc, arguments and
- * it creates a new instance to store statistics in and registers this new
- * instance for the rpc tap.
- */
-static void
-rpcstat_init(const char *opt_arg, void *userdata _U_)
-{
- rpcstat_t *rs;
- int i;
- int program, version;
- int pos = 0;
- const char *filter = NULL;
- GString *error_string;
- static char table_name[100];
-
- if (sscanf(opt_arg, "rpc,srt,%d,%d,%n", &program, &version, &pos) == 2) {
- if (pos) {
- filter = opt_arg+pos;
- }
- } else {
- fprintf(stderr, "tshark: invalid \"-z rpc,srt,<program>,<version>[,<filter>]\" argument\n");
- exit(1);
- }
-
- rs = g_new(rpcstat_t, 1);
- rs->prog = rpc_prog_name(program);
- rs->program = program;
- rs->version = version;
-
- rpc_program = program;
- rpc_version = version;
- rpc_min_proc = -1;
- rpc_max_proc = -1;
- g_hash_table_foreach(rpc_procs, (GHFunc)rpcstat_find_procs, NULL);
- if (rpc_min_proc == -1) {
- fprintf(stderr, "tshark: Invalid -z rpc,srt,%u,%u\n", rpc_program, rpc_version);
- fprintf(stderr, " Program:%u version:%u isn't supported by tshark.\n", rpc_program, rpc_version);
- exit(1);
- }
-
- g_snprintf(table_name, sizeof(table_name), "%s Version %u", rs->prog, rs->version);
- init_srt_table(table_name, &rs->rpc_srt_table, rpc_max_proc+1, NULL, filter ? g_strdup(filter) : NULL);
- for (i = 0; i < rs->rpc_srt_table.num_procs; i++)
- {
- init_srt_table_row(&rs->rpc_srt_table, i, rpc_proc_name(program, version, i));
- }
-
-/* It is possible to create a filter and attach it to the callbacks. Then the
- * callbacks would only be invoked if the filter matched.
- *
- * Evaluating filters is expensive and if we can avoid it and not use them,
- * then we gain performance.
- *
- * In this case, we do the filtering for protocol and version inside the
- * callback itself but use whatever filter the user provided.
- * (Perhaps the user only wants the stats for nis+ traffic for certain objects?)
- */
-
- error_string = register_tap_listener("rpc", rs, filter, 0, NULL, rpcstat_packet, rpcstat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&rs->rpc_srt_table);
- g_free(rs);
-
- fprintf(stderr, "tshark: Couldn't register rpc,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui rpcstat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "rpc,srt",
- rpcstat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_rpcstat(void)
-{
- register_stat_tap_ui(&rpcstat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-scsistat.c b/ui/cli/tap-scsistat.c
deleted file mode 100644
index 4465919793..0000000000
--- a/ui/cli/tap-scsistat.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/* tap-scsistat.c 2010 Chris Costa and Cal Turney
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-
-#include <string.h>
-#include <epan/packet_info.h>
-#include <epan/stat_tap_ui.h>
-#include <ui/cli/cli_service_response_time_table.h>
-#include <epan/tap.h>
-#include <epan/conversation.h>
-#include <epan/dissectors/packet-scsi.h>
-#include <epan/dissectors/packet-scsi-sbc.h>
-#include <epan/dissectors/packet-scsi-ssc.h>
-#include <epan/dissectors/packet-scsi-smc.h>
-#include <epan/dissectors/packet-scsi-osd.h>
-#include <epan/dissectors/packet-scsi-mmc.h>
-
-void register_tap_listener_scsistat(void);
-
-#define SCSI_NUM_PROCEDURES 256
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _scsistat_t {
- guint8 cmdset;
- const char *prog;
- srt_stat_table scsi_srt_table;
-} scsistat_t;
-
-static int
-scsistat_packet(void *prs, packet_info *pinfo, epan_dissect_t *edt _U_, const void *pri)
-{
- scsistat_t *rs = (scsistat_t *)prs;
- const scsi_task_data_t *ri = (const scsi_task_data_t *)pri;
-
- /* we are only interested in response packets */
- if (ri->type != SCSI_PDU_TYPE_RSP) {
- return 0;
- }
- /* we are only interested in a specific commandset */
- if ( (!ri->itl) || ((ri->itl->cmdset&SCSI_CMDSET_MASK) != rs->cmdset) ) {
- return 0;
- }
- /* check that the opcode looks sane */
- if ( (!ri->itlq) || (ri->itlq->scsi_opcode > 255) ) {
- return 0;
- }
-
- add_srt_table_data(&rs->scsi_srt_table, ri->itlq->scsi_opcode, &ri->itlq->fc_time, pinfo);
- return 1;
-}
-
-static void
-scsistat_draw(void *prs)
-{
- scsistat_t *rs = (scsistat_t *)prs;
-
- draw_srt_table_data(&rs->scsi_srt_table, TRUE, TRUE);
-}
-
-static void
-scsistat_init(const char *opt_arg, void* userdata _U_)
-{
- scsistat_t *rs;
- guint32 i;
- int program, pos;
- const char *filter = NULL;
- value_string_ext *cdbnames_ext;
- GString *error_string;
- const char *table_name;
-
- pos = 0;
- if (sscanf(opt_arg, "scsi,srt,%d,%n", &program, &pos) == 1) {
- if (pos) {
- filter = opt_arg+pos;
- }
- } else {
- fprintf(stderr, "tshark: invalid \"-z scsi,srt,<cmdset>[,<filter>]\" argument\n");
- exit(1);
- }
-
- rs = g_new(scsistat_t,1);
- rs->cmdset = program;
-
- switch(program) {
- case SCSI_DEV_SBC:
- rs->prog = "SBC (disk)";
- table_name = "SCSI SBC (disk)";
- cdbnames_ext = &scsi_sbc_vals_ext;
- break;
- case SCSI_DEV_SSC:
- rs->prog = "SSC (tape)";
- table_name = "SCSI SSC (tape)";
- cdbnames_ext = &scsi_ssc_vals_ext;
- break;
- case SCSI_DEV_CDROM:
- rs->prog = "MMC (cd/dvd)";
- table_name = "SCSI MMC (cd/dvd)";
- cdbnames_ext = &scsi_mmc_vals_ext;
- break;
- case SCSI_DEV_SMC:
- rs->prog = "SMC (tape robot)";
- table_name = "SCSI SMC (tape robot)";
- cdbnames_ext = &scsi_smc_vals_ext;
- break;
- case SCSI_DEV_OSD:
- rs->prog = "OSD (object based)";
- table_name = "SCSI OSD (object based)";
- cdbnames_ext = &scsi_osd_vals_ext;
- break;
- default:
- /* Default to the SBC (disk), since this is what EMC SCSI seem to always be */
- rs->cmdset = 0;
- rs->prog = "SBC (disk)";
- table_name = "SCSI SBC (disk)";
- cdbnames_ext = &scsi_sbc_vals_ext;
- break;
- }
-
- init_srt_table(table_name, &rs->scsi_srt_table, SCSI_NUM_PROCEDURES, NULL, filter ? g_strdup(filter) : NULL);
- for (i = 0; i < SCSI_NUM_PROCEDURES; i++)
- {
- init_srt_table_row(&rs->scsi_srt_table, i, val_to_str_ext_const(i, cdbnames_ext, "<unknown>"));
- }
-
- error_string = register_tap_listener("scsi", rs, filter, 0, NULL, scsistat_packet, scsistat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&rs->scsi_srt_table);
- g_free(rs);
-
- fprintf(stderr, "tshark: Couldn't register scsi,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui scsistat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "scsi,srt",
- scsistat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_scsistat(void)
-{
- register_stat_tap_ui(&scsistat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-smb2stat.c b/ui/cli/tap-smb2stat.c
deleted file mode 100644
index fef21505c8..0000000000
--- a/ui/cli/tap-smb2stat.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* tap-smb2stat.c
- * Based off if smbstat by Ronnie Sahlberg
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "epan/packet_info.h"
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include "epan/value_string.h"
-#include <ui/cli/cli_service_response_time_table.h>
-#include <epan/dissectors/packet-smb2.h>
-#include "epan/timestats.h"
-
-void register_tap_listener_smbstat(void);
-
-#define SMB2_NUM_PROCEDURES 256
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _smb2stat_t {
- srt_stat_table smb2_srt_table;
-} smb2stat_t;
-
-static int
-smb2stat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
-{
- smb2stat_t *ss=(smb2stat_t *)pss;
- const smb2_info_t *si=(const smb2_info_t *)psi;
-
- /* we are only interested in response packets */
- if(!(si->flags&SMB2_FLAGS_RESPONSE)){
- return 0;
- }
- /* if we haven't seen the request, just ignore it */
- if(!si->saved){
- return 0;
- }
- /* SMB2 SRT can be very inaccurate in the presence of retransmissions. Retransmitted responses
- * not only add additional (bogus) transactions but also the latency associated with them.
- * This can greatly inflate the maximum and average SRT stats especially in the case of
- * retransmissions triggered by the expiry of the rexmit timer (RTOs). Only calculating SRT
- * for the last received response accomplishes this goal without requiring the TCP pref
- * "Do not call subdissectors for error packets" to be set. */
- if(si->saved->frame_req
- && si->saved->frame_res==pinfo->fd->num)
- add_srt_table_data(&ss->smb2_srt_table, si->opcode, &si->saved->req_time, pinfo);
- else
- return 0;
-
- return 1;
-
-}
-
-static void
-smb2stat_draw(void *pss)
-{
- smb2stat_t *ss = (smb2stat_t *)pss;
-
- draw_srt_table_data(&ss->smb2_srt_table, TRUE, TRUE);
-}
-
-
-static void
-smb2stat_init(const char *opt_arg, void *userdata _U_)
-{
- smb2stat_t *ss;
- guint32 i;
- const char *filter = NULL;
- GString *error_string;
-
- if (!strncmp(opt_arg, "smb2,srt,", 8)) {
- filter = opt_arg + 8;
- }
-
- ss = g_new(smb2stat_t, 1);
-
- init_srt_table("SMB2", &ss->smb2_srt_table, SMB2_NUM_PROCEDURES, "Commands", filter ? g_strdup(filter) : NULL);
- for (i = 0; i < SMB2_NUM_PROCEDURES; i++)
- {
- init_srt_table_row(&ss->smb2_srt_table, i, val_to_str_ext_const(i, &smb2_cmd_vals_ext, "<unknown>"));
- }
-
- error_string = register_tap_listener("smb2", ss, filter, 0, NULL, smb2stat_packet, smb2stat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&ss->smb2_srt_table);
- g_free(ss);
-
- fprintf(stderr, "tshark: Couldn't register smb2,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui smb2stat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "smb2,srt",
- smb2stat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_smb2stat(void)
-{
- register_stat_tap_ui(&smb2stat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-smbstat.c b/ui/cli/tap-smbstat.c
deleted file mode 100644
index d5f9150c2d..0000000000
--- a/ui/cli/tap-smbstat.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* tap-smbstat.c
- * smbstat 2003 Ronnie Sahlberg
- *
- * Wireshark - Network traffic analyzer
- * By Gerald Combs <gerald@wireshark.org>
- * Copyright 1998 Gerald Combs
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "epan/packet_info.h"
-#include <epan/tap.h>
-#include <epan/stat_tap_ui.h>
-#include "epan/value_string.h"
-#include <ui/cli/cli_service_response_time_table.h>
-#include <epan/dissectors/packet-smb.h>
-#include "epan/timestats.h"
-
-void register_tap_listener_smbstat(void);
-
-#define SMB_NUM_PROCEDURES 256
-
-/* used to keep track of the statistics for an entire program interface */
-typedef struct _smbstat_t {
- srt_stat_table smb_srt_table;
- srt_stat_table trans2_srt_table;
- srt_stat_table nt_srt_table;
-} smbstat_t;
-
-static int
-smbstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const void *psi)
-{
- smbstat_t *ss = (smbstat_t *)pss;
- const smb_info_t *si = (const smb_info_t *)psi;
-
- /* we are only interested in reply packets */
- if (si->request) {
- return 0;
- }
- /* if we havnt seen the request, just ignore it */
- if (!si->sip) {
- return 0;
- }
-
- if (si->cmd == 0xA0 && si->sip->extra_info_type == SMB_EI_NTI) {
- smb_nt_transact_info_t *sti = (smb_nt_transact_info_t *)si->sip->extra_info;
-
- /*nt transaction*/
- if (sti) {
- add_srt_table_data(&ss->nt_srt_table, sti->subcmd, &si->sip->req_time, pinfo);
- }
- } else if (si->cmd == 0x32 && si->sip->extra_info_type == SMB_EI_T2I) {
- smb_transact2_info_t *st2i = (smb_transact2_info_t *)si->sip->extra_info;
-
- /*transaction2*/
- if (st2i) {
- add_srt_table_data(&ss->trans2_srt_table, st2i->subcmd, &si->sip->req_time, pinfo);
- }
- } else {
- add_srt_table_data(&ss->smb_srt_table,si->cmd, &si->sip->req_time, pinfo);
- }
-
- return 1;
-}
-
-static void
-smbstat_draw(void *pss)
-{
- smbstat_t *ss = (smbstat_t *)pss;
-
- draw_srt_table_data(&ss->smb_srt_table, TRUE, FALSE);
- printf("\n");
- draw_srt_table_data(&ss->trans2_srt_table, FALSE, FALSE);
- printf("\n");
- draw_srt_table_data(&ss->nt_srt_table, FALSE, TRUE);
-}
-
-
-static void
-smbstat_init(const char *opt_arg, void *userdata _U_)
-{
- smbstat_t *ss;
- guint32 i;
- const char *filter = NULL;
- GString *error_string;
-
- if (!strncmp(opt_arg, "smb,srt,", 8)) {
- filter = opt_arg + 8;
- }
-
- ss = g_new(smbstat_t, 1);
-
- init_srt_table("SMB", &ss->smb_srt_table, SMB_NUM_PROCEDURES, "Commands", filter ? g_strdup(filter) : NULL);
- init_srt_table("SMB", &ss->trans2_srt_table, SMB_NUM_PROCEDURES, "Transaction2 Commands", filter ? g_strdup(filter) : NULL);
- init_srt_table("SMB", &ss->nt_srt_table, SMB_NUM_PROCEDURES, "NT Transaction Commands", filter ? g_strdup(filter) : NULL);
- for (i = 0; i < SMB_NUM_PROCEDURES; i++)
- {
- init_srt_table_row(&ss->smb_srt_table, i, val_to_str_ext_const(i, &smb_cmd_vals_ext, "<unknown>"));
- init_srt_table_row(&ss->trans2_srt_table, i, val_to_str_ext_const(i, &trans2_cmd_vals_ext, "<unknown>"));
- init_srt_table_row(&ss->nt_srt_table, i, val_to_str_ext_const(i, &nt_cmd_vals_ext, "<unknown>"));
- }
-
- error_string = register_tap_listener("smb", ss, filter, 0, NULL, smbstat_packet, smbstat_draw);
- if (error_string) {
- /* error, we failed to attach to the tap. clean up */
- free_srt_table_data(&ss->smb_srt_table);
- free_srt_table_data(&ss->trans2_srt_table);
- free_srt_table_data(&ss->nt_srt_table);
- g_free(ss);
-
- fprintf(stderr, "tshark: Couldn't register smb,srt tap: %s\n",
- error_string->str);
- g_string_free(error_string, TRUE);
- exit(1);
- }
-}
-
-static stat_tap_ui smbstat_ui = {
- REGISTER_STAT_GROUP_GENERIC,
- NULL,
- "smb,srt",
- smbstat_init,
- 0,
- NULL
-};
-
-void
-register_tap_listener_smbstat(void)
-{
- register_stat_tap_ui(&smbstat_ui, NULL);
-}
-
-/*
- * Editor modelines - http://www.wireshark.org/tools/modelines.html
- *
- * Local variables:
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- *
- * vi: set shiftwidth=8 tabstop=8 noexpandtab:
- * :indentSize=8:tabSize=8:noTabs=false:
- */
diff --git a/ui/cli/tap-srt.c b/ui/cli/tap-srt.c
new file mode 100644
index 0000000000..ec9084021d
--- /dev/null
+++ b/ui/cli/tap-srt.c
@@ -0,0 +1,196 @@
+/* tap-srt.c
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <string.h>
+#include <epan/packet.h>
+#include <epan/timestamp.h>
+#include <epan/stat_tap_ui.h>
+#include <ui/cli/tshark-tap.h>
+#include <ui/cli/tap-srt.h>
+
+#define NANOSECS_PER_SEC 1000000000
+
+typedef struct _srt_t {
+ const char *type;
+ const char *filter;
+ srt_data_t data;
+} srt_t;
+
+void
+draw_srt_table_data(srt_stat_table *rst, gboolean draw_footer)
+{
+ int i;
+ guint64 td;
+ guint64 sum;
+
+ if (rst->num_procs > 0) {
+ printf("Filter: %s\n", rst->filter_string ? rst->filter_string : "");
+ printf("Index %-22s Calls Min SRT Max SRT Avg SRT Sum SRT\n", (rst->proc_column_name != NULL) ? rst->proc_column_name : "Procedure");
+ }
+ for(i=0;i<rst->num_procs;i++){
+ /* ignore procedures with no calls (they don't have rows) */
+ if(rst->procedures[i].stats.num==0){
+ continue;
+ }
+ /* Scale the average SRT in units of 1us and round to the nearest us.
+ tot.secs is a time_t which may be 32 or 64 bits (or even floating)
+ depending uon the platform. After casting tot.secs to 64 bits, it
+ would take a capture with a duration of over 136 *years* to
+ overflow the secs portion of td. */
+ td = ((guint64)(rst->procedures[i].stats.tot.secs))*NANOSECS_PER_SEC + rst->procedures[i].stats.tot.nsecs;
+ sum = (td + 500) / 1000;
+ td = ((td / rst->procedures[i].stats.num) + 500) / 1000;
+
+ printf("%5u %-22s %6u %3d.%06d %3d.%06d %3d.%06d %3d.%06d\n",
+ i, rst->procedures[i].procedure,
+ rst->procedures[i].stats.num,
+ (int)rst->procedures[i].stats.min.secs, (rst->procedures[i].stats.min.nsecs+500)/1000,
+ (int)rst->procedures[i].stats.max.secs, (rst->procedures[i].stats.max.nsecs+500)/1000,
+ (int)(td/1000000), (int)(td%1000000),
+ (int)(sum/1000000), (int)(sum%1000000)
+ );
+ }
+
+ if (draw_footer)
+ printf("==================================================================\n");
+}
+
+static void
+srt_draw(void *arg)
+{
+ guint i = 0;
+ srt_data_t* data = (srt_data_t*)arg;
+ srt_t *ui = (srt_t *)data->user_data;
+ srt_stat_table *srt_table;
+ gboolean need_newline = FALSE;
+
+ printf("\n");
+ printf("===================================================================\n");
+ printf("%s SRT Statistics:\n", ui->type);
+
+ srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
+ draw_srt_table_data(srt_table, data->srt_array->len == 1);
+ if (srt_table->num_procs > 0) {
+ need_newline = TRUE;
+ }
+
+ for (i = 1; i < data->srt_array->len; i++)
+ {
+ if (need_newline)
+ {
+ printf("\n");
+ need_newline = FALSE;
+ }
+ srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
+ draw_srt_table_data(srt_table, i == data->srt_array->len-1);
+ if (srt_table->num_procs > 0) {
+ need_newline = TRUE;
+ }
+ }
+}
+
+static GArray* global_srt_array;
+
+static void
+init_srt_tables(register_srt_t* srt, const char *filter)
+{
+ srt_t *ui;
+ GString *error_string;
+
+ ui = g_new0(srt_t, 1);
+ ui->type = proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt)));
+ ui->filter = g_strdup(filter);
+ ui->data.srt_array = global_srt_array;
+ ui->data.user_data = ui;
+
+ error_string = register_tap_listener(get_srt_tap_listener_name(srt), &ui->data, filter, 0, NULL, get_srt_packet_func(srt), srt_draw);
+ if (error_string) {
+ free_srt_table(srt, global_srt_array, NULL, NULL);
+ g_free(ui);
+ fprintf(stderr, "tshark: Couldn't register srt tap: %s\n", error_string->str);
+ g_string_free(error_string, TRUE);
+ exit(1);
+ }
+}
+
+static void
+dissector_srt_init(const char *opt_arg, void* userdata)
+{
+ register_srt_t *srt = (register_srt_t*)userdata;
+ const char *filter=NULL;
+ char* err;
+
+ srt_table_get_filter(srt, opt_arg, &filter, &err);
+ if (err != NULL)
+ {
+ gchar* cmd_str = srt_table_get_tap_string(srt);
+ fprintf(stderr, "tshark: invalid \"-z %s,%s\" argument\n", cmd_str, err);
+ g_free(cmd_str);
+ g_free(err);
+ exit(1);
+ }
+
+ /* Need to create the SRT array now */
+ global_srt_array = g_array_new(FALSE, TRUE, sizeof(srt_stat_table*));
+
+ srt_table_dissector_init(srt, global_srt_array, NULL, NULL);
+ init_srt_tables(srt, filter);
+}
+
+/* Set GUI fields for register_srt list */
+void
+register_srt_tables(gpointer data, gpointer user_data _U_)
+{
+ register_srt_t *srt = (register_srt_t*)data;
+ const char* short_name = proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt)));
+ stat_tap_ui ui_info;
+
+ /* XXX - CAMEL dissector hasn't been converted over due seemingly different tap packet
+ handling functions. So let the existing TShark CAMEL tap keep its registration */
+ if (strcmp(short_name, "CAMEL") == 0)
+ return;
+
+ ui_info.group = REGISTER_STAT_GROUP_RESPONSE_TIME;
+ ui_info.title = NULL; /* construct this from the protocol info? */
+ ui_info.cli_string = srt_table_get_tap_string(srt);
+ ui_info.tap_init_cb = dissector_srt_init;
+ ui_info.nparams = 0;
+ ui_info.params = NULL;
+ register_stat_tap_ui(&ui_info, srt);
+}
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vi: set shiftwidth=8 tabstop=8 noexpandtab:
+ * :indentSize=8:tabSize=8:noTabs=false:
+ */
diff --git a/ui/cli/tap-srt.h b/ui/cli/tap-srt.h
new file mode 100644
index 0000000000..95f271ed55
--- /dev/null
+++ b/ui/cli/tap-srt.h
@@ -0,0 +1,43 @@
+/* tap-srt.h
+ * TShark service_response_time_table based on GTK version by Ronnie Sahlberg
+ * Helper routines common to all service response time statistics
+ * tap.
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __TAP_SRT_H__
+#define __TAP_SRT_H__
+
+#include "wsutil/nstime.h"
+#include "epan/srt_table.h"
+
+/** @file
+ * Helper routines common to all service response time statistics tap.
+ */
+
+/** Draw the srt table data.
+ *
+ * @param rst the srt table
+ * @param draw_header draw the header
+ * @param draw_footer draw the footer
+ */
+void draw_srt_table_data(srt_stat_table *rst, gboolean draw_footer);
+
+#endif /* __TAP_SRT_H__ */
diff --git a/ui/cli/tshark-tap.h b/ui/cli/tshark-tap.h
index 2c96cfbd75..3de71ddb18 100644
--- a/ui/cli/tshark-tap.h
+++ b/ui/cli/tshark-tap.h
@@ -26,5 +26,6 @@
extern void init_iousers(struct register_ct* ct, const char *filter);
extern void init_hostlists(struct register_ct* ct, const char *filter);
+extern void register_srt_tables(gpointer data, gpointer user_data);
#endif /* __TSHARK_TAP_H__ */