path: root/file.h
AgeCommit message (Collapse)AuthorFilesLines
2016-12-16Rename packet-range.[ch] to packet_range.[ch]Michael Mann1-1/+1
The check*.pl scripts presume that files with the prefix "packet-" are dissector files and therefore have different rules than other files. Rather than trying to clarify that more with additional directory information, just make any non-dissector file with "packet-" filename prefix conform if it fails a "dissector specific" check from the scripts. Change-Id: I7cb52e1fad4ea62320492bb690904260f958aeb4 Reviewed-on: https://code.wireshark.org/review/19304 Petri-Dish: Michael Mann <mmann78@netscape.net> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-12-12Get rid of some GTK+-only routines in file.c.Guy Harris1-15/+0
Just directly call the packet_list_select_ routine from the GTK+ code. Change-Id: I9146fb968c407d6186b146a86aa34678765f7352 Reviewed-on: https://code.wireshark.org/review/19225 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-12-12Mark routines GTK+ only.Gerald Combs1-0/+1
Mark packet_list_select_last_row and cf_goto_bottom_frame GTK+ only. Change-Id: I158814c2fa8c5fa8021b7156dded0945535c978a Reviewed-on: https://code.wireshark.org/review/19223 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-12-04Have separate merge APIs for regular file/temporary file/standard output.Guy Harris1-6/+6
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-07-18Mark the file as having unsaved data if you change address resolution.Guy Harris1-0/+10
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-06-27Qt: Clean up capture file callbacks.Gerald Combs1-8/+8
Mark some callbacks GTK+ only as appropriate. Change a debug message to an assert since we handle all callbacks. Change-Id: I4266f0d7134d19a9c0432354ea36de67501275b4 Reviewed-on: https://code.wireshark.org/review/16171 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-06-20Add JSON export to Qt/GTK UIPascal Quantin1-0/+9
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-03-01Don't show a progress bar when previewing for the Qt print dialog.Guy Harris1-1/+3
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>
2015-08-26Rework tapping in Qt dialogs.Gerald Combs1-0/+2
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-04-06Keep a captured-packet count in a capture_session and use that.Guy Harris1-8/+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-01-01Declare read_keytab_file() in epan/dissectors/packet-kerberos.h.Guy Harris1-5/+0
Don't throw its declaration in file.h, as it's not defined in file.c. Instead, include it in epan/dissectors/packet-kerberos.h and include that wherever read_keytab_file() is called. Yes, that means you also have to include <epan/asn1.h> and, therefore, you have to include <epan/packet.h>. Yes, that should be cleaned up, perhaps by splitting the Kerberos support code into "stuff that handles encryption keys without any reference to dissection" and "stuff that does dissection-related work". Change-Id: Ide5c31e6d85e6011d57202f728dbc656e36138ef Reviewed-on: https://code.wireshark.org/review/6210 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-20Qt: Add a CaptureFile class.Gerald Combs1-1/+19
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-10-21file.c isn't in a DLL, so what it exports shouldn't be WS_DLL_PUBLIC.Guy Harris1-1/+0
Change-Id: I1fcd0422703d21ce3d0764a23bd491708ffc6785 Reviewed-on: https://code.wireshark.org/review/4890 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-20Export cf_set_frame_edited().Guy Harris1-0/+1
Change-Id: I6569b020ff00d6748840a00ca418653d9e3fdb9b Reviewed-on: https://code.wireshark.org/review/4886 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-20Fix support for writing out edited records.Guy Harris1-0/+12
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-14Always put editor-modelines at the end of the file ...Bill Meier1-2/+2
... to ensure that there are no potential issues with respect to editors limiting the number of lines scanned at the end of the file when checking for editor modelines. Change-Id: Ic85cbb108bb5159d6ec4116fea11f5eebb4e44a4 Reviewed-on: https://code.wireshark.org/review/4688 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-10-12Add editor modelines; Adjust whitespace as needed.Bill Meier1-4/+17
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad Reviewed-on: https://code.wireshark.org/review/4626 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-05-24Allow wtap_read() and wtap_seek_read() to return records other than packets.Guy Harris1-14/+14
Add a "record type" field to "struct wtap_pkthdr"; currently, it can be REC_TYPE_PACKET, for a record containing a packet, or REC_TYPE_FILE_TYPE_SPECIFIC, for records containing file-type-specific data. Modify code that reads packets to be able to handle non-packet records, even if that just means ignoring them. Rename some routines to indicate that they handle more than just packets. We don't yet have any libwiretap code that supplies records other than REC_TYPE_PACKET or that supporting writing records other than REC_TYPE_PACKET, or any code to support plugins for handling REC_TYPE_FILE_TYPE_SPECIFIC records; this is just the first step for bug 8590. Change-Id: Idb40b78f17c2c3aea72031bcd252abf9bc11c813 Reviewed-on: https://code.wireshark.org/review/1773 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Revert "Allow wtap_read() and wtap_seek_read() to return non-packet records."Guy Harris1-16/+15
This reverts commit c0c480d08c175eed4524ea9e73ec86298f468cf4. A better way to do this is to have the record type be part of struct wtap_pkthdr; that keeps the metadata for the record together and requires fewer API changes. That is in-progress. Change-Id: Ic558f163a48e2c6d0df7f55e81a35a5e24b53bc6 Reviewed-on: https://code.wireshark.org/review/1741 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-05-23Allow wtap_read() and wtap_seek_read() to return non-packet records.Guy Harris1-15/+16
This is the first step towards implementing the mechanisms requestd in bug 8590; currently, we don't return any records other than packet records from libwiretap, and just ignore non-packet records in the rest of Wireshark, but this at least gets the ball rolling. Change-Id: I34a45b54dd361f69fdad1a758d8ca4f42d67d574 Reviewed-on: https://code.wireshark.org/review/1736 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-25Wireshark: Add option to choose format type of capture fileMichal Labedzki1-1/+2
The best heuristic can fail, so add possibility to manually choose capture file format type, so not correctly recognize file format can be loaded in Wireshark. On the other side now it is possible to open capture file as file format to be dissected. Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a Reviewed-on: https://code.wireshark.org/review/16 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2013-10-11cf_start_tail() is (now) just a wrapper around cf_open(). Get rid of it and ↵Jeff Morriss1-12/+0
just call cf_open(). svn path=/trunk/; revision=52553
2013-08-14Global variables considered harmful.Guy Harris1-1/+1
svn path=/trunk/; revision=51352
2013-08-10Fix (-W)documentation error found by ClangAlexis La Goutte1-2/+2
../ui/preference_utils.h:40:11: error: parameter 'pref:' not found in the function declaration [-Werror,-Wdocumentation] * @param pref: A preference. ^~~~~ ../ui/preference_utils.h:40:11: note: did you mean 'pref'? * @param pref: A preference. ^~~~~ pref ../ui/preference_utils.h:41:11: error: parameter 'unused:' not found in the function declaration [-Werror,-Wdocumentation] * @param unused: unused ^~~~~~~ ../ui/preference_utils.h:41:11: note: did you mean 'unused'? * @param unused: unused ^~~~~~~ unused ../ui/preference_utils.h:48:11: error: parameter 'pref:' not found in the function declaration [-Werror,-Wdocumentation] * @param pref: A preference. ^~~~~ ../ui/preference_utils.h:48:11: note: did you mean 'pref'? * @param pref: A preference. ^~~~~ pref ../ui/preference_utils.h:49:11: error: parameter 'changed_p:' not found in the function declaration [-Werror,-Wdocumentation] * @param changed_p: A pointer to a gboolean. Set to TRUE if the prefere... ^~~~~~~~~~ ../ui/preference_utils.h:49:11: note: did you mean 'changed_p'? * @param changed_p: A pointer to a gboolean. Set to TRUE if the prefere... ^~~~~~~~~~ changed_p ../ui/preference_utils.h:60:11: error: parameter 'unused:' not found in the function declaration [-Werror,-Wdocumentation] * @param unused: unused ^~~~~~~ ../ui/preference_utils.h:60:11: note: did you mean 'unused'? * @param unused: unused ^~~~~~~ unused svn path=/trunk/; revision=51275
2013-08-01Remove fdata->opt_comment, add pkt_comment to pinfoJakub Zawadzki1-2/+4
Original (read from file) comments can be accessed by pkthdr->opt_comment Keep user comments in seperated BST, add new method for epan session to get it. svn path=/trunk/; revision=51090
2013-07-12Move the print modules into epan.Jeff Morriss1-1/+1
svn path=/trunk/; revision=50526
2013-07-11Move some more modules into epan.Jeff Morriss1-1/+1
svn path=/trunk/; revision=50517
2013-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-3/+3
as the "where to put the packet data" argument. This lets more of the libwiretap code be common between the read and seek-read code paths, and also allows for more flexibility in the "fill in the data" path - we can expand the buffer as needed in both cases. svn path=/trunk/; revision=49949
2013-04-26Fix a whole bunch of doxygen warnings, mostly typos or renamed parameters.Evan Huus1-3/+3
svn path=/trunk/; revision=49053
2013-04-02Rename cf_not_saved() to cf_has_unsaved_data() to clarify what itGuy Harris1-1/+1
indicates. (Note: "unsaved data" is more than just "unsaved changes"; it could also mean "temporary file that hasn't been saved anywhere".) svn path=/trunk/; revision=48709
2013-04-01Add routines to file.c to indicate whether:Guy Harris1-2/+27
a save can be done ("can" in the sense of "there's something to save" and in the sense of "we can write that something out"); a "save as" can be done (in the sense of "we can write what we have out"); there's unsaved data to save (which might be unsaved changes or might be a temporary file full of packets); and use them as appropriate. This means that the "unsaved data" indicator in the UI will be turned on for temporary files full of packets as well as for files with unsaved changes; that's what we want. svn path=/trunk/; revision=48693
2013-04-01Define a collection of bits for different types of capture file comments.Guy Harris1-3/+3
For each capture file type, have a bitset of comment types supported by that capture file type. Add a Wiretap routine that, for a given file type, returns the bitset of comment types it supports. Have wtap_get_savable_file_types() take a bitset of comment types that need to be supported by the file types it returns. Replace cf_has_comments() with a routine that returns a bitset of capture file comment types in the capture file. Use those routines in the capture file dialogs; don't wire in the notion that pcap-NG supports all comment types and no other file formats support any comment types. (That's currently true, but we don't want to wire that in as being forever true.) svn path=/trunk/; revision=48689
2013-03-01Export libwireshark symbols using WS_DLL_PUBLIC defineBalint Reczey1-0/+1
Also remove old WS_VAR_IMPORT define and related Makefile magic everywhere in the project. svn path=/trunk/; revision=47992
2013-02-26Fix spelling/typos found using a list of commonly misspelled words.Bill Meier1-5/+5
The misspellings were mostly in comments but some were in text strings visible to the user. svn path=/trunk/; revision=47899
2013-01-02Fix "file.h:56:21: warning: comma at end of enumerator list".Gerald Combs1-1/+1
svn path=/trunk/; revision=46889
2012-10-22volatile fixes.Jakub Zawadzki1-1/+1
svn path=/trunk/; revision=45729
2012-10-22Fix warning: file.c(776) : warning C4028: formal parameter 2 different from ↵Jakub Zawadzki1-1/+1
declaration svn path=/trunk/; revision=45725
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-1/+1
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
2012-10-05Add a capture_file * element to packet_range_t and pass it explicitly inGerald Combs1-3/+1
packet_range_init(). Get rid of global cfile references in packet-range.c. C++-ize packet-range.h. Shuffle some includes around. svn path=/trunk/; revision=45333
2012-09-26Add a cf_cb_file_opened callback and use it instead of callingGerald Combs1-0/+1
fileset_file_opened directly from file.c. This makes the code a bit more consistenent and makes it easier to port the File Set dialog to Qt. svn path=/trunk/; revision=45162
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2012-06-25Only allow "Save" ifGuy Harris1-2/+2
the file has unsaved changes, and we can save it in some format through Wiretap or the file is a temporary file and has no unsaved changes (so that "saving" it just means copying it). Only allow "Save As" if we can save it in some format through Wiretap or the file is a temporary file and has no unsaved changes (so that "saving" it just means copying it). This means that we don't support using "Save As" for just copying the file unless we can do that with Wiretap; copying the file byte-for-byte only works as "saving" if there are no unsaved changes *and* we're saving it in the same format that it's in *and* we're saving it with the same form of compression (if any) that it has. Rename cf_can_save_as() to cf_can_write_with_wiretap() to better reflect what it really does. svn path=/trunk/; revision=43477
2012-06-20Handle the case where the user has added comments to a file that's notGuy Harris1-0/+8
in a format that supports comments and they do a "Save" by popping up a similar question to the one we pop up in the "Save As" case and, if they say "choose another format", pop up a "Save As" dialog box. svn path=/trunk/; revision=43395
2012-06-20If the file has an SHB comment or any packet comments, and the userGuy Harris1-0/+12
tries to do "Save As" in a format for which we don't support comments (currently, we only support them for pcap-ng), ask whether they want to discard the comments and save anyway or, *if* the file can be saved in a format for which we *do* support comments, they want to save the file in some other format. Keep a count of packet comments so that we don't have to scan all the frame_data structures to determine whether we have any comments. svn path=/trunk/; revision=43392
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