aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2001-07-17Added a "Suppress Unmarked" option to the print dialog toEd Warnicke1-3/+5
allow you to suppress the printing of unmarked packets. This allows a user to mark the packets they wish to print and print ONLY those packets by suppressing all other unmarked packets. This may seem like a bit of a convoluted way of expressing things, as usually the desired behavior would be to print the marked packets. However, we do NOT print marked packets that are not displayed under the current filter. To be maximally explicite I've expressed this as suppressing unmarked frames. svn path=/trunk/; revision=3736
2001-07-05"open_cap_file()" in Ethereal and Tethereal don't use the FILE_T theyGuy Harris1-3/+1
get from calling "wtap_file()", so get rid of the call and the (otherwise unused) variable to which its result gets assigned. That lets us get rid of "wtap_file()" in Wiretap. It also lets us get rid of the include of "zlib.h" in "file.h"; the #defines of "file_open()", "filed_open()", and "file_close()" are also unnecessary, so we get rid of those as well. However, that means we need to include <zlib.h> in "gtk/main.c" and "tethereal.c", so that the version number of libz is defined and can show up in the version string. svn path=/trunk/; revision=3652
2001-06-19More signed vs. unsigned cleanups, and initialization cleanups, fromGuy Harris1-4/+4
Joerg Mayer. svn path=/trunk/; revision=3578
2001-06-08When printing the contents of a raw-data field, don't use the raw dataGuy Harris1-2/+2
of the current frame as the source, use the raw data of the tvbuff that's the data source of that field. svn path=/trunk/; revision=3531
2001-06-08Move the fragment reassembly code into "reassemble.c" andGuy Harris1-1/+14
"reassemble.h", and remove IPv4 dependencies from it. Use it for OSI CLNP segment reassembly as well. svn path=/trunk/; revision=3525
2001-06-05Enable "Match Selected" only if there's a field selected *and* we can doGuy Harris1-47/+27
a "Match Selected" on it - we can't do a "Match Selected" if the field has no value (e.g., FT_NULL) and has a length of 0. If we unselect the current packet, we don't have a protocol tree, so we don't have a currently selected field - clear the "Match Selected" menu item and the display in the status line of information about the currently selected field. Move the low-level statusbar manipulation into "gtk/main.c", in routines whose API doesn't expose anything GTK+-ish. "close_cap_file()" calls one of those routines to clear out the status bar, so it doesn't need to take a pointer to the statusbar widget as an argument. "clear_tree_and_hex_views()" is purely a display-manipulating routine; move it to "gtk/proto_draw.c". Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine to do all the work that needs to be done if the currently selected protocol tree row is unselected, and call it if the currently selected packet list row is unselected (if it's unselected, there *is* no protocol tree, so no row can be selected), as well as from "tree_view_unselect_row_cb()". Before pushing a new field-description message onto the statusbar, pop the old one off. Get rid of an unused variable (set, but not used). svn path=/trunk/; revision=3513
2001-05-27Plug a memory leak (we weren't freeing the "epan_dissect_t" pointed toGuy Harris1-3/+10
by the "edt" member of a "capture_file" structure if we were selecting a new frame, we were just overwriting that pointer). Update Gerald's e-mail address. svn path=/trunk/; revision=3470
2001-05-01"prefs.capture_real_time", not "prefs.capture_auto_scroll", shouldGuy Harris1-5/+3
control whether we have a child process do the capturing; a user might want the packet list to be updated as packets arrive but *not* want it to scroll so that the most recently arrived packets are shown. "prefs.capture_auto_scroll", not "auto_scroll_live", should control whether we scroll a real-time-update capture's packet list; "auto_scroll_live" isn't set by the capture dialog box, "prefs_capture_auto_scroll" is. svn path=/trunk/; revision=3388
2001-03-24The declaration of "destroy_packet_wins()" belongs inGuy Harris1-1/+2
"gtk/packet_win.h", along with the declarations of the other packet window manipulation routines; put it there. svn path=/trunk/; revision=3180
2001-03-24Give the code that computes protocol statistics a progress dialog box,Guy Harris1-1/+2
as, on a large capture, it could take a significant amount of time. Let the user stop the computation and, if they do, don't pop up the statistics dialog box. Create a new header file declaring the routines to create, update, and destroy progress dialog boxes; those routines' APIs don't depend on GTK+, but others declared in "ui_util.h" do, and we don't want to oblige a source file to depend on GTK+ headers unless it uses a GTK+ API or an API that depends on GTK+. svn path=/trunk/; revision=3179
2001-03-23Changes required to support multiple named data sources.Jeff Foster1-10/+40
Tvbuffers changed to added the data source name, GUI and printing code changed to support these changes and display the multiple hex views. svn path=/trunk/; revision=3165
2001-02-11In Ethereal, attempt to get the packet statistics from libpcap whenGuy Harris1-5/+13
capturing; if we succeed, display the packet drops count as the "Drops" value in the status line and as the "Dropped packets" statistics in the summary dialog box, otherwise don't display it at all. In Tethereal, attempt to get the packet statistics from libpcap when capturing; if we succeed, and if there were any dropped packets, print out the count of dropped packets when the capture finishes. svn path=/trunk/; revision=3016
2001-02-10Check for errors when writing a capture file.Guy Harris1-2/+2
Report errors when writing or closing a capture file. Clean up some I/O error messages. svn path=/trunk/; revision=3011
2001-02-03Use "dfilter_apply_edt()" rather than "dfilter_apply()".Guy Harris1-10/+7
svn path=/trunk/; revision=2982
2001-02-01Create a more modular type system for the FT_* types. Put themGilbert Ramirez1-15/+14
into epan/ftypes. Re-write display filter routines using Lemon parser instead of yacc. Besides using a different tool, the new grammar is much simpler, while the display filter engine itself is more powerful and more easily extended. Add dftest executable, to test display filter "bytecode" generation. Add option to "configure" to build dftest or randpkt, both of which are not built by default. Implement Ed Warnicke's ideas about dranges in the new display filter and ftype code. Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree, while FT_PROTOCOL is used for protocols. This was necessary for being able to make byte slices (ranges) out of protocols, like "frame[0:3]" Win32 Makefile.nmake's will be added tonight. svn path=/trunk/; revision=2967
2001-01-28Get rid of support for old-style plugins (support for old-style pluginsGuy Harris1-10/+2
requires that the dfilter code be initialized before the plugins are added; this required us to *re*-initialize the dfilter code after reading in all the plugins, as the plugins may themselves have added new filterable fields - that was a bit of a mess), and make the "Tools->Plugins" dialog box show the new-style plugins. svn path=/trunk/; revision=2950
2000-11-21Add a "color.h" file that declares a nominally-toolkit-independentGuy Harris1-9/+12
"color_t" structure to store color values (although currently it has all the same fields that a GdkColor has; its currently advantage is that you don't have to include any GTK/GDK stuff to declare it). Add routines in the "gtk" directory to convert between "color_t" and GdkColor values. Define, in "prefs.h", all colors as "color_t" values rather than GdkColor values. "prefs.h" now no longer needs to include <gtk/gtk.h>, so don't include it. svn path=/trunk/; revision=2692
2000-11-19For each column, have both a buffer into which strings for that columnGuy Harris1-4/+6
can be put, and a pointer to the string for the column, which might or might not point to that buffer. Add a routine "col_set_str()", which sets the string for the column to the string passed to it as an argument; it should only be handed a static string (a string constant would be ideal). It doesn't do any copying, so it's faster than "col_add_str()". Make the routines that append to columns check whether the pointer to the string for the column points to the buffer for the column and, if not, copy the string for the column to the buffer for the column so that you can append to it (so you can use "col_set_str()" and then use "col_append_str()" or "col_append_fstr()"). Convert a bunch of "col_add_str()" calls that take a string constant as an argument to "col_set_str()" calls. Convert some "col_add_fstr()" calls that take a string constant as the only argument - i.e., the format string doesn't have any "%" slots into which to put strings for subsequent arguments to "col_set_str()" calls (those calls are just like "col_add_str()" calls). Replace an END_OF_FRAME reference in a tvbuffified dissector with a "tvb_length(tvb)" call. svn path=/trunk/; revision=2670
2000-10-20Remove #include "gtk/colors.h" from file.h, which keep the GTK+ headerGilbert Ramirez1-1/+2
files from being #included in epan/packet.c. Fix the other files that need either "gtk/colors.h" or <gtk/gtk.h> #included as a result of not pulling in gtk/colors.h automatically because of file.h. svn path=/trunk/; revision=2519
2000-10-06Implement epan_dissect_new() and epan_dissect_free(). These are theGilbert Ramirez1-7/+17
"top-level" dissectors that libepan-users call, instead of dissect_packet(). The epan_dissect_t holds the tvbuff after dissection so that the tvbuff's memory is not cleared until after the proto_tree is freed. (I might stuff the proto_tree into the epan_dissect_t, too). What remains of dissect_packet() in packet.c handles the tvbuff initialiation. The real meat of dissect_packet() is now in dissect_frame(), in packet-frame.c This means that "packet.c" is no longer a dissector, os it is no longer passed to make-reg-dotc. Once dissect_fddi() gets two wrapper functions (dissect_fddi_swapped() and dissect_fddi_nonswapped()), the a dissector handoff routine could be used instead of the switch statement in dissect_frame(). I'd register a field like "wtap.encap" svn path=/trunk/; revision=2478
2000-09-27First step in moving core Ethereal routines to libepan.Gilbert Ramirez1-3/+5
svn path=/trunk/; revision=2458
2000-09-17The correct way to check for an error (rather than an EOF) from a failedGuy Harris1-4/+4
attempt to read from a capture file is to check whether the error returned was 0 - if it is, it's an EOF. We no longer guarantee that the data offset supplied will be negative on an error and 0 on an EOF. svn path=/trunk/; revision=2445
2000-09-12It's "GSList", not "GSlist".Guy Harris1-2/+2
svn path=/trunk/; revision=2417
2000-09-12Also free the GSLists for per-frame data on frames we haven'tGuy Harris1-8/+6
re-dissected on a rescan. svn path=/trunk/; revision=2416
2000-09-11Fix the problem with resetting per-frame state info problems that thereRichard Sharpe1-8/+7
seemed to be ... svn path=/trunk/; revision=2412
2000-09-11We have to free up the per-frame data when we rescan, because we haveRichard Sharpe1-1/+10
called packet_init_proto, which blows away the items the list points to. svn path=/trunk/; revision=2408
2000-09-10Compute and display negative relative and delta time stamps correctly,Guy Harris1-19/+14
just in case time goes backwards (yes, it sometimes does happen in captures). svn path=/trunk/; revision=2407
2000-09-09"redraw_hex_dump()" can't use "cfile.pd" or "cfile.current_frame", as itGuy Harris1-3/+2
may be redrawing a packet window that displays a frame other than the current frame; give it arguments to specify the raw frame data and "frame_data" structure for the frame. This requires that each packet window have, associated with it, a pointer to the "frame_data" structure; that replaces the "cap_len" and "encoding" fields in a "PacketWinData" structure, as those are just copies of fields from the frame's "frame_data" structure. "packet_hex_print()" needn't be passed both the start and length values from a "field_info" structure - just pass it a pointer to that structure, or NULL for "no field is selected in the packet". It also needn't, any longer, be passed the "cap_len" and "flags.encoding" fields of a "frame_data" structure - just pass it a pointer to that structure. In "redraw_hex_dump_all()", don't redraw the hex dump pane of the main window if there is no current frame. svn path=/trunk/; revision=2404
2000-09-08Redraw:Guy Harris1-3/+2
the text in all "Follow TCP Stream" windows; the text in the help window if we have one up; all hex dump windows; when GUI preference changes are to be applied, so that font changes and "Follow TCP Stream" color changes show up. Update both the Roman and bold font when the font is changed. Don't decrement the reference counts on the old Roman and bold fonts until that's all done. svn path=/trunk/; revision=2401
2000-09-08Graham Bloice's patch to support inverse video rather than boldfaceGuy Harris1-2/+3
highlighting of the bytes, in the hex dump window, corresponding to a selected field. Also, make "remember_ptree_widget()" static, as it's not used outside "gtk/proto_draw.c". svn path=/trunk/; revision=2399
2000-09-07Change wtap_read() API so that the data offset is set via a pointer, andGilbert Ramirez1-4/+4
a "keep reading" boolean value is returned from the function. This avoids having to hack around the fact that some file formats truly do have records that start at offset 0. (i4btrace and csids have no file header. Neither does the pppdump-style file that I'm looking at right now). svn path=/trunk/; revision=2392
2000-08-24If we've thrown away saved state before a rescan of the frames in aGuy Harris1-2/+21
capture, clear the per-frame data pointers of all frames in the capture, as those pointers now refer to data that's been freed. Do that to all frames even if the user stops the rescan in the middle - and clear the "visited" flag for all frames as well. svn path=/trunk/; revision=2361
2000-08-24Actually, we do have to clear all the dissector information if we'reGuy Harris1-8/+34
redissecting the packets due to some preference changing, as the preference may affect what state information gets constructed as a result of some particular frame being dissected. We don't have to do it when filtering the packets, or colorizing them, however. svn path=/trunk/; revision=2359
2000-08-24Instead of keeping in the information about an RPC call a count of theGuy Harris1-14/+1
number of replies seen, keep the frame number of the first request seen for that call and the first reply seen for that call. Use that to determine whether a request or reply is a duplicate or not. That means that we don't have to reset the table of RPC calls on a rescan of the capture (which didn't even fix all the cases where we'd have misreported the original call or reply as a duplicate due to having seen it once on the initial pass through the file and once again when, for example, the user clicked on the packet); doing so causes plenty of other problems, so don't do that - and don't clear the "visited" flag on frames on a rescan, either, as that's only done because we were clearing out conversations and calling all protocols' "init" routines. As a free bonus, this means that, for a reply, we know what frame the request was in; put that information into the protocol tree for the reply, snoop-style. Make the table of RPC call information, and the routines that manipulate it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them. svn path=/trunk/; revision=2358
2000-08-21Add prefs.gui_marked_[fb]g color preferences for theLaurent Deniel1-4/+3
color of marked frames. They are currently only available from preferences file, but I will add the color selection in GUI later. svn path=/trunk/; revision=2327
2000-08-21Frames in the packet list can now be marked by the user usingLaurent Deniel1-9/+22
the middle mouse button. The marked packets are displayed in reverse video but this should change in the future (the color should be configurable via the GUI). Then, the marked packets can be saved (via the "Save as" window dialog). Other features will be added in the future (I am waiting for your comments and wishes). svn path=/trunk/; revision=2322
2000-08-19Fix potential buffer overflows.Laurent Deniel1-3/+4
svn path=/trunk/; revision=2298
2000-08-15Oups. Forgot some set_menus_for_selected_tree_row calls.Laurent Deniel1-1/+2
svn path=/trunk/; revision=2277
2000-08-11Miscellaneous code cleaningLaurent Deniel1-8/+9
- add <stdarg.h> or <varargs.h> in snprintf.h and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes - remove the check of multiple inclusions in source (.c) code (there is a bit loss of _cpp_ performance, but I prefer the gain of code reading and maintenance; and nowadays, disk caches and VM are correctly optimized ;-). - protect all (well almost) header files against multiple inclusions - add header (i.e. GPL license) in some include files - reorganize a bit the way header files are included: First: #include <system_include_files> #include <external_package_include_files (e.g. gtk, glib etc.)> Then #include "ethereal_include_files" with the correct HAVE_XXX or NEED_XXX protections. - add some HAVE_XXX checks before including some system header files - add the same HAVE_XXX in wiretap as in ethereal Please forgive me, if I break something (I've only compiled and regression tested on Linux). svn path=/trunk/; revision=2254
2000-08-09Make copy_binary_file() static since follow_dlg.c no longer uses it.Gilbert Ramirez1-2/+3
svn path=/trunk/; revision=2237
2000-08-03Add a "Save As" feature to the TCP Follow dialogue, to save the streamGilbert Ramirez1-54/+76
file to a user-specified file. Move the file-copy routine in save_cap_file() to an indepenent function in file.c (copy_binary_file()) so that follow_dlg.c can use it. Remove #include "follow.h" from the C files that don't need it. svn path=/trunk/; revision=2200
2000-08-03Replace calls to sprintf() with snprintf() in file_*_error_message routines,Gilbert Ramirez1-6/+11
as a long filename may overflow the buffer. svn path=/trunk/; revision=2199
2000-07-26When rescanning a file, all state information for the frames hasGilbert Ramirez1-1/+5
been deleted. So we have to set fdata->flags.visited to 0 for each frame, denoting a "fresh" scan. svn path=/trunk/; revision=2161
2000-07-20In Tethereal:Guy Harris1-2/+2
When capturing, report errors trying to create the output file with "file_open_error_message()". Make the "for_writing" argument to "file_open_error_message()" a "gboolean", as it's either TRUE (if the file is being opened for writing) or FALSE (if it's being opened for reading). Report EISDIR as "XXX is a directory (folder), not a file.". When checking whether an "open()" of a capture file succeeded, check whether "open()" returns a negative number, not whether it returns 0. In "wtap_open_offline()", if the file to be opened is a directory, return EISDIR, not WTAP_ERR_NOT_REGULAR_FILE, so that the error message can say "that's a directory, not a file". If "wtap_open_offline()" returns WTAP_ERR_NOT_REGULAR_FILE, don't just say the file is "invalid", say it's a "special file" or socket or some other weird type of file. svn path=/trunk/; revision=2144
2000-07-20Use ESD_TYPE_CRIT for most errors (the model used by various GUIs seemsGuy Harris1-13/+17
to use "warning" dialog boxes only to warn the user "if you do that, bad things may happen" *and* to offer them the option either to drive on or quit, so perhaps ESD_TYPE_CRIT should be used for all errors). However, put "Ethereal: Error" rather than "Ethereal: Critical" in the title bar, in the hopes that it'll make it clearer that Something Bad Happened. If the user specifies that captures should be saved to a user-specified file rather than a temporary file, report errors trying to create that file with "file_open_error_message()". Make the "for_writing" argument to "file_open_error_message()" a "gboolean", as it's either TRUE (if the file is being opened for writing) or FALSE (if it's being opened for reading). Report EISDIR as "XXX is a directory (folder), not a file.". svn path=/trunk/; revision=2143
2000-07-09Put up a progress dialog when changing the time display; it can take aGuy Harris1-1/+47
long time on a large capture. If the user is changing the setting of "Display TOS as DiffServ" *and* the time stamp format, don't bother doing the time display update - we'll regenerate the entire display anyway because we changed the setting of "Display TOS as DiffServ". svn path=/trunk/; revision=2130
2000-07-09Turn the code of "colorize_packet()" into a static routine that is givenGuy Harris1-35/+74
a word to use in the progress dialog, and a flag indicating whether the display filter is to be reevaluated or not, and: have "colorize_packet()" call that routine with "Colorizing" and FALSE as those arguments; have the filtering code call that routine with "Filtering" and TRUE as those arguments; add an exported routine to call that routine with "Reprocessing" and TRUE as those arguments, to use to re-generate the packet list and to re-filter the packets if a protocol preference has been changed. Keep track of whether preferences are changed from their initial value by a preferences file or a command-line option, or from their previous value by the "Preferences" dialog box; have "prefs_apply_all()" only call the "apply" callback for a module if they have. Call "prefs_apply_all()" after the command-line arguments have been parsed and after "OK" has been clicked in the "Preferences" dialog box, to notify modules of preference changes if they've registered a callback for that. After "OK" has been clicked in the "Preferences" dialog box, if any preferences have changed, call the reprocessing routine, as the summary line for some frames and/or the current display filter's value when applied to some frames may have changed as a result of a preference change. Do the same after "OK" or "Apply" has been clicked in the "Display Options" dialog box (as it controls a protocol preferences item. svn path=/trunk/; revision=2126
2000-07-07If the progress dialog gets a "delete" event, have the handler returnGuy Harris1-4/+5
TRUE, meaning "don't delete this", and if its "stop this operation" button gets clicked, don't have its handler delete the progress dialog; instead, leave the deletion of the window up to the code using the dialog, as it'll do so when it stops the operation. Make the "read file" operation destroy the dialog; all the other operations already did so (as they just broke out of the loop doing the operation, rather than returning). Don't catch the "destroy" operation on the dialog box - its handler appeared never to get called; we can just free the "progdlg_t" for the dialog in "destroy_progress_dlg()", right after destroying the dialog box widget. svn path=/trunk/; revision=2122
2000-07-07Use "progdlg_t *" rather than "void *" as the handle for a progressGuy Harris1-18/+19
dialog box; that lets us do some type-checking, but we can still typedef it to an incompletely-defined structure to hide the implementation details from the caller. Make "create_progress_dlg()" take, as an argument, the title to put in the "stop the operation" button, and use "Stop" rather than "Cancel" if stopping the operation doesn't undo all the work it's done. Thaw the clist if we break out of a "read the file" operation, as we freeze it before the operation. Have the handler for the "delete" event on the progress dialog box return FALSE, to let GTK+ know that it should, in fact, delete the window. ("delete" event handlers should return TRUE if the window shouldn't actually be deleted, FALSE if it should; they should not return "void".) svn path=/trunk/; revision=2120
2000-07-03If the user clicks the "Cancel" button in a progress-bar dialog box forGuy Harris1-4/+5
reading a capture file, we should just clean up and return so that Ethereal continues running with no capture file loaded, unless the read is being done as a result of Ethereal being run with the "-r" flag, in which case we still exit (although we may eventually choose to continue running with no capture file loaded even in that case). svn path=/trunk/; revision=2104