aboutsummaryrefslogtreecommitdiffstats
path: root/capture.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-04-12 21:44:55 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-04-12 21:44:55 +0000
commit7e9cedfed81ac84ac28b5f48e36c843025abe2c8 (patch)
tree8e6ac01a654fb5dfb8725e1c07c3fbc683fdab11 /capture.c
parentfcb74124f8072024a1608d7a65ffffa79f3832e7 (diff)
capture engine:
add a new feature to clear the currently captured packets and restart the capture with the previous parameters various code cleanup and minor bugfixes Win32: use millisecond resolution in capture_loop, to smooth screen update a bit (500ms instead of 1000ms) svn path=/trunk/; revision=14059
Diffstat (limited to 'capture.c')
-rw-r--r--capture.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/capture.c b/capture.c
index 951b02114b..5b4df8b907 100644
--- a/capture.c
+++ b/capture.c
@@ -102,6 +102,15 @@ capture_stop(capture_options *capture_opts)
sync_pipe_stop(capture_opts);
}
+
+void
+capture_clear(capture_options *capture_opts)
+{
+ capture_opts->restart = TRUE;
+ capture_stop(capture_opts);
+}
+
+
void
capture_kill_child(capture_options *capture_opts)
{
@@ -267,6 +276,7 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
file.
XXX - abort on a read error? */
+ main_window_update();
break;
case CF_READ_ABORTED:
@@ -325,8 +335,22 @@ capture_input_closed(capture_options *capture_opts)
cf_get_drops_known(capture_opts->cf), cf_get_drops(capture_opts->cf));
}
- /* We're not doing a capture any more, so we don't have a save file. */
- if(capture_opts->save_file) {
+ /* does the user wants to restart the current capture? */
+ if(capture_opts->restart) {
+ capture_opts->restart = FALSE;
+
+ unlink(capture_opts->save_file);
+
+ /* if it was a tempfile, throw away the old filename (so it will become a tempfile again) */
+ if(cf_is_tempfile(capture_opts->cf)) {
+ g_free(capture_opts->save_file);
+ capture_opts->save_file = NULL;
+ }
+
+ /* ... and start the capture again */
+ capture_start(capture_opts);
+ } else {
+ /* We're not doing a capture any more, so we don't have a save file. */
g_free(capture_opts->save_file);
capture_opts->save_file = NULL;
}