path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2012-10-22Move some variables inside TRY { } block.Jakub Zawadzki1-89/+95
svn path=/trunk/; revision=45724
2012-10-22Make progbar_quantum volatile to suppress setjmp/longjmp warnings.Guy Harris1-1/+1
svn path=/trunk/; revision=45723
2012-10-22Move TRY CATCH outside reading packet loops.Jakub Zawadzki1-49/+45
svn path=/trunk/; revision=45722
2012-10-221) Allow for the possibility for both packet summary and packet details to beChris Maynard1-0/+4
printed when either -T is not specified or "-T text" or "-T ps" is selected. 2) Allow for packet hex/ascii to be printed without necessarily requiring that either packet summary or packet details also be printed. This just means that if you want packet summary information, use "-Px" instead of just "-x". 3) Fix bug with order of evaluation of -V and "-T psml". 4) If a packet separator is specified, always use it regardless of the -PVx options chosen. 5) Don't print 2 lines of separation between packets when only printing hex/ascii. Print 1 line of separation as in all other cases. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7782 plus other misc. enhancements. svn path=/trunk/; revision=45715
2012-10-20Move ep_free_all() *AFTER* packet dissection.Jakub Zawadzki1-1/+1
Use glib allocator for data_source. Thread on wireshark-dev: http://www.wireshark.org/lists/wireshark-dev/201210/msg00116.html svn path=/trunk/; revision=45673
2012-10-20I don't understand how this variable might be clobbered, but mark it ↵Jakub Zawadzki1-1/+1
volatile to silent gcc warning. svn path=/trunk/; revision=45671
2012-10-20Introduce epan_dissect_run_with_taps() which run dissection with taps.Jakub Zawadzki1-6/+2
unexport tap_queue_init, tap_push_tapped_queue svn path=/trunk/; revision=45670
2012-10-20- Allow reseting edt with new function epan_dissect_reset(),Jakub Zawadzki1-33/+52
- initialize edt once in few places, and later reset it after dissecting (add_packet_to_packet_list), - revert r45667, probably no longer needed. svn path=/trunk/; revision=45669
2012-10-20Make a few variables volatile to fix longjmp warnings.Evan Huus1-9/+9
svn path=/trunk/; revision=45667
2012-10-20Pass create_proto_tree, cinfo directly to add_packet_to_packet_listJakub Zawadzki1-41/+29
svn path=/trunk/; revision=45666
2012-10-20Remove always TRUE refilter argument from rescan_packets, ↵Jakub Zawadzki1-34/+18
add_packet_to_packet_list svn path=/trunk/; revision=45665
2012-10-17Only cap_len (not pkt_len) bytes of buffer are valid.Jakub Zawadzki1-4/+4
svn path=/trunk/; revision=45621
2012-10-17Fix a copy/paste errorJakub Zawadzki1-1/+1
svn path=/trunk/; revision=45620
2012-10-16Add wtap_pseudo_header union to wtap_pkthdr structure.Jakub Zawadzki1-36/+37
Use pkthdr instead of pseudo_header as argument for dissecting. svn path=/trunk/; revision=45601
2012-10-08Log the time we spend waiting for the capture child to exit.Gerald Combs1-0/+4
Add breadcrumbs so that we can switch from g_get_current_time to g_get_real_time when our minimum GLib version is >= 2.28. svn path=/trunk/; revision=45399
2012-10-05Add a capture_file * element to packet_range_t and pass it explicitly inGerald Combs1-1/+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-28Revert r45183:r45184Jakub Zawadzki1-11/+14
r45182 was good fix, but updae frames_count when redissecting. svn path=/trunk/; revision=45189
2012-09-27Revert r45182, add better fix for bug #6208: Status bar count of displayed ↵Jakub Zawadzki1-12/+11
packets wrong cf_read() is already checking for cf->redissecting variable and if set it don't add packets to packet_list. Rename it to cf->rescanning and set it always in rescan_packets() [not only when redissecting]. svn path=/trunk/; revision=45183
2012-09-27Try to fix bug #6208: Status bar count of displayed packets wrongJakub Zawadzki1-4/+6
When refiltering we process gtk/glib events, so it's possible that cf_continue_tail() will fire-up, reading new packets and incrementing cf->count. It's also possible that this packet(s) will pass display filter, incrementing cf->displayed_count. But when refiltering we use cf->count as number of packets to process, so new packets are also processed, incrementing cf->displayed_count second time. Fix bug by saving cf->count before starting refilter loop. svn path=/trunk/; revision=45182
2012-09-26Call fileset_file_closed from cf_cb_file_closed.Gerald Combs1-2/+0
svn path=/trunk/; revision=45163
2012-09-26Add a cf_cb_file_opened callback and use it instead of callingGerald Combs1-1/+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-09-23Store pointers to previously displayed and captured packet, not nstime_t deltas.Jakub Zawadzki1-13/+15
This commit reduces size (from 144B to 128B on AMD64) of frame_data structure. Part of bug 5821: Reduce per-packet memory requirements. svn path=/trunk/; revision=45071
2012-09-20(Try to) fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5808 :Jeff Morriss1-2/+7
Use and free err_info in cf_continue_tail() and cf_finish_tail(). (Untested because I'm not sure how to corrupt a file to exercise this code path...) svn path=/trunk/; revision=45032
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
svn path=/trunk/; revision=45015
2012-09-05Remove string constants from g_assert() calls, as per thread on wireshark-dev:Evan Huus1-1/+2
http://www.wireshark.org/lists/wireshark-dev/201209/msg00030.html svn path=/trunk/; revision=44774
2012-09-04- Replace packet_list_recreate_visible_rows -> ↵Jörg Mayer1-29/+29
packet_list_recreate_visible_rows_list - Replace new_packet_list_ -> packet_list_ svn path=/trunk/; revision=44765
2012-08-12Fix indentation to match editor mode-lines (no tabs, correct indentation, etc);Bill Meier1-326/+329
Reformat some whitespace; Remove unneeded variable initialization. svn path=/trunk/; revision=44461
2012-08-08Make it possible to merge libpcap files with different encapsulation types ↵Anders Broman1-11/+112
by making the output file a pcapng file and construkting SHB and IDB svn path=/trunk/; revision=44338
2012-07-21simple_message_box() does not expect Pango markup, so escaping isGuy Harris1-5/+1
not necessary, and just messes up the display. Fixes bug 7489. #BACKPORT svn path=/trunk/; revision=43875
2012-07-20Add a routine that, given a set of packet encapsulation types, returnsGuy Harris1-4/+12
the per-file encapsulation type needed to write out a set of packets with all those encapsulation types. If there's only one such encapsulation type, that's the type, otherwise WTAP_ENCAP_PER_PACKET is needed. Use that in wtap_dump_can_write_encaps(). Also use it in cf_save_packets() and cf_export_specified_packets(), so that we can write out files with WTAP_ENCAP_PER_PACKET as the file encapsulation type and only one actual per-packet encapsulation type in some cases where that failed before. This fixes the case that showed up in bug 7505, although there are other cases where we *could* write out a capture in a given file format but won't be able to do so; fixing those will take more work. #BACKPORT (Note: this adds a routine to libwiretap, so, when backported, the *minor* version of the library should be increased. Code that worked with the version of the library prior to this change will continue to work, so there's no need to change the *major* version of the library.) svn path=/trunk/; revision=43847
2012-07-19Pass {delayed_}create_progress_dlg a pointer the top level windowGerald Combs1-11/+11
so that we can properly associate a widget with create, update, and destroy events. Only used by Qt so far but it should be easy enough to add to GTK+. Rename ui/qt/progress_dialog.{h,cpp} to progress_bar.{h,cpp}. Show a progress bar in the status bar of the main window instead of creating a separate dialog. Note that we still need to add a "cancel" mechanism and display the task and item titles somewhere. Thus began the War Against Gratuitous Dialogs. svn path=/trunk/; revision=43833
2012-07-15From Michael Mann via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7356:Chris Maynard1-19/+55
Print only visible columns. svn path=/trunk/; revision=43722
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/+3
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-24From Evan Huus:Anders Broman1-0/+4
Size wrong in "File Set List" for just-finished captures. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7370 svn path=/trunk/; revision=43455
2012-06-20Handle the case where the user has added comments to a file that's notGuy Harris1-0/+9
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-6/+48
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-17Add "simple dialog" routines to pop up modal message boxes. Use them inGuy Harris1-204/+172
file.c and routines called from it; non-modal dialogs end up, in some cases, either hidden, devoid of the input focus and not dismissable, or both. svn path=/trunk/; revision=43321
2012-06-17Export a wtap_dump_can_write_encaps() routine from Wiretap; it takes aGuy Harris1-2/+2
file type and a GArray of encapsulation types and returns TRUE if a capture with all those encapsulation types can be written to a file in that file type and FALSE otherwise. Use it where appropriate. svn path=/trunk/; revision=43315
2012-06-15For a capture file, keep an array of all encapsulation types seen.Guy Harris1-3/+44
Show all of them in the summary dialog; we will be using it in the future to figure out what capture file formats we can write to (just because a capture file format supports per-packet encapsulations, that doesn't mean that it supports *all possible* encapsulations). svn path=/trunk/; revision=43278
2012-06-10Clear GtkTreeStore before freeing edtJakub Zawadzki1-8/+13
When building current data for packet details treeview we store two things. - Generated string with item label - Pointer to node field_info structure After epan_dissect_{free, cleanup} pointer to field_info node is no longer valid so we should clear GtkTreeStore before freeing. svn path=/trunk/; revision=43188
2012-06-05If we do a Save or Save As with a move, don't reread the capture file,Guy Harris1-39/+295
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-05Fix some comments.Guy Harris1-2/+2
svn path=/trunk/; revision=43096
2012-06-05Distinguish between "failed" and "user stopped it" for "save as" andGuy Harris1-26/+43
"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-03As we might use cf->lnk_t while a capture is in progress, we need upGuy Harris1-4/+6
update it after each burst of packets. (This is broken - we should have cf->lnk_t be WTAP_ENCAP_PER_PACKET in all capture file formats that can handle more than one packet type, and, in order to support writing out *some* such files in formats that can only handle one packet type, just use the type of the first packet when doing a one-pass operation and gather up all the packet types in a multi-pass operation.) svn path=/trunk/; revision=43048
2012-06-03g_filename_display_basename() returns a g_mallocated string, so itsGuy Harris1-6/+9
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-06-03Use g_filename_display_basename() rather than get_basename() when we'reGuy Harris1-2/+2
getting the basename for display purposes, so it's converted from the GLib/GTK+ locale filename encoding to UTF-8. (For Windows, the locale filename encoding is UTF-8, and the internal encoding is UTF-16, so the file names should *probably* all be valid UTF-8 - Windows may not support invalid UTF-16 in file names. For Qt, I'm not sure whether the file dialogs ever return file names in some non-UTF-8 encoding.) svn path=/trunk/; revision=43044
2012-06-03Update a comment.Guy Harris1-2/+3
svn path=/trunk/; revision=43043
2012-06-02If the rename in a safe "Save As" fails, the current file's name hasGuy Harris1-4/+5
*not* changed; what we need to, on Windows, reopen is the *old* file name, not the name we're saving as. svn path=/trunk/; revision=43003
2012-06-01TShark doesn't need wtap_fdreopen(), as it doesn't do saves and thusGuy Harris1-2/+3
doesn't do safe saves, so wtap_fdreopen() always needs to reopen the random file descriptor. At the point where a safe save is done, the sequential read is done, so the sequential stream is closed; there's no need to reopen it. (The former fourth argument to wtap_fdreopen() wasn't an indication of whether the file was compressed, it was an indicationof whether the random stream should be reopened.) svn path=/trunk/; revision=42977