Commit Graph

144 Commits

Author SHA1 Message Date
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
Ulf Lamping 179d4cca95 fix a capture bug if the capture filter wasn't valid to get back to "empty" state.
instead of already invoking cf_cb_live_capture_started in capture.c, I've introduced the new event cf_cb_live_capture_prepare which only has to set the main windows title and nothing more.

svn path=/trunk/; revision=13355
2005-02-08 19:57:16 +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 79a39eddbc Move the code to set the title on a window when a capture is in progress
to the "start live capture" callback, and call that from "do_capture()".

When opening a capture file, don't pop up the "What do you want to do?"
pane when closing any existing file you have open, as we're just going
to put the regular view up right after that.

svn path=/trunk/; revision=13332
2005-02-07 02:09:30 +00:00
Guy Harris 641106f21d Declare "cf_callback_t" before using it in a further declaration.
Mark the "func" argument to "cf_callback_remove()" as unused.

Get rid of the "iface" argument to "cf_start_tail()", as it's no longer
used.

svn path=/trunk/; revision=13331
2005-02-07 01:32:53 +00:00
Ulf Lamping 1c6b2cf0e3 Instead of calling each single thing when doing/finish a file operation, file.c shouldn't call all the GUI related functions itself, instead throwing some kind of Events to it's caller(s).
I've implemented a very simple callback mechanism which provides exactly this. I've tried GHook from GLib before, but this doesn't seem to be the right thing, as it's too inflexible for the purpose here.

So I've implemented a callback function in main.c which receives all "events" and spreads them to menu, statusbar and itself.

I would see this implementation as a prototype which may need  improvements. Please comment the changes.

svn path=/trunk/; revision=13330
2005-02-07 00:54:46 +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 316ce5f19b fix a comment
svn path=/trunk/; revision=13306
2005-02-05 14:33:03 +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 9bf11427f4 make some string parameters const, as they are not changed inside
svn path=/trunk/; revision=13298
2005-02-05 11:00:04 +00:00
Guy Harris 2c89242aac Instead of having a single enumerated type for status return values from
cf_ functions, have separate ones for different classes of routines, and
use gboolean when the return value is just "success" or "failure" - that
way you don't get compiler warnings if a case statement isn't handling a
particular status value if the routine in question won't return it.

svn path=/trunk/; revision=13293
2005-02-04 20:54:12 +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
Ulf Lamping 10ee9093c8 remove #include "globals.h" and access to global cfile, use access functions and capture_opts instead
svn path=/trunk/; revision=13284
2005-02-04 08:42:39 +00:00
Ulf Lamping 9f171b0485 remove #include "globals.h" and access to global cfile, use access functions and capture_opts instead
svn path=/trunk/; revision=13283
2005-02-04 08:27:41 +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
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 d9bdadc4dd Get rid of merge_n_files() - it's only called in one place now, and
absorbing its logic into "cf_merge_files()" simplifies things a bit.

svn path=/trunk/; revision=12421
2004-10-27 23:45:10 +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
Jörg Mayer 88b9b09373 Trivial warning fix
svn path=/trunk/; revision=12170
2004-10-01 12:27:52 +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
Gerald Combs 16c708571a Move the guts of gtk/file_dlg.c:goto_framenum_cb() to
file.c:goto_framenum(), where all of the other goto_ routines live.

svn path=/trunk/; revision=11887
2004-09-02 19:52:39 +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
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 b650d01031 Make the "human-readable text vs. PSML vs. PDML" choice separate from
the "text vs.  PostScript" choice.  The "text vs. PostScript" choice
should probably ultimately be done with a generic set of print methods,
to handle various platform-native print mechanisms more cleanly (and
perhaps the dialog box code for "export as {PDML,PSML}" should be
separate from the "export as text"/"print" dialog).

svn path=/trunk/; revision=11342
2004-07-08 10:36:29 +00:00
Guy Harris 9feb374670 Don't refer to "auto_scroll_live" if HAVE_LIBPCAP isn't defined - and
put the definition of it back under HAVE_LIBPCAP and don't add an extra
declaration in "file.h", as there's no longer code that needs to refer
to it if HAVE_LIBPCAP isn't defined.

svn path=/trunk/; revision=10350
2004-03-08 23:45:25 +00:00
Jörg Mayer 452789c91f This makes ethereal compile again when configured --without-pcap
I don't know whether this is the optimal patch, but it does the job.

file.h: extern declaration of auto_scroll_live
file.c: always declare auto_scroll_live

svn path=/trunk/; revision=10347
2004-03-08 23:07:15 +00:00
Guy Harris 6064ef84c2 Add a "force" argument to "filter_packets()" and
"main_filter_packets()", to force the filtering to be done even if the
filter is the same as the current one; this is necessary in order to
make sure "Follow TCP Stream" gets the packets processed even if you're
filtering the stream that's currently filtered in.

svn path=/trunk/; revision=10209
2004-02-23 22:48:52 +00:00
Guy Harris d6cd61061e Have the Wiretap open, read, and seek-and-read routines return, in
addition to an error code, an error info string, for
WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and
WTAP_ERR_BAD_RECORD errors.  Replace the error messages logged with
"g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed
strings returned as the error info string, and change the callers of
those routines to, for those errors, put the info string into the
printed message or alert box for the error.

Add messages for cases where those errors were returned without printing
an additional message.

Nobody uses the error code from "cf_read()" - "cf_read()" puts up the
alert box itself for failures; get rid of the error code, so it just
returns a success/failure indication.

Rename "file_read_error_message()" to "cf_read_error_message()", as it
handles read errors from Wiretap, and have it take an error info string
as an argument.  (That handles a lot of the work of putting the info
string into the error message.)

Make some variables in "ascend-grammar.y" static.

Check the return value of "erf_read_header()" in "erf_seek_read()".

Get rid of an unused #define in "i4btrace.c".

svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
Guy Harris 7502ac216a There's no need to keep a "FILE *" for the file being printed to in a
"capture_file" structure.  Keep it locally, instead.

Check for errors when printing packets.

Report failure to open a print destination and failure to write to a
print destination differently.

Don't have the "print preamble" and "print final" routines return
success/failure indications - revert to the old scheme where they
didn't, and have the callers use "ferror()" to check for errors.

Report write errors when printing dissections in Tethereal.

Report print errors as errors, not warnings.

svn path=/trunk/; revision=9828
2004-01-25 00:58:13 +00:00
Guy Harris d8d91ff347 As with "cf_open_error_message()"/"file_open_error_message()", so with
"cf_write_error_message()"/"file_write_error_message()".

Use "file_open_error_message()" instead of "cf_open_error_message()" in
some places we missed in the previous checkin.

Catch ENOSPC and EDQUOT in "file_open_error_message()".

Use "file_open_error_message()" rather than "file_write_error_message()"
to report errors when creating the file to which we're saving the
"Follow TCP Stream" data.

svn path=/trunk/; revision=9823
2004-01-24 02:01:44 +00:00
Guy Harris 46848f0a9e Add a new "file_open_error_message()" routine in "epan/filesystem.c", to
translate UNIX errno values to a somewhat friendly message format
string.

Rename "file_open_error_message()" in "file.c" to
"cf_open_error_message()", make "cf_open_error_message()" use the new
"file_open_error_message()" for UNIX errno values, have "do_capture()"
in "capture.c" use "file_open_error_message()" to report errors from
"open()", and make "cf_open_error_message()" static as nothing outside
"file.c" uses it.

Do similar stuff in "tethereal.c".

svn path=/trunk/; revision=9821
2004-01-24 01:44:29 +00:00
Ulf Lamping ef57df088f a.) saving GTK1 and GTK2 fontnames in different preference setting, to prevent problems when switching between GTK1 and GTK2 ethereal versions
b.) added new feature "Edit->Go To First Packet" "Edit->Go To Last Packet" with corresponding menu and toolbar items
c.) added new feature "View->Zoom In" / "View->Zoom Out" / View->Normal Size" with corresponding menu and toolbar items
This feature will act as a "size offset" to the current fontsize, so that the packet list/tree view/... will have a larger/smaller font size.
The value is stored inside the recent file.
d.) Win32 only: Try to get the win32 system font and fontsize at program startup and show the menus/dialogs and such with the same font and fontsize like other win32 windows.
This makes the program make a *lot* more feel like a normal win32 program.

svn path=/trunk/; revision=9753
2004-01-20 18:47:25 +00:00
Guy Harris 4dd10c6687 Add a routine "retap_packet()" that runs through all packets, dissecting
them and running all taps on them, but not reconstructing the packet
list.  Use that in the IO-stat tap rather than "redissect_packet()"; the
latter does more work and redraws the display, neither of which are
necessary.

Call the filter callback when the Calc field is changed, to redraw the
graphs; that change also fixes things so that it's called when the
Filter field is changed.

Rename the "filter_button" member of an io_stat_graph_t to
"filter_field", as it's not the "Filter:" button, it's the text field
containing the filter expression.

svn path=/trunk/; revision=9659
2004-01-13 22:34:10 +00:00
Ulf Lamping 14e2a790f9 From Dick Gooris (and me :-)
more ways to choose which packets can be saved,
in the save(as) dialog box

svn path=/trunk/; revision=9476
2003-12-29 20:05:59 +00:00
Guy Harris dd628e00c7 Make "finfo_selected" a member of a "capture_file" structure rather than
an independent global variable.

svn path=/trunk/; revision=8524
2003-09-24 00:47:37 +00:00
Guy Harris 14509164fc Rename various capture file routines to have names starting with "cf_".
svn path=/trunk/; revision=8479
2003-09-15 22:48:42 +00:00
Guy Harris f56d16abab Add a routine to return the display name for a "capture_file" structure,
rather than constructing that name when a capture file is opened and
putting a pointer to it in that structure.

svn path=/trunk/; revision=8476
2003-09-15 22:16:08 +00:00
Ronnie Sahlberg 007d873671 Added TimeReference frames.
One can now select a packet and mark it as a TimeReference packet using the menu.
A TimeReference packet will be indicated by having all timestamp related column entries replaced by the string *REF*
A TimeReference packet will always be displayed in the packet pane, and overrides any display filters.

When a frame is a TimeReference frame, all later frames will calculate the TimeRelativeToFirstPacket  relative to the timestamp of the TimeReference frame instead of the first frame of the capture.

You can have any number of TimeReference frames you like.

svn path=/trunk/; revision=8459
2003-09-12 02:48:23 +00:00
Guy Harris 1cf6565adc Get rid of the EBCDIC stuff in the find dialog - it's not supported yet,
so we shouldn't torment the users by offering it.

Check the string type and convert it to an internal representation in
the GUI code; have the search code deal only with the internal
representation.

Save the case-sensitivity flag, and the indication of where string
searches look, along with other search parameters.

Upper-casify the string, for case-insensitive searches, in the GUI code;
don't save the upper-casified string, so it doesn't SHOUT at you when
you next pop up a "find" dialog.

Convert the hex value string to raw binary data in the GUI code, rather
than doing so in the search code.  Check that it's a valid string.

Connect the signals to the radio buttons after the pointers have been
attached to various GUI items - the signal handlers expect some of those
pointers to be attached, and aren't happy if they're not.

Have "find_packet()" contain a framework for searching, but not contain
the matching code; instead, pass it a pointer to a matching routine and
an opaque pointer to be passed to the matching routine.  Have all the
routines that do different types of searching have their own matching
routines, and use the common "find_packet()" code, rather than
duplicating that code.

Search for the Info column by column type, not by name (the user can
change the name).

When matching on the protocol tree, don't format the entire protocol
tree into a big buffer - just have a routine that matches the text
representation of a protocol tree item against a string, and, if it
finds a match, sets a "we found a match flag" and returns; have that
routine not bother doing any more work if that flag is set.
(Unfortunately, you can't abort "g_node_children_foreach()" in the
middle of a traversal.)

Free the generated display filter code after a find-by-display-filter
finishes.

svn path=/trunk/; revision=8306
2003-08-29 04:03:46 +00:00
Richard Sharpe 2f8c75aed1 Applied the "Updated find capabilities...." from Greg Morris.
svn path=/trunk/; revision=8158
2003-08-11 22:41:10 +00:00
Guy Harris d2e2149ff9 From Greg Morris: add support for case-insensitive full-text searches.
svn path=/trunk/; revision=8132
2003-08-05 00:01:27 +00:00
Guy Harris 337287266e Get rid of carriage returns - some compilers don't like them.
svn path=/trunk/; revision=8086
2003-07-25 17:57:09 +00:00
Guy Harris 487d0def6b From Greg Morris: code to support searches for text or raw binary data
in a frame in Find Frame.

svn path=/trunk/; revision=8067
2003-07-22 23:08:48 +00:00
Guy Harris 6c9deead35 Have "goto_frame()" put up error dialog boxes itself, rather than having
its callers put up the same error dialog boxes.  Have it just return a
success vs. failure Boolean.

svn path=/trunk/; revision=7254
2003-03-02 22:07:25 +00:00
Ronnie Sahlberg 429b24827b From Vassilii Khachaturov, cleanup of redundant code.
svn path=/trunk/; revision=6202
2002-09-06 22:45:44 +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
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
equivalents for the toplevel directory. The removal of winsock2.h will
hopefully not cause any problems under MSVC++, as those files using
struct timeval still include wtap.h, which still includes winsock2.h.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris 44d19627ef From Graeme Hewson:
Allow "-" as the output file name in Wiretap, referring to the
	standard error.

	Optimize the capture loop.

Fix some of the error-message printing code in Ethereal and Tethereal.

Have Wiretap check whether it can seek on a file descriptor, and pass
the results of that test to the file-type-specific "open for output"
routine.  Have the "open for output" routines for files where we need to
seek when writing the file return an error if seeks don't work.

svn path=/trunk/; revision=5884
2002-07-16 07:15:09 +00:00