aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/tshark.pod14
-rw-r--r--epan/packet.c78
-rw-r--r--epan/packet.h4
-rw-r--r--tfshark.c3
-rw-r--r--tshark.c3
5 files changed, 99 insertions, 3 deletions
diff --git a/doc/tshark.pod b/doc/tshark.pod
index 05f5b9700f..f17253419e 100644
--- a/doc/tshark.pod
+++ b/doc/tshark.pod
@@ -54,7 +54,7 @@ S<[ B<--capture-comment> E<lt>commentE<gt> ]>
S<[ E<lt>capture filterE<gt> ]>
B<tshark>
-B<-G> [column-formats|currentprefs|decodes|defaultprefs|fields|ftypes|heuristic-decodes|plugins|protocols|values]
+B<-G> [ E<lt>report typeE<gt> ]
=head1 DESCRIPTION
@@ -355,7 +355,7 @@ 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 [column-formats|currentprefs|decodes|defaultprefs|fields|ftypes|heuristic-decodes|plugins|protocols|values]
+=item -G [ E<lt>report typeE<gt> ]
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.
@@ -379,6 +379,14 @@ There is one record per line. The fields are tab-delimited.
B<defaultprefs> Dumps a default preferences file to stdout.
+B<dissector-tables> Dumps a list of dissector tables to stdout. There
+is one record per line. The fields are tab-delimited.
+
+ * Field 1 = dissector table name, e.g. "tcp.port"
+ * Field 2 = name used for the dissector table in the GUI
+ * Field 3 = type (textual representation of the ftenum type)
+ * Field 4 = base for display (for integer types)
+
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
@@ -396,7 +404,7 @@ The fields are tab-delimited.
* Field 1 = 'F'
* Field 2 = descriptive field name
* Field 3 = field abbreviation
- * Field 4 = type ( textual representation of the ftenum type )
+ * Field 4 = type (textual representation of the ftenum type)
* Field 5 = parent protocol abbreviation
* Field 6 = base for display (for integer types); "parent bitfield width" for FT_BOOLEAN
* Field 7 = bitmask: format: hex: 0x....
diff --git a/epan/packet.c b/epan/packet.c
index 058c12ef6e..0b515ac8eb 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -2362,6 +2362,7 @@ void call_heur_dissector_direct(heur_dtbl_entry_t *heur_dtbl_entry, tvbuff_t *tv
pinfo->heur_list_name = saved_heur_list_name;
}
+
/*
* Dumps the "layer type"/"decode as" associations to stdout, similar
* to the proto_registrar_dump_*() routines.
@@ -2419,6 +2420,83 @@ dissector_dump_decodes(void)
dissector_all_tables_foreach(dissector_dump_decodes_display, NULL);
}
+/*
+ * Dumps the "layer type"/"decode as" associations to stdout, similar
+ * to the proto_registrar_dump_*() routines.
+ *
+ * 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"
+ */
+
+
+static void
+dissector_dump_dissector_tables_display (gpointer key, gpointer user_data _U_)
+{
+ const char *table_name = (const char *)key;
+ dissector_table_t table;
+
+ table = (dissector_table_t)g_hash_table_lookup(dissector_tables, key);
+ printf("%s\t%s\t%s", table_name, table->ui_name, ftype_name(table->type));
+ switch (table->type) {
+
+ case FT_UINT8:
+ case FT_UINT16:
+ case FT_UINT24:
+ case FT_UINT32:
+ switch(table->base) {
+
+ case BASE_NONE:
+ printf("\tBASE_NONE");
+ break;
+
+ case BASE_DEC:
+ printf("\tBASE_DEC");
+ break;
+
+ case BASE_HEX:
+ printf("\tBASE_HEX");
+ break;
+
+ case BASE_DEC_HEX:
+ printf("\tBASE_DEC_HEX");
+ break;
+
+ case BASE_HEX_DEC:
+ printf("\tBASE_HEX_DEC");
+ break;
+
+ default:
+ printf("\t%d", table->base);
+ break;
+ }
+ break;
+
+ default:
+ break;
+ }
+ printf("\n");
+}
+
+static gint
+compare_dissector_key_name(gconstpointer dissector_a, gconstpointer dissector_b)
+{
+ return strcmp((const char*)dissector_a, (const char*)dissector_b);
+}
+
+void
+dissector_dump_dissector_tables(void)
+{
+ GList *list;
+
+ list = g_hash_table_get_keys(dissector_tables);
+ list = g_list_sort(list, compare_dissector_key_name);
+ g_list_foreach(list, dissector_dump_dissector_tables_display, NULL);
+ g_list_free(list);
+}
+
static GPtrArray* post_dissectors = NULL;
static guint num_of_postdissectors = 0;
diff --git a/epan/packet.h b/epan/packet.h
index afa17d93ad..507e9b2aaf 100644
--- a/epan/packet.h
+++ b/epan/packet.h
@@ -214,6 +214,10 @@ WS_DLL_PUBLIC ftenum_t get_dissector_table_selector_type(const char *name);
sub-dissector table, given the table's internal name */
WS_DLL_PUBLIC int get_dissector_table_base(const char *name);
+/* Dump all dissector tables to the standard output (not the entries,
+ just the information about the tables) */
+WS_DLL_PUBLIC void dissector_dump_dissector_tables(void);
+
/* Add an entry to a uint dissector table. */
WS_DLL_PUBLIC void dissector_add_uint(const char *abbrev, const guint32 pattern,
dissector_handle_t handle);
diff --git a/tfshark.c b/tfshark.c
index 2cbe7e7485..04923f8800 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -269,6 +269,7 @@ glossary_option_help(void)
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 dissector-tables dump dissector table names, types, and properties\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");
@@ -998,6 +999,8 @@ main(int argc, char *argv[])
dissector_dump_decodes();
else if (strcmp(argv[2], "defaultprefs") == 0)
write_prefs(NULL);
+ else if (strcmp(argv[2], "dissector-tables") == 0)
+ dissector_dump_dissector_tables();
else if (strcmp(argv[2], "fields") == 0)
proto_registrar_dump_fields();
else if (strcmp(argv[2], "ftypes") == 0)
diff --git a/tshark.c b/tshark.c
index 0cdbb901fb..10dbb5f6d9 100644
--- a/tshark.c
+++ b/tshark.c
@@ -417,6 +417,7 @@ glossary_option_help(void)
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 dissector-tables dump dissector table names, types, and properties\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");
@@ -1227,6 +1228,8 @@ main(int argc, char *argv[])
dissector_dump_decodes();
else if (strcmp(argv[2], "defaultprefs") == 0)
write_prefs(NULL);
+ else if (strcmp(argv[2], "dissector-tables") == 0)
+ dissector_dump_dissector_tables();
else if (strcmp(argv[2], "fields") == 0)
proto_registrar_dump_fields();
else if (strcmp(argv[2], "ftypes") == 0)