aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.c
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2006-02-11 23:25:11 +0000
committerUlf Lamping <ulf.lamping@web.de>2006-02-11 23:25:11 +0000
commitcf94760fa4a1de9fdb1aa5a3152516699bceaf45 (patch)
tree1c665d6e6c1ad304187017b4cdbe4ecc3aba2532 /capture_opts.c
parentec37501696d809d932c6db398b71950b4beb4e36 (diff)
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_opts.c')
-rw-r--r--capture_opts.c74
1 files changed, 2 insertions, 72 deletions
diff --git a/capture_opts.c b/capture_opts.c
index 6c451458a1..a893ff6f9b 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -89,7 +89,7 @@ capture_opts_init(capture_options *capture_opts, void *cfile)
capture_opts->fork_child = -1; /* invalid process handle */
#ifdef _WIN32
- capture_opts->signal_pipe_fd = -1;
+ capture_opts->signal_pipe_write_fd = -1;
#endif
capture_opts->state = CAPTURE_STOPPED;
capture_opts->output_to_pipe = FALSE;
@@ -125,7 +125,7 @@ capture_opts_log(const char *log_domain, GLogLevelFlags log_level, capture_optio
g_log(log_domain, log_level, "ForkChild : %d", capture_opts->fork_child);
#ifdef _WIN32
- g_log(log_domain, log_level, "SignalPipeFd : %d", capture_opts->signal_pipe_fd);
+ g_log(log_domain, log_level, "SignalPipeWrite : %d", capture_opts->signal_pipe_write_fd);
#endif
}
@@ -231,67 +231,6 @@ get_ring_arguments(capture_options *capture_opts, const char *arg)
}
-#ifdef _WIN32
-/*
- * Given a string of the form "<pipe name>:<file descriptor>", as might appear
- * as an argument to a "-Z" option, parse it and set the arguments in
- * question. Return an indication of whether it succeeded or failed
- * in some fashion.
- */
-static gboolean
-get_pipe_arguments(capture_options *capture_opts, const char *arg)
-{
- gchar *p = NULL, *colonp;
- int pipe_fd;
-
-
- colonp = strchr(arg, ':');
- if (colonp == NULL)
- return TRUE;
-
- p = colonp;
- *p++ = '\0';
-
- /*
- * Skip over any white space (there probably won't be any, but
- * as we allow it in the preferences file, we might as well
- * allow it here).
- */
- while (isspace((guchar)*p))
- p++;
- if (*p == '\0') {
- /*
- * Put the colon back, so if our caller uses, in an
- * error message, the string they passed us, the message
- * looks correct.
- */
- *colonp = ':';
- return FALSE;
- }
-
- if (strcmp(arg,"sync") == 0) {
- /* associate stdout with sync pipe */
- pipe_fd = get_natural_int(p, "sync pipe file descriptor");
- if (dup2(pipe_fd, 1) < 0) {
- cmdarg_err("Unable to dup sync pipe handle");
- return FALSE;
- }
- } else if (strcmp(arg,"signal") == 0) {
- /* associate stdin with signal pipe */
- pipe_fd = get_natural_int(p, "signal pipe file descriptor");
- if (dup2(pipe_fd, 0) < 0) {
- cmdarg_err("Unable to dup signal pipe handle");
- return FALSE;
- }
- capture_opts->signal_pipe_fd = pipe_fd;
- }
-
- *colonp = ':'; /* put the colon back */
- return TRUE;
-}
-#endif
-
-
static int
capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg)
{
@@ -441,15 +380,6 @@ capture_opts_add_opt(capture_options *capture_opts, int opt, const char *optarg,
capture_opts->linktype = get_natural_int(optarg, "data link type");
#endif /* HAVE_PCAP_DATALINK_NAME_TO_VAL */
break;
-#ifdef _WIN32
- /* Hidden option supporting Sync mode */
- case 'Z': /* Write to pipe FD XXX */
- if (get_pipe_arguments(capture_opts, optarg) == FALSE) {
- cmdarg_err("Invalid or unknown -Z flag \"%s\"", optarg);
- return 1;
- }
- break;
-#endif /* _WIN32 */
default:
/* the caller is responsible to send us only the right opt's */
g_assert_not_reached();