wireshark/doc
Michael Mann 60d6b05e23 Stats_tree enhancements for sorting, averages and burst rate. Bug 9452 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9452)
From Deon van der Westhuysen

- Bug fix: object leak in stats_tree after a tap reset (for example apply statistics preferences with a stats_tree window open)
- Bug fix: correct sample code in README.stats_tree
- Add: slash in plug-in name now creates submenu as docs describe (was a bug?)
- Add: menu separator before the stat_tree registered plug-ins
- Add: stats_tree can now calculate averages for nodes; automatically calculated for range nodes. Add section in README.stats_tree describing averages.
- Add: stats_tree can now calculate burst rate of each node (like rate but with a shorter, sliding time window)
- Add: sorting for stats_tree plug-ins. Can sort on node name, count, average, min, max values and burst rate.
- Add: preferences for stats_tree system (default sort column, burst calc params)
- Add: stats_tree window copy to clipboard and export and plain text, csv and XML.
- Added sample of new functionality in $srcdir/plugins/stats_tree/pinfo_stats_tree.c
- Moved all stats_tree sample plug-ins to "IP Statistics" submenu.

svn path=/trunk/; revision=53657
2013-11-29 22:47:59 +00:00
..
.gitignore
Makefile.am Subsume README.binarytrees into wmem doxygen. The README was out of date 2013-10-13 13:13:24 +00:00
Makefile.nmake makefile.nmake -> Makefile.nmake and minor whitespace (spaces -> tabs) changes. 2013-06-25 15:32:49 +00:00
README.capture
README.design
README.developer Remove a phrase which implies that tab widths other than 8 are OK. 2013-11-01 20:39:11 +00:00
README.display_filter Update dfilter-test.py to use a much more modern test harness, 2013-09-18 05:07:46 +00:00
README.dissector Rename some of pint.h macros to match common style (bits number on the end). 2013-11-29 18:59:06 +00:00
README.epan_child The API is almost there I guess... 2013-06-09 22:33:37 +00:00
README.heuristic Fix two bugs in the example code that I revised. 2013-02-11 01:31:49 +00:00
README.idl2wrs Fix trivial typos and other misc. minor updates. 2012-07-26 01:50:39 +00:00
README.malloc Update READMEs. 2013-06-18 21:47:18 +00:00
README.packaging
README.plugins WS_DLL_PUBLIC is now always WS_DLL_PUBLIC_NOEXTERN with "extern" added; 2013-07-03 01:43:39 +00:00
README.python More SVN properties cleanup. 2013-10-27 01:11:15 +00:00
README.qt Update the guidelines a bit. 2013-11-14 23:40:26 +00:00
README.regression
README.request_response_tracking Sync up with packet-pana.c. 2013-10-25 21:16:39 +00:00
README.stats_tree Stats_tree enhancements for sorting, averages and burst rate. Bug 9452 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9452) 2013-11-29 22:47:59 +00:00
README.tapping
README.wmem Document that pinfo-scoped memory is also needed for anything passed to 2013-07-26 13:06:50 +00:00
README.wslua Add README for Lua 2013-02-25 16:37:34 +00:00
README.xml-output Update WiresharkXML.py to work with Python 2.7. 2013-01-24 18:16:32 +00:00
asn2deb.pod Make sure we apply POD_CSS_URL everywhere. Capitalize a couple of titles. 2013-05-20 22:51:33 +00:00
capinfos.pod If tcpdump doesn't exist, why refer to it? Omit this confusing phrase. 2013-05-20 02:21:07 +00:00
dfilter2pod.pl Add some license headers after emailing the respective authors to confirm. 2013-10-09 17:30:50 +00:00
dftest.pod
doc.vcproj Subsume README.binarytrees into wmem doxygen. The README was out of date 2013-10-13 13:13:24 +00:00
dumpcap.pod Handle the 2GiB boundary case of the max filesize autostop condition properly so that we avoid overflow conditions and so that we ensure we don't capture more than 2GiB. Also, document the max filesize autostop value of 2GIB as well as indicating that it's truly GiB and not GB. 2013-08-29 18:15:13 +00:00
editcap.pod Replace the simpler chop example with a more detailed example. 2013-09-09 21:32:03 +00:00
eproto2sgml
idl2deb.pod Make sure we apply POD_CSS_URL everywhere. Capitalize a couple of titles. 2013-05-20 22:51:33 +00:00
idl2wrs.pod Fix all errors and warnings found by podchecker. 2013-06-07 17:06:27 +00:00
make-authors-format.pl
make-authors-short.pl
mergecap.pod If a core Wireshark developer repeatedly can't remember that the 2013-07-28 21:12:07 +00:00
packet-PROTOABBREV.c Add an example of filterable expert info. 2013-09-09 03:43:45 +00:00
perlnoutf.pl
randpkt.pod If a core Wireshark developer repeatedly can't remember that the 2013-07-28 21:12:07 +00:00
randpkt.txt
rawshark.pod Add support for displaying dates as year and day-of-year (1-origin). 2013-11-06 20:39:09 +00:00
reordercap.pod Fix "./reordercap.pod: unterminated list(s) at =head in paragraph 14. ignoring." 2013-05-20 14:56:18 +00:00
sgml.doc.template
text2pcap.pod Add a link to IANA's Assigned Internet Protocol Numbers page. 2013-09-11 17:31:24 +00:00
tshark.pod Add support for displaying dates as year and day-of-year (1-origin). 2013-11-06 20:39:09 +00:00
wireshark-filter.pod Fix all errors and warnings found by podchecker. 2013-06-07 17:06:27 +00:00
wireshark.pod.template Add support for displaying dates as year and day-of-year (1-origin). 2013-11-06 20:39:09 +00:00

README.xml-output

Protocol Dissection in XML Format
=================================
$Id$
Copyright (c) 2003 by Gilbert Ramirez <gram@alumni.rice.edu>


Wireshark has the ability to export its protocol dissection in an
XML format, tshark has similar functionality by using the "-Tpdml" 
option. 

The XML that wireshark produces follows the Packet Details Markup
Language (PDML) specified by the group at the Politecnico Di Torino
working on Analyzer. The specification can be found at:

http://analyzer.polito.it/30alpha/docs/dissectors/PDMLSpec.htm

That URL is not functioning any more, but a copy can be found at:

http://gd.tuwien.ac.at/.vhost/analyzer.polito.it/docs/dissectors/PDMLSpec.htm

A related XML format, the Packet Summary Markup Language (PSML), is
also defined by the Analyzer group to provide packet summary information.
The PSML format is not documented in a publicly-available HTML document,
but its format is simple. Wireshark can export this format too. Some day it 
may be added to tshark so that "-Tpsml" would produce PSML.

One wonders if the "-T" option should read "-Txml" instead of "-Tpdml"
(and in the future, "-Tpsml"), but if tshark was required to produce
another XML-based format of its protocol dissection, then "-Txml" would
be ambiguous.

PDML
====
The PDML that wireshark produces is known not to be loadable into Analyzer.
It causes Analyzer to crash. As such, the PDML that wireshark produces
is be labeled with a version number of "0", which means that the PDML does
not fully follow the PDML spec. Furthermore, a creator attribute in the
"<pdml>" tag gives the version number of wireshark/tshark that produced the PDML.
In that way, as the PDML produced by wireshark matures, but still does not
meet the PDML spec, scripts can make intelligent decisions about how to
best parse the PDML, based on the "creator" attribute.

A PDML file is delimited by a "<pdml>" tag.
A PDML file contains multiple packets, denoted by the "<packet>" tag.
A packet will contain multiple protocols, denoted by the "<proto>" tag.
A protocol might contain one or more fields, denoted by the "<field>" tag.

A pseudo-protocol named "geninfo" is produced, as is required by the PDML
spec, and exported as the first protocol after the opening "<packet>" tag.
Its information comes from wireshark's "frame" protocol, which serves
the similar purpose of storing packet meta-data. Both "geninfo" and
"frame" protocols are provided in the PDML output.

The "<pdml>" tag
================
Example:
	<pdml version="0" creator="wireshark/0.9.17">

The creator is "wireshark" (i.e., the "wireshark" engine. It will always say
"wireshark", not "tshark") version 0.9.17.


The "<proto>" tag
=================
"<proto>" tags can have the following attributes:

	name - the display filter name for the protocol
	showname - the label used to describe this protocol in the protocol
		tree. This is usually the descriptive name of the protocol,
		but it can be modified by dissectors to include more data
		(tcp can do this)
	pos - the starting offset within the packet data where this
		protocol starts
	size - the number of octets in the packet data that this protocol
		covers.

The "<field>" tag
=================
"<field>" tags can have the following attributes:

	name - the display filter name for the field
	showname - the label used to describe this field in the protocol
		tree. This is usually the descriptive name of the protocol,
		followed by some representation of the value.
	pos - the starting offset within the packet data where this
		field starts
	size - the number of octets in the packet data that this field
		covers.
	value - the actual packet data, in hex, that this field covers
	show - the representation of the packet data ('value') as it would
		appear in a display filter.

Some dissectors sometimes place text into the protocol tree, without using
a field with a field-name. Those appear in PDML as "<field>" tags with no
'name' attribute, but with a 'show' attribute giving that text.

Many dissectors label the undissected payload of a protocol as belonging
to a "data" protocol, and the "data" protocol usually resided inside
that last protocol dissected. In the PDML, The "data" protocol becomes
a "data" field, placed exactly where the "data" protocol is in wireshark's
protocol tree. So, if wireshark would normally show:

+-- Frame
|
+-- Ethernet
|
+-- IP
|
+-- TCP
|
+-- HTTP
    |
    +-- Data

In PDML, the "Data" protocol would become another field under HTTP:

<packet>
	<proto name="frame">
	...
	</proto>

	<proto name="eth">
	...
	</proto>

	<proto name="ip">
	...
	</proto>

	<proto name="tcp">
	...
	</proto>

	<proto name="http">
	...
		<field name="data" value="........."/>
	</proto>
</packet>



tools/WiresharkXML.py
====================
This is a python module which provides some infrastructure for
Python developers who wish to parse PDML. It is designed to read
a PDML file and call a user's callback function every time a packet
is constructed from the protocols and fields for a single packet.

The python user should import the module, define a callback function
which accepts one argument, and call the parse_fh function:

------------------------------------------------------------
import WiresharkXML

def my_callback(packet):
	# do something

# If the PDML is stored in a file, you can:
fh = open(xml_filename)
WiresharkXML.parse_fh(fh, my_callback)

# or, if the PDML is contained within a string, you can:
WiresharkXML.parse_string(my_string, my_callback)

# Now that the script has the packet data, do something.
------------------------------------------------------------

The object that is passed to the callback function is an
WiresharkXML.Packet object, which corresponds to a single packet.
WiresharkXML Provides 3 classes, each of which corresponds to a PDML tag:

	Packet	 - "<packet>" tag
	Protocol - "<proto>" tag
	Field    - "<field>" tag

Each of these classes has accessors which will return the defined attributes:

	get_name()
	get_showname()
	get_pos()
	get_size()
	get_value()
	get_show()

Protocols and fields can contain other fields. Thus, the Protocol and
Field class have a "children" member, which is a simple list of the
Field objects, if any, that are contained. The "children" list can be
directly accessed by code using the object. The "children" list will be
empty if this Protocol or Field contains no Fields.

Furthermore, the Packet class is a sub-class of the PacketList class.
The PacketList class provides methods to look for protocols and fields.
The term "item" is used when the item being looked for can be
a protocol or a field:

	item_exists(name) - checks if an item exists in the PacketList
	get_items(name) - returns a PacketList of all matching items


General Notes
=============
Generally, parsing XML is slow. If you're writing a script to parse
the PDML output of tshark, pass a read filter with "-R" to tshark to
try to reduce as much as possible the number of packets coming out of tshark.
The less your script has to process, the faster it will be.

'tools/msnchat' is a sample Python program that uses WiresharkXML to parse
PDML. Given one or more capture files, it runs tshark on each of them,
providing a read filter to reduce tshark's output. It finds MSN Chat
conversations in the capture file and produces nice HTML showing the
conversations. It has only been tested with capture files containing
non-simultaneous chat sessions, but was written to more-or-less handle any
number of simultaneous chat sessions.