aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-18Revert: Free cf->edt before free cf->epan when redissecting.Gerald Combs1-4/+0
Instead of freeing cf->edt before clearing the packet list, add an extra check to MainWindow::setMenusForSelectedTreeRow. Semi-blind attempt at fixing bug 11719. This reverts commit 8c211d51ef66b64c708f7ad079e7e7e913ac9f14. This reverts commit da71ccbf778cca5d9c48e010597570a40fd190c0. Bug: 11719 Change-Id: Ifd07be414ffd03a40bdfa7110395c9542bd86fc4 Reviewed-on: https://code.wireshark.org/review/11943 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-11-18epan: Check for valid cf->edt before free.Stig Bjørlykke1-2/+4
Added a check for a valid cf->edt before calling epan_dissect_free(), as this will give an unintended assert. This is related to da71ccbf778cca5d9c48e010597570a40fd190c0. Change-Id: I7f7ceb1b25cfa2400063947f674df10ed6a93e9d Reviewed-on: https://code.wireshark.org/review/11934 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-13epan: Free cf->edt before free cf->epan when redissecting.Stig Bjørlykke1-0/+2
This because cf->edt->pi is pointing to data allocated in wmem_file_scope and epan_free() will free all data in wmem_file_scope. In Qt packet_list_clear() we check and use cf->edt, which will give a heap-use-after-free error. Change-Id: I97d532ba976b7bc5fe2995a224ca168edf3da38b Reviewed-on: https://code.wireshark.org/review/11803 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2015-11-10file.c: do not try to close a file descriptor that was previously already closedPascal Quantin1-1/+4
Bug: 11684 Change-Id: Iaaa5958ea6192ef52b669c687082469b8c7c0219 Reviewed-on: https://code.wireshark.org/review/11656 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jim Young <jim.young.ws@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-8/+0
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-10-05file.c: fix resource leak reported by Coverity (CID 1159387)Pascal Quantin1-1/+1
Change-Id: I24f85f41bcb0c3a0dda0b6658dbfdb4098eb64b9 Reviewed-on: https://code.wireshark.org/review/10796 Reviewed-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-09-29file.c: do not rescan packets is no capture file is openedPascal Quantin1-4/+6
Otherwise we will end up calling cf_cb_file_rescan_started and cf_cb_file_rescan_finished callbacks while no capture file is available Bug: 11552 Change-Id: Ib6fd7b13ce1b083d5f5b4e05d80152112c1451f6 Reviewed-on: https://code.wireshark.org/review/10692 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-09-20Call cf_cb_file_rescan_* callbacks in rescan_packets.Gerald Combs1-0/+4
We call cf_cb_file_rescan_{started,finished} in rescan_file. Do the same in rescan_packets. In the Qt UI this ensures that flushVisibleRows gets called so that packet_list_select_row_from_data works as expected. Change-Id: I425b7beb0f97a7d5b84c979fca65b877673b4722 Reviewed-on: https://code.wireshark.org/review/10569 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-08-26Rework tapping in Qt dialogs.Gerald Combs1-0/+4
Add cf_cb_file_retap_started and cf_cb_file_retap_finished to file.[ch]. Add their associated signals to CaptureFile. Add registerTapListener and removeTapListeners to WiresharkDialog, which collect and automatically remove tap listeners. Add beginRetapPackets and endRetapPackets, which can be used to wrap critical sections so that we don't delete ourselves while tapping. Don't cancel tapping on close in WiresharkDialog. Use beginRetapPackets and endRetapPackets in WiresharkDialog and FollowStreamDialog. We will likely need to add them elsewhere. Update comments. Change-Id: I1788a6ade0817c31aa3419216df96be5e36b2178 Reviewed-on: https://code.wireshark.org/review/10261 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-08-18Improve file merging for mergecap and wiresharkHadriel Kaplan1-371/+144
Refactor the file merging code by removing the duplicate logic from mergecap.c and file.c's cf_merge_files(), into a new merge_files() function in merge.c. Also the following user-visible changes: * Removed the '-T' encap type option from mergecap, as it's illogical for mergecap and would complicate common merge code. * Input files with IDBs of different name, speed, tsprecision, etc., will produce an output PCAPNG file with separate IDBs, even if their encap types are the same. * Added a '-I' IDB merge mode option for mergecap, to control how IDBs are merged. * Changed Wireshark's drag-and-drop merging to use PCAPNG instead of PCAP. Bug: 8795 Bug: 7381 Change-Id: Icc30d217e093d6f40114422204afd2e332834f71 Reviewed-on: https://code.wireshark.org/review/10058 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-18Pcapng: clean up Section Header Block handlingHadriel Kaplan1-27/+10
Change-Id: I8516d0c561ed0b63e49a3594027c9c15bb789258 Reviewed-on: https://code.wireshark.org/review/9726 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-08-06Pcapng: support Name Resolution Block optionsHadriel Kaplan1-8/+18
Make pcapng decode options in an NRB during read, and store the comment option, and write it back out as well. Also make it handle plugin handlers for unknown options in received NRB(s). Change-Id: I81863ef8d85cb1c8b5ba6673ba0e562efe77714f Reviewed-on: https://code.wireshark.org/review/9723 Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-07-04Do error checking on simple_error_message_box() calls and fix errors.Guy Harris1-2/+2
It's a printf-like routine, so give it the right declaration. Fix errors that this finds. Change-Id: I7e8c100ff9e16ba89743ce744cbf548aae705b77 Reviewed-on: https://code.wireshark.org/review/9487 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-06-29Take all epan_column_info members that always get allocated to "number of ↵Michael Mann1-10/+12
columns" to share their own data structure. Change-Id: Ib982662db6cf68730a7d121eac60d9bc5ae67429 Reviewed-on: https://code.wireshark.org/review/9195 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Anders Broman <a.broman58@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-06-25mergecap: check input files time precision before exporting to pcapng formatPascal Quantin1-1/+1
Bug: 11202 Change-Id: I0891235e9fd41687a12eb8c7e05048e25de3d8b9 Reviewed-on: https://code.wireshark.org/review/9137 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-25Qt: fix crashes when Wireshark is closed while running a captureMartin Kaiser1-1/+1
if we haven't captured any packets yet, don't display a warning about unsaved changes make sure that we're not running into a scenario where MainWindow::testCaptureFileClose() tries to close the capture file at the same time as the pipe handler who sees an eof on the pipe cf_has_unsaved_data() should return false if we have a temporary file that contains no packets Change-Id: I18d75bd658b85d45dd3313d49e2cd654c6300de5 Reviewed-on: https://code.wireshark.org/review/9109 Reviewed-by: Evan Huus <eapache@gmail.com> Petri-Dish: Anders Broman <a.broman58@gmail.com> Petri-Dish: Gerald Combs <gerald@wireshark.org> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-24file.c: fix Fix Branch condition evaluates to a garbage value found by Clang ↵Alexis La Goutte1-1/+1
Analyzer Change-Id: Ib7c9e114973f78775cf17889b6aeab217cb6d0ef Reviewed-on: https://code.wireshark.org/review/9101 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-23Morph ProgressBar into CaptureProgressFrame.Gerald Combs1-24/+20
Switch from a plain QProgressBar to a QFrame with a QProgressBar and a stop button. Add a stop_flag boolean to the capture_file struct. To do: - Start adding the progress bar to dialogs. - Don't complain so loudly when the user stops a capture. Change-Id: Iedd1d7d79f2044f1a53e4fb22186d25930a3ef03 Reviewed-on: https://code.wireshark.org/review/9029 Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-05-23Qt: Update the status bar when saving.Gerald Combs1-5/+4
Plumb in more capture file callbacks. Add common functions for setting the status bar file information. Add and update code to match the GTK+ status bar behavior. Make sure we update the capture file length when rescanning. Bug: 10943 Change-Id: Ie84c7a57ee421d57ba3477f8dde3847aaafa1cd1 Reviewed-on: https://code.wireshark.org/review/8594 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-05-17Fix some files to pass the pre-commit hook script.Joerg Mayer1-5/+5
Change-Id: I105bf4e03fcf95cf7541f6377215809759fd933e Reviewed-on: https://code.wireshark.org/review/8502 Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2015-05-10mergecap: fix merge of files with different encapsulation typesPascal Quantin1-23/+31
Issue reported on https://ask.wireshark.org/questions/42061/merging-captures-on-1995 Change-Id: I0697a03221972f2d1616da52aecc6257f0bc5b88 Reviewed-on: https://code.wireshark.org/review/8293 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com>
2015-04-07Revert "Don't rescan packets when a display filter is added if we are ↵Michael Mann1-3/+0
capturing without "Updating list of packets in real time". There are no displayed packets to filter!" This reverts commit a11f7a75486abe3b2fdb7e8ba61e41b40b738dee. Change-Id: If3ae617c8e35439d0a77d2a2ded50288e2e6f5d7 Reviewed-on: https://code.wireshark.org/review/7961 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-07Don't rescan packets when a display filter is added if we are capturing ↵Michael Mann1-0/+3
without "Updating list of packets in real time". There are no displayed packets to filter! Bug: 6217 Change-Id: Ie4a90ff8a738d6c970d51598bf14b4b51ea069ce Reviewed-on: https://code.wireshark.org/review/7918 Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-04-06Keep a captured-packet count in a capture_session and use that.Guy Harris1-7/+0
Have the count in a cfile_t structure always reflect the actual number of packets that have been read from the file, rather than, when doing a non-update-list-of-packets-in-real-time capture, falsely increasing the count in the cfile_t to reflect the number of packets captured but not yet read. Have the status bar base its captured-packet count on the count in the capture_session structure, and base the "sorry, no packets were captured" message on the count in the capture_session structure, as we're no longer using the count in the cfile_t structure to count anything in the process of a non-update-list-of-packets-in-real-time capture. That way, we preserve the invariant that the "frames" member of a cfile_t will be non-null if the "count" member is non-zero, fixing bug 6217. It also means we can get rid of cf_set_packet_count(), as we only set the count in the capture-file-reading code. Bug: 6217 Change-Id: I72c0e2c07c30782bad777995370b7c19e1460cc2 Reviewed-on: https://code.wireshark.org/review/7950 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-03-20Reduce epan dependence on dissectors by having print module "cache" the ↵Michael Mann1-1/+0
protocol and field ids that it needs. Change-Id: I4ec48067e9ca2cbe88e1cf2e6c9dc1e382379221 Reviewed-on: https://code.wireshark.org/review/7767 Reviewed-by: Michael Mann <mmann78@netscape.net> Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-10Change a lot of http:// URLs to https://.Gerald Combs1-2/+2
Most of our sites are now HTTPS-only. Update URLs accordingly. Update other URLs while we're at it. Remove or comment out dead links. Change-Id: I7c4f323e6585d22760bb90bf28fc0faa6b893a33 Reviewed-on: https://code.wireshark.org/review/7621 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-27Qt: Automatically scroll the packet list.Michal Labedzki1-1/+1
Add an "Auto Scroll in Live Capture" action to the Go menu. It's in the View menu in the GTK+ UI but it seems to make more sense as a navigation item. Use a timeout interval for automatic scrolling. I haven't run any tests to see if this makes a difference but it would seem that the less drawing we do during a high speed capture the better, particularly for remote displays. Update the x-stay-last icons. Note that we might want to make prefs.capture_auto_scroll a "recent" setting. Mark auto_scroll_live and packet_list_check_end GTK+ only. Bug: 10601 Co-authored-by: Gerald Combs <gerald@wireshark.org> Change-Id: I645d27c0814f0e4a0d5b01ae68be366847e2522d Reviewed-on: https://code.wireshark.org/review/7292 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-01-18Clean up ftype-conversion and dfilter error message string handling.Guy Harris1-7/+9
Have dfilter_compile() take an additional gchar ** argument, pointing to a gchar * item that, on error, gets set to point to a g_malloc()ed error string. That removes one bit of global state from the display filter parser, and doesn't impose a fixed limit on the error message strings. Have fvalue_from_string() and fvalue_from_unparsed() take a gchar ** argument, pointer to a gchar * item, rather than an error-reporting function, and set the gchar * item to point to a g_malloc()ed error string on an error. Allow either gchar ** argument to be null; if the argument is null, no error message is allocated or provided. Change-Id: Ibd36b8aaa9bf4234aa6efa1e7fb95f7037493b4c Reviewed-on: https://code.wireshark.org/review/6608 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Don't include signal.h unless we need it.Guy Harris1-1/+0
Change-Id: I3965e0951eee919720f780b5e52732fd18fd9786 Reviewed-on: https://code.wireshark.org/review/6194 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-22Fix The left operand of '!=' is a garbage value issue found by Clang AnalyzerAlexis La Goutte1-1/+1
Change-Id: Ia555fc8eca2a7288c159983578cbc88dc0bebbc2 Reviewed-on: https://code.wireshark.org/review/5952 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-12-20Qt: Add a CaptureFile class.Gerald Combs1-2/+2
Wrap the capture_file struct in a QObject which translates cf_cb_* and capture_cb_* events into signals. Move the global cfile to capture_file.cpp. Don't use a void pointer for the capture file struct. Change-Id: Ic5d5efb4bb1db64aa0247245890e5669b1da723a Reviewed-on: https://code.wireshark.org/review/5885 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-12-18Make sure err_info is always set, and print it iff it's non-null.Guy Harris1-22/+36
Change-Id: Ib5c600c491a3d8adcfa91c00fa9445283610545b Reviewed-on: https://code.wireshark.org/review/5830 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18WTAP_ERR_UNWRITABLE_ errors aren't returned by reads or open-for-reading.Guy Harris1-36/+2
Check for them *only* on opening for writing and writes. Change-Id: I4b537d511ec04bcfc81f69166a2b9a2ee9310067 Reviewed-on: https://code.wireshark.org/review/5827 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18Rename WTAP_ERR_REC_TYPE_UNSUPPORTED to WTAP_ERR_UNWRITABLE_REC_TYPE.Guy Harris1-2/+2
That indicates that it's a problem specific to *writing* capture files; we've already converted some errors to that style, and added a new one in that style. Change-Id: I8268316fd8b1a9e301bf09ae970b4b1fbcb35c9d Reviewed-on: https://code.wireshark.org/review/5826 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-18Handle "I can't map this for that file format" better.Guy Harris1-3/+58
For cases where record (meta)data is something that can't be written out in a particular file format, return WTAP_ERR_UNWRITABLE_REC_DATA along with an err_info string. Report (and free) that err_info string in cases where WTAP_ERR_UNWRITABLE_REC_DATA is returned. Clean up some other error reporting cases, and flag with an XXX some cases where we aren't reporting errors at all, while we're at it. Change-Id: I91d02093af0d42c24ec4634c2c773b30f3d39ab3 Reviewed-on: https://code.wireshark.org/review/5823 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17Fix another incorrect message for WTAP_ERR_UNSUPPORTED.Guy Harris1-1/+1
WTAP_ERR_FILE_UNKNOWN_FORMAT is reported if the file is in a format that libwiretap doesn't know about (either because it's not a capture file at all or because it's a capture file in a format it doesn't support). WTAP_ERR_UNSUPPORTED is for files in a *known* format that are using features or file format elements (record type, link-layer header type, etc.) that libwireshark doesn't support. Fix another copy-and-pasteo causing WTAP_ERR_UNSUPPORTED to be reported with a message appropriate for WTAP_ERR_FILE_UNKNOWN_FORMAT. Change-Id: Ib35e2a6b6c62517887e0386f0fed1795db335439 Reviewed-on: https://code.wireshark.org/review/5810 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17Rename WTAP_ERR_UNSUPPORTED_FILE_TYPE to WTAP_ERR_UNWRITABLE_FILE_TYPE.Guy Harris1-1/+1
That makes it clearer what the problem is, and that it should only be returned by the dump code path, not by the read code path. Change-Id: I22d407efe3ae9fba7aa25f08f050317549866442 Reviewed-on: https://code.wireshark.org/review/5798 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-17Rename WTAP_ERR_UNSUPPORTED_ENCAP to WTAP_ERR_UNWRITABLE_ENCAP.Guy Harris1-7/+7
That makes it clearer what the problem is, and that it should only be returned by the dump code path, not by the read code path. Change-Id: Icc5c9cff43be6c073f0467607555fa7138c5d074 Reviewed-on: https://code.wireshark.org/review/5797 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-01Add a Buffer to wtap_pkthdr to hold file-type-specific packet metadata.Guy Harris1-4/+15
For example, this can be used for pcap-ng options not mapped to file-type-independent metadata values. Change-Id: I398b324c62c1cc1cc61eb5e9631de00481b4aadc Reviewed-on: https://code.wireshark.org/review/5549 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-29Clean up routine names, don't pass capture_file into libwireshark.Guy Harris1-25/+11
Give all routines in epan/print.c that write a particular format a name beginning with write_{formatname}. If routines write columns, rather than the raw protocol tree, don't give it a name containing proto_tree. Get rid of empty preamble/finale routines. For CSV, the preamble routine writes out column titles, so call it write_csv_column_titles(). For C arrays, the body routine writes out raw hex data, so call it write_carrays_hex_data(). capture_file isn't a structure defined by libwireshark, so don't make it an argument passed into libwireshark. Change-Id: I5a7e04de9382cf51a59d9d9802f815b8b3558332 Reviewed-on: https://code.wireshark.org/review/5536 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22Get rid of another global in the print code.Guy Harris1-1/+1
Pass the "output only these protocols" hash table as an argument, instead. Change-Id: Id8540943037e7b9bbfe377120c3f60dbe54fe0f1 Reviewed-on: https://code.wireshark.org/review/5440 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-11-22Get rid of write_headers global variable.Guy Harris1-2/+2
Have write_psml_preamble() and write_csv_preamble() take a capture_file * as an argument, so they can print the column titles themselves, rather than having to defer it to the routine that prints packet data. Change-Id: Ifd1b7a13062be8ad46846315976922a752778153 Reviewed-on: https://code.wireshark.org/review/5438 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-20Fix support for writing out edited records.Guy Harris1-1/+45
Add a cf_set_frame_edited() routine to set the record header and data for a record; have it do all the non-GUI work, and have it set the file's "unsaved changes" flag. Have the GUI code just call that routine and then update the title bar to reflect the unsaved changes. While we're at it, unmark a no-longer-unused argument to save_record(). Change-Id: Ieb513fdf423b388519527621ecec4cf634b98caf Reviewed-on: https://code.wireshark.org/review/4885 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-07No need for WTAP_ERR_CANT_READ.Guy Harris1-18/+0
Unlike the standard I/O routines, the code we introduced that supports fast random seeking on gzipped files will always supply some specific error code for read errors, so we don't need WTAP_ERR_CANT_READ. Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard I/O routines for that. Set errno to WTAP_ERR_CANT_WRITE before calling fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails without setting errno. Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63 Reviewed-on: https://code.wireshark.org/review/4540 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28Make the time stamp resolution per-packet.Guy Harris1-34/+0
Pcap-ng files don't have a per-file time stamp resolution, they have a per-interface time stamp resolution. Add new time stamp resolution types of "unknown" and "per-packet", add the time stamp resolution to struct wtap_pkthdr, have the libwiretap core initialize it to the per-file time stamp resolution, and have pcap-ng do the same thing with the resolution that it does with the packet encapsulation. Get rid of the TS_PREC_AUTO_XXX values; just have TS_PREC_AUTO, which means "use the packet's resolution to determine how many significant digits to display". Rename all the WTAP_FILE_TSPREC_XXX values to WTAP_TSPREC_XXX, as they're also used for per-packet values. Change-Id: If9fd8f799b19836a5104aaa0870a951498886c69 Reviewed-on: https://code.wireshark.org/review/4349 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-25Update the simple dialog code.Gerald Combs1-9/+9
Rename simple_dialog_qt.{cpp,h} to simple_dialog.{cpp,h}. Make it a subclass of QMessageBox. Queue messages at startup similar to GTK+. Move the GTK+-specific simple_dialog declarations to gtk/simple_dialog.h. Don't yell at the user so much. Replace exclamation points with periods. Change-Id: I1cc771106222d5e06f1f52d67ac29d6dc367cce4 Reviewed-on: https://code.wireshark.org/review/4288 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-09-22Ensure pcapng application name is dynamically allocatedEvan Huus1-1/+1
I was hasty with my original fix... Change-Id: I339994c1afc34274a5d73eff98c4ebbf030e0f36 Reviewed-on: https://code.wireshark.org/review/4255 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-09-16Fix spelling: cant-->can't, wont-->won't, etcBill Meier1-1/+1
Change-Id: Ia6c3e7a25615bf8e052c3bacf096d76df775c9c2 Reviewed-on: https://code.wireshark.org/review/4126 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-24Modify includes of config.h so that out-of-tree builds, i.e. CMakeGraham Bloice1-1/+1
don't pick up the in-tree copy. Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71 Reviewed-on: https://code.wireshark.org/review/3798 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-02Rename buffer_ routines to ws_buffer_ to avoid name collisions.Guy Harris1-14/+14
In particular, epan/wslua/lrexlib.c has its own buffer_ routines, causing some linker warnings on some platforms, as reported in bug 10332. (Not to be backported to 1.12, as that would change the API and ABI of libwsutil and libwiretap. We should also make the buffer_ routines in epan/wslua/lrexlib.c static, which should also address this problem, but the name change avoids other potential namespace collisions.) Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28 Reviewed-on: https://code.wireshark.org/review/3351 Reviewed-by: Guy Harris <guy@alum.mit.edu>