aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2016-12-04Have separate merge APIs for regular file/temporary file/standard output.Guy Harris1-32/+10
This is similar to what we have for opening a dump file - one API that uses the file name as specified, one that creates a temporary file and provides the file name, and one that uses the standard output. All of those APIs handle closing the output file. Change-Id: I56beea7be347402773460b9148ab31a8f8bc51e1 Reviewed-on: https://code.wireshark.org/review/19059 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-23CMake: Allow setting per target compiler warningsJoão Valverde1-2/+2
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow using different flags per target. Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS and using the COMPILE_OPTIONS property to set them. This change is just setting mechanism and there should be no difference in generated warnings. The check_X_compiler_flag cmake test is changed to test each flag individually. We need a list, not a space separated string, and the aggregate test is not significant. Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25 Reviewed-on: https://code.wireshark.org/review/17150 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-07-21No need to check for string option values being null.Guy Harris1-5/+3
A string option, if present, always has a value; it might be a null *string*, but you won't get a null pointer (if the option isn't present, it simply isn't present). Fix some comments while we're at it. Change-Id: I9c1420f56998a7d04de5c5cc2e92631b181f303a Reviewed-on: https://code.wireshark.org/review/16564 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-18Mark the file as having unsaved data if you change address resolution.Guy Harris1-0/+18
That information can, and will, get saved in some file formats, so mark the file as changed so it can and will get saved by "Save". XXX - we need to treat it as a type of data that can be discarded when saving in some file formats, just like comments. Bug: 12629 Change-Id: I1fd69b95f4f7345c339961b4c53c28b98b364e4e Reviewed-on: https://code.wireshark.org/review/16538 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-07-16Use timers instead of packet counts to update our UI.Gerald Combs1-127/+111
In file.c, update our UI based on the time elapsed since we last finished updating the UI instead of on the number of packets we've processed. Remove the timer code from progress_frame.cpp since it's now redundant. This makes the UI more responsive here for captures with large numbers of packets and it should mean that packets_bar_update spends less time repainting, at least on Windows. Change-Id: I9edfa944c44192350bef75b8c0c3ad63bae9c131 Reviewed-on: https://code.wireshark.org/review/16476 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-14Redo the block options APIs.Guy Harris1-15/+34
A block can have zero or more instances of a given option. We distinguish between "one instance only" options, where a block can have zero or one instance, and "multiple instances allowed" options, where a block can have zero or more instances. For "one instance only" options: "add" routines add an instance if there isn't one already and fail if there is; "set" routines add an instance if there isn't one already and change the value of the existing instance if there is one; "set nth" routines fail; "get" routines return the value of the instance if there is one and fail if there isn't; "get nth" routines fail. For "multiple instances allowed" options: "add" routines add an instance; "set" routines fail; "set nth" routines set the value of the nth instance if there is one and fail otherwise; "get" routines fail; "get nth" routines get the value if the nth instance if there is one and fail otherwise. Rename "optionblock" to just "block"; it describes the contents of a block, including both mandatory items and options. Add some support for NRB options, including IPv4 and IPv6 option types. Change-Id: Iad184f668626c3d1498b2ed00c7f1672e4abf52e Reviewed-on: https://code.wireshark.org/review/16444 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-29tshark fields filter added for other outputsMartin Kacer1-2/+2
-e fields filter addded to ek|json|pdml output. Bug: 12529 Change-Id: I1f0f8772eefceb5b71927925ce0c34af483571b9 Reviewed-on: https://code.wireshark.org/review/16193 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-21tshark JSON and Elasticsearch output fixMartin Kacer1-1/+1
Fixed json and ek escape function Fixed -j protocol filter to do exact match Fixed -T json to correctly close json Added -j protocol filter also to pdml output Bug: 11754 Change-Id: I02f274e4a5a02346922b37bbe946c10340c242ea Reviewed-on: https://code.wireshark.org/review/16034 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-20Add JSON export to Qt/GTK UIPascal Quantin1-0/+80
Change-Id: I5ff46a40cdb1f8f41565d2aa54c6f9e61d397e3a Reviewed-on: https://code.wireshark.org/review/16013 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com> Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-01Add data structures necessary to support multiple Name Resolution blocks.Michael Mann1-8/+8
This doesn't try to use any data from multiple Name Resolution blocks, it just converts single Name Resolution block usage into a GArray, so the potential is there to then use/support multiple Name Resolution blocks within a file format (like pcapng) Change-Id: Ib0b584af0bd263f183bd6d31ba18275ab0577d0c Reviewed-on: https://code.wireshark.org/review/15684 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-01Add data structures necessary to support multiple Section Header blocks.Michael Mann1-8/+8
This doesn't try to use any data from multiple Section Header blocks, it just converts single Section Header block usage into a GArray, so the potential is there to then use/support multiple Section Header blocks within a file format (like pcapng) Change-Id: I6ad1f7b8daf4b1ad7ba0eb1ecf2e170421505486 Reviewed-on: https://code.wireshark.org/review/15636 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-01Allow create_tempfile to support a suffix.Michael Mann1-1/+1
Ping-Bug: 10203 Change-Id: Ifa24870d711449b87e9839dd46af614e4aa28fde Reviewed-on: https://code.wireshark.org/review/15608 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-04-21Link version code statically againJoão Valverde1-1/+1
This allows keeping the code-sharing with the static linking. This "fixes" a hypothetical ABI mismatch with wsutil and avoids pulling more external dependencies to wsutil than strictly necessary. A nice side-effect is that libwsutil no longer depends on version.h. Follow up to f95976eefcbeb5d24df383c29d29ef888b503945. Change-Id: I8f0d6a557ab3f7ce6f0e2c269124c89f29d6ad23 Reviewed-on: https://code.wireshark.org/review/15002 Petri-Dish: João Valverde <j@v6e.pt> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: João Valverde <j@v6e.pt>
2016-04-11Lua: Fix add and remove Fields when reload Lua pluginsStig Bjørlykke1-0/+6
Reset wslua_dfilter and remove the Field tap_listener when reloading plugins. Check for tap listeners in rescan_packets() after ws_epan_new() because Lua may register the Lua field tap when adding Fields. Bug: 12328 Change-Id: Ibbd8339033132c6f3b61d7e9c9ced9ed2b9affec Reviewed-on: https://code.wireshark.org/review/14871 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-03-01Don't show a progress bar when previewing for the Qt print dialog.Guy Harris1-13/+15
We don't do much work to do that - we don't print anything before the first selected page, and once we're finished generating that page, we terminate the printing process - so it shouldn't need a progress bar. (If it needs a progress bar, We Have A Problem, as that slows down the drawing of the dialog box.) This should prevent the problem seen in bug 12040. Bug: 12040 Change-Id: I129191e06fff3e1eb59a9631c7395b9e7f650809 Reviewed-on: https://code.wireshark.org/review/14255 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-23Qt: Select matching tree item and bytes in Find PacketStig Bjørlykke1-1/+7
Highlight the matching tree item and matching packet bytes when doing a Find Packet. Added cf->search_len to correctly highlight the matching bytes when doing a regex search. Bug: 12157 Change-Id: I84fbdb9b43be4355e24aff3cf5f8850f1119e2bf Reviewed-on: https://code.wireshark.org/review/14086 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-02-23Making wiretap option blocks more generic.Michael Mann1-4/+4
This was inspired by https://code.wireshark.org/review/9729/, but takes it in a different direction where all options are put into an array, regardless of whether they are "standard" or "custom". It should be easier to add "custom" options in this design. Some, but not all blocks have been converted. Descriptions of some of the block options have been moved from wtap.h to pcapng.h as it seems to be the one that implements the description of the blocks. Also what could be added/refactored is registering block behavior. Change-Id: I3dffa38f0bb088f98749a4f97a3b7655baa4aa6a Reviewed-on: https://code.wireshark.org/review/13667 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-02-18Qt: Add regex support in Find PacketStig Bjørlykke1-30/+73
Add support for using regular expressions in the Search Frame when searching in packet list, packet details and packet bytes. This search is in many cases faster than plain string search. Change-Id: I2d8a709046f90d7b278fb39547fc4e2e420623bc Reviewed-on: https://code.wireshark.org/review/13981 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-02-12file: fix variable ‘progbar’ might be clobbered by ‘longjmp’ or ↵Alexis La Goutte1-1/+1
‘vfork’ [-Werror=clobbered] found by gcc6 Change-Id: I24a2d48968826c079e696b8136d32929508a26dd Reviewed-on: https://code.wireshark.org/review/13921 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-11Make file indices consistently unsigned in the merge code.Guy Harris1-1/+1
Change-Id: Ie531e5c24c32ca86abbe0c2b5d3526014e5fb831 Reviewed-on: https://code.wireshark.org/review/13897 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-05Don’t adjust time column widths in cf_openStig Bjørlykke1-3/+0
The time column widths should not be adjusted in cf_open() because we don’t have any packets yet and Qt resizeColumnToContents() will not adjust any widths but emits a sectionResized() with invalid or default values (new_width seems to always be 32). This will in some cases (when start capturing packets) give wrong width values which is later stored in the recent file, and the time columns may end up narrow the next time the recent file is read. This fix is related to the column with issues previously compensated for in PacketList::sectionResized() (g4980d505). Change-Id: Id3b49069fe5d2b55d608cc7a6d32fe7851369bf9 Reviewed-on: https://code.wireshark.org/review/13712 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-02-05Qt: Add check for field extractorsStig Bjørlykke1-5/+5
The proto tree is needed in several cases when using Lua field extractors, because they fetch values from the tree. Without a valid field extractor a Lua plugin may misbehave and display wrong column info. This fixes column issues when: - Calling resetColumns() in Qt. This involves adding a display filter, change time display format, change name resolution and other changes in UI which requires column updates. - Print summary lines. - Export as CSV and PSML. Change-Id: Ieed6f8578cdf2759f1f836cd8413a4529b7bbd80 Reviewed-on: https://code.wireshark.org/review/13708 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-23Add more fields to packet_info structure and use them.Guy Harris1-3/+2
Add fields for the absolute time stamp (and another field for a presence flag for the absolute time stamp) and the packet encapsulation for the packet. This lets us remove the field for the packet encapsulation in the frame_data structure; do so. Change-Id: Ifb910a9a192414e2a53086f3f7b97f39ed36aa39 Reviewed-on: https://code.wireshark.org/review/13499 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-13Do not apply color rule filter every dissectionPeter Wu1-0/+9
Introduce a frame_data flag "need_colorize" to indicate that coloring rules need to be evaluated and set it for the GUI (not tshark). This restores the original performance characteristics. It additionally fixes a regression where the color filter name and filter is not shown anymore in the tree (I guess it is related to the edt->tree being NULL when re-selected, resulting in empty color_filter). Remaining problems: - Display filter cannot contain frame.coloring_rule.* fields. Code is present to enable this, but then a method is needed to avoid an expensive second calculation (which is why it is disabled). - The columns are still not updated after coloring rule change. - The two frame.coloring_rule fields in the tree are not updated when the coloring rule is changed (e.g. Ctrl-1). The last two issues were supposed to be fixed by the previous patch, but there is probably some missing code... Tested with GTK and Qt. Bug: 11980 Change-Id: I3ef7713b28db242e178d20f6a5f333374718b52e Reviewed-on: https://code.wireshark.org/review/13170 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-01-10GTK: plugin_if_goto_frame can cause an Access ViolationPaul Offord1-2/+2
This is a fix for bug 11989. This patch fixes the problem for the GTK variant of Wireshark and matches the Qt bug reported by bug 11810 and fixed by change 12306. Bug: 11989 Change-Id: Ib9af8ba745394ebd31825003361ec637c45d75d6 Reviewed-on: https://code.wireshark.org/review/13152 Petri-Dish: Roland Knall <rknall@gmail.com> Reviewed-by: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2016-01-08Fix a lot of typos and misspellingsmoshekaplan1-1/+1
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3 Reviewed-on: https://code.wireshark.org/review/13069 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-28Refactor GUI dependencies out of color_filters.[ch] and move it to epan ↵Michael Mann1-2/+1
directory. This also moved color.h into color_filters.h Change-Id: Ic19e27aa1b3ec67e764aa7ee8bbef7b1187bb12e Reviewed-on: https://code.wireshark.org/review/12831 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-12-09Update the packets bar periodically when loading a (large) file.Jeff Morriss1-22/+2
Update the packet bar each time we update the progress bar: 1) in the Qt UI 2) (and) in the Gtk UI if auto_scroll_live wasn't set 3) (and) even if we don't HAVE_LIBPCAP This allows the user to watch the number of packets increasing. (Extracted from I02c46b086f34a026b7980458f2a93d0d70cac23b.) Change-Id: I47a7a2b0dc6da50035098ab0b0eb0d55f7484960 Reviewed-on: https://code.wireshark.org/review/12459 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-01Fix to avoid protection exception in cf_goto_framePaul Offord1-0/+6
A call to plugin_if_goto_frame when there is no capture file loaded causes a protection exception in cf_goto_file. This fix avoids that problem. Bug: 11810 Change-Id: I7e6f31690a4b0d8d4252b41d8d438979cb253050 Reviewed-on: https://code.wireshark.org/review/12306 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Roland Knall <rknall@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-12-01file: fix Potentially uninitialized variable 'err/err_info' used found by ↵Alexis La Goutte1-2/+2
PVS Studio (V614) Change-Id: I9abc192c492c98beb4cdc32e623115849ad6d512 Reviewed-on: https://code.wireshark.org/review/12332 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-23epan: Free pointers to deallocated memoryStig Bjørlykke1-0/+6
When redissecting packets we call epan_free() which deallocates wmem_file_scope memory. Such memory may be used in proto_data for the currently selected packet (cf->edt) and leaves pointers to deallocated memory (cf->edt->pi.fd->pfd). Free them after epan_free() to avoid unintended usage in packet_list_clear(). Bug: 11740 Change-Id: Ia3bc54f3f34e644a98b8a7eb1addd19b8aeeaab9 Reviewed-on: https://code.wireshark.org/review/11996 Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-11-23Remove configure --enable-ipv6 optionJoão Valverde1-1/+1
It's an ancient obsolete option with a confusing name. Change-Id: Ib10330cf859cdea18fed2077c6539e56350ef380 Reviewed-on: https://code.wireshark.org/review/11967 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
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>