diff options
author | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-12-18 19:09:08 +0000 |
---|---|---|
committer | gram <gram@f5534014-38df-0310-8fa8-9805f1628bb7> | 2001-12-18 19:09:08 +0000 |
commit | d5d413b37cbb9a722294ac7bfd37d9201d5054fd (patch) | |
tree | 35f987f9914fead0fb5fefe79df280b7340831b4 /epan/epan.c | |
parent | 748114aaf4b25e5167b36e2046aca75f38290e41 (diff) |
Provide for per-protocol-tree data in the proto_tree code.
Put a hash-table of "interesting" fields in the per-proto-tree data.
The dfilter code records which fields/protocols are "interesting" (by which
I mean, their value or existence is checked). Thus, the proto_tree routines
can create special arrays of field_info*'s that are ready for the dfilter
engine to use during a filter operation.
Also store the "proto_tree_is_visible" boolean, renamed "visible", in
the per-proto-tree data.
Move epan_dissect_t to its own header file to make #include dependencies
easier to handle.
Provide epan_dissect_fill_in_columns(), which accepts just the epan_dissect_t*
as an argument.
epan_dissect_new() needs to be followed by epan_dissect_run() for the
dissection to actually take place. Between those two calls,
epan_dissect_prime_dfilter() can be run 0, 1, or multiple times in order to
prime the empty proto_tree with the "intersesting" fields from the dfilter_t.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4422 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/epan.c')
-rw-r--r-- | epan/epan.c | 61 |
1 files changed, 39 insertions, 22 deletions
diff --git a/epan/epan.c b/epan/epan.c index 20edfb4b42..4be784e8b2 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -1,6 +1,6 @@ /* epan.h * - * $Id: epan.c,v 1.14 2001/12/16 22:16:13 guy Exp $ + * $Id: epan.c,v 1.15 2001/12/18 19:09:03 gram Exp $ * * Ethereal Protocol Analyzer Library * @@ -11,14 +11,13 @@ #endif #include <glib.h> -#include <epan.h> +#include "epan.h" +#include "epan_dissect.h" #include "conversation.h" -#include "dfilter/dfilter.h" #include "except.h" #include "packet.h" -#include "proto.h" -#include "tvbuff.h" +#include "column-utils.h" /* * XXX - this takes the plugin directory as an argument, because @@ -74,37 +73,34 @@ epan_conversation_init(void) epan_dissect_t* -epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, - gboolean create_proto_tree, gboolean proto_tree_visible, - column_info *cinfo) +epan_dissect_new(gboolean create_proto_tree, gboolean proto_tree_visible) { epan_dissect_t *edt; edt = g_new(epan_dissect_t, 1); - /* start with empty data source list */ - if ( fd->data_src) - g_slist_free( fd->data_src); - fd->data_src = 0; - - /* - * Set the global "proto_tree_is_visible" to control whether - * to fill in the text representation field in the protocol - * tree fields. - */ - proto_tree_is_visible = proto_tree_visible; if (create_proto_tree) { edt->tree = proto_tree_create_root(); + proto_tree_set_visible(edt->tree, proto_tree_visible); } else { edt->tree = NULL; } - dissect_packet(edt, pseudo_header, data, fd, cinfo); + return edt; +} - proto_tree_is_visible = FALSE; +void +epan_dissect_run(epan_dissect_t *edt, void* pseudo_header, + const guint8* data, frame_data *fd, column_info *cinfo) +{ + /* start with empty data source list */ + if (fd->data_src) { + g_slist_free(fd->data_src); + } + fd->data_src = NULL; - return edt; + dissect_packet(edt, pseudo_header, data, fd, cinfo); } @@ -122,3 +118,24 @@ epan_dissect_free(epan_dissect_t* edt) g_free(edt); } + +static void +prime_dfilter(gpointer data, gpointer user_data) +{ + int hfid = GPOINTER_TO_INT(data); + proto_tree *tree = user_data; + + proto_tree_prime_hfid(tree, hfid); +} + +void +epan_dissect_prime_dfilter(epan_dissect_t *edt, dfilter_t* dfcode) +{ + dfilter_foreach_interesting_field(dfcode, prime_dfilter, edt->tree); +} + +void +epan_dissect_fill_in_columns(epan_dissect_t *edt) +{ + fill_in_columns(&edt->pi); +} |