aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
AgeCommit message (Collapse)AuthorFilesLines
2012-06-05If we do a Save or Save As with a move, don't reread the capture file,Guy Harris1-0/+3
just tweak the elements in the capture_file structure as necessary and poke the UI to update stuff such as the windows title. If we do a Save or Save As with a copy, don't reread the capture file, just close the old wtap, open a wtap for the copy, and tweak the elements in the capture_file structure as necessary and poke the UI to update stuff such as the windows title. Otherwise, don't do a full read-and-dissect pass on the capture file, just close the old wtap, open a wtap for the new file, tweak the elements in the capture_file structure as necessary and poke the UI to update stuff such as the windows title, and rescan the file to update the packet offsets (and cause Wiretap to regenerate, for a gzipped file, the information needed to support fast random access to the gzipped file). This should speed up Save and Save As a bit, as well as removing some glitches in the UI (e.g., you won't see the packet list disappear and reappear). svn path=/trunk/; revision=43101
2012-06-05Distinguish between "failed" and "user stopped it" for "save as" andGuy Harris1-10/+23
"export specified packets". For "failed", let the user try again with a different file, in case it failed due to, for example, running out of space or quota (probably the most likely failure mode for writing, and trying to a different volume might be the best workaround). For "user stopped it", presumably they don't want to try again (the most likely reason is "it was taking too damn long"). Put "Exporting to: ...", not "Saving: ..." in the statusbar if we're doing "export specified packets". In process_specified_packets(), allow a null range pointer to be specified, meaning "save 'em all"; that avoids the possibly-expensive (with a large capture) operation of initializing the range. If a "safe save" atop an existing file fails or is stopped, get rid of the temporary file we created. svn path=/trunk/; revision=43095
2012-06-03g_filename_display_basename() returns a g_mallocated string, so itsGuy Harris1-2/+2
callers either need to free it or their callers need to free it or.... This means that cf_get_display_name() must always return a g_mallocated string and its callers or... must free it. For some of those callers, create a new set_window_title() routine to do the work - they're all using the same pattern. svn path=/trunk/; revision=43047
2012-05-25Use GTK+'s GtkMessageDialog for the questions we ask in the process ofGuy Harris1-1/+5
saving files, and run it modal (which we're already doing with the GtkFileChooserDialog); this means less callback-based state machine stuff, simplifying the code paths a bit. If we're saving a file before closing it, don't bother reloading it after saving it. svn path=/trunk/; revision=42855
2012-05-24In the "Save As" and "Export Specified Packets" code path, do a "safeGuy Harris1-18/+11
save" if the destination file exists. Don't forbid overwriting an existing file in either of those cases (we still forbid overwriting the current capture file) - the GUI asks the user whether they want to do the overwrite, and allows them to cancel out of it - and don't remove the file before writing to it (doing so makes the save *un*safe). Attempt to do a save of an unedited temporary file by just moving the file on Windows as well as on UN*X - ws_rename() will remove the target if necessary on Windows (and won't do it as a separate operation before attempting the rename), so it behaves like ws_rename() on UN*X (which is just a wrapper around rename()). svn path=/trunk/; revision=42816
2012-05-22"Save As" always saves everything and, when the save is done, makes theGuy Harris1-4/+20
new file the current file, as is the case in most if not all other GUI applications. A new "Export Specified Packets" menu option allows you to specify which packets to write out, with the default being the displayed packets (and those on which the displayed packets depend for, e.g. reassembly), and never makes the resulting file the current file. The two operations are conceptually distinct. Lumping them into one menu item, with the default for "Save As" being "displayed packets only" and thus making it behave like the latter operation, was causing some confusion; see, for example, bug 6640. Make the dialog popped up if you try to "Save As" or "Export Specified Packets" on top of an existing file ask the "do you want to do this?" question in the main part of the message, and note in the secondary text that doing that will overwrite what's in the file; that matches what TextEdit on OS X and the GNOME text editor say. svn path=/trunk/; revision=42792
2012-05-22We're an editor now, as we let you add, delete, and edit frame comments,Guy Harris1-2/+15
so "Save" should, for non-temporary files, mean "save the current state of the capture file on top of the existing file" without prompting for a file name. That means we have to do a "safe save" - i.e, write the capture out to a new file and, if that succeeds, rename the new file on top of the old file - as the actual packet data to write out is in the file we're overwriting, not in memory. (We'd want to do that anyway, of course....) Update some comments. Clean up indentation slightly, and get rid of an unnecessary variable (in all the cases where we use it, we assign it the same value, and that value isn't modified out from under us before we use it). Note that after a "Save", or a "Save As" that writes out all captured packets, we shouldn't have to close the current file and open the new file and reread it - we should be able to open the new file and update the frame offsets in the frame_data structures. Note that we need to do some a better job of reporting rename failures. svn path=/trunk/; revision=42777
2012-05-22The GUI's state machine requires that, when reloading a capture after aGuy Harris1-7/+8
save, we post capture file callback events similar to the ones posted when reading a capture - otherwise, the reload will leave the welcome screen up. Rename cf_cb_file_save_reload_finished to cf_cb_file_reload_finished, add a cf_cb_file_reload_started callback, have them work similarly to read_finished and read_started except that the reload uses "Reloading" in the progress bar and status bar. Clean up some indentation while we're at it. svn path=/trunk/; revision=42764
2012-02-29- Add a LED in the statusbar to indicate that capture comments exists,Anders Broman1-0/+17
clickable to open an edit window. - Add checks for NULL pointers. Help with a different color LED possibly with Jeff's (c) in it apreceated. Should the LED be placed elsewhere or the whole thing done differently? svn path=/trunk/; revision=41242
2011-12-29Add 'extern "C"' wrappers and #include guards to various header files.Gerald Combs1-0/+7
svn path=/trunk/; revision=40321
2011-05-17This ain't C++; you have to put "void" in as the argument list ofGuy Harris1-2/+2
functions that take no arguments, otherwise the function is treated as a crufty old C function with undeclared arguments. svn path=/trunk/; revision=37211
2011-03-08Removal of the old packet-list in favor of the new packet list.Sake Blok1-18/+2
It compiles with "./configure without options" on my Mac. Let's see what the buildbots have to say about it :-) svn path=/trunk/; revision=36161
2011-01-31From Cal Turney:Anders Broman1-0/+19
Bug 5621 - With String in Packet details searches, highlight row in tree https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5621 svn path=/trunk/; revision=35718
2010-08-26Doxygen fixes.Anders Broman1-5/+3
svn path=/trunk/; revision=33942
2010-08-13Instead of using a Boolean for the search direction, use an enum, soGuy Harris1-22/+68
that you can tell from examination whether the search is forward or backward. Make the cf_find_packet routines take the direction as an explicit argument, rather than, in the cases where you don't want to permanently set the direction, saving the direction in the capture_file structure, changing it, doing the search, and restoring the saved direction. Give more information in the Doxygen comments for those routines. Add a cf_find_packet_dfilter_string() routine, which takes a filter string rather than a compiled filter as an argument. Replace find_previous_next_frame_with_filter() with it. Have cf_read_frame_r() and cf_read_frame() pop up the error dialog if the read fails, rather than leaving that up to its caller. That lets us eliminate cf_read_error_message(), by swallowing its code into cf_read_frame_r(). Add Doxygen comments for cf_read_frame_r() and cf_read_frame(). Don't have find_packet() read the packet before calling the callback routine; leave that up to the callback routine. Add cf_find_packet_marked(), to find the next or previous marked packet, and cf_find_packet_time_reference(), to find the next or previous time reference packet. Those routines do *not* need to read the packet data to see if it matches; that lets them run much faster. Clean up indentation. svn path=/trunk/; revision=33791
2010-05-27Add cf_fake_continue_tail() which is called when real-time captureGerald Combs1-32/+39
updates are off and which sets the capture file state to a value that won't cause an assertion when the user stops capturing. Fixes bug 4035. svn path=/trunk/; revision=33005
2010-05-26From Jakub Zawadzki:Anders Broman1-0/+7
New functions: cf_read_frame_r, cf_read_frame It's much easier to write: cf_read_frame (cf, fdata, &err, &err_info) Than: wtap_seek_read (cf->wth, fdata->file_off, &cf->pseudo_header, cf->pd, fdata->cap_len, &err, &err_info) svn path=/trunk/; revision=32980
2010-04-01Keep a copy of the interface description and capture filter around so thatGerald Combs1-0/+18
we can use it in the main window title during and after capture. Add a "-X" option for providing a description for stdin. svn path=/trunk/; revision=32357
2009-12-17Introduce "Ignore Packet" in the packet list.Stig Bjørlykke1-0/+16
This will remove the package from the dissection functions without removing it from the capture file. svn path=/trunk/; revision=31287
2009-12-14From Valerio Messina:Jaap Keuter1-6/+7
As now, when Wireshark save capture files, it show "Loading" in status bar and in the dialog box, warning many users of lost them packets. Saving work as expected. Is simply a GUI use interaction problem. svn path=/trunk/; revision=31269
2009-08-30Some minor corrections in function descriptionsSake Blok1-1/+5
svn path=/trunk/; revision=29625
2009-08-28Compute the loading time and show it in the main status bar.Anders Broman1-0/+1
(Modified code from Didier Gautheron). svn path=/trunk/; revision=29592
2009-07-28Fix setting of new time format.Anders Broman1-0/+7
svn path=/trunk/; revision=29212
2009-06-05Have tap listeners specify whether the "packet" routine requiresGuy Harris1-2/+1
a protocol tree; the column values. This includes stats-tree listeners. Have the routines to build the packet list, and to retap packets, honor those requirements. This means that cf_retap_packets() no longer needs an argument to specify whether to construct the column values or not, so get rid of that argument. This also means that there's no need for a tap to have a fake filter to ensure that the protocol tree will be built, so don't set up a fake "frame" filter. While we're at it, clean up some cases where "no filter" was represented as a null string rather than a null pointer. Have a routine to return an indication of the number of tap listeners with filters; use that rather than the global num_tap_filters. Clean up some indentation and some gboolean vs. gint items. svn path=/trunk/; revision=28645
2009-04-08(Trivial) Fix some spelling & etc in commentsBill Meier1-1/+1
svn path=/trunk/; revision=27996
2008-10-03add a -K command line option to provide the name of the kerberos keytab Ronnie Sahlberg1-0/+4
file to use for decryption of Krb5 and GSS-KRB svn path=/trunk/; revision=26343
2008-06-24Have separate callback mechanisms in file.c and capture.c; pass theGuy Harris1-13/+0
capture callbacks the capture_options * as its second argument in all cases. This makes it a bit clearer what arguments callbacks take, and means we can get rid of all global_capture_opts references in gtk/main_statusbar.c. Put the interface between gtk/main.c and gtk/main_statusbar.c into a private header. svn path=/trunk/; revision=25576
2008-05-30Again, the err_info returned from wtap_read() and wtap_seek_read() is aGuy Harris1-2/+2
g_mallocated string, so it's not const. Fix a comment to reflect reality (err_info is some additional information about the error returned by Wiretap, e.g. some gory details about the error, mainly useful to developers and support people). svn path=/trunk/; revision=25401
2008-03-11From Francesco Fondelli (bug 2349):Stig Bjørlykke1-0/+9
Attached is a patch to export packets data as "C Arrays". I often have the need to [re]send data captured with wireshark using a raw/pf_packet socket. Output format is one char[] per packet, it looks like almost the same as the one produced by "Follow TCP stream". svn path=/trunk/; revision=24604
2007-03-22match declaration of cf_continue_tail() with implementationUlf Lamping1-1/+1
svn path=/trunk/; revision=21135
2007-03-14Don't enable "Save As" if you don't have an unsaved live capture fileGuy Harris1-0/+9
and there are no formats in which the file can be saved by some means other than copying the raw data; "Save As" isn't a very useful function in that case, and that prevents us from having an empty list of formats in which the file can be saved. svn path=/trunk/; revision=21032
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-01-22show the number of packets captured, if "Update list of packets ..." isn't usedUlf Lamping1-1/+10
svn path=/trunk/; revision=17071
2005-09-20add two new callbacks:Ulf Lamping1-0/+2
cf_cb_file_closing (called before closing a capture file) cf_cb_file_closed will be called afterwards, but both only if a file is really closed as cf_close is called more often ... If we are closing large capture files (~20MB), the screen looks ugly while the file is closed. Change this so the screen will immediately go back to initial state and a dialog (without buttons) is shown that the file is currently closed. As the operation which takes most of the time to close the file is a single eth_clist_clear call, we can't use a progress bar here. cf_cb_live_capture_stopping: called when the user wants to stop the capture (toolbar or menu clicked). At least on Win32, the time between this and the actual stop completed can be noticeable (1-2 seconds), so the user doesn't know if the button press did anything at all. Do something similar as above, show a dialog box without buttons to inform that the close is in progress. svn path=/trunk/; revision=15891
2005-09-14added compression support for capture file output. The Save/As dialog now ↵Ulf Lamping1-1/+2
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-14Have cf_retap_packets() take an argument that indicates whether toGuy Harris1-1/+2
generate columns; use cf_retap_packets instead of cf_redissect_packets() when running taps (the general flow graph stat uses the Info column). svn path=/trunk/; revision=15793
2005-05-25the capture child might not respond shortly after bringing it up (especially ↵Ulf Lamping1-0/+1
it will block, if no input coming from an input capture pipe (e.g. mkfifo) is coming in) to prevent problems, bring the main GUI into "capture mode" right after successfully spawn/exec the capture child, without waiting for any response from it svn path=/trunk/; revision=14436
2005-04-18statusbar changes:Ulf Lamping1-1/+2
-show the current capture file size, if capturing in real time mode. -move the packet "Drops" count (if available) from file to packets statusbar part svn path=/trunk/; revision=14130
2005-04-11various capture code cleanup and fixes: Ulf Lamping1-1/+0
display filename in statusbar while capturing print_usage banner fixed cf_cb_live_capture_prepare no longer needed rename sync_pipe_do_capture -> sync_pipe_start bugfix: sync_pipe_input_wait_for_start replaced by former implementation fix cleanup of old file in capture_input_new_file fix a tempfile detection bug (named file showed up as tempfile after capture) svn path=/trunk/; revision=14053
2005-04-10fix statusbar messages by splitting into update and fixed messages between ↵Ulf Lamping1-2/+4
capture and main svn path=/trunk/; revision=14044
2005-03-28a lot more capture engine code cleanupUlf Lamping1-0/+5
most notably: - moved opening of safe_file to the capture child (capture_loop.c) - removed save_file_fd from capture_opts (no longer need to have it global) svn path=/trunk/; revision=13953
2005-03-11from Stefano Pettini: add CSV export function, similar to PSML exportUlf Lamping1-0/+9
svn path=/trunk/; revision=13724
2005-02-28Another step towards using the parent/child mode for ALL captures.Ulf Lamping1-0/+16
This is currently still disabled, as we cannot pass all required capture flags to the child process (lack of command line parameters). svn path=/trunk/; revision=13558
2005-02-17Have "cf_merge_files()" take a pointer-to-pointer-to-char as the outputGuy Harris1-4/+4
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-08fix a capture bug if the capture filter wasn't valid to get back to "empty" ↵Ulf Lamping1-0/+1
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-07Make Ethereal and Tethereal compile if we're building without libpcap.Guy Harris1-0/+2
svn path=/trunk/; revision=13346
2005-02-07Move the code to set the title on a window when a capture is in progressGuy Harris1-0/+3
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-07Declare "cf_callback_t" before using it in a further declaration.Guy Harris1-1/+1
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-07Instead of calling each single thing when doing/finish a file operation, ↵Ulf Lamping1-0/+23
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-06another two steps towards privilege seperation:Ulf Lamping1-17/+1
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