diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2006-02-11 23:25:11 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2006-02-11 23:25:11 +0000 |
commit | cf94760fa4a1de9fdb1aa5a3152516699bceaf45 (patch) | |
tree | 1c665d6e6c1ad304187017b4cdbe4ecc3aba2532 /capture_loop.c | |
parent | ec37501696d809d932c6db398b71950b4beb4e36 (diff) | |
download | wireshark-cf94760fa4a1de9fdb1aa5a3152516699bceaf45.tar.gz wireshark-cf94760fa4a1de9fdb1aa5a3152516699bceaf45.tar.bz2 wireshark-cf94760fa4a1de9fdb1aa5a3152516699bceaf45.zip |
the point of no return ...
using dumpcap as the capture child for Ethereal.
dumpcap is a plain console application now, even for Win32 (so no WinMain, create_console and special piping stuff reguired). The undocumented command line option -Z will switch dumpcap into "child mode", using binary instead of plain text output messages to communicate with a parent Ethereal.
Ethereal's main.c no longer needs to distinguish between child mode or not, so some simplifying here.
capture_sync.c has to call dumpcap in a "hidden window" mode using CreateProcess instead of spawnvp, otherwise an uggly console window would appear. The handles created by _pipe doesn't seem to be inheritable for this function, using CreatePipe instead.
The file capture_loop.c is only needed by dumpcap, removed from Ethereal link objects.
Some debugging aid added and other minor cleanup done.
svn path=/trunk/; revision=17256
Diffstat (limited to 'capture_loop.c')
-rw-r--r-- | capture_loop.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/capture_loop.c b/capture_loop.c index 58745e7c12..3ae13f0492 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -1100,19 +1100,22 @@ capture_loop_stop_signal_handler(int signo _U_) static gboolean signal_pipe_stopped(void) { - /* some news from our parent (signal pipe)? -> just stop the capture */ + /* any news from our parent (stdin)? -> just stop the capture */ HANDLE handle; DWORD avail = 0; gboolean result; - handle = (HANDLE) _get_osfhandle (0); + handle = (HANDLE) GetStdHandle(STD_INPUT_HANDLE); result = PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL); - /*g_warning("check pipe: handle: %x result: %u avail: %u", handle, result, avail);*/ - if(!result || avail > 0) { /* peek failed or some bytes really available */ + + /* XXX - if not piping from stdin this fails */ + /*g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, + "Signal pipe: handle: %x result: %u avail: %u", handle, result, avail); + return FALSE;*/ return TRUE; } else { /* pipe ok and no bytes available */ @@ -1247,10 +1250,10 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct inpkts = capture_loop_dispatch(capture_opts, &ld, errmsg, sizeof(errmsg)); #ifdef _WIN32 - /*fprintf(stderr, "fd: %u ret: %u\n", capture_opts->signal_pipe_fd, signal_pipe_stopped());*/ + /*fprintf(stderr, "signal pipe ret: %u\n", signal_pipe_stopped());*/ /* any news from our parent (signal pipe)? -> just stop the capture */ - if (capture_opts->signal_pipe_fd != -1 && signal_pipe_stopped()) { + if (signal_pipe_stopped()) { ld.go = FALSE; } #endif |