diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2003-12-06 06:09:13 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2003-12-06 06:09:13 +0000 |
commit | 058ef64db8ce40909a18c91ab4805804362f80cb (patch) | |
tree | 767a7824daa712556971559e29e563658d643d51 /epan/proto.c | |
parent | 33b25ac15eac2e2cb4269377c41eada622c81fc1 (diff) |
Add the ability to print packet dissections in PDML (an XML-based format)
to tethereal. It could be added to Ethereal, but the GUI changes to
allow the user to select PDML as a print format have not been added.
Provide a python module (EtherealXML.py) to help parse PDML.
Provide a sample app (msnchat) which uses tethereal and EtherealXML.py
to reconstruct MSN Chat sessions from packet capture files. It produces
a nice HTML report of the chat sessions.
Document tethereal's PDML and EtherealXML.py usage in doc/README.xml-output
Update tethereal's manpage to reflect the new [-T pdml|ps|text] option
svn path=/trunk/; revision=9180
Diffstat (limited to 'epan/proto.c')
-rw-r--r-- | epan/proto.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c index 87d8d8e873..2a1ead0a1b 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -1,7 +1,7 @@ /* proto.c * Routines for protocol tree * - * $Id: proto.c,v 1.125 2003/12/04 19:53:53 guy Exp $ + * $Id: proto.c,v 1.126 2003/12/06 06:09:12 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -3312,6 +3312,46 @@ proto_get_finfo_ptr_array(proto_tree *tree, int id) } +/* Helper struct and function for proto_find_info() */ +typedef struct { + GPtrArray *array; + int id; +} ffdata_t; + +static gboolean +find_finfo(proto_node *node, gpointer data) +{ + field_info *fi = PITEM_FINFO(node); + if (fi && fi->hfinfo) { + if (fi->hfinfo->id == ((ffdata_t*)data)->id) { + g_ptr_array_add(((ffdata_t*)data)->array, fi); + } + } + + /* Don't stop traversing. */ + return FALSE; +} + +/* Return GPtrArray* of field_info pointers for all hfindex that appear in a tree. + * This works on any proto_tree, primed or unprimed, but actually searches + * the tree, so it is slower than using proto_get_finfo_ptr_array on a primed tree. + * The caller does need to free the returned GPtrArray with + * g_ptr_array_free(<array>, FALSE). + */ +GPtrArray* +proto_find_finfo(proto_tree *tree, int id) +{ + ffdata_t ffdata; + + ffdata.array = g_ptr_array_new(); + ffdata.id = id; + + proto_tree_traverse_pre_order(tree, find_finfo, &ffdata); + + return ffdata.array; +} + + typedef struct { guint offset; field_info *finfo; |