3 # Reads the display filter keyword dump produced by 'tshark -G' and
4 # formats it for a pod document. The pod document is then used to
7 # STDIN is the wireshark glossary
8 # arg1 is the pod template file. The =insert_dfilter_table token
9 # will be replaced by the pod-formatted glossary
10 # STDOUT is the output
12 # Gilbert Ramirez <gram [AT] alumni.rice.edu>
16 # Wireshark - Network traffic analyzer
17 # By Gerald Combs <gerald@wireshark.org>
18 # Copyright 1998 Gerald Combs
20 # This program is free software; you can redistribute it and/or
21 # modify it under the terms of the GNU General Public License
22 # as published by the Free Software Foundation; either version 2
23 # of the License, or (at your option) any later version.
25 # This program is distributed in the hope that it will be useful,
26 # but WITHOUT ANY WARRANTY; without even the implied warranty of
27 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 # GNU General Public License for more details.
30 # You should have received a copy of the GNU General Public License
31 # along with this program; if not, write to the Free Software
32 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
37 'FT_NONE', 'No value',
38 'FT_PROTOCOL', 'Protocol',
39 'FT_BOOLEAN', 'Boolean',
40 'FT_UINT8', 'Unsigned 8-bit integer',
41 'FT_UINT16', 'Unsigned 16-bit integer',
42 'FT_UINT24', 'Unsigned 24-bit integer',
43 'FT_UINT32', 'Unsigned 32-bit integer',
44 'FT_UINT64', 'Unsigned 64-bit integer',
45 'FT_INT8', 'Signed 8-bit integer',
46 'FT_INT16', 'Signed 16-bit integer',
47 'FT_INT24', 'Signed 24-bit integer',
48 'FT_INT32', 'Signed 32-bit integer',
49 'FT_INT64', 'Signed 64-bit integer',
50 'FT_FLOAT', 'Single-precision floating point',
51 'FT_DOUBLE', 'Double-precision floating point',
52 'FT_ABSOLUTE_TIME', 'Date/Time stamp',
53 'FT_RELATIVE_TIME', 'Time duration',
54 'FT_STRING', 'String',
55 'FT_STRINGZ', 'NULL terminated string',
56 'FT_EBCDIC', 'EBCDIC string',
57 'FT_UINT_STRING', 'Length string pair',
58 'FT_ETHER', '6-byte Hardware (MAC) Address',
59 'FT_BYTES', 'Byte array',
60 'FT_UINT_BYTES', 'Length byte array pair',
61 'FT_IPv4', 'IPv4 address',
62 'FT_IPv6', 'IPv6 address',
63 'FT_IPXNET', 'IPX network or server name',
64 'FT_FRAMENUM', 'Frame number',
65 'FT_PCRE', 'Perl Compatible Regular Expression',
66 'FT_GUID', 'Globally Unique Identifier',
67 'FT_OID', 'Object Identifier',
68 'FT_REL_OID', 'Relative Object Identifier',
74 $proto_abbrev{'Unable to generate filter documentation'} =
75 'Please refer to http://www.wireshark.org/docs/dfref/';
76 printf STDERR
"Creating empty filter list.\n";
78 # Read all the data into memory
80 next unless (/^([PF])/);
83 # Strip the line from its line-end sequence
84 # chomp($_) won't work on Win32/CygWin as it leaves the '\r' character.
87 # Store protocol information
88 if ($record_type eq 'P') {
89 ($junk, $name, $abbrev) = split(/\t+/, $_);
90 $proto_abbrev{$name} = $abbrev;
92 # Store header field information
94 ($junk, $name, $abbrev, $type, $parent, $blurb) =
96 push(@
{$field_abbrev{$parent}}, $abbrev);
97 $field_info{$abbrev} = [ $name, $type, $blurb ];
102 # if there was no input on stdin, bail out
103 if ($record_type ne 'P' and $record_type ne 'F' and !defined($opt_e)) {
107 $template = shift(@ARGV);
109 open(TEMPLATE
, $template) || die "Can't open $template for reading: $!\n";
112 if (/=insert_dfilter_table/) {
113 &create_dfilter_table
;
120 close(TEMPLATE
) || die "Can't close $template: $!\n";
122 sub create_dfilter_table
{
124 # Print each protocol
125 for $proto_name (sort keys %proto_abbrev) {
127 print "=head2 $proto_name ($proto_abbrev{$proto_name})\n\n";
129 # If this proto has children fields, print those
130 if ($field_abbrev{$proto_abbrev{$proto_name}}) {
132 for $field_abbrev (sort @
{$field_abbrev{$proto_abbrev{$proto_name}}}) {
133 print " $field_abbrev ", $field_info{$field_abbrev}[0],"\n",
134 " ", $ftenum_names{$field_info{$field_abbrev}[1]},
136 print " ", $field_info{$field_abbrev}[2], "\n"
137 if $field_info{$field_abbrev}[2];