diff options
author | Guy Harris <guy@alum.mit.edu> | 2000-09-09 10:26:58 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2000-09-09 10:26:58 +0000 |
commit | f0efbd1a0216cc5eca9beddd3b1bd64d6420e818 (patch) | |
tree | 274d5eb905c47271a6d8d41817cea20086aec986 /gtk/packet_win.c | |
parent | 6e04ac48f9d597f7f9a6a98410cd3c1ab13ece6f (diff) |
"redraw_hex_dump()" can't use "cfile.pd" or "cfile.current_frame", as it
may be redrawing a packet window that displays a frame other than the
current frame; give it arguments to specify the raw frame data and
"frame_data" structure for the frame.
This requires that each packet window have, associated with it, a
pointer to the "frame_data" structure; that replaces the "cap_len" and
"encoding" fields in a "PacketWinData" structure, as those are just
copies of fields from the frame's "frame_data" structure.
"packet_hex_print()" needn't be passed both the start and length values
from a "field_info" structure - just pass it a pointer to that
structure, or NULL for "no field is selected in the packet". It also
needn't, any longer, be passed the "cap_len" and "flags.encoding" fields
of a "frame_data" structure - just pass it a pointer to that structure.
In "redraw_hex_dump_all()", don't redraw the hex dump pane of the main
window if there is no current frame.
svn path=/trunk/; revision=2404
Diffstat (limited to 'gtk/packet_win.c')
-rw-r--r-- | gtk/packet_win.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/gtk/packet_win.c b/gtk/packet_win.c index 48084fe3cd..a5688dfa25 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.14 2000/09/08 10:59:18 guy Exp $ + * $Id: packet_win.c,v 1.15 2000/09/09 10:26:56 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@zing.org> @@ -70,8 +70,7 @@ /* Data structure holding information about a packet-detail window. */ struct PacketWinData { - gint cap_len; - gint encoding; + frame_data *frame; /* The frame being displayed */ union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */ guint8 *pd; /* Data for packet */ proto_tree *protocol_tree; /* Protocol tree for packet */ @@ -166,14 +165,13 @@ create_new_window ( char *Title, gint tv_size, gint bv_size){ /* Allocate data structure to represent this window. */ DataPtr = (struct PacketWinData *) g_malloc(sizeof(struct PacketWinData)); - DataPtr->cap_len = cfile.current_frame->cap_len; - DataPtr->encoding = cfile.current_frame->flags.encoding; + DataPtr->frame = cfile.current_frame; memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header); - DataPtr->pd = g_malloc(DataPtr->cap_len); - memcpy(DataPtr->pd, cfile.pd, DataPtr->cap_len); + DataPtr->pd = g_malloc(DataPtr->frame->cap_len); + memcpy(DataPtr->pd, cfile.pd, DataPtr->frame->cap_len); DataPtr->protocol_tree = proto_tree_create_root(); proto_tree_is_visible = TRUE; - dissect_packet(&DataPtr->pseudo_header, DataPtr->pd, cfile.current_frame, + dissect_packet(&DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame, DataPtr->protocol_tree); proto_tree_is_visible = FALSE; DataPtr->main = main_w; @@ -195,8 +193,7 @@ create_new_window ( char *Title, gint tv_size, gint bv_size){ /* draw the protocol tree & print hex data */ proto_tree_draw(DataPtr->protocol_tree, tree_view); - packet_hex_print( GTK_TEXT(byte_view), DataPtr->pd, - DataPtr->cap_len, -1, -1, DataPtr->encoding); + packet_hex_print(GTK_TEXT(byte_view), DataPtr->pd, DataPtr->frame, NULL); DataPtr->finfo_selected = NULL; gtk_widget_show(main_w); @@ -230,8 +227,7 @@ new_tree_view_select_row_cb(GtkCTree *ctree, GList *node, gint column, DataPtr->finfo_selected = finfo; packet_hex_print(GTK_TEXT(DataPtr->byte_view), DataPtr->pd, - DataPtr->cap_len, finfo->start, finfo->length, - DataPtr->encoding); + DataPtr->frame, finfo); } @@ -247,7 +243,7 @@ new_tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, DataPtr->finfo_selected = NULL; packet_hex_print(GTK_TEXT(DataPtr->byte_view), DataPtr->pd, - DataPtr->cap_len, -1, -1, DataPtr->encoding); + DataPtr->frame, NULL); } /* Functions called from elsewhere to act on all popup packet windows. */ @@ -274,7 +270,8 @@ redraw_hex_dump_cb(gpointer data, gpointer user_data) { struct PacketWinData *DataPtr = (struct PacketWinData *)data; - redraw_hex_dump(DataPtr->byte_view, DataPtr->finfo_selected); + redraw_hex_dump(DataPtr->byte_view, DataPtr->pd, + DataPtr->frame, DataPtr->finfo_selected); } /* Redraw the hex dump part of all the popup packet windows. */ |