diff options
author | Gilbert Ramirez <gram@alumni.rice.edu> | 2001-12-18 19:09:08 +0000 |
---|---|---|
committer | Gilbert Ramirez <gram@alumni.rice.edu> | 2001-12-18 19:09:08 +0000 |
commit | 791f5774d0fdabdb706bfd7056e534713cc4e4d6 (patch) | |
tree | 35f987f9914fead0fb5fefe79df280b7340831b4 /gtk | |
parent | 4e013a44de86f8146cfd7d440adb67366e37273a (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.
svn path=/trunk/; revision=4422
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/colors.c | 21 | ||||
-rw-r--r-- | gtk/colors.h | 6 | ||||
-rw-r--r-- | gtk/decode_as_dlg.c | 3 | ||||
-rw-r--r-- | gtk/follow_dlg.c | 3 | ||||
-rw-r--r-- | gtk/main.c | 3 | ||||
-rw-r--r-- | gtk/menu.c | 3 | ||||
-rw-r--r-- | gtk/packet_win.c | 8 | ||||
-rw-r--r-- | gtk/print_dlg.c | 3 | ||||
-rw-r--r-- | gtk/proto_draw.c | 4 |
9 files changed, 42 insertions, 12 deletions
diff --git a/gtk/colors.c b/gtk/colors.c index 4bb1e5c3ed..1f7bb969e8 100644 --- a/gtk/colors.c +++ b/gtk/colors.c @@ -1,7 +1,7 @@ /* colors.c * Definitions for color structures and routines * - * $Id: colors.c,v 1.16 2001/12/02 00:16:02 guy Exp $ + * $Id: colors.c,v 1.17 2001/12/18 19:09:07 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -127,6 +127,25 @@ delete_color_filter(color_filter_t *colorf) g_free(colorf); } + +static void +prime_edt(gpointer data, gpointer user_data) +{ + color_filter_t *colorf = data; + epan_dissect_t *edt = user_data; + + epan_dissect_prime_dfilter(edt, colorf->c_colorfilter); +} + +/* Prime the epan_dissect_t with all the compiler + * color filters in 'filter_list'. */ +void +filter_list_prime_edt(epan_dissect_t *edt) +{ + g_slist_foreach(filter_list, prime_edt, edt); +} + + /* read filters from the file */ static gboolean read_filters(colfilter *filter) diff --git a/gtk/colors.h b/gtk/colors.h index 9c15030837..b5e80ff67d 100644 --- a/gtk/colors.h +++ b/gtk/colors.h @@ -1,7 +1,7 @@ /* colors.h * Definitions for color structures and routines * - * $Id: colors.h,v 1.4 2001/02/01 20:21:21 gram Exp $ + * $Id: colors.h,v 1.5 2001/12/18 19:09:07 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -28,6 +28,7 @@ #include "proto.h" #include "dfilter/dfilter.h" #include <gtk/gtk.h> +#include "epan.h" #define MAXCOLORS 255 #define MAX_COLOR_FILTER_NAME_LEN 33 @@ -67,4 +68,7 @@ void delete_color_filter(color_filter_t *colorf); gboolean get_color (GdkColor *new_color); +void +filter_list_prime_edt(epan_dissect_t *edt); + #endif diff --git a/gtk/decode_as_dlg.c b/gtk/decode_as_dlg.c index 7c023b18f0..13b45d64e5 100644 --- a/gtk/decode_as_dlg.c +++ b/gtk/decode_as_dlg.c @@ -1,6 +1,6 @@ /* decode_as_dlg.c * - * $Id: decode_as_dlg.c,v 1.20 2001/12/08 06:41:48 guy Exp $ + * $Id: decode_as_dlg.c,v 1.21 2001/12/18 19:09:07 gram Exp $ * * Routines to modify dissector tables on the fly. * @@ -45,6 +45,7 @@ #include "packet.h" #include "ipproto.h" #include "ui_util.h" +#include "epan_dissect.h" #undef DEBUG diff --git a/gtk/follow_dlg.c b/gtk/follow_dlg.c index 3bbf339022..69f3e0ab63 100644 --- a/gtk/follow_dlg.c +++ b/gtk/follow_dlg.c @@ -1,6 +1,6 @@ /* follow_dlg.c * - * $Id: follow_dlg.c,v 1.15 2001/12/12 21:38:58 gerald Exp $ + * $Id: follow_dlg.c,v 1.16 2001/12/18 19:09:07 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -70,6 +70,7 @@ #include "resolv.h" #include "util.h" #include "ui_util.h" +#include "epan_dissect.h" /* Show Stream */ typedef enum { diff --git a/gtk/main.c b/gtk/main.c index 45aa63efbc..ad3d32ba8c 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -1,6 +1,6 @@ /* main.c * - * $Id: main.c,v 1.218 2001/12/12 21:38:58 gerald Exp $ + * $Id: main.c,v 1.219 2001/12/18 19:09:08 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -113,6 +113,7 @@ #include <epan.h> #include <epan/filesystem.h> +#include <epan_dissect.h> #include "main.h" #include "timestamp.h" diff --git a/gtk/menu.c b/gtk/menu.c index 65a7f724c2..b66d278c40 100644 --- a/gtk/menu.c +++ b/gtk/menu.c @@ -1,7 +1,7 @@ /* menu.c * Menu routines * - * $Id: menu.c,v 1.57 2001/12/08 09:27:51 guy Exp $ + * $Id: menu.c,v 1.58 2001/12/18 19:09:08 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -61,6 +61,7 @@ #include "keys.h" #include "plugins.h" #include "tcp_graph.h" +#include "epan_dissect.h" GtkWidget *popup_menu_object; diff --git a/gtk/packet_win.c b/gtk/packet_win.c index e6a8433a33..29ebccbcad 100644 --- a/gtk/packet_win.c +++ b/gtk/packet_win.c @@ -3,7 +3,7 @@ * * Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com> * - * $Id: packet_win.c,v 1.29 2001/12/16 22:16:14 guy Exp $ + * $Id: packet_win.c,v 1.30 2001/12/18 19:09:08 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -63,6 +63,7 @@ #include "keys.h" #include "gtkglobals.h" #include "plugins.h" +#include "epan_dissect.h" /* Data structure holding information about a packet-detail window. */ struct PacketWinData { @@ -166,8 +167,9 @@ create_new_window(char *Title, gint tv_size, gint bv_size) memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header); DataPtr->pd = g_malloc(DataPtr->frame->cap_len); memcpy(DataPtr->pd, cfile.pd, DataPtr->frame->cap_len); - DataPtr->edt = epan_dissect_new(&DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame, - TRUE, TRUE, &cfile.cinfo); + DataPtr->edt = epan_dissect_new(TRUE, TRUE); + epan_dissect_run(DataPtr->edt, &DataPtr->pseudo_header, DataPtr->pd, + DataPtr->frame, &cfile.cinfo); DataPtr->main = main_w; DataPtr->tv_scrollw = tv_scrollw; DataPtr->tree_view = tree_view; diff --git a/gtk/print_dlg.c b/gtk/print_dlg.c index 255d8787aa..88ded60e5c 100644 --- a/gtk/print_dlg.c +++ b/gtk/print_dlg.c @@ -1,7 +1,7 @@ /* print_dlg.c * Dialog boxes for printing * - * $Id: print_dlg.c,v 1.26 2001/12/09 01:12:07 guy Exp $ + * $Id: print_dlg.c,v 1.27 2001/12/18 19:09:08 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -37,6 +37,7 @@ #include "simple_dialog.h" #include "ui_util.h" #include "dlg_utils.h" +#include "epan_dissect.h" /* On Win32, a GUI application apparently can't use "popen()" (it "returns an invalid file handle, if used in a Windows program, diff --git a/gtk/proto_draw.c b/gtk/proto_draw.c index 46c8f1f6e3..d031563593 100644 --- a/gtk/proto_draw.c +++ b/gtk/proto_draw.c @@ -1,7 +1,7 @@ /* proto_draw.c * Routines for GTK+ packet display * - * $Id: proto_draw.c,v 1.41 2001/11/20 10:37:16 guy Exp $ + * $Id: proto_draw.c,v 1.42 2001/12/18 19:09:08 gram Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -927,7 +927,7 @@ proto_tree_draw_node(GNode *node, gpointer data) struct proto_tree_draw_info info; struct proto_tree_draw_info *parent_info = (struct proto_tree_draw_info*) data; - field_info *fi = (field_info*) (node->data); + field_info *fi = PITEM_FINFO(node); gchar label_str[ITEM_LABEL_LENGTH]; gchar *label_ptr; GtkCTreeNode *parent; |