diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2005-02-28 22:46:49 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2005-02-28 22:46:49 +0000 |
commit | 399c8212543cbeadd00aa69cd090856ca1f7e64a (patch) | |
tree | 8209e606f3916a26eca6e7d97362bb4bf137ac75 /capture.c | |
parent | 88ffe080662114e43b002a8cd3dd279b6a3ccdc1 (diff) |
Another step towards using the parent/child mode for ALL captures.
This is currently still disabled, as we cannot pass all required capture flags to the child process (lack of command line parameters).
svn path=/trunk/; revision=13558
Diffstat (limited to 'capture.c')
-rw-r--r-- | capture.c | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -165,7 +165,15 @@ do_capture(capture_options *capture_opts) /* close the currently loaded capture file */ cf_close(capture_opts->cf); - if (capture_opts->sync_mode) { + /* We could simply use TRUE for this expression now, this will work for all + * captures except for some of the multiple files options, as these capture + * options currently cannot be passed through the command line to the + * capture child. + * + * If this is fixed, we could always use the sync mode, throwing away the + * normal mode completely and doing some more cleanup. */ +/* if (TRUE) {*/ + if (capture_opts->sync_mode) { /* sync mode: do the capture in a child process */ ret = sync_pipe_do_capture(capture_opts, is_tempfile); /* capture is still running */ @@ -182,9 +190,9 @@ do_capture(capture_options *capture_opts) /* we've succeeded a capture, try to read it into a new capture file */ -static gboolean -capture_read(capture_options *capture_opts, gboolean is_tempfile, gboolean stats_known, -struct pcap_stat stats) +gboolean +capture_read(capture_options *capture_opts, gboolean is_tempfile, gboolean drops_known, +guint32 drops) { int err; @@ -218,7 +226,7 @@ struct pcap_stat stats) we'll put them into the capture file that we write, and will thus not have to set them here - "cf_read()" will get them from the file and use them. */ - if (stats_known) { + if (drops_known) { cf_set_drops_known(capture_opts->cf, TRUE); /* XXX - on some systems, libpcap doesn't bother filling in @@ -229,7 +237,7 @@ struct pcap_stat stats) several statistics - perhaps including various interface error statistics - and would tell us which of them it supplies, allowing us to display only the ones it does. */ - cf_set_drops(capture_opts->cf, stats.ps_drop); + cf_set_drops(capture_opts->cf, drops); } switch (cf_read(capture_opts->cf)) { @@ -277,7 +285,7 @@ normal_do_capture(capture_options *capture_opts, gboolean is_tempfile) } if (succeeded) { /* We succeed in doing the capture, try to read it in. */ - succeeded = capture_read(capture_opts, is_tempfile, stats_known, stats); + succeeded = capture_read(capture_opts, is_tempfile, stats_known, stats.ps_drop); } /* wether the capture suceeded or not, we have to close the output file here */ @@ -325,7 +333,7 @@ void capture_stop(capture_options *capture_opts) { /* stop the capture child, if we have one */ - if (capture_opts->sync_mode) { + if (!capture_opts->capture_child) { sync_pipe_stop(capture_opts); } @@ -337,7 +345,7 @@ void capture_kill_child(capture_options *capture_opts) { /* kill the capture child, if we have one */ - if (capture_opts->sync_mode) { + if (!capture_opts->capture_child) { sync_pipe_kill(capture_opts); } } |