Commit Graph

356 Commits

Author SHA1 Message Date
Guy Harris 0129bb146c Simplify the argument list to cap_pipe_dispatch().
svn path=/trunk/; revision=17690
2006-03-21 09:36:07 +00:00
Guy Harris 6f5916eb36 In the capture_loop.c code, open the capture device for input before
doing anything with the output file, so that

	1) if the attempt to open the capture device fails, we don't
	   bother creating any output files;

	2) we could relinquish privileges permanently as soon as we
	   finish opening the capture device, so we don't have to give
	   them up temporarily when opening the output file, reclaim
	   them to open the input device, and then give them up
	   permanently;

(we already do that in Tethereal).

While we're at it, set the capture filter immediately after opening the
capture device, so we quit before opening capture devices if that fails.

svn path=/trunk/; revision=17468
2006-03-05 04:11:57 +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
Guy Harris e6886d90ce When capturing, we only support writing to libpcap files. Given that,
bypass Wiretap; that means we don't have to run the packet through
wtap_process_pcap_packet() and then undo that conversion in Wiretap if
we're just going to write it out, shortening the code path.

svn path=/trunk/; revision=17461
2006-03-04 22:33:04 +00:00
Guy Harris 39ab0e77d7 Clean up white space.
Don't warn about a live capture format other than libpcap format if
you're not capturing to a file.

Do warn about a maximum capture file specification if you're not
capturing to a file.

svn path=/trunk/; revision=17456
2006-03-03 10:17:04 +00:00
Guy Harris aed93fa46a Reject attempts to use packet capture options when we're reading a saved
capture file.

We don't support saving live captures in any format other than libpcap
format (and probably don't want to - we really want to avoid using
Wiretap in that case, as it requires us to Wiretapify captured packets,
which adds extra processing to the capture path); reject attempts to do
that.

svn path=/trunk/; revision=17436
2006-03-01 01:21:51 +00:00
Luis Ontanon 7be2fd30ab finish adding the tethereal's funnel.
svn path=/trunk/; revision=17397
2006-02-24 02:01:29 +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
Ulf Lamping e4e8df5e1d remove all calls to exit() from the capture_opts.c and replace them by status return values (0,1 or 2).
This way makes it much easier to debug, e.g. to set a common breakpoint if a command line parameter fails.

svn path=/trunk/; revision=17240
2006-02-10 02:05:30 +00:00
Luis Ontanon b5f22bf8a8 eXtenstion options access to the -X command line options
svn path=/trunk/; revision=17207
2006-02-07 22:08:12 +00:00
Guy Harris c897da2ded Move the code to relinquish set-UID and set-GID privileges to a routine
in epan/privileges.c.

svn path=/trunk/; revision=17181
2006-02-06 10:27:27 +00:00
Guy Harris 4c4f18eb3f Add code to check whether the app was started with special privileges
(e.g., set-UID or set-GID), and don't load user plugs if it is.

svn path=/trunk/; revision=17174
2006-02-06 03:11:34 +00:00
Ulf Lamping 864edeb5ac add matched coloring rule name and string to the frame dissector output (or nothing if no coloring rule matched or none was set)
svn path=/trunk/; revision=17068
2006-01-21 17:49:00 +00:00
Ulf Lamping a556628ece minor changes
svn path=/trunk/; revision=17012
2006-01-12 01:29:20 +00:00
Ulf Lamping 5a0037d568 fix usage output
fix -F command option handling (output list of available formats if missing of invalid)

svn path=/trunk/; revision=17011
2006-01-12 00:13:40 +00:00
Ulf Lamping 15f9051029 move output_to_pipe flag from tethereal's loop_data into capture_opts, so it can be used by dumpcap (capture_loop.c) as well
svn path=/trunk/; revision=16972
2006-01-07 01:29:45 +00:00
Ulf Lamping 161d4d7efd code cleanup: use "-" for all places, where stdin/stdout is meant
tethereal internally converted the stdout capture filename "-" into "" which doesn't make any real sense and only complicated things.

To make things even more confusing, wiretap expected "" for dump output and "-" for offline reading ...

svn path=/trunk/; revision=16962
2006-01-06 01:06:46 +00:00
Guy Harris 6919c9c80f Catch a combination of "-S" and "-w -" - you'll just get
non-human-readable and non-machine-readable garbage from that
combination.

Use an exit code of 1 for command-line argument syntax errors in some
more cases.

svn path=/trunk/; revision=16961
2006-01-05 23:44:16 +00:00
Guy Harris fe31c14685 Set "ld.save_file" when we start capturing, so we can report capture
errors.

Display output errors with either 'the file "XXX"' or 'the standard
output".

svn path=/trunk/; revision=16943
2006-01-04 09:49:18 +00:00
Guy Harris 3aef4f9dc6 Distinguish between "writing to the standard output" and "writing to a
pipe"; there's not much point in writing to the standard output if
you're *not* writing to a pipe, but....

"-b" doesn't necessarily imply a ring buffer - you can just request that
Tethereal keep switching files forever.

Standardize on an exit status of 1 for all those errors (there's a
sort-of convention, adhered to by many apps, that an exit status of 1
means a command-line argument error (as in "illegal flag" or "you
combined two flags that don't make sense together") and an exit status
of 2 is for other "run-time" errors.

svn path=/trunk/; revision=16942
2006-01-04 03:07:16 +00:00
Guy Harris c9b702ba1a Provide not only copyright information, but a GPL blurb, in all the
version/usage messages.

Put newlines at the end of various version strings.

svn path=/trunk/; revision=16870
2005-12-21 08:59:52 +00:00
Ulf Lamping fb6554117f some minor fixes: logging and comments fixed
svn path=/trunk/; revision=16819
2005-12-16 07:43:24 +00:00
Guy Harris eaee2b68c5 Constify a bunch of arguments and variables, to squelch compiler
warnings.

Include "wiretap/libpcap.h" in "capture_loop.h", to get its declarations
of data structures for headers in libpcap files.  This lets us remove
the includes of "wiretap/libpcap.h from files including
"capture_loop.h".

Make "log_func_ignore()" in "tethereal.c" static, and declare some of
its arguments unused.  Also get rid of an unused variable.

Include <pcap.h> before including "wiretap/wtap-capture.h", to declare
"struct pcap_pkthdr".

svn path=/trunk/; revision=16791
2005-12-14 07:29:38 +00:00
Ulf Lamping 79217bab2e HUGE STEP (hopefully toward the right direction):
remove a lot of redundant code from tethereal and use (move) stuff from capture_loop.c instead.

concentrate common capture related code in capture_opts.c, e.g. trying to find the right interface to capture from (command line option, preference, first usable) instead of duplicating this code over several files.

remove redundant code from dumpcap.c

this also implements command line option -D (and indexed interfaces at -i) for Ethereal and Dumpcap (as we have it in Tethereal already for a while)

svn path=/trunk/; revision=16787
2005-12-13 22:48:58 +00:00
Ulf Lamping 7e3a24418c rename pcap-....c/.h files to capture-pcap-....c/.h
this way, the capture prefix will "logically" group the files together and file browsers will also group them

we may want to move the files into a subdir capture later

svn path=/trunk/; revision=16691
2005-12-06 00:07:13 +00:00
Ulf Lamping fcd9e87872 fixed a typo
svn path=/trunk/; revision=16688
2005-12-05 22:49:10 +00:00
Ulf Lamping a1dc531677 replace all appearances of 'fprintf(stderr, "tethereal: ' with 'cmdarg_err("', this is:
a) smaller
b) makes it possible to use some functions for Ethereal too
c) is the wrong name now, as some outputs are not command line related :-(

use capture_opts_trim()

svn path=/trunk/; revision=16685
2005-12-05 21:32:12 +00:00
Ulf Lamping ca14992672 fix alphabetical order of OPTINIT string, v seems to be a controversial character :-)
svn path=/trunk/; revision=16642
2005-12-01 20:04:55 +00:00
Ulf Lamping 03b4388fe0 rephrase the error dialog if an interface couldn't be opened.
made the CaptureSetup wiki page more prominent
added some "headings" so some of the help subtopics are easier for "human grep" IMHO

svn path=/trunk/; revision=16592
2005-11-25 22:38:02 +00:00
Guy Harris 93e66072c1 Add support for the "-B" flag to Tethereal on Windows.
svn path=/trunk/; revision=16542
2005-11-18 06:12:17 +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
Guy Harris 15cd2aed30 Include <wiretap/file_util.h> to declare the eth_ routines.
svn path=/trunk/; revision=16407
2005-11-07 02:35:02 +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 544c0bc63c add missing #include "capture_errs.h"
svn path=/trunk/; revision=16137
2005-10-06 01:32:25 +00:00
Guy Harris bfcbcfb4ea Add a "capture_errs.c" routine to cough up error messages for capture
problems, and use the first routine in it in multiple places.

Get rid of DISSECTOR_SUPPORT_INCLUDES - just add its contents to
ETHEREAL_COMMON_INCLUDES.

svn path=/trunk/; revision=16109
2005-10-04 06:25:01 +00:00
Guy Harris 9e96a03e18 Add a note about 64-bit support in WinPcap to the capture errors on
Windows, and add the URL for the CaptureSetup page to the Tethereal
error.

svn path=/trunk/; revision=16103
2005-10-04 04:23:09 +00:00
Guy Harris 505e73ec39 Libpcap uses u_char; use it in our calls to libpcap routines and in our
libpcap callback routine (if it's not getting defined, <pcap.h> doesn't
work).

svn path=/trunk/; revision=15952
2005-09-22 02:00:38 +00:00
Guy Harris b093cc3697 Update to current reality (WinPcap 3.1) the messages shown on Windows if
a capture device open fails.

svn path=/trunk/; revision=15951
2005-09-22 01:53:54 +00:00
Ulf Lamping 79fac68d61 fix wtap_dump_flush function name and don't check for it's return value. We don't do this check in Ethereal either and we will recognize problems at next write anyway ...
svn path=/trunk/; revision=15805
2005-09-14 23:15:12 +00:00
Ulf Lamping 84cf7ce767 added compression support for capture file output. The Save/As dialog now has a checkbox "Compress with gzip"
currently limited to Ethereal and all the variants of libpcap filetypes only.

We might want to add output compression support to the other tools as well (tethereal, mergecap, ...).

We might also want to add support for the other filetypes, but this is only possible if the filetype functions doesn't use special output operations like fseek.

One bug is still left: if the input and output filetypes while saving are the same, Ethereal currently optimizes this by simply copy the binary file instead of using wiretap (so it will be faster but it will ignore the compress setting). 

Don't know a good workaround for this, as I don't know a way to find out if the input file is currently compressed or not. One idea might be to use a heuristic on the filesize (compared to the packet size summmary). Another workaround I see is to remove this optimization, which is of course not the way I like to do it ...

svn path=/trunk/; revision=15804
2005-09-14 21:57:30 +00:00
Guy Harris 8ab1ac71f8 Make usage messages fit within 80 characters.
svn path=/trunk/; revision=15676
2005-09-03 18:51:55 +00:00
Guy Harris b76a02df1c As with Ethereal, so with Tethereal; we're not a GNU program, don't say
we are.

svn path=/trunk/; revision=15675
2005-09-03 18:31:45 +00:00
Guy Harris a5bb1bc88c Fix a typo.
svn path=/trunk/; revision=15637
2005-08-31 18:49:14 +00:00
Guy Harris fab7006697 Set the time stamp precision; we need it when printing packet summary
lines.

Clean up indentation.

svn path=/trunk/; revision=15569
2005-08-27 18:15:42 +00:00
Ulf Lamping 723c80ea90 timestamp display precision:
- automatic adjustment depending on file format
- manual adjustment through menu items

save the setting in the recent file

svn path=/trunk/; revision=15534
2005-08-25 21:29:54 +00:00
Ulf Lamping 6f43fbb2f0 EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry!
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ...

What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere.

As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon.

Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way...

As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number...

svn path=/trunk/; revision=15520
2005-08-24 21:31:56 +00:00
Guy Harris 50d77b113c Rename epan/stat.[ch] to epan/stat_cmd_args.[ch] - it only deals with
implementing the "-z" command-line arguments, it doesn't deal with *all*
issues for stats.

svn path=/trunk/; revision=15483
2005-08-20 20:06:05 +00:00
Guy Harris 53b54d11ed Get rid of f_len field in capture_file structure - we can just keep
the length locally. within cf_read().

svn path=/trunk/; revision=15454
2005-08-20 02:14:01 +00:00
Guy Harris 38ec1644e6 Add APIs to Wiretap to return the file of the size as supplied by the OS
(so if the file's gzipped, it's *NOT* the size of the file after
uncompressing), and an approximation of the amount of that data read
sequentially so far.

Use those for various progress bars and the like.

Make the fstat() in the Ascend trace reader directly use wth->fd, as
it's inside Wiretap; that gets rid of the last caller of wtap_fd() (as
we're no longer directly using fstat() or lseek() in Ethereal), so get
rid of wtap_fd().

svn path=/trunk/; revision=15437
2005-08-19 19:40:00 +00:00