diff options
author | Guy Harris <guy@alum.mit.edu> | 2004-01-13 22:34:10 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2004-01-13 22:34:10 +0000 |
commit | 4dd10c66875f42caa8fafa6b276e29f645bba832 (patch) | |
tree | 5fb9c6f76df0e0b83294e1b120d21808cad4d886 /file.c | |
parent | 6c01a97497e2ce65b4783661d8466a86832a8cdb (diff) |
Add a routine "retap_packet()" that runs through all packets, dissecting
them and running all taps on them, but not reconstructing the packet
list. Use that in the IO-stat tap rather than "redissect_packet()"; the
latter does more work and redraws the display, neither of which are
necessary.
Call the filter callback when the Calc field is changed, to redraw the
graphs; that change also fixes things so that it's called when the
Filter field is changed.
Rename the "filter_button" member of an io_stat_graph_t to
"filter_field", as it's not the "Filter:" button, it's the text field
containing the filter expression.
svn path=/trunk/; revision=9659
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 50 |
1 files changed, 49 insertions, 1 deletions
@@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.340 2004/01/10 17:29:26 ulfl Exp $ + * $Id: file.c,v 1.341 2004/01/13 22:33:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1376,6 +1376,54 @@ process_specified_packets(capture_file *cf, packet_range_t *range, return ret; } +static gboolean +retap_packet(capture_file *cf _U_, frame_data *fdata, + union wtap_pseudo_header *pseudo_header, const guint8 *pd, + void *argsp _U_) +{ + epan_dissect_t *edt; + + /* If we have tap listeners, allocate a protocol tree root node, so that + we'll construct a protocol tree against which a filter expression can + be evaluated. */ + edt = epan_dissect_new(num_tap_filters != 0, FALSE); + tap_queue_init(edt); + epan_dissect_run(edt, pseudo_header, pd, fdata, NULL); + tap_push_tapped_queue(edt); + epan_dissect_free(edt); + + return TRUE; +} + +int +retap_packets(capture_file *cf) +{ + packet_range_t range; + + /* Iterate through the list of packets, dissecting all packets and + re-running the taps. */ + packet_range_init(&range); + packet_range_process_init(&range); + switch (process_specified_packets(cf, &range, "Refiltering statistics on", + "all packets", "Stop", retap_packet, + NULL)) { + case PSP_FINISHED: + /* Completed successfully. */ + break; + + case PSP_STOPPED: + /* Well, the user decided to abort the refiltering. + Return FALSE so our caller knows they did that. */ + return FALSE; + + case PSP_FAILED: + /* Error while retapping. */ + return FALSE; + } + + return TRUE; +} + typedef struct { print_args_t *print_args; gboolean print_separator; |