diff options
author | Richard Sharpe <sharpe@ns.aus.com> | 2000-08-08 01:56:57 +0000 |
---|---|---|
committer | Richard Sharpe <sharpe@ns.aus.com> | 2000-08-08 01:56:57 +0000 |
commit | b762041ba3973efc59b4829b35c02242465ded10 (patch) | |
tree | 961bc98fa8d3fd83918401cb8258d1e17caf7e62 /doc/eproto2sgml | |
parent | d9b5291990b5ba2ba45aa546cc2a1435d5926ade (diff) |
Added another tool to generate lists of protocols from Ethereal for the
documentation/user guide ...
svn path=/trunk/; revision=2224
Diffstat (limited to 'doc/eproto2sgml')
-rw-r--r-- | doc/eproto2sgml | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/doc/eproto2sgml b/doc/eproto2sgml new file mode 100644 index 0000000000..0a14859b53 --- /dev/null +++ b/doc/eproto2sgml @@ -0,0 +1,95 @@ +#!/usr/bin/perl +# +# Reads the display filter keyword dump produced by 'ethereal -G' and +# formats it as an SGML bulleted list of protocols. +# +# STDIN is the ethereal glossary +# arg1 is the pod template file. The =insert_dfilter_table token +# will be replaced by the pod-formatted glossary +# STDOUT is the output +# +# $Id: eproto2sgml,v 1.1 2000/08/08 01:56:57 sharpe Exp $ + +%ftenum_names = ( + 'FT_NONE', 'No value', + 'FT_BOOLEAN', 'Boolean', + 'FT_UINT8', 'Unsigned 8-bit integer', + 'FT_UINT16', 'Unsigned 16-bit integer', + 'FT_UINT24', 'Unsigned 24-bit integer', + 'FT_UINT32', 'Unsigned 32-bit integer', + 'FT_INT8', 'Signed 8-bit integer', + 'FT_INT16', 'Signed 16-bit integer', + 'FT_INT24', 'Signed 24-bit integer', + 'FT_INT32', 'Signed 32-bit integer', + 'FT_ABSOLUTE_TIME', 'Date/Time stamp', + 'FT_RELATIVE_TIME', 'Time duration', + 'FT_STRING', 'String', + 'FT_DOUBLE', 'Double-precision floating point', + 'FT_ETHER', '6-byte Hardware (MAC) Address', + 'FT_BYTES', 'Byte array', + 'FT_IPv4', 'IPv4 address', + 'FT_IPv6', 'IPv6 address', + 'FT_IPXNET', 'IPX network or server name', + 'FT_TEXT_ONLY', 'Text-only. Not filterable' +); + +# Read all the data into memory +while (<STDIN>) { + next unless (/^([PF])/); + + $record_type = $1; + chomp($_); + + # Store protocol information + if ($record_type eq 'P') { + ($junk, $name, $abbrev) = split(/\t+/, $_); + $proto_abbrev{$name} = $abbrev; + } + # Store header field information + else { + ($junk, $name, $abbrev, $type, $parent) = + split(/\t+/, $_); + push(@{$field_abbrev{$parent}}, $abbrev); + $field_info{$abbrev} = [ $name, $type ]; + } +} + +# if there was no input on stdin, bail out +if ($record_type ne 'P' and $record_type ne 'F') { + exit; +} + +$template = shift(@ARGV); + +open(TEMPLATE, $template) || die "Can't open $template for reading: $!\n"; + +while (<TEMPLATE>) { + if (/=insert_dfilter_table/) { + &create_dfilter_table; + } + else { + print; + } +} + +close(TEMPLATE) || die "Can't close $template: $!\n"; + +sub create_dfilter_table { + + print "<itemizedlist id=\"EtherealListOfProtos\">\n"; + + # Print each protocol + for $proto_name (sort keys %proto_abbrev) { + + if ($proto_name eq 'Text' && $proto_abbrev{$proto_name} eq 'text') { + next; + } + + print " <listitem><para>$proto_name</></>\n"; + + + } + + print "</itemizedlist>\n"; + +} |