forked from osmocom/wireshark
Remove proto_tree from capture_file and PacketWinData, since they
already contain a pointer to an epan_dissect_t, which contains the proto_tree. Routines calling epan_dissect_new() do not create their own proto_tree via proto_tree_create_root(); instead, they pass a boolean to epan_dissect_new() telling it whether it should create the root proto_tree. svn path=/trunk/; revision=4343
This commit is contained in:
parent
2026f857bc
commit
6542c18172
17
epan/epan.c
17
epan/epan.c
|
@ -1,6 +1,6 @@
|
||||||
/* epan.h
|
/* epan.h
|
||||||
*
|
*
|
||||||
* $Id: epan.c,v 1.11 2001/11/21 23:16:23 gram Exp $
|
* $Id: epan.c,v 1.12 2001/12/06 04:25:08 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal Protocol Analyzer Library
|
* Ethereal Protocol Analyzer Library
|
||||||
*
|
*
|
||||||
|
@ -74,7 +74,8 @@ epan_conversation_init(void)
|
||||||
|
|
||||||
|
|
||||||
epan_dissect_t*
|
epan_dissect_t*
|
||||||
epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, proto_tree *tree)
|
epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd,
|
||||||
|
gboolean create_proto_tree)
|
||||||
{
|
{
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
|
|
||||||
|
@ -85,8 +86,12 @@ epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, proto_
|
||||||
g_slist_free( fd->data_src);
|
g_slist_free( fd->data_src);
|
||||||
fd->data_src = 0;
|
fd->data_src = 0;
|
||||||
|
|
||||||
/* XXX - init tree */
|
if (create_proto_tree) {
|
||||||
edt->tree = tree;
|
edt->tree = proto_tree_create_root();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
edt->tree = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
dissect_packet(edt, pseudo_header, data, fd);
|
dissect_packet(edt, pseudo_header, data, fd);
|
||||||
|
|
||||||
|
@ -102,5 +107,9 @@ epan_dissect_free(epan_dissect_t* edt)
|
||||||
* would have incremented the usage count on that tvbuff_t*) */
|
* would have incremented the usage count on that tvbuff_t*) */
|
||||||
tvb_free_chain(edt->tvb);
|
tvb_free_chain(edt->tvb);
|
||||||
|
|
||||||
|
if (edt->tree) {
|
||||||
|
proto_tree_free(edt->tree);
|
||||||
|
}
|
||||||
|
|
||||||
g_free(edt);
|
g_free(edt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* epan.h
|
/* epan.h
|
||||||
*
|
*
|
||||||
* $Id: epan.h,v 1.8 2001/11/21 23:16:23 gram Exp $
|
* $Id: epan.h,v 1.9 2001/12/06 04:25:08 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal Protocol Analyzer Library
|
* Ethereal Protocol Analyzer Library
|
||||||
*
|
*
|
||||||
|
@ -55,7 +55,8 @@ typedef struct _epan_dissect_t {
|
||||||
} epan_dissect_t;
|
} epan_dissect_t;
|
||||||
|
|
||||||
epan_dissect_t*
|
epan_dissect_t*
|
||||||
epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd, proto_tree *tree);
|
epan_dissect_new(void* pseudo_header, const guint8* data, frame_data *fd,
|
||||||
|
gboolean create_proto_tree);
|
||||||
|
|
||||||
void
|
void
|
||||||
epan_dissect_free(epan_dissect_t* edt);
|
epan_dissect_free(epan_dissect_t* edt);
|
||||||
|
|
49
file.c
49
file.c
|
@ -1,7 +1,7 @@
|
||||||
/* file.c
|
/* file.c
|
||||||
* File I/O routines
|
* File I/O routines
|
||||||
*
|
*
|
||||||
* $Id: file.c,v 1.250 2001/12/06 02:21:24 guy Exp $
|
* $Id: file.c,v 1.251 2001/12/06 04:25:07 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -615,7 +615,7 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
{
|
{
|
||||||
apply_color_filter_args args;
|
apply_color_filter_args args;
|
||||||
gint i, row;
|
gint i, row;
|
||||||
proto_tree *protocol_tree = NULL;
|
gboolean create_proto_tree = FALSE;
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
GdkColor fg, bg;
|
GdkColor fg, bg;
|
||||||
|
|
||||||
|
@ -646,10 +646,10 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
a protocol tree against which a filter expression can be
|
a protocol tree against which a filter expression can be
|
||||||
evaluated. */
|
evaluated. */
|
||||||
if ((cf->dfcode != NULL && refilter) || filter_list != NULL)
|
if ((cf->dfcode != NULL && refilter) || filter_list != NULL)
|
||||||
protocol_tree = proto_tree_create_root();
|
create_proto_tree = TRUE;
|
||||||
|
|
||||||
/* Dissect the frame. */
|
/* Dissect the frame. */
|
||||||
edt = epan_dissect_new(pseudo_header, buf, fdata, protocol_tree);
|
edt = epan_dissect_new(pseudo_header, buf, fdata, create_proto_tree);
|
||||||
|
|
||||||
/* If we have a display filter, apply it if we're refiltering, otherwise
|
/* If we have a display filter, apply it if we're refiltering, otherwise
|
||||||
leave the "passed_dfilter" flag alone.
|
leave the "passed_dfilter" flag alone.
|
||||||
|
@ -674,11 +674,6 @@ add_packet_to_packet_list(frame_data *fdata, capture_file *cf,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* There are no more filters to apply, so we don't need any protocol
|
|
||||||
tree; free it if we created it. */
|
|
||||||
if (protocol_tree != NULL)
|
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
|
|
||||||
|
|
||||||
if (fdata->flags.passed_dfilter) {
|
if (fdata->flags.passed_dfilter) {
|
||||||
/* This frame passed the display filter, so add it to the clist. */
|
/* This frame passed the display filter, so add it to the clist. */
|
||||||
|
@ -766,7 +761,6 @@ read_packet(capture_file *cf, long offset)
|
||||||
const u_char *buf = wtap_buf_ptr(cf->wth);
|
const u_char *buf = wtap_buf_ptr(cf->wth);
|
||||||
frame_data *fdata;
|
frame_data *fdata;
|
||||||
int passed;
|
int passed;
|
||||||
proto_tree *protocol_tree;
|
|
||||||
frame_data *plist_end;
|
frame_data *plist_end;
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
|
|
||||||
|
@ -790,10 +784,8 @@ read_packet(capture_file *cf, long offset)
|
||||||
|
|
||||||
passed = TRUE;
|
passed = TRUE;
|
||||||
if (cf->rfcode) {
|
if (cf->rfcode) {
|
||||||
protocol_tree = proto_tree_create_root();
|
edt = epan_dissect_new(pseudo_header, buf, fdata, TRUE);
|
||||||
edt = epan_dissect_new(pseudo_header, buf, fdata, protocol_tree);
|
|
||||||
passed = dfilter_apply_edt(cf->rfcode, edt);
|
passed = dfilter_apply_edt(cf->rfcode, edt);
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
epan_dissect_free(edt);
|
epan_dissect_free(edt);
|
||||||
}
|
}
|
||||||
if (passed) {
|
if (passed) {
|
||||||
|
@ -1069,7 +1061,6 @@ print_packets(capture_file *cf, print_args_t *print_args)
|
||||||
guint32 progbar_quantum;
|
guint32 progbar_quantum;
|
||||||
guint32 progbar_nextstep;
|
guint32 progbar_nextstep;
|
||||||
guint32 count;
|
guint32 count;
|
||||||
proto_tree *protocol_tree;
|
|
||||||
gint *col_widths = NULL;
|
gint *col_widths = NULL;
|
||||||
gint data_width;
|
gint data_width;
|
||||||
gboolean print_separator;
|
gboolean print_separator;
|
||||||
|
@ -1197,7 +1188,7 @@ print_packets(capture_file *cf, print_args_t *print_args)
|
||||||
fdata->cinfo->col_buf[i][0] = '\0';
|
fdata->cinfo->col_buf[i][0] = '\0';
|
||||||
fdata->cinfo->col_data[i] = fdata->cinfo->col_buf[i];
|
fdata->cinfo->col_data[i] = fdata->cinfo->col_buf[i];
|
||||||
}
|
}
|
||||||
edt = epan_dissect_new(&cf->pseudo_header, cf->pd, fdata, NULL);
|
edt = epan_dissect_new(&cf->pseudo_header, cf->pd, fdata, FALSE);
|
||||||
fill_in_columns(fdata, &edt->pi);
|
fill_in_columns(fdata, &edt->pi);
|
||||||
cp = &line_buf[0];
|
cp = &line_buf[0];
|
||||||
line_len = 0;
|
line_len = 0;
|
||||||
|
@ -1233,15 +1224,12 @@ print_packets(capture_file *cf, print_args_t *print_args)
|
||||||
print_line(cf->print_fh, print_args->format, "\n");
|
print_line(cf->print_fh, print_args->format, "\n");
|
||||||
|
|
||||||
/* Create the logical protocol tree. */
|
/* Create the logical protocol tree. */
|
||||||
protocol_tree = proto_tree_create_root();
|
edt = epan_dissect_new(&cf->pseudo_header, cf->pd, fdata, TRUE);
|
||||||
edt = epan_dissect_new(&cf->pseudo_header, cf->pd, fdata, protocol_tree);
|
|
||||||
|
|
||||||
/* Print the information in that tree. */
|
/* Print the information in that tree. */
|
||||||
proto_tree_print(FALSE, print_args, (GNode *)protocol_tree,
|
proto_tree_print(FALSE, print_args, (GNode *)edt->tree,
|
||||||
fdata, cf->print_fh);
|
fdata, cf->print_fh);
|
||||||
|
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
|
|
||||||
if (print_args->print_hex) {
|
if (print_args->print_hex) {
|
||||||
/* Print the full packet data as hex. */
|
/* Print the full packet data as hex. */
|
||||||
print_hex_data(cf->print_fh, print_args->format, fdata);
|
print_hex_data(cf->print_fh, print_args->format, fdata);
|
||||||
|
@ -1392,7 +1380,6 @@ find_packet(capture_file *cf, dfilter_t *sfcode)
|
||||||
guint32 progbar_quantum;
|
guint32 progbar_quantum;
|
||||||
guint32 progbar_nextstep;
|
guint32 progbar_nextstep;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
proto_tree *protocol_tree;
|
|
||||||
gboolean frame_matched;
|
gboolean frame_matched;
|
||||||
int row;
|
int row;
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
|
@ -1457,12 +1444,10 @@ find_packet(capture_file *cf, dfilter_t *sfcode)
|
||||||
/* Is this packet in the display? */
|
/* Is this packet in the display? */
|
||||||
if (fdata->flags.passed_dfilter) {
|
if (fdata->flags.passed_dfilter) {
|
||||||
/* Yes. Does it match the search filter? */
|
/* Yes. Does it match the search filter? */
|
||||||
protocol_tree = proto_tree_create_root();
|
|
||||||
wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
wtap_seek_read(cf->wth, fdata->file_off, &cf->pseudo_header,
|
||||||
cf->pd, fdata->cap_len);
|
cf->pd, fdata->cap_len);
|
||||||
edt = epan_dissect_new(&cf->pseudo_header, cf->pd, fdata, protocol_tree);
|
edt = epan_dissect_new(&cf->pseudo_header, cf->pd, fdata, TRUE);
|
||||||
frame_matched = dfilter_apply_edt(sfcode, edt);
|
frame_matched = dfilter_apply_edt(sfcode, edt);
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
epan_dissect_free(edt);
|
epan_dissect_free(edt);
|
||||||
if (frame_matched) {
|
if (frame_matched) {
|
||||||
new_fd = fdata;
|
new_fd = fdata;
|
||||||
|
@ -1565,25 +1550,21 @@ select_packet(capture_file *cf, int row)
|
||||||
cf->pd, fdata->cap_len);
|
cf->pd, fdata->cap_len);
|
||||||
|
|
||||||
/* Create the logical protocol tree. */
|
/* Create the logical protocol tree. */
|
||||||
if (cf->protocol_tree)
|
|
||||||
proto_tree_free(cf->protocol_tree);
|
|
||||||
cf->protocol_tree = proto_tree_create_root();
|
|
||||||
proto_tree_is_visible = TRUE;
|
proto_tree_is_visible = TRUE;
|
||||||
if (cf->edt != NULL) {
|
if (cf->edt != NULL) {
|
||||||
epan_dissect_free(cf->edt);
|
epan_dissect_free(cf->edt);
|
||||||
cf->edt = NULL;
|
cf->edt = NULL;
|
||||||
}
|
}
|
||||||
cf->edt = epan_dissect_new(&cf->pseudo_header, cf->pd, cf->current_frame,
|
cf->edt = epan_dissect_new(&cf->pseudo_header, cf->pd, cf->current_frame, TRUE);
|
||||||
cf->protocol_tree);
|
|
||||||
proto_tree_is_visible = FALSE;
|
proto_tree_is_visible = FALSE;
|
||||||
|
|
||||||
/* Display the GUI protocol tree and hex dump.
|
/* Display the GUI protocol tree and hex dump.
|
||||||
XXX - why does the protocol tree not show up if we call
|
XXX - why does the protocol tree not show up if we call
|
||||||
"proto_tree_draw()" before calling "add_byte_views()"? */
|
"proto_tree_draw()" before calling "add_byte_views()"? */
|
||||||
clear_tree_and_hex_views();
|
clear_tree_and_hex_views();
|
||||||
add_byte_views(cf->current_frame, cfile.protocol_tree, tree_view,
|
add_byte_views(cf->current_frame, cf->edt->tree, tree_view,
|
||||||
byte_nb_ptr);
|
byte_nb_ptr);
|
||||||
proto_tree_draw(cf->protocol_tree, tree_view);
|
proto_tree_draw(cf->edt->tree, tree_view);
|
||||||
|
|
||||||
/* A packet is selected. */
|
/* A packet is selected. */
|
||||||
set_menus_for_selected_packet(TRUE);
|
set_menus_for_selected_packet(TRUE);
|
||||||
|
@ -1593,11 +1574,7 @@ select_packet(capture_file *cf, int row)
|
||||||
void
|
void
|
||||||
unselect_packet(capture_file *cf)
|
unselect_packet(capture_file *cf)
|
||||||
{
|
{
|
||||||
/* Destroy the protocol tree and epan_dissect_t for that packet. */
|
/* Destroy the epan_dissect_t for the unselected packet. */
|
||||||
if (cf->protocol_tree != NULL) {
|
|
||||||
proto_tree_free(cf->protocol_tree);
|
|
||||||
cf->protocol_tree = NULL;
|
|
||||||
}
|
|
||||||
if (cf->edt != NULL) {
|
if (cf->edt != NULL) {
|
||||||
epan_dissect_free(cf->edt);
|
epan_dissect_free(cf->edt);
|
||||||
cf->edt = NULL;
|
cf->edt = NULL;
|
||||||
|
|
3
file.h
3
file.h
|
@ -1,7 +1,7 @@
|
||||||
/* file.h
|
/* file.h
|
||||||
* Definitions for file structures and routines
|
* Definitions for file structures and routines
|
||||||
*
|
*
|
||||||
* $Id: file.h,v 1.87 2001/12/06 02:21:25 guy Exp $
|
* $Id: file.h,v 1.88 2001/12/06 04:25:07 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -84,7 +84,6 @@ typedef struct _capture_file {
|
||||||
frame_data *last_displayed; /* Last frame displayed */
|
frame_data *last_displayed; /* Last frame displayed */
|
||||||
column_info cinfo; /* Column formatting information */
|
column_info cinfo; /* Column formatting information */
|
||||||
frame_data *current_frame; /* Frame data for current frame */
|
frame_data *current_frame; /* Frame data for current frame */
|
||||||
proto_tree *protocol_tree; /* Protocol tree for currently selected packet */
|
|
||||||
epan_dissect_t *edt; /* Protocol dissection fo rcurrently selected packet */
|
epan_dissect_t *edt; /* Protocol dissection fo rcurrently selected packet */
|
||||||
FILE *print_fh; /* File we're printing to */
|
FILE *print_fh; /* File we're printing to */
|
||||||
#ifdef HAVE_LIBPCAP
|
#ifdef HAVE_LIBPCAP
|
||||||
|
|
14
gtk/main.c
14
gtk/main.c
|
@ -1,6 +1,6 @@
|
||||||
/* main.c
|
/* main.c
|
||||||
*
|
*
|
||||||
* $Id: main.c,v 1.216 2001/12/06 02:21:26 guy Exp $
|
* $Id: main.c,v 1.217 2001/12/06 04:25:09 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -555,21 +555,21 @@ tree_view_unselect_row_cb(GtkCTree *ctree, GList *node, gint column, gpointer us
|
||||||
}
|
}
|
||||||
|
|
||||||
void collapse_all_cb(GtkWidget *widget, gpointer data) {
|
void collapse_all_cb(GtkWidget *widget, gpointer data) {
|
||||||
if (cfile.protocol_tree)
|
if (cfile.edt->tree)
|
||||||
collapse_all_tree(cfile.protocol_tree, tree_view);
|
collapse_all_tree(cfile.edt->tree, tree_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void expand_all_cb(GtkWidget *widget, gpointer data) {
|
void expand_all_cb(GtkWidget *widget, gpointer data) {
|
||||||
if (cfile.protocol_tree)
|
if (cfile.edt->tree)
|
||||||
expand_all_tree(cfile.protocol_tree, tree_view);
|
expand_all_tree(cfile.edt->tree, tree_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void resolve_name_cb(GtkWidget *widget, gpointer data) {
|
void resolve_name_cb(GtkWidget *widget, gpointer data) {
|
||||||
if (cfile.protocol_tree) {
|
if (cfile.edt->tree) {
|
||||||
gint tmp = prefs.name_resolve;
|
gint tmp = prefs.name_resolve;
|
||||||
prefs.name_resolve = PREFS_RESOLV_ALL;
|
prefs.name_resolve = PREFS_RESOLV_ALL;
|
||||||
gtk_clist_clear ( GTK_CLIST(tree_view) );
|
gtk_clist_clear ( GTK_CLIST(tree_view) );
|
||||||
proto_tree_draw(cfile.protocol_tree, tree_view);
|
proto_tree_draw(cfile.edt->tree, tree_view);
|
||||||
prefs.name_resolve = tmp;
|
prefs.name_resolve = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*
|
*
|
||||||
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
||||||
*
|
*
|
||||||
* $Id: packet_win.c,v 1.26 2001/11/21 01:02:03 guy Exp $
|
* $Id: packet_win.c,v 1.27 2001/12/06 04:25:09 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -69,7 +69,6 @@ struct PacketWinData {
|
||||||
frame_data *frame; /* The frame being displayed */
|
frame_data *frame; /* The frame being displayed */
|
||||||
union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */
|
union wtap_pseudo_header pseudo_header; /* Pseudo-header for packet */
|
||||||
guint8 *pd; /* Data for packet */
|
guint8 *pd; /* Data for packet */
|
||||||
proto_tree *protocol_tree; /* Protocol tree for packet */
|
|
||||||
GtkWidget *main;
|
GtkWidget *main;
|
||||||
GtkWidget *tv_scrollw;
|
GtkWidget *tv_scrollw;
|
||||||
GtkWidget *tree_view;
|
GtkWidget *tree_view;
|
||||||
|
@ -167,10 +166,9 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
|
||||||
memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header);
|
memcpy(&DataPtr->pseudo_header, &cfile.pseudo_header, sizeof DataPtr->pseudo_header);
|
||||||
DataPtr->pd = g_malloc(DataPtr->frame->cap_len);
|
DataPtr->pd = g_malloc(DataPtr->frame->cap_len);
|
||||||
memcpy(DataPtr->pd, cfile.pd, 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;
|
proto_tree_is_visible = TRUE;
|
||||||
DataPtr->edt = epan_dissect_new(&DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame,
|
DataPtr->edt = epan_dissect_new(&DataPtr->pseudo_header, DataPtr->pd, DataPtr->frame,
|
||||||
DataPtr->protocol_tree);
|
TRUE);
|
||||||
proto_tree_is_visible = FALSE;
|
proto_tree_is_visible = FALSE;
|
||||||
DataPtr->main = main_w;
|
DataPtr->main = main_w;
|
||||||
DataPtr->tv_scrollw = tv_scrollw;
|
DataPtr->tv_scrollw = tv_scrollw;
|
||||||
|
@ -190,9 +188,9 @@ create_new_window(char *Title, gint tv_size, gint bv_size)
|
||||||
GTK_SIGNAL_FUNC(destroy_new_window), DataPtr);
|
GTK_SIGNAL_FUNC(destroy_new_window), DataPtr);
|
||||||
|
|
||||||
/* draw the protocol tree & print hex data */
|
/* draw the protocol tree & print hex data */
|
||||||
add_byte_views(DataPtr->frame, DataPtr->protocol_tree, tree_view,
|
add_byte_views(DataPtr->frame, DataPtr->edt->tree, tree_view,
|
||||||
DataPtr->bv_nb_ptr);
|
DataPtr->bv_nb_ptr);
|
||||||
proto_tree_draw(DataPtr->protocol_tree, tree_view);
|
proto_tree_draw(DataPtr->edt->tree, tree_view);
|
||||||
|
|
||||||
DataPtr->finfo_selected = NULL;
|
DataPtr->finfo_selected = NULL;
|
||||||
gtk_widget_show(main_w);
|
gtk_widget_show(main_w);
|
||||||
|
@ -204,7 +202,6 @@ destroy_new_window(GtkObject *object, gpointer user_data)
|
||||||
struct PacketWinData *DataPtr = user_data;
|
struct PacketWinData *DataPtr = user_data;
|
||||||
|
|
||||||
detail_windows = g_list_remove(detail_windows, DataPtr);
|
detail_windows = g_list_remove(detail_windows, DataPtr);
|
||||||
proto_tree_free(DataPtr->protocol_tree);
|
|
||||||
epan_dissect_free(DataPtr->edt);
|
epan_dissect_free(DataPtr->edt);
|
||||||
g_free(DataPtr->pd);
|
g_free(DataPtr->pd);
|
||||||
g_free(DataPtr);
|
g_free(DataPtr);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* print_dlg.c
|
/* print_dlg.c
|
||||||
* Dialog boxes for printing
|
* Dialog boxes for printing
|
||||||
*
|
*
|
||||||
* $Id: print_dlg.c,v 1.24 2001/07/17 05:32:44 hagbard Exp $
|
* $Id: print_dlg.c,v 1.25 2001/12/06 04:25:09 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -589,7 +589,7 @@ file_print_packet_cmd_cb(GtkWidget *widget, gpointer data) {
|
||||||
print_args.print_hex = FALSE;
|
print_args.print_hex = FALSE;
|
||||||
print_args.expand_all = TRUE;
|
print_args.expand_all = TRUE;
|
||||||
print_args.suppress_unmarked = FALSE;
|
print_args.suppress_unmarked = FALSE;
|
||||||
proto_tree_print(TRUE, &print_args, (GNode*) cfile.protocol_tree,
|
proto_tree_print(TRUE, &print_args, (GNode*) cfile.edt->tree,
|
||||||
cfile.current_frame, fh);
|
cfile.current_frame, fh);
|
||||||
print_finale(fh, prefs.pr_format);
|
print_finale(fh, prefs.pr_format);
|
||||||
close_print_dest(print_args.to_file, fh);
|
close_print_dest(print_args.to_file, fh);
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* proto_hier_stats.c
|
/* proto_hier_stats.c
|
||||||
* Routines for calculating statistics based on protocol.
|
* Routines for calculating statistics based on protocol.
|
||||||
*
|
*
|
||||||
* $Id: proto_hier_stats.c,v 1.4 2001/06/19 23:08:55 guy Exp $
|
* $Id: proto_hier_stats.c,v 1.5 2001/12/06 04:25:07 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@zing.org>
|
* By Gerald Combs <gerald@zing.org>
|
||||||
|
@ -123,24 +123,20 @@ process_frame(frame_data *frame, ph_stats_t* ps)
|
||||||
{
|
{
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
union wtap_pseudo_header phdr;
|
union wtap_pseudo_header phdr;
|
||||||
proto_tree *protocol_tree;
|
|
||||||
guint8 pd[WTAP_MAX_PACKET_SIZE];
|
guint8 pd[WTAP_MAX_PACKET_SIZE];
|
||||||
|
|
||||||
protocol_tree = proto_tree_create_root();
|
|
||||||
|
|
||||||
/* Load the frame from the capture file */
|
/* Load the frame from the capture file */
|
||||||
wtap_seek_read(cfile.wth, frame->file_off, &phdr,
|
wtap_seek_read(cfile.wth, frame->file_off, &phdr,
|
||||||
pd, frame->cap_len);
|
pd, frame->cap_len);
|
||||||
|
|
||||||
/* Dissect the frame */
|
/* Dissect the frame */
|
||||||
edt = epan_dissect_new(&phdr, pd, frame, protocol_tree);
|
edt = epan_dissect_new(&phdr, pd, frame, TRUE);
|
||||||
|
|
||||||
/* Get stats from this protocol tree */
|
/* Get stats from this protocol tree */
|
||||||
process_tree(protocol_tree, ps, frame->pkt_len);
|
process_tree(edt->tree, ps, frame->pkt_len);
|
||||||
|
|
||||||
/* Free our memory. */
|
/* Free our memory. */
|
||||||
epan_dissect_free(edt);
|
epan_dissect_free(edt);
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
21
tethereal.c
21
tethereal.c
|
@ -1,6 +1,6 @@
|
||||||
/* tethereal.c
|
/* tethereal.c
|
||||||
*
|
*
|
||||||
* $Id: tethereal.c,v 1.102 2001/12/04 23:38:53 guy Exp $
|
* $Id: tethereal.c,v 1.103 2001/12/06 04:25:07 gram Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -1239,7 +1239,6 @@ wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
capture_file *cf = args->cf;
|
capture_file *cf = args->cf;
|
||||||
wtap_dumper *pdh = args->pdh;
|
wtap_dumper *pdh = args->pdh;
|
||||||
frame_data fdata;
|
frame_data fdata;
|
||||||
proto_tree *protocol_tree;
|
|
||||||
int err;
|
int err;
|
||||||
gboolean passed;
|
gboolean passed;
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
|
@ -1247,11 +1246,9 @@ wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
cf->count++;
|
cf->count++;
|
||||||
if (cf->rfcode) {
|
if (cf->rfcode) {
|
||||||
fill_in_fdata(&fdata, cf, phdr, pseudo_header, offset);
|
fill_in_fdata(&fdata, cf, phdr, pseudo_header, offset);
|
||||||
protocol_tree = proto_tree_create_root();
|
edt = epan_dissect_new(pseudo_header, buf, &fdata, TRUE);
|
||||||
edt = epan_dissect_new(pseudo_header, buf, &fdata, protocol_tree);
|
|
||||||
passed = dfilter_apply_edt(cf->rfcode, edt);
|
passed = dfilter_apply_edt(cf->rfcode, edt);
|
||||||
} else {
|
} else {
|
||||||
protocol_tree = NULL;
|
|
||||||
passed = TRUE;
|
passed = TRUE;
|
||||||
edt = NULL;
|
edt = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1273,8 +1270,6 @@ wtap_dispatch_cb_write(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
exit(2);
|
exit(2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (protocol_tree != NULL)
|
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
if (edt != NULL)
|
if (edt != NULL)
|
||||||
epan_dissect_free(edt);
|
epan_dissect_free(edt);
|
||||||
if (cf->rfcode)
|
if (cf->rfcode)
|
||||||
|
@ -1335,10 +1330,10 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
cb_args_t *args = (cb_args_t *) user;
|
cb_args_t *args = (cb_args_t *) user;
|
||||||
capture_file *cf = args->cf;
|
capture_file *cf = args->cf;
|
||||||
frame_data fdata;
|
frame_data fdata;
|
||||||
proto_tree *protocol_tree;
|
|
||||||
gboolean passed;
|
gboolean passed;
|
||||||
print_args_t print_args;
|
print_args_t print_args;
|
||||||
epan_dissect_t *edt;
|
epan_dissect_t *edt;
|
||||||
|
gboolean create_proto_tree;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cf->count++;
|
cf->count++;
|
||||||
|
@ -1351,10 +1346,10 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
|
|
||||||
passed = TRUE;
|
passed = TRUE;
|
||||||
if (cf->rfcode || verbose)
|
if (cf->rfcode || verbose)
|
||||||
protocol_tree = proto_tree_create_root();
|
create_proto_tree = TRUE;
|
||||||
else
|
else
|
||||||
protocol_tree = NULL;
|
create_proto_tree = FALSE;
|
||||||
edt = epan_dissect_new(pseudo_header, buf, &fdata, protocol_tree);
|
edt = epan_dissect_new(pseudo_header, buf, &fdata, create_proto_tree);
|
||||||
if (cf->rfcode)
|
if (cf->rfcode)
|
||||||
passed = dfilter_apply_edt(cf->rfcode, edt);
|
passed = dfilter_apply_edt(cf->rfcode, edt);
|
||||||
if (passed) {
|
if (passed) {
|
||||||
|
@ -1367,7 +1362,7 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
print_args.print_hex = print_hex;
|
print_args.print_hex = print_hex;
|
||||||
print_args.expand_all = TRUE;
|
print_args.expand_all = TRUE;
|
||||||
print_args.suppress_unmarked = FALSE;
|
print_args.suppress_unmarked = FALSE;
|
||||||
proto_tree_print(FALSE, &print_args, (GNode *)protocol_tree,
|
proto_tree_print(FALSE, &print_args, (GNode *)edt->tree,
|
||||||
&fdata, stdout);
|
&fdata, stdout);
|
||||||
if (!print_hex) {
|
if (!print_hex) {
|
||||||
/* "print_hex_data()" will put out a leading blank line, as well
|
/* "print_hex_data()" will put out a leading blank line, as well
|
||||||
|
@ -1587,8 +1582,6 @@ wtap_dispatch_cb_print(u_char *user, const struct wtap_pkthdr *phdr,
|
||||||
having to wait until a standard I/O buffer fills up. */
|
having to wait until a standard I/O buffer fills up. */
|
||||||
if (line_buffered)
|
if (line_buffered)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (protocol_tree != NULL)
|
|
||||||
proto_tree_free(protocol_tree);
|
|
||||||
|
|
||||||
epan_dissect_free(edt);
|
epan_dissect_free(edt);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue