Commit Graph

78 Commits

Author SHA1 Message Date
Ulf Lamping d2a024af60 split capture.h into capture.h, capture_loop.h and capture_opts.h and place the parts into the corresponding files
svn path=/trunk/; revision=16664
2005-12-03 19:32:54 +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
Guy Harris 2f7fd680e2 Handle "-G" only in Tethereal - it doesn't work in Ethereal, and isn't
necessary there.

Add a "cmdarg_err()" routine to report command-line option errors; it
creates a console if necessary, and prints the command name and the
trailing newline.  Also add "cmdarg_err_cont()", which also creates a
console if necessary, and prints a trailing newline but no command name;
it's used to continue the message.  Use those, rather than
"g_warning()", for errors.

That means that we no longer need to pass the command name to various
command-line argument parsing routines.

svn path=/trunk/; revision=16526
2005-11-17 05:59:21 +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 4852c618d8 add a state member to the capture_opts, and set it according to the capture engine
svn path=/trunk/; revision=14205
2005-04-27 19:43:02 +00:00
Ulf Lamping 83dc83abd8 rename capture_clear() to capture_restart()
statusbar update should work now even in capture error case

svn path=/trunk/; revision=14105
2005-04-16 20:08:00 +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 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 2d1981f08b various (minor) capture code cleanup
svn path=/trunk/; revision=13957
2005-03-28 18:04:09 +00:00
Ulf Lamping b64ebb05c2 fix Solaris build (I've removed O_BINARY)
rename sync_mode to real_time_mode, as we using sync_mode all the time now, so the name is misleading

svn path=/trunk/; revision=13956
2005-03-28 16:14:34 +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
Jörg Mayer 58d8f2f652 - pcap.h needs to be included before capture.h
- As capture.h is empty without libpcap defined, only include it in that
  case and don't protect the file internally against libpcap any more.

svn path=/trunk/; revision=13648
2005-03-07 10:19:33 +00:00
Ulf Lamping 399c821254 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
2005-02-28 22:46:49 +00:00
Ulf Lamping e7fafa28c6 some clarification of the capture child thing
svn path=/trunk/; revision=13535
2005-02-27 17:30:33 +00:00
Ulf Lamping f2375c3127 minor comment additions
svn path=/trunk/; revision=13533
2005-02-27 16:54:52 +00:00
Ulf Lamping 0c03b4b002 CHILD_NAME is only used #ifdef HAVE_LIBPCAP
svn path=/trunk/; revision=13481
2005-02-23 21:04:19 +00:00
Ulf Lamping 72547c8d02 use the applications name (currently "ethereal" or "tethereal") in capture_opts, instead of hardcoded "ethereal" for both.
svn path=/trunk/; revision=13476
2005-02-23 08:34:12 +00:00
Guy Harris d83f7865ff Clean up indentation.
svn path=/trunk/; revision=13323
2005-02-06 22:06:31 +00:00
Ulf Lamping 3a63719e38 another two steps towards privilege seperation:
move another two capture related fields (iface and cfilter) from cfile to capture_opts

also move the handling of capture related command line options from main.c to capture.c, that way a future privilege seperated capture program can use the same code to parse it's command line than Ethereal. 
It might be even possible to share this parser code even with Tethereal, didn't took a closer look at this.

svn path=/trunk/; revision=13320
2005-02-06 21:20:35 +00:00
Ulf Lamping 97866a968b instead of initializing the capture_options in main.c, use the new function capture_opts_init
svn path=/trunk/; revision=13315
2005-02-06 00:13:00 +00:00
Ulf Lamping a1a2ae3180 rename kill_capture_child to capture_kill_child to have a common prefix
split drag and drop support out of main.c into new file drag_and_drop.c, to reduce the size of main.c a bit.

Hopefully this won't break unix builds because of missing #include's, I will keep an eye on the buildbot

svn path=/trunk/; revision=13308
2005-02-05 15:35:25 +00:00
Ulf Lamping 49b4e57a10 updated some comments
svn path=/trunk/; revision=13301
2005-02-05 11:37:56 +00:00
Ulf Lamping dd71ad695f (some) redesign of capture data structures.
don't use global cfile at all but only an untpyed handle to call the cf_... functions in file.c
move the save_file member from capture_file to capture_opts, as it's only used while capturing and while preparing it

svn path=/trunk/; revision=13276
2005-02-04 01:29:29 +00:00
Ulf Lamping 9ff19a4c94 move capture_file_fd field from capture_file to capture_opts type, as this is the place where it should be
svn path=/trunk/; revision=13268
2005-02-03 22:48:20 +00:00
Ulf Lamping d9be4670a7 move global capture_child flag into capture_options
svn path=/trunk/; revision=12855
2004-12-29 12:37:06 +00:00
Ulf Lamping 2ed93e96bd Don't use a global capture_opts in the capturing engine (this isn't a good idea). Do some more "housekeeping" in the capturing part.
Hopefully the unspecified forward declaration of capture_options_t in main.h is portable, but buildbot will tell me. This way I need the internals of that struct only at the places I really use it.

svn path=/trunk/; revision=12853
2004-12-29 09:09:35 +00:00
Ulf Lamping 7445ecfd05 split capture_loop from capture.c, some more code cleanup
svn path=/trunk/; revision=12451
2004-10-30 17:50:51 +00:00
Ulf Lamping bdfe1d7fc8 move quit_after_cap into capture_opts
svn path=/trunk/; revision=12449
2004-10-30 14:30:52 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
they have LF at the end of the line on UN*X and CR/LF on Windows;
hopefully this means that if a CR/LF version is checked in on Windows,
the CRs will be stripped so that they show up only when checked out on
Windows, not on UN*X.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Gerald Combs 04d996b183 Make sure child processes don't create a splash screen. Make the verbs in
the splash screen messages present participles.

svn path=/trunk/; revision=11321
2004-07-06 19:16:04 +00:00
Ulf Lamping 7e8187df20 added an option to "avoid" the capture info dialog completely.
This matters for "update of list in real time" (sync_mode) only,
as in normal mode you wouldn't otherwise have the possibility
to stop the capture.

svn path=/trunk/; revision=11194
2004-06-20 13:39:44 +00:00
Ulf Lamping fa7a022db3 add more details for doxygen
svn path=/trunk/; revision=11107
2004-06-04 17:19:01 +00:00
Michael Tüxen 254aba8282 From Jon Oberheide: Add interface name to the capture and ethereal window
while capturing.

svn path=/trunk/; revision=10594
2004-04-13 18:01:40 +00:00
Ulf Lamping 6c9a1dc093 experimental: make usage of pcap_setbuff to increase the kernel buffer size
svn path=/trunk/; revision=10377
2004-03-13 22:49:30 +00:00
Ulf Lamping cb5a386901 fixed differences between capture GUI frontend and backend
svn path=/trunk/; revision=10303
2004-03-04 19:31:21 +00:00
Ulf Lamping ecf2665992 implemented capture dialog 3rd (+x) proposal
svn path=/trunk/; revision=10279
2004-03-02 22:07:23 +00:00
Ulf Lamping b151b6d215 Capturing: "Number of files" switches between normal and multiple mode,
"Use ring buffer" switches between multiple single run and real ring buffer

svn path=/trunk/; revision=10257
2004-02-28 16:21:11 +00:00
Ulf Lamping 2509c20b61 quit_after_cap should be a gboolean, not an int, and it should be initialized
svn path=/trunk/; revision=10169
2004-02-21 13:40:06 +00:00
Ulf Lamping ba50469654 rework of capture.c: better seperation of sync and capture pipe by using
explicit names and seperated functionality of do_capture(),
but no functional change!

svn path=/trunk/; revision=10168
2004-02-21 12:58:42 +00:00
Ulf Lamping bca18fcf68 seperated capture dialog from capture.c and put into new gtk/capture_info_dlg.c
svn path=/trunk/; revision=8968
2003-11-15 08:48:14 +00:00
Guy Harris 219b6cefa2 Based on a patch from Brian Fundakowski Feldman, add support for setting
link-layer type when capturing, using the "pcap_set_datalink()" and
related APIs.

svn path=/trunk/; revision=8848
2003-11-01 02:30:18 +00:00
Guy Harris 2e98c97118 Don't pop up tap windows specified with "-z" options until we have a
capture file open.

svn path=/trunk/; revision=8480
2003-09-15 23:15:32 +00:00
Laurent Deniel 3070b797d5 Implement a ring buffer switch duration:
when the new "Rotate capture file every n second(s)" checkbox or the
-b <# of file>[:<duration>] argument are used, [t]ethereal will skip to the
next ring buffer file if the specified duration has elapsed (even if the
specified capture size is not reached). This is useful when you want to have
separate capture files per hour or day for instance.

I let the autostop filesize parameter mandatory (i.e. the "rotate capture
file after n kilobytes") but this could be no longer strictly necessary when
that new feature is used ...

Another point: it might be interesting to really truncate the file at the
switch and not the closure ... According to user comments and my own real
case tests, I might plan to enhance this point and others (still ring buffer
related) in the future.

svn path=/trunk/; revision=7678
2003-05-15 13:40:20 +00:00
Guy Harris 2f10d65eb2 From Albert Chin: "sync_pipe[]" isn't exported by "capture.c", so it
shouldn't be declared in "capture.h".

svn path=/trunk/; revision=6886
2003-01-09 19:37:14 +00:00
Guy Harris 5e8ecbaf46 From Graeme Hewson:
Currently Ethereal sets and uses a default directory for reading
	and writing, but only in some places.  This set of patches extends
	the setting of the default directory to the -w option as well as
	the -r option, and causes all file dialogs to use and set the
	default consistently.  (I haven't changed the
	Preferences/Printing/File dialog, though, as that's a special
	case.)

	There's also a fix for a bug where Ethereal was issuing the
	message "Ring buffer requested, but capture isn't being saved to
	a permanent file" even though a file was specified with -w.

There also appear to be some other cleanups in his patch.

svn path=/trunk/; revision=6238
2002-09-09 20:39:01 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Guy Harris 541c654ff0 Put all the capture options into a structure.
Move the ringbuffer capture options from the "capture_file" structure to
the structure for capture options, as they're a property of an
in-progress capture, not a property of a particular capture file.

svn path=/trunk/; revision=4799
2002-02-24 09:25:36 +00:00
Guy Harris 8bd63530ed "autostop_filesize" and "autostop_duration" don't need to be in the
"capture_file" structure - they're a property of an in-progress capture,
not a property of an open capture file.  Make them just variables.

The maximum number of packets to be captured should be a variable
separate from the "count" field in the "capture_file" structure - the
latter is a count of the packets in the capture file in question.

Have Boolean variables indicating whether a maximum packet count,
maximum capture file size, and maximum capture duration were specified.
If an option isn't set, and we're doing an "update list of packets in
real time" capture, don't pass the option to the child process with a
command-line argument.

Don't create "stop when the capture file reaches this size" or "stop
when the capture's run for this long" conditions if a maximum capture
file size or a maximum capture duration, respectively, haven't been
specified.  Don't test or free a condition if it wasn't created.

Don't allow a 0 argument to the "-c" flag - the absence of a "-c" flag
is the way you specify "no limit on the number of packets".

Initialize the check boxes and spin buttons for the "maximum packets to
capture", "maximum capture size", and "maximum capture duration" options
to the values they had in the last capture.  If an option wasn't
specified, don't read its value from the dialog box and set the
variable.

svn path=/trunk/; revision=4795
2002-02-24 03:33:05 +00:00
Guy Harris 89a4acb438 Have Wiretap set the snapshot length to 0 if it can't be derived from
reading the capture file.  Have callers of "wtap_snapshot_length()"
treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so
that, when writing a capture file in a format that *does* store the
snapshot length, we can at least put *something* in the file).

If we don't know the snapshot length of the current capture file, don't
display a value in the summary window.

Don't use "cfile.snap" as the snapshot length option when capturing -
doing so causes Ethereal to default, when capturing, to the snapshot
length of the last capture file that you read in, rather than to the
snapshot length of the last capture you did (or the initial default of
"no snapshot length").

Redo the "Capture Options" dialog box to group options into sections
with frames around them, and add units to the snapshot length, maximum
file size, and capture duration options, as per a suggestion by Ulf
Lamping.  Also add units to the capture count option.

Make the snapshot length, capture count, maximum file size, and capture
duration options into a combination of a check box and a spin button.
If the check box is not checked, the limit in question is inactive
(snapshot length of 65535, no max packet count, no max file size, no max
capture duration); if it's checked, the spinbox specifies the limit.
Default all of the check boxes to "not checked" and all of the spin
boxes to small values.

Use "gtk_toggle_button_get_active()" rather than directly fetching the
state of a check box.

svn path=/trunk/; revision=4709
2002-02-08 10:07:41 +00:00