aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2011-04-29 06:53:29 +0000
committerStig Bjørlykke <stig@bjorlykke.org>2011-04-29 06:53:29 +0000
commit65910b24799e242a5cddc7b6821f2962b13e56f2 (patch)
treecd82fa5149447e71a7719ca415dd99026f4f7d87 /tshark.c
parent664c69dbaa47dfbe01baaee7ff5236b8b5c21d76 (diff)
From Edwin Groothuis via bug 5870:
The supplied patch adds a new option -O, which specifies a list of protocols (names can be found with the "-G protocols" option) to be fully decoded while the others only show the layer header. svn path=/trunk/; revision=36947
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tshark.c b/tshark.c
index a20f1250cc..ebbc9ad915 100644
--- a/tshark.c
+++ b/tshark.c
@@ -297,6 +297,7 @@ print_usage(gboolean print_ver)
fprintf(output, " -F <output file type> set the output file type, default is libpcap\n");
fprintf(output, " an empty \"-F\" option will list the file types\n");
fprintf(output, " -V add output of packet tree (Packet Details)\n");
+ fprintf(output, " -O <protocols> Only show packet details of these protocols, comma separated\n");
fprintf(output, " -S display packets even when writing to a file\n");
fprintf(output, " -x add output of hex and ASCII dump (Packet Bytes)\n");
fprintf(output, " -T pdml|ps|psml|text|fields\n");
@@ -830,6 +831,7 @@ main(int argc, char *argv[])
char badopt;
GLogLevelFlags log_flags;
int optind_initial;
+ gchar *output_only = NULL;
#ifdef HAVE_LIBPCAP
#if defined(_WIN32) || defined(HAVE_PCAP_CREATE)
@@ -847,7 +849,7 @@ main(int argc, char *argv[])
#define OPTSTRING_I ""
#endif
-#define OPTSTRING "a:b:" OPTSTRING_B "c:C:d:De:E:f:F:G:hH:i:" OPTSTRING_I "K:lLnN:o:pPqr:R:s:St:T:u:vVw:W:xX:y:z:"
+#define OPTSTRING "a:b:" OPTSTRING_B "c:C:d:De:E:f:F:G:hH:i:" OPTSTRING_I "K:lLnN:o:O:pPqr:R:s:St:T:u:vVw:W:xX:y:z:"
static const char optstring[] = OPTSTRING;
@@ -1237,6 +1239,9 @@ main(int argc, char *argv[])
break;
}
break;
+ case 'O': /* Only output these protocols */
+ output_only = g_strdup(optarg);
+ break;
case 'q': /* Quiet */
quiet = TRUE;
break;
@@ -1456,6 +1461,20 @@ main(int argc, char *argv[])
}
}
+ if (output_only != NULL) {
+ char *ps;
+
+ if (!verbose) {
+ cmdarg_err("-O requires -V");
+ return 1;
+ }
+
+ output_only_tables = g_hash_table_new (g_str_hash, g_str_equal);
+ for (ps = strtok (output_only, ","); ps; ps = strtok (NULL, ",")) {
+ g_hash_table_insert(output_only_tables, (gpointer)ps, (gpointer)ps);
+ }
+ }
+
#ifdef HAVE_LIBPCAP
if (list_link_layer_types) {
/* We're supposed to list the link-layer types for an interface;