aboutsummaryrefslogtreecommitdiffstats
path: root/tethereal.c
AgeCommit message (Collapse)AuthorFilesLines
2006-03-21Simplify the argument list to cap_pipe_dispatch().guy1-3/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17690 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-05In the capture_loop.c code, open the capture device for input beforeguy1-6/+6
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17468 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-05Pass two strings in capture child messages, so the child can sendguy1-52/+74
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!). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17465 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-04When capturing, we only support writing to libpcap files. Given that,guy1-62/+84
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17461 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-03Clean up white space.guy1-149/+151
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17456 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-01Reject attempts to use packet capture options when we're reading a savedguy1-32/+78
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17436 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-24finish adding the tethereal's funnel.lego1-0/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17397 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-17remove dependencies to pcap.h, so getting an idea what needs to be done by ↵ulfl1-0/+17
dumpcap in addition to the things already done now various dumpcap related code cleanup: mainly #include's and capture engine related stuff git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17327 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-10remove all calls to exit() from the capture_opts.c and replace them by ↵ulfl1-5/+9
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17240 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-07eXtenstion options access to the -X command line optionslego1-3/+8
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17207 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-06Move the code to relinquish set-UID and set-GID privileges to a routineguy1-15/+10
in epan/privileges.c. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17181 f5534014-38df-0310-8fa8-9805f1628bb7
2006-02-06Add code to check whether the app was started with special privilegesguy1-0/+6
(e.g., set-UID or set-GID), and don't load user plugs if it is. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17174 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-21add matched coloring rule name and string to the frame dissector output (or ↵ulfl1-0/+1
nothing if no coloring rule matched or none was set) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17068 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-12minor changesulfl1-4/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17012 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-12fix usage output ulfl1-38/+83
fix -F command option handling (output list of available formats if missing of invalid) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17011 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-07move output_to_pipe flag from tethereal's loop_data into capture_opts, so it ↵ulfl1-67/+26
can be used by dumpcap (capture_loop.c) as well git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16972 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-06code cleanup: use "-" for all places, where stdin/stdout is meantulfl1-10/+9
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 ... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16962 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-05Catch a combination of "-S" and "-w -" - you'll just getguy1-4/+13
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16961 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-04Set "ld.save_file" when we start capturing, so we can report captureguy1-21/+46
errors. Display output errors with either 'the file "XXX"' or 'the standard output". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16943 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-04Distinguish between "writing to the standard output" and "writing to aguy1-17/+26
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16942 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-21Provide not only copyright information, but a GPL blurb, in all theguy1-7/+19
version/usage messages. Put newlines at the end of various version strings. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16870 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-16some minor fixes: logging and comments fixedulfl1-0/+4
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16819 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-14Constify a bunch of arguments and variables, to squelch compilerguy1-3/+3
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". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16791 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-13HUGE STEP (hopefully toward the right direction):ulfl1-730/+188
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) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16787 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-06rename pcap-....c/.h files to capture-pcap-....c/.hulfl1-1/+1
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 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16691 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-05fixed a typoulfl1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16688 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-05replace all appearances of 'fprintf(stderr, "tethereal: ' with ↵ulfl1-154/+117
'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() git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16685 f5534014-38df-0310-8fa8-9805f1628bb7
2005-12-01fix alphabetical order of OPTINIT string, v seems to be a controversial ↵ulfl1-1/+1
character :-) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16642 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-25rephrase the error dialog if an interface couldn't be opened.ulfl1-8/+12
made the CaptureSetup wiki page more prominent added some "headings" so some of the help subtopics are easier for "human grep" IMHO git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16592 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-18Add support for the "-B" flag to Tethereal on Windows.guy1-2/+36
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16542 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-17Handle "-G" only in Tethereal - it doesn't work in Ethereal, and isn'tguy1-4/+63
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16526 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-07Include <wiretap/file_util.h> to declare the eth_ routines.guy1-0/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16407 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-06replace *a lot* of file related calls by their GLib counterparts. This is ↵ulfl1-5/+5
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16403 f5534014-38df-0310-8fa8-9805f1628bb7
2005-10-07fix Ethereal so command line capture parameter will work with kilobytes (again)ulfl1-1/+1
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) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16149 f5534014-38df-0310-8fa8-9805f1628bb7
2005-10-06add missing #include "capture_errs.h"ulfl1-0/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16137 f5534014-38df-0310-8fa8-9805f1628bb7
2005-10-04Add a "capture_errs.c" routine to cough up error messages for captureguy1-1/+6
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16109 f5534014-38df-0310-8fa8-9805f1628bb7
2005-10-04Add a note about 64-bit support in WinPcap to the capture errors onguy1-1/+12
Windows, and add the URL for the CaptureSetup page to the Tethereal error. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16103 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-22Libpcap uses u_char; use it in our calls to libpcap routines and in ourguy1-6/+6
libpcap callback routine (if it's not getting defined, <pcap.h> doesn't work). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15952 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-22Update to current reality (WinPcap 3.1) the messages shown on Windows ifguy1-7/+8
a capture device open fails. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15951 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-14fix wtap_dump_flush function name and don't check for it's return value. We ↵ulfl1-4/+1
don't do this check in Ethereal either and we will recognize problems at next write anyway ... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15805 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-14added compression support for capture file output. The Save/As dialog now ↵ulfl1-3/+3
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 ... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15804 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-03Make usage messages fit within 80 characters.guy1-8/+9
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15676 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-03As with Ethereal, so with Tethereal; we're not a GNU program, don't sayguy1-1/+1
we are. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15675 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-31Fix a typo.guy1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15637 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-27Set the time stamp precision; we need it when printing packet summaryguy1-34/+63
lines. Clean up indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15569 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-25timestamp display precision:ulfl1-5/+6
- automatic adjustment depending on file format - manual adjustment through menu items save the setting in the recent file git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15534 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-24EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry! ulfl1-24/+16
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... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15520 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-20Rename epan/stat.[ch] to epan/stat_cmd_args.[ch] - it only deals withguy1-1/+1
implementing the "-z" command-line arguments, it doesn't deal with *all* issues for stats. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15483 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-20Get rid of f_len field in capture_file structure - we can just keepguy1-1/+0
the length locally. within cf_read(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15454 f5534014-38df-0310-8fa8-9805f1628bb7
2005-08-19Add APIs to Wiretap to return the file of the size as supplied by the OSguy1-1/+0
(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(). git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15437 f5534014-38df-0310-8fa8-9805f1628bb7