Commit Graph

172 Commits

Author SHA1 Message Date
Guy Harris 83d6dc10e1 For the "there's already a file with that name" dialog, use a wording
more like the one used by gedit.  (Note that the file in question might
not be a capture file, although it probably is.)

svn path=/trunk/; revision=17355
2006-02-19 23:51:39 +00:00
Gerald Combs e8860e5a95 Freeze and thaw the packet list after a merge so that the packet list shows
the correct information.

svn path=/trunk/; revision=17320
2006-02-16 15:53:48 +00:00
Guy Harris a189adb2fb Have those functions that end up just calling a win32_ routine if we're
using GTK+ 2.x on Windows just have the call, nothing else (no extra
variables).

svn path=/trunk/; revision=17308
2006-02-15 11:01:57 +00:00
Gerald Combs 80e5e0fb15 Copy over the file open/save code from the Win32 native branch.
The Windows-native routines were integrated by inserting

#if GTK_MAJOR_VERSION >= 2 && _WIN32
  win32_native_routine(GDK_WINDOW_HWND(top_level->window));
  return;
#endif

at the beginning of each GTK+ file routine.  There's probably a prettier
way to do this.

Some of the sizes need to be tweaked in win32-file-dlg.rc, but everything
seems to work.

Fix up whitespace.

svn path=/trunk/; revision=17285
2006-02-13 21:25:43 +00:00
Guy Harris ca970e3757 In "Save As", support only file types we can write to; that simplifies
the logic, making it easier to get it right (fewer interactions between
components of the dialog - the file type doesn't affect whether we can
save some but not all packets).  It also means we don't offer a file
type for saving, only to take it away if you choose anything other than
saving all packets.

If the capture file is a temporary file from a capture done in the
current Ethereal session, it's libpcap format, which we can write to, so
you would be able to save it.

If it's a saved file we read in, saving the file in its entirety in its
own format is just copying the file, and it's not clear supporting that
adds enough useful functionality to justify the extra complication.

Fix "range_update_dynamics()" to update all the rows of the range
button/count table properly (make the button active iff there's
a non-zero count in the currently-selected column, make a count active
iff the column is selected), to select the "Captured" column if the
count of displayed packets goes to zero, and to select the "Save all
packets" row if the count of packets in the currently-selected row and
column goes to zero.  (XXX - we should perhaps do that with the
"user-defined range" counts as well, which would involve updating the
counts on every change to the range field.)

svn path=/trunk/; revision=17251
2006-02-11 11:21:38 +00:00
Ulf Lamping b4471e0195 fix #152
set the read filter dialog modal and transient to the parent window if requested. This way, it will receive input signals (solving problems with GTK2's gtk_file_chooser).

To do this, add another construct_args flag, so it will be modal only if really needed ...

svn path=/trunk/; revision=16926
2005-12-31 17:09:27 +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 fe17843002 bugfix: don't crash the file open dialog, if the preview gets confused by "invalid" timestamps.
The localtime call will return NULL on invalid input which results in a NULL pointer exception. Simply print '?' if localtime returned NULL.

svn path=/trunk/; revision=16317
2005-10-26 08:32:21 +00:00
Ulf Lamping e34467a28c disable gzip output compression for now, as it won't work in some cases (see source commment for details)
svn path=/trunk/; revision=15981
2005-09-23 18:50:07 +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
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
Ulf Lamping eafbbbcabb renamed ui_util.c/.h to gui_utils.c/.h to prevent confusion with identical named ui_util.h in / dir
svn path=/trunk/; revision=15465
2005-08-20 12:09:48 +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
Jörg Mayer 4e1f4b18ab More char -> const char warning fixes.
Removed (very few) casts that only change the warning message
  but don't remove it (with gcc-4).

svn path=/trunk/; revision=15227
2005-08-05 20:59:08 +00:00
Jörg Mayer e9ea42eed9 Fix more "no previous declaration" warnings
svn path=/trunk/; revision=15173
2005-08-02 04:47:15 +00:00
Ulf Lamping 9b5d52aab6 ask for unsaved file when using the new start capture feature,
ask for unsaved file when really starting the capture, not already when showing the options dialog,
use the start capture icon in the capture options dialog (instead of simply Ok)

svn path=/trunk/; revision=14142
2005-04-19 21:02:01 +00:00
Ulf Lamping fcb74124f8 Save As: ask user if he wants to overwrite an already existing file
svn path=/trunk/; revision=14058
2005-04-12 21:24:30 +00:00
Ulf Lamping ccff84dbdf code cleanup: use common prefix for all functions in color_filters.h
svn path=/trunk/; revision=13910
2005-03-26 01:09:14 +00:00
Guy Harris 9105b04e4b Have "cf_merge_files()" take a pointer-to-pointer-to-char as the output
file name argument; if the pointed-to pointer is null, it opens a
temporary file, and sets that pointer to a mallocated copy of the
pathname of the temporary file.  It no longer needs a file descriptor as
an argument.

svn path=/trunk/; revision=13419
2005-02-17 03:05:54 +00:00
Guy Harris ea7ef54b0d Have "cf_merge_files()" always close "out_fd" before returning; it does
so if "wtap_dump_fdopen()" succeeds (as a side-effect of calling
"wtap_dump_close()"), even if "cf_merge_fails()" after that, so it
should do so if it fails.

That means we don't need to close it in the callers of "cf_merge_files()".

svn path=/trunk/; revision=13407
2005-02-15 20:01:24 +00:00
Ulf Lamping 9d18adec33 minor enhancements to Guy's last update
svn path=/trunk/; revision=13304
2005-02-05 13:44:27 +00:00
Guy Harris fa3e5609ab Put "cf_status_t" back.
svn path=/trunk/; revision=13303
2005-02-05 12:50:47 +00:00
Ulf Lamping 0861927ce3 huge cleanup of capture file API (functions in file.c/file.h).
This includes: all functions in file.h now have a cf_ prefix, will have doxygen tags, will have the capture_file *cf as the first parameter and I tried to generalize the return values for non trivial functions.

Hopefully, I didn't introduced any new bugs, as I had to change a lot of files...

svn path=/trunk/; revision=13289
2005-02-04 18:44:44 +00:00
Guy Harris f72cba5413 We use the range utilities regardless of whether we're built with
libpcap or not.

svn path=/trunk/; revision=13182
2005-01-27 11:23:06 +00:00
Guy Harris 0067b4b94e The right way to check whether a pointer is null and get a Boolean is to
test it against null, not to cast it to a Boolean type - as Boolean
types in C89/C90, at least, are just integral types, that cast might
just throw away the upper 32 bits; that probably yields the results you
want, but the compiler might well justifiably warn about that on an LP64
platform.

svn path=/trunk/; revision=12915
2005-01-01 23:19:11 +00:00
Guy Harris 6e622fd24e "gtk_entry_get_text()" returns a "const char *" - assign the result to
one.

"get_basename()" doesn't modify its argument, and its callers don't
modify the substring pointed to by the result, so make it take a "const
char *" as an argument and return a "const char *". 

"find_last_pathname_separator()" doesn't modify its argument, so make it
a "const char *" - but some of its callers pass a non-"const" "char *"
and modify the result, so don't make its return value a "const char *".
And, as none of its callers are outside "filesystem.c", make it static.

In "about_folders_page_new()", have separate variables for pathnames
returned as "const char *" (which are cached by the routine that returns
them, so you can't modify them - and can't free them, so get rid of the
commented-out "g_free()" calls for them) and pathnames returned as "char
*" (which are allocated anew for each call, and can be modified, but
have to be freed).

Clean up white space.

svn path=/trunk/; revision=12881
2004-12-31 00:26:36 +00:00
Guy Harris f1deabed56 Make the tone of the error messages a bit less formal, by using
contractions.  (Safari does, at least when you're trying to open a file
to which you don't have read access.)

svn path=/trunk/; revision=12852
2004-12-29 01:08:20 +00:00
Guy Harris b48b8847b1 Change some of the merge.c APIs to return more information on failure,
and use that information to provide better error messages.

Have "merge_open_outfile()" do all the work of filling in the
merge_out_file_t structure, with the values to use passed as arguments. 
Get rid of some structure members that used to be used solely to pass
information to "merge_open_outfile()".

Add a "cf_merge_files()" routine to do the merging and reporting of errors.

svn path=/trunk/; revision=12420
2004-10-27 23:28:37 +00:00
Guy Harris c0ad4beb9c Change some code that affects g_resolv_flags to set a flag if the check
box for the flag is active and clear it if it's inactive, rather than
clearing all but RESOLV_CONCURRENT and then setting flags if the check
box is active - or, in one case, not clearing any flags due to a typo
and then setting them, so they never get cleared.  This matches what's
done with theresolution flags in some other places.

svn path=/trunk/; revision=12375
2004-10-22 07:07:08 +00:00
Guy Harris 34a94d6b37 When merging, default to the current file format as the output format.
svn path=/trunk/; revision=12327
2004-10-17 03:11:31 +00:00
Guy Harris 4624549a99 From Mark C. Brown: allow the file type for the merge operation to be
specified in the GUI.

svn path=/trunk/; revision=12326
2004-10-17 02:53:26 +00:00
Guy Harris 727ad67453 Remove the fixed maximum number of subranges in a range_t; dynamically
allocate them to be large enough.

Add checks that the numbers in the range fit in a guint32.

Check the validity of a range before saving or printing, and report
errors in an alert box.

Clean up white space.

svn path=/trunk/; revision=12320
2004-10-16 23:32:24 +00:00
Guy Harris bbe7f89742 Move prefs.c and prefs.h into the epan subdirectory.
svn path=/trunk/; revision=12115
2004-09-27 22:55:15 +00:00
Ulf Lamping 636317d3a6 Fix a minor bug only with GTK2.4: if have a problem while saving a file (e.g. filename already exists) will lead to an unresponding file dialog. The fix will close the dialog, which isn't the best solution, but I don't see a better one.
svn path=/trunk/; revision=11943
2004-09-08 19:26:36 +00:00
Guy Harris f06c1b5fb0 The packet range stuff knows about capture_file structures, so it's
really more of an Ethereal/Tethereal component than a libethereal
component (nothing else in libethereal knows about capture files); move
it back out of libethereal.  (The range stuff doesn't; we leave it in
libethereal.)

svn path=/trunk/; revision=11898
2004-09-04 20:02:11 +00:00
Guy Harris 478ba9a691 Rename "range.c" and "range.h" to "packet-range.c" and "packet-range.h";
they should ultimately be split into files with routines that handle
ranges, which are just subsets of [0,2^32), and packet ranges, which are
subsets of the packet list, possibly specified by a range.

Move them into epan, so they can be used by, for example, utilities that
handle ranges, such editcap.

svn path=/trunk/; revision=11890
2004-09-04 00:53:16 +00:00
Ulf Lamping 5e32dc06eb added a preference setting, to be able to change the preview timeout in the file open dialog (as requested by Ronnie Sahlberg).
svn path=/trunk/; revision=11859
2004-08-31 09:22:57 +00:00
Ulf Lamping 50b29ff07d Split the preview function into a prepare and a do part, to be able to do some experiments about the preview timeout things.
As the FileChooser dialog (GTK2.4) doesn't seem to let pass other GTK events (even with calling gtk_main_iteration()), it's not possible to change the preview behaviour to be more keen. To get a mechanism to update the preview independant from the dialog workings, we would need to start a new thread/task, which is too much effort for this IMHO.

So we might use the more simple approach of setting the timeout by a preference setting.

svn path=/trunk/; revision=11856
2004-08-31 08:18:10 +00:00
Gerald Combs c8235fae25 Move the file-reloading code from gtk/file_dlg.c to file.c.
svn path=/trunk/; revision=11823
2004-08-25 03:01:32 +00:00
Gerald Combs 76fd761686 As suggested by Guy: Have mark_frame() do nothing if the frame has
already been marked and have unmark_frame() do likewise.  Don't mess
with the marked frame count in mark_all_frames().

Be a little more paranoid about the marked frame count in other places.

svn path=/trunk/; revision=11775
2004-08-19 14:35:55 +00:00
Guy Harris 3a583aeb59 From Albert Chin: rename resolv.{ch} to addr_resolv.{ch}, so that an
include of <resolv.h> in any system header file gets the system
<resolv.h> (needed for builds on Tru64 with GTK+ 1.2[.x]).

svn path=/trunk/; revision=11615
2004-08-06 19:57:49 +00:00
Guy Harris b67a0f92d2 Move color_filters.c and color_filters.h up to the top-level directory,
as they're now (theoretically) toolkit-independent (modulo changes that
might be required to the code to update filter lists when a new filter
is read in).

svn path=/trunk/; revision=11500
2004-07-24 01:29:12 +00:00
Ulf Lamping bfd6ace52e renamed filter_prefs to filter_dlg, as the filter settings are (well, for a long time) no longer part of the preferences dialog.
svn path=/trunk/; revision=11436
2004-07-19 21:42:01 +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
Guy Harris fd262f1b97 From Daniel Thompson: add additional message/alert box options to
display "Save", "Continue without Saving", and "Cancel", for the "do you
want to save?" messages.

svn path=/trunk/; revision=11372
2004-07-13 07:15:45 +00:00
Guy Harris 9cff51ea78 Include <unistd.h>, if available, to declare "close()".
svn path=/trunk/; revision=11278
2004-06-30 07:12:25 +00:00
Ulf Lamping 24527148ab close temporary merge output file, if merging failed
svn path=/trunk/; revision=11275
2004-06-30 05:49:30 +00:00
Ulf Lamping 19c7f04794 avoid using tmpnam() for security reasons.
instead of giving the merge stuff a filename,
give it an already opened file descriptor

svn path=/trunk/; revision=11273
2004-06-29 20:59:24 +00:00
Jörg Mayer 4bbb32eaaa The patch to fix the race condition introduced by using tmpnam replaced
insecure code by not-working code.  As I currently lack the time to fix
this properly until Monday as the earliest possible date I undo the patch.

Please note that Ethereal should not be used on multiuser systems with
untrusted users until a proper fix has been applied.

svn path=/trunk/; revision=11263
2004-06-29 03:27:52 +00:00
Ulf Lamping bf6103638f minor bugfix for merge dialog: use the correct handle for resizing
svn path=/trunk/; revision=11259
2004-06-28 15:09:26 +00:00