Commit Graph

326 Commits

Author SHA1 Message Date
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
Guy Harris 4ddd504bb4 Move the stats.[ch] stuff into epan, so plugins can use it.
svn path=/trunk/; revision=15429
2005-08-19 10:00:14 +00:00
Guy Harris b2807e2ab6 Move the APIs for registering and processing "-z" command-line arguments
and "Statistics" menu items into "stat.h" and "stat.c", to separate them
from the core tapping APIs.  A tap could conceivably not register as a
"-z" command-line argument or "Statistics" menu item, and a stat could
conceivably not be implemented as a tap, and dissectors that implement
tapping points don't need the UI-related stuff from "stat.h", they just
want the tap-related stuff in <epan/tap.h>.

svn path=/trunk/; revision=15427
2005-08-19 09:29:41 +00:00
Guy Harris e67b202e2c Have "f_datalen" keep track of the number of bytes of uncompressed file
data, so that "f_len" still keeps the size of the underlying file (which
is necessary in order to make the progress bar when files are being read
work correctly).

svn path=/trunk/; revision=15415
2005-08-19 01:17:24 +00:00
Jörg Mayer 0f9ffd6923 Move SVNVERSION handling into version_info. That way, we won't have
to recompile tethereal.o etc each time the svn version has changed,
relinking is sufficient.

I'm not sure what to do about mergecap, as it currently doesn't link
against version_info, so it's "overhead" either way.

svn path=/trunk/; revision=15371
2005-08-16 06:45:17 +00:00
Ronnie Sahlberg 055e2596d9 Add beginning of seasonal allocation in addition to the existing ephemeral ones.
svn path=/trunk/; revision=15301
2005-08-12 08:51:08 +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
Guy Harris b8bb6b495c Squelch more const pointer warnings.
svn path=/trunk/; revision=15242
2005-08-06 10:31:27 +00:00
Guy Harris 554f620001 Constify to remove a bunch of warnings. Add some casts to squelch
(presumably-)harmless-but-otherwise-unremovable const-to-nonconst
warnings.

In the TACACS dissector, clean up the variables used in option parsing
to avoid some const-to-nonconst warnings.

Clean up some white space.

svn path=/trunk/; revision=15043
2005-07-24 19:01:28 +00:00
Jörg Mayer 30a8557868 More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
2005-07-23 11:41:25 +00:00
Ronnie Sahlberg c841beb71b EMEM : a simple and FAST api to allocate memory that will be automatically freed() when the next packet is dissected.
This offesr memory allocation with a packet  scope making memory leaks less likely and memory management faster.


Add initialization calls for both tethereal and ethereal.

Convert the ip_to_str() function to use this and avoid doing the silly rotating buffers thing it previously did.


We also need an equivalent set of functions for allocation with capture file scope (free when next capture is loaded) but i dont know where to put the free_all call.



svn path=/trunk/; revision=14984
2005-07-22 07:46:58 +00:00
Ulf Lamping 66acca7018 update usage output and manual pages for both Ethereal and Tethereal to reflect the latest changes in the command line.
clarifications of some command line parameter descriptions in the manual pages

this also fixes #221

svn path=/trunk/; revision=14545
2005-06-04 01:29:14 +00:00
Guy Harris 33db7e6fcb Don't include <pcap.h> twice.
svn path=/trunk/; revision=14357
2005-05-12 03:29:59 +00:00
Ronnie Sahlberg 1a647a2c6a make tethereal compile when plugins are disabled
svn path=/trunk/; revision=14319
2005-05-05 13:48:34 +00:00
Guy Harris 80c1907a36 Rename "register_ethereal_tap()" to "register_tap_listener_cmd_arg()" as
it's used to register a callback for a tap listener invoked if the
specified command line argument is specified to the "-z" flag.

Move it, along with routines to:

	look up a "-z" argument in the table constructed by
	"register_tap_listener_cmd_arg()" and either save the full
	argument to "-z" and the corresponding listener if it's found or
	return a failure indication if it isn't;

	list the available tap listeners;

	call the "init" routines for the tap listeners saved in the
	table above;

and have Ethereal and Tethereal use those routines.

svn path=/trunk/; revision=13993
2005-04-01 09:08:27 +00:00
Guy Harris 910ad32b3b Don't assume only one "-z" argument will be given on the command line;
add information for each tap to a list, and set up all the taps in the
list.

svn path=/trunk/; revision=13991
2005-04-01 05:45:08 +00:00
Guy Harris 46e1907f13 If we have "pcap_freecode()", use it to free the instructions for a BPF
filter after installing the filter.

Set HAVE_PCAP_LIB_VERSION if we're building with WinPcap 3.1; it's not
present in earlier versions, but is present in current 3.1 betas.

Check HAVE_PCAP_LIB_VERSION when building capture-wpcap.c.

svn path=/trunk/; revision=13872
2005-03-23 01:25:01 +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
Luis Ontanon 779a8f5d80 If -z was not given as the very last argument the tap listener initialization might have crashed.
Copy the optarg so that when the tap initialization is called it gets the right argument.

svn path=/trunk/; revision=13570
2005-03-01 23:46:05 +00:00
Luis Ontanon 5319cabe88 Make sure that plugin tap listeners get registered before the non-plugin tap listeners
that's because stat trees are registered as tap listeners by either
gtk/stats_tree_stat.c or tap-stats_tree.c


svn path=/trunk/; revision=13545
2005-02-28 00:55:49 +00:00
Guy Harris dd4b0b718b The stats tree stuff should ultimately allow us to have plugin taps, so
add infrastructure for them, and display the plugin type (which could be
both dissector *and* tap) in the list of plugins.

svn path=/trunk/; revision=13543
2005-02-27 22:04:48 +00:00
Luis Ontanon 707c3c52d0 in tethereal
list_link_layer_types was not being initialized causing the "-r" option to fail


svn path=/trunk/; revision=13480
2005-02-23 17:05:32 +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
Ulf Lamping d643a55488 move capture_opts related things (init, command line, ...) from capture.c to a new file capture_opts.c and let both ethereal and tethereal use it.
svn path=/trunk/; revision=13474
2005-02-23 01:01:19 +00:00
Luis Ontanon 7dccea9b20 Do not call the tap's initialization as soon as the -z option is read,
postpone it after the preferences callback has being called.

That way mate's fields, which are registered by the preferences callback
can be used as part of the tap's filter.


svn path=/trunk/; revision=13469
2005-02-22 19:17:28 +00:00
Lars Roland f3294ee49a change nmake makefiles in /trunk and /trunk/epan so that
object code for libethereal.dll isn't generated by the
makefile in /trunk.

Having no code in /trunk linked into libethereal.dll
anymore, the definition of the macro _NEED_VAR_IMPORT_
can be moved from various source files in /trunk to /trunk/Makefile.nmake .
So do that, too.

svn path=/trunk/; revision=13389
2005-02-13 00:10:15 +00:00
Guy Harris 01b33c922d Fix up the suppression of packet printing and packet count printing so
that:

	packets are printed iff we're not saving packets to a file and
	"-q" wasn't specified;

	packet counts are printed iff we're capturing (i.e., not reading
	from a file) and "-q" wasn't specified.

svn path=/trunk/; revision=13348
2005-02-07 21:40:53 +00:00
Guy Harris 802a3977bf Make Ethereal and Tethereal compile if we're building without libpcap.
svn path=/trunk/; revision=13346
2005-02-07 20:52:59 +00:00
Guy Harris d01ae28b6f Suppress the packet counts when we're reading from a file.
svn path=/trunk/; revision=13342
2005-02-07 19:42:32 +00:00
Guy Harris da36197902 Tethereal can write to a file in binary even if not built with libpcap.
svn path=/trunk/; revision=13341
2005-02-07 19:33:49 +00:00
Guy Harris 6e58e3984b Clean up indentation.
The default for "capture_options.save_file" is a null pointer, meaning
we're not writing to a save file, we're writing out the dissection as
text.

svn path=/trunk/; revision=13340
2005-02-07 19:11:45 +00:00