forked from osmocom/wireshark
From Ed Beroset via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9272
Add tshark -G column-formats report and document the missing ftypes, heuristic-decodes and plugins reports. From me: Sort the reports. Add modelines to epan/column.c. Minor whitespace changes. svn path=/trunk/; revision=52627
This commit is contained in:
parent
b0080ae123
commit
63e4539229
|
@ -53,7 +53,7 @@ S<[ B<--capture-comment> E<lt>commentE<gt> ]>
|
|||
S<[ E<lt>capture filterE<gt> ]>
|
||||
|
||||
B<tshark>
|
||||
B<-G> [fields|protocols|values|decodes|defaultprefs|currentprefs]
|
||||
B<-G> [column-formats|currentprefs|decodes|defaultprefs|fields|ftypes|heuristic-decodes|plugins|protocols|values]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
@ -354,13 +354,30 @@ This option causes the output file(s) to be created with group-read permission
|
|||
(meaning that the output file(s) can be read by other members of the calling
|
||||
user's group).
|
||||
|
||||
=item -G [fields|protocols|values|decodes|defaultprefs|currentprefs]
|
||||
=item -G [column-formats|currentprefs|decodes|defaultprefs|fields|ftypes|heuristic-decodes|plugins|protocols|values]
|
||||
|
||||
The B<-G> option will cause B<Tshark> to dump one of several types of glossaries
|
||||
and then exit. If no specific glossary type is specified, then the B<fields> report will be generated by default.
|
||||
|
||||
The available report types include:
|
||||
|
||||
B<column-formats> Dumps the column formats understood by tshark.
|
||||
There is one record per line. The fields are tab-delimited.
|
||||
|
||||
* Field 1 = format string (e.g. "%rD")
|
||||
* Field 2 = text description of format string (e.g. "Dest port (resolved)")
|
||||
|
||||
B<currentprefs> Dumps a copy of the current preferences file to stdout.
|
||||
|
||||
B<decodes> Dumps the "layer type"/"decode as" associations to stdout.
|
||||
There is one record per line. The fields are tab-delimited.
|
||||
|
||||
* Field 1 = layer type, e.g. "tcp.port"
|
||||
* Field 2 = selector in decimal
|
||||
* Field 3 = "decode as" name, e.g. "http"
|
||||
|
||||
B<defaultprefs> Dumps a default preferences file to stdout.
|
||||
|
||||
B<fields> Dumps the contents of the registration database to
|
||||
stdout. An independent program can take this output and format it into nice
|
||||
tables or HTML or whatever. There is one record per line. Each record is
|
||||
|
@ -384,6 +401,27 @@ The fields are tab-delimited.
|
|||
* Field 7 = bitmask: format: hex: 0x....
|
||||
* Field 8 = blurb describing field
|
||||
|
||||
B<ftypes> Dumps the "ftypes" (fundamental types) understood by tshark.
|
||||
There is one record per line. The fields are tab-delimited.
|
||||
|
||||
* Field 1 = FTYPE (e.g "FT_IPv6")
|
||||
* Field 2 = text description of type (e.g. "IPv6 address")
|
||||
|
||||
B<heuristic-decodes> Dumps the heuristic decodes currently installed.
|
||||
There is one record per line. The fields are tab-delimited.
|
||||
|
||||
* Field 1 = underlying dissector (e.g. "tcp")
|
||||
* Field 2 = name of heuristic decoder (e.g. ucp")
|
||||
* Field 3 = heuristic enabled (e.g. "T" or "F")
|
||||
|
||||
B<plugins> Dumps the plugins currently installed.
|
||||
There is one record per line. The fields are tab-delimited.
|
||||
|
||||
* Field 1 = plugin library (e.g. "gryphon.so")
|
||||
* Field 2 = plugin version (e.g. 0.0.4)
|
||||
* Field 3 = plugin type (e.g. "dissector" or "tap")
|
||||
* Field 4 = full path to plugin file
|
||||
|
||||
B<protocols> Dumps the protocols in the registration database to stdout.
|
||||
An independent program can take this output and format it into nice tables
|
||||
or HTML or whatever. There is one record per line. The fields are tab-delimited.
|
||||
|
@ -420,17 +458,6 @@ the type of record.
|
|||
* Field 3 = True String
|
||||
* Field 4 = False String
|
||||
|
||||
B<decodes> Dumps the "layer type"/"decode as" associations to stdout.
|
||||
There is one record per line. The fields are tab-delimited.
|
||||
|
||||
* Field 1 = layer type, e.g. "tcp.port"
|
||||
* Field 2 = selector in decimal
|
||||
* Field 3 = "decode as" name, e.g. "http"
|
||||
|
||||
B<defaultprefs> Dumps a default preferences file to stdout.
|
||||
|
||||
B<currentprefs> Dumps a copy of the current preferences file to stdout.
|
||||
|
||||
=item -h
|
||||
|
||||
Print the version and options and exits.
|
||||
|
|
|
@ -185,6 +185,16 @@ col_format_desc(const gint fmt) {
|
|||
return(dlist[fmt]);
|
||||
}
|
||||
|
||||
void
|
||||
column_dump_column_formats(void)
|
||||
{
|
||||
gint fmt;
|
||||
|
||||
for (fmt = 0; fmt < NUM_COL_FMTS; fmt++) {
|
||||
printf("%s\t%s\n", col_format_to_string(fmt), col_format_desc(fmt));
|
||||
}
|
||||
}
|
||||
|
||||
/* Marks each array element true if it can be substituted for the given
|
||||
column format */
|
||||
void
|
||||
|
@ -802,3 +812,16 @@ build_column_format_array(column_info *cinfo, const gint num_cols, const gboolea
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
*
|
||||
* Local variables:
|
||||
* c-basic-offset: 2
|
||||
* tab-width: 2
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*
|
||||
* vi: set shiftwidth=2 tabstop=2 expandtab:
|
||||
* :indentSize=2:tabSize=2:noTabs=true:
|
||||
*/
|
||||
|
||||
|
|
|
@ -83,6 +83,9 @@ WS_DLL_PUBLIC
|
|||
void
|
||||
build_column_format_array(column_info *cinfo, const gint num_cols, const gboolean reset_fences);
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
void column_dump_column_formats(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
|
55
tshark.c
55
tshark.c
|
@ -375,16 +375,18 @@ glossary_option_help(void)
|
|||
fprintf(output, "Usage: tshark -G [report]\n");
|
||||
fprintf(output, "\n");
|
||||
fprintf(output, "Glossary table reports:\n");
|
||||
fprintf(output, " -G column-formats dump column format codes and exit\n");
|
||||
fprintf(output, " -G decodes dump \"layer type\"/\"decode as\" associations and exit\n");
|
||||
fprintf(output, " -G fields dump fields glossary and exit\n");
|
||||
fprintf(output, " -G ftypes dump field type basic and descriptive names\n");
|
||||
fprintf(output, " -G heuristic-decodes dump heuristic dissector tables\n");
|
||||
fprintf(output, " -G plugins dump installed plugins and exit\n");
|
||||
fprintf(output, " -G protocols dump protocols in registration database and exit\n");
|
||||
fprintf(output, " -G values dump value, range, true/false strings and exit\n");
|
||||
fprintf(output, " -G ftypes dump field type basic and descriptive names\n");
|
||||
fprintf(output, " -G decodes dump \"layer type\"/\"decode as\" associations and exit\n");
|
||||
fprintf(output, " -G heuristic-decodes dump heuristic dissector tables\n");
|
||||
fprintf(output, "\n");
|
||||
fprintf(output, "Preference reports:\n");
|
||||
fprintf(output, " -G defaultprefs dump default preferences and exit\n");
|
||||
fprintf(output, " -G currentprefs dump current preferences and exit\n");
|
||||
fprintf(output, " -G defaultprefs dump default preferences and exit\n");
|
||||
fprintf(output, "\n");
|
||||
}
|
||||
|
||||
|
@ -1126,31 +1128,34 @@ main(int argc, char *argv[])
|
|||
if (argc == 2)
|
||||
proto_registrar_dump_fields();
|
||||
else {
|
||||
if (strcmp(argv[2], "fields") == 0)
|
||||
proto_registrar_dump_fields();
|
||||
else if (strcmp(argv[2], "protocols") == 0)
|
||||
proto_registrar_dump_protocols();
|
||||
else if (strcmp(argv[2], "values") == 0)
|
||||
proto_registrar_dump_values();
|
||||
else if (strcmp(argv[2], "ftypes") == 0)
|
||||
proto_registrar_dump_ftypes();
|
||||
else if (strcmp(argv[2], "decodes") == 0)
|
||||
dissector_dump_decodes();
|
||||
else if (strcmp(argv[2], "heuristic-decodes") == 0)
|
||||
dissector_dump_heur_decodes();
|
||||
else if (strcmp(argv[2], "defaultprefs") == 0)
|
||||
write_prefs(NULL);
|
||||
else if (strcmp(argv[2], "plugins") == 0)
|
||||
plugins_dump_all();
|
||||
else if (strcmp(argv[2], "?") == 0)
|
||||
glossary_option_help();
|
||||
else if (strcmp(argv[2], "-?") == 0)
|
||||
glossary_option_help();
|
||||
if (strcmp(argv[2], "column-formats") == 0)
|
||||
column_dump_column_formats();
|
||||
else if (strcmp(argv[2], "currentprefs") == 0) {
|
||||
read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
||||
&pf_open_errno, &pf_read_errno, &pf_path);
|
||||
write_prefs(NULL);
|
||||
} else {
|
||||
}
|
||||
else if (strcmp(argv[2], "decodes") == 0)
|
||||
dissector_dump_decodes();
|
||||
else if (strcmp(argv[2], "defaultprefs") == 0)
|
||||
write_prefs(NULL);
|
||||
else if (strcmp(argv[2], "fields") == 0)
|
||||
proto_registrar_dump_fields();
|
||||
else if (strcmp(argv[2], "ftypes") == 0)
|
||||
proto_registrar_dump_ftypes();
|
||||
else if (strcmp(argv[2], "heuristic-decodes") == 0)
|
||||
dissector_dump_heur_decodes();
|
||||
else if (strcmp(argv[2], "plugins") == 0)
|
||||
plugins_dump_all();
|
||||
else if (strcmp(argv[2], "protocols") == 0)
|
||||
proto_registrar_dump_protocols();
|
||||
else if (strcmp(argv[2], "values") == 0)
|
||||
proto_registrar_dump_values();
|
||||
else if (strcmp(argv[2], "?") == 0)
|
||||
glossary_option_help();
|
||||
else if (strcmp(argv[2], "-?") == 0)
|
||||
glossary_option_help();
|
||||
else {
|
||||
cmdarg_err("Invalid \"%s\" option for -G flag, enter -G ? for more help.", argv[2]);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue