Commit Graph

71 Commits

Author SHA1 Message Date
Ulf Lamping de0981f611 disable the call to sync_pipe_errmsg_to_parent for now, if execv failed (so at least the *NIX versions compile again)
svn path=/trunk/; revision=17719
2006-03-24 11:05:46 +00:00
Guy Harris ad7ed41f04 Dumpcap probably has *no* windows.
svn path=/trunk/; revision=17716
2006-03-24 05:05:14 +00:00
Ulf Lamping fe3c3029aa Various code cleanup in the capture pipe stuff
svn path=/trunk/; revision=17714
2006-03-24 02:23:48 +00:00
Guy Harris 624db0dc41 Fix pipe_read_bytes() to return the total number of bytes read, not just
the number of bytes read in the last read() call done.

svn path=/trunk/; revision=17675
2006-03-19 20:39:49 +00:00
Ulf Lamping 069b26b2d9 fix bug #803: sync pipe on Win32 wasn't set to binary mode, so error message transport failed between Ethereal and dumpcap.
I've also changed the way the secondary error message is transported from former "header message 0 secondary 0" to "header header message 0 header secondary 0" as that might be a bit more clearer, and I'll need it for further development anyway.

I was using this while debugging and not recognizing the real problem - for about four hours :-(. I'll need this feature when doing the interface (and link layer type) browsing later (transferring this data from dumpcap to Ethereal) to get a full blown privilege seperation.

svn path=/trunk/; revision=17608
2006-03-13 00:30:51 +00:00
Ulf Lamping 209af8f5f0 debugging helper: if (for whatever reason) the message from dumpcap was invalid, try to print it. This was already helpful e.g. as a GLib warning was confusing the pipe handling
svn path=/trunk/; revision=17559
2006-03-09 22:13:51 +00:00
Gerald Combs 742493acd5 Take care of one last UTF-8 <-> UTF-16 conversion (assuming there aren't any
hiding behind casts).  Fixes bug 798.

Clean up whitespace.

svn path=/trunk/; revision=17550
2006-03-09 14:39:44 +00:00
Guy Harris cbe69401cc Pass two strings in capture child messages, so the child can send
primary and secondary error messages and let the parent worry about how
to display them.  This means dumpcap doesn't need stub routines for
generating the formatting tags for the primary and secondary messages.

Have a separate message for capture filter errors, so that the parent
can check whether the capture filter looks like a display filter and
report the appropriate message.  This means that dumpcap doesn't need a
stub routine for compiling display filters (a stub routine also means
that Ethereal won't do the check for capture filters that look like
display filters!).

svn path=/trunk/; revision=17465
2006-03-05 03:14:16 +00:00
Ulf Lamping 86cf71c5a0 fix some bugs introduced with command line encapsulation
svn path=/trunk/; revision=17341
2006-02-17 22:39:32 +00:00
Guy Harris 9124329ee2 We now quote args as necessary on Windows when constructing the command
line, so there's no need to quote them when adding the arguments.

svn path=/trunk/; revision=17332
2006-02-17 11:53:11 +00:00
Guy Harris bb3d513158 On Windows. quote arguments as necessary before sticking them into the
command line passed to Create_Process().

On UN*X, use "execv()", not "execvp()", as we now construct the absolute
pathname of "dumpcap".

svn path=/trunk/; revision=17330
2006-02-17 09:45:52 +00:00
Ulf Lamping 79053183c5 remove dependencies to pcap.h, so getting an idea what needs to be done by dumpcap in addition to the things already done now
various dumpcap related code cleanup: mainly #include's and capture engine related stuff

svn path=/trunk/; revision=17327
2006-02-17 02:18:48 +00:00
Guy Harris 4d94f994b5 At least on UN*X, the first argument - argv[0] - is supposed to be the
name of the program as used to run it (command name/path name).  Pass
that - otherwise, we pass "-i" as argv[0], and dumpcap ignores it and
treats the capture device as the first argument and doesn't handle it
correctly (i.e., it doesn't capture on that device).

svn path=/trunk/; revision=17277
2006-02-12 20:55:11 +00:00
Guy Harris 3607862994 Distinguish between pipe_read_block() returning 0 (EOF) or a negative
value (error reading).

svn path=/trunk/; revision=17276
2006-02-12 20:41:28 +00:00
Guy Harris 6009f7c549 Instead of using (commented-out) g_warning() calls to log errors reading
and writing the sync pipe, using g_log() calls at the G_LOG_LEVEL_DEBUG
or G_LOG_LEVEL_WARNING levels, so we can get at them if necessary.  Add
some messages for errors for which we had no logging.

svn path=/trunk/; revision=17275
2006-02-12 20:35:15 +00:00
Ulf Lamping d595d6a8da add a minor comment
svn path=/trunk/; revision=17270
2006-02-12 12:04:17 +00:00
Guy Harris b8136fbfa9 Add a routine to attempt to get the absolute pathname of the executable
file, strip off the last component to get the pathname of the directory
containing the executable file, and save it for future use.  On Windows,
you can get that from the OS, but, on UN*X, you have to look at argv[0]
and derive the absolute path from that (argv[0] is not guaranteed to be
an absolute path, or even a path at all).  (In addition, if you're
running from the build directory, you might have to strip off a ".libs/"
added to argv[0] as an artifact of the libtoolizing script.)

Use that in the About dialog, and use it to construct the path of
dumpcap.

Don't put quotes into the path of dumpcap; you don't have to quote
strings with spaces in them when handing them to execvp and, in fact,
you *mustn't* quote them, as the quotes will be treated as part of the
pathname.

svn path=/trunk/; revision=17267
2006-02-12 03:15:29 +00:00
Guy Harris 9077412e85 Fix up indentation.
svn path=/trunk/; revision=17262
2006-02-12 00:59:34 +00:00
Ulf Lamping 2af7f6b948 we still need sync_pipe_errmsg_to_parent() for the *NIX build
svn path=/trunk/; revision=17260
2006-02-12 00:03:10 +00:00
Ulf Lamping cf94760fa4 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
2006-02-11 23:25:11 +00:00
Ulf Lamping 0d9c276e90 only a backup, nothing changed for now.
second try to bring dumpcap to life. Currently it's working, but the child (dumpcap) will show an annoying Win32 console window while running. 

svn path=/trunk/; revision=17239
2006-02-10 01:27:23 +00:00
Ulf Lamping 3b36e59113 remove the setting of no longer required command line options:
-H (Hide capture info dialog)
-m (font to use)

svn path=/trunk/; revision=16807
2005-12-15 00:48:59 +00:00
Ulf Lamping 459c0b07b2 we don't use the command line option -W any longer, remove it from a comment
svn path=/trunk/; revision=16786
2005-12-13 22:35:28 +00:00
Ulf Lamping e829856c0c move the complete functionality of the capture info dialog from capture_loop.c to capture_info.c and call it from capture.c (instead of capture_loop.c).
This way, the capture child don't need to now any of the packet_counter things (no epan/packet.h and all alike).

Currently the capture_info code will always open another wiretap file instance to build it's own counter values. This isn't optimized for now (next step: use data from cf_continue_tail() somehow).

svn path=/trunk/; revision=16669
2005-12-04 02:04:18 +00:00
Ulf Lamping 0a2188eed6 add missing functions (to complete/cleanup of interface):
capture_input_drops
capture_input_error_message

and move the functionality from capture_sync.c to capture.c (just where it belongs)

svn path=/trunk/; revision=16663
2005-12-03 18:15:02 +00:00
Ulf Lamping 97d5241c60 precise some pipe message comments
svn path=/trunk/; revision=16660
2005-12-03 12:32:41 +00:00
Guy Harris 6753da5403 Make the message length in the sync pipe message header 3 bytes of
binary data, so the maximum message length can be up to 2^24-1.

Add a #define for that message size, and have it be 4096, for now, as
that was the size of the buffer used to read sync pipe messages.

Clean up white space.

When displaying an error message from the capture child, don't use it as
a format string - it could conceivably contain "%"s.  Instead, format it
with "%s".

svn path=/trunk/; revision=16541
2005-11-18 00:34:11 +00:00
Ulf Lamping c3187174bf replace *a lot* of file related calls by their GLib counterparts. This is necessary for the switch to GTK 2.6 (at least on WIN32).
to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place.

deleted related things from config.h.win32

As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon.

svn path=/trunk/; revision=16403
2005-11-06 22:43:25 +00:00
Ulf Lamping 4443681a9e fix Ethereal so command line capture parameter will work with kilobytes (again)
remove Byte(s) from the dropdown list of filesizes, this doesn't make sense
replace 1000 with 1024, as all (modern?) file managers are based on 1024 bytes for a kilobyte (the old KB vs. KiB controversy)

svn path=/trunk/; revision=16149
2005-10-07 03:34:27 +00:00
Ulf Lamping cf3b9f23e5 capture_sync.c(290) : warning C4090: 'function' : different 'const' qualifiers
capture_sync.c(290) : warning C4022: 'g_realloc' : pointer mismatch for actual parameter 1
capture_sync.c(431) : warning C4090: 'function' : different 'const' qualifiers
capture_sync.c(431) : warning C4022: 'g_free' : pointer mismatch for actual parameter 1
capture_sync.c(442) : warning C4090: 'function' : different 'const' qualifiers
capture_sync.c(442) : warning C4022: 'g_free' : pointer mismatch for actual parameter 1
capture_sync.c(549) : warning C4090: 'function' : different 'const' qualifiers
capture_sync.c(549) : warning C4022: 'g_free' : pointer mismatch for actual parameter 1

svn path=/trunk/; revision=15487
2005-08-20 22:16:12 +00:00
Jörg Mayer 956eee946f Some 'no previous declararion' warning fixes
svn path=/trunk/; revision=15355
2005-08-14 23:25:20 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Jörg Mayer 62b7cc3043 Last set of char -> const char trivial warning fixes.
svn path=/trunk/; revision=15244
2005-08-06 14:03:14 +00:00
Ulf Lamping ec246cae54 fix #148: (win32 only) use command line parameter -B to set capture buffer size
svn path=/trunk/; revision=14484
2005-05-30 04:46:25 +00:00
Ulf Lamping 6a853e1bc3 some cleanup of capture error notification handling
svn path=/trunk/; revision=14441
2005-05-26 19:06:01 +00:00
Ulf Lamping 5d404864f2 use the log features of the GLib to have verbose output of the capturing engine, e.g. GLib provides different domains for different submodules. Output more verbose than warning level will be disabled by default (just like before).
use the console_log_handler in main.c for win32 AND unix now

Currently use the log for the capturing engine (only), as I desperately needed a log output for debugging.


svn path=/trunk/; revision=14438
2005-05-26 17:50:27 +00:00
Ulf Lamping b3b72959a2 forgot to init savefilestring = NULL;
svn path=/trunk/; revision=14435
2005-05-25 22:20:46 +00:00
Ulf Lamping fbe12a9a22 fix #199: encapsulate capture filename, to avoid problems with spaces in the filename (win32 only)
svn path=/trunk/; revision=14432
2005-05-25 17:46:04 +00:00
Ulf Lamping be9bdd1fee (hopefully) removed various gcc warnings
svn path=/trunk/; revision=14241
2005-04-30 15:39:40 +00:00
Ulf Lamping 7e9cedfed8 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
2005-04-12 21:44:55 +00:00
Ulf Lamping 06ef0a3b52 it should now be possible to use "Update packets in real time" even if used with one of the "Multiple files" option.
If this is used together with an option where input files changes too fast (e.g. new file every second), capturing will be (hopefully) stopped.

I've replaced the former capture pipe message format into a somewhat more general format to remove a lot of confusion.


svn path=/trunk/; revision=14054
2005-04-12 00:54:52 +00:00
Ulf Lamping 61ccc8baf1 various capture code cleanup and fixes:
display filename in statusbar while capturing
print_usage banner fixed
cf_cb_live_capture_prepare no longer needed
rename sync_pipe_do_capture -> sync_pipe_start
bugfix: sync_pipe_input_wait_for_start replaced by former implementation
fix cleanup of old file in capture_input_new_file
fix a tempfile detection bug (named file showed up as tempfile after capture)

svn path=/trunk/; revision=14053
2005-04-11 18:57:19 +00:00
Ulf Lamping 7b7f7e7f9a Win32 only bugfix: as using TerminateProcess is the brute force way and sometimes clipped packets in the middle, now using a pipe called signal_pipe from the parent to the child for this.
On unix we're using kill() for this, which simply signals the child, but this isn't available on win32.

svn path=/trunk/; revision=14040
2005-04-10 16:43:22 +00:00
Ulf Lamping 3ee155a90a refactoring of the capture startup (while the capture parent waits for the child to start)
svn path=/trunk/; revision=14038
2005-04-10 14:29:12 +00:00
Guy Harris 5e096c5c19 Clean up white space, and tweak a comment slightly ("message" in the
error message case referred to the error message text, not the message
on the pipe).

svn path=/trunk/; revision=14035
2005-04-10 08:51:46 +00:00
Ulf Lamping e548ddf904 some minor changes
svn path=/trunk/; revision=13962
2005-03-28 21:35:21 +00:00
Ulf Lamping 0b132c9b1d bugfixes: bring non real-time captures back to former behaviour, other minor fixes
svn path=/trunk/; revision=13961
2005-03-28 21:05:53 +00:00
Ulf Lamping 9d6ac60cef remove capture_child flag from capture_opts as it's no longer required
svn path=/trunk/; revision=13954
2005-03-28 15:31:13 +00:00
Ulf Lamping daa67c79ba a lot more capture engine code cleanup
most notably:

- moved opening of safe_file to the capture child (capture_loop.c)
- removed save_file_fd from capture_opts (no longer need to have it global)

svn path=/trunk/; revision=13953
2005-03-28 14:39:31 +00:00
Ulf Lamping 7e78ef354e major capture engine rework: use two task model for EVERY capture mode
rework of the -b command line parameter (for Ethereal and Tethereal)

svn path=/trunk/; revision=13949
2005-03-28 00:19:02 +00:00