aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
AgeCommit message (Collapse)AuthorFilesLines
2001-04-18Check the validity of numbers specified in command-line options.Guy Harris1-3/+3
svn path=/trunk/; revision=3326
2001-02-11In Ethereal, attempt to get the packet statistics from libpcap whenGuy Harris1-1/+2
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-01Create a more modular type system for the FT_* types. Put themGilbert Ramirez1-8/+5
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-28There's no need for a member of a "capture_file" structure holding aGuy Harris1-8/+1
compiled capture filter program, so remove it, and remove the include of <pcap.h> from "file.h"; instead, have local "struct bpf_program" structures where needed, and have those files that need stuff from <pcap.h> include it. This cleans stuff up a bit, and should eliminate a pile of compile warnings with Visual C++ due to <pcap.h> and some GTK+/GLib header file (or files they include) both defining "inline". svn path=/trunk/; revision=2954
2000-10-20Remove #include "gtk/colors.h" from file.h, which keep the GTK+ headerGilbert Ramirez1-3/+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-1/+4
"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-08-21Frames in the packet list can now be marked by the user usingLaurent Deniel1-2/+2
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-11Miscellaneous code cleaningLaurent Deniel1-13/+1
- 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-3/+1
svn path=/trunk/; revision=2237
2000-08-03Add a "Save As" feature to the TCP Follow dialogue, to save the streamGilbert Ramirez1-1/+3
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-07-20Use ESD_TYPE_CRIT for most errors (the model used by various GUIs seemsGuy Harris1-2/+2
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-09Turn the code of "colorize_packet()" into a static routine that is givenGuy Harris1-1/+2
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-03Remove the progress bar from the status line, and, instead, for anyGuy Harris1-2/+1
potentially long-running operation that has a progress indicator, pop up a modal dialog box with an indication of what is being done; a progress bar; a "Cancel" button to stop the operation. This: leaves more room on the status line for a filter expression; provides a mechanism to allow the user to cancel long-running operations (although the way we do so may not back out of them as nicely as the user might like, if it's not obvious what the "right" way is or if the "right" way is difficult to implement or involves doing as much work as letting the operation continue); means that, because the dialog box is modal, we don't have to worry about the user performing arbitrary UI operations out from under the operation and changing arbitrary bits of state being used by that operation. svn path=/trunk/; revision=2103
2000-06-27Add routines to Wiretap to allow a client of Wiretap to get:Guy Harris1-4/+21
a pointer to the "wtap_pkthdr" structure for an open capture file; a pointer to the "wtap_pseudo_header" union for an open capture file; a pointer to the packet buffer for an open capture file; so that a program using "wtap_read()" in a loop can get at those items. Keep, in a "capture_file" structure, an indicator of whether: no file is open; a file is open, and being read; a file is open, and is being read, but the user tried to quit out of reading the file (e.g., by doing "File/Quit"); a file is open, and has been completely read. Abort if we try to close a capture that's being read if the user hasn't tried to quit out of the read. Have "File/Quit" check if a file is being read; if so, just set the state indicator to "user tried to quit out of it", so that the code reading the file can do what's appropriate to clean up, rather than closing the file out from under that code and causing crashes. Have "read_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, close the capture and return an indication that the read was aborted by the user. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have "continue_tail_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, quit the loop, and after the loop finishes (even if it read no packets), return an indication that the read was aborted by the user if that happened. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have "finish_tail_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, quit the loop, and after the loop finishes (even if it read no packets), close the capture and return an indication that the read was aborted by the user if that happened. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have their callers check whether the read was aborted or not and, if it was, bail out in the appropriate fashion (exit if it's reading a file specified by "-r" on the command line; exit the main loop if it's reading a file specified with File->Open; kill the capture child if it's "continue_tail_cap_file()"; exit the main loop if it's "finish_tail_cap_file()". svn path=/trunk/; revision=2095
2000-05-19Add wtap-int.h. Move definitions relevant to the internal workins of wiretapGilbert Ramirez1-2/+2
to that file, leave public definitions in wtap.h. Rename "union pseudo_header" to "union wtap_pseudo_header". Make the wtap_pseudo_header pointer available in packet_info struct. svn path=/trunk/; revision=1989
2000-05-18Remove the "union pseudo_header" from the "frame_data" structure;Guy Harris1-2/+2
there's no need to keep it around in memory - when the frame data is read in when handing a frame, read in the information, if any, necessary to reconstruct the frame header, and reconstruct it. This saves some memory. This requires that the seek-and-read function be implemented inside Wiretap, and that the Wiretap handle remain open even after we've finished reading the file sequentially. This also points out that we can't really do X.25-over-Ethernet correctly, as we don't know where the direction (DTE->DCE or DCE->DTE) flag is stored; it's not clear how the Ethernet type 0x0805 for X.25 Layer 3 is supposed to be handled in any case. We eliminate X.25-over-Ethernet support (until we find out what we're supposed to do). svn path=/trunk/; revision=1975
2000-05-15We can't trust "cf->current_frame" to refer to the frame that wasGuy Harris1-3/+1
selected before we started re-colorizing or re-filtering the display, as when the first row is added to the clist, that may be selected and thus made the current frame. This means that we can't find the row corresponding to the previously-selected frame, if any, by checking as each packet is colorized/filtered and see whether its "frame_data" structure is equal to "cf->current_frame", as that'll always say that the first frame in the display is the selected frame. Instead, we recored the value of "cf->current_frame" before we do anything to the clist, have "add_packet_to_packet_list()" return either the row number of the frame (if it passed the filter and thus was added to the clist) or -1 (if it didn't pass the filter and thus wasn't added to the clist), and, after "add_packet_to_packet_list()", if the current frame is the one that was the selected row, remember its row number (if any), and, when we're finished colorizing/filtering the display, make that row the current row if it's not -1 (-1 means that the selected row didn't pass the filter). Also, don't do that until after we've thawed the clist, as the vertical adjustment for the clist doesn't reflect reality until then, and attempting to go to a given row won't work right until the vertical adjustment for the clist reflects reality. Shove all the code to set the selected and focus rows, and to make said row visible, into a routine, so the "Find Frame" and "Go To Frame" code can use it as well. svn path=/trunk/; revision=1959
2000-04-03Use a GMemChunk for allocating and freeing "frame_data" structures; itGuy Harris1-1/+2
reduces the memory required for one big capture file I have by about 10 megabytes, and speeds up the reading in of that file, presumably because it amortizes the memory-allocator space and CPU time overhead over a set of several "frame_data" structures. svn path=/trunk/; revision=1776
2000-02-12The color stuff is almost completely toolkit-dependent (this isn't justGuy Harris1-2/+2
the color-selection and color-filter-editing GUI stuff; different toolkits, and different windows systems, have their own notions of color objects - they may have nothing in common other than the notion that colors have red, green, and blue values); move it all to the "gtk" subdirectory for now, and, as we discover stuff stuff that can be made platform-independent, drag it up to the top-level directory. svn path=/trunk/; revision=1621
2000-01-24Ethereal shouldn't use "file_seek()", "file_read()", or "file_write()"Guy Harris1-9/+1
directly; it should use them through Wiretap. (Arguably, it shouldn't use "file_open()", "file_dopen()", or "file_close()" directly, and should use those through Wiretap as well.) svn path=/trunk/; revision=1540
2000-01-08Don't recompute "cf->count" when filtering packets - the recomputationGuy Harris1-2/+1
will just give it the value it's always had, as packets are counted regardless of whether they pass the filter or not (which is what we want). Given that, so there's no need for a separate "cf->unfiltered_count" value, so get rid of it and use "cf->count" instead. svn path=/trunk/; revision=1441
1999-12-10Move GTK code out of summary.c and into gtk/summary_dlg.cGilbert Ramirez1-1/+5
summary.c now provides a struct of info (see summary.h) Changed the name of the summary dialogue callback (hence the change in menu.c), and added a close button to the dialogue. Moved #include <gtk/gtk.h> out of print.c and into prefs.h where it was needed for GdkColor. svn path=/trunk/; revision=1273
1999-12-04To find out the file's packet encapsulation type (which could beGuy Harris1-2/+1
WTAP_ENCAP_PER_PACKET, if there's more than one type of packet in the file, or could be WTAP_ENCAP_UNKNOWN, if the file is of a type that doesn't put an encapsulation type in the file header, and it has no packets), we just need to call "wtap_file_encap()" when we're done reading the file. svn path=/trunk/; revision=1205
1999-12-04Now that "wtap_file_type_string()" takes a file type rather than a "wtapGuy Harris1-2/+1
*" as an argument, there's no need to save the file type string in a "capture_file" structure - we save the file type, and can use that when generating the summary display. svn path=/trunk/; revision=1202
1999-11-30Allow the user to save either all of the current capture, or only theGuy Harris1-5/+9
packets that are currently being displayed from that capture. Centralize the code to control whether "File:Save" and "File:Save As" are enabled (and *always* have "File:Save As" enabled if you have a capture; "File:Save" is enabled only if you have a live capture you've not yet saved, although it does the same thing as "File:Save As"). Have the "save_file" member of a "capture_file" structure represent *only* the file currently being *written* to by a capture, and, if there is no capture currently in progress, have it be NULL; the name of the file currently being *displayed" is in the "filename" member, and an "is_tempfile" member indicates whether it's a temporary file for a live capture or not. Have "close_cap_file()" delete the current capture file if it's a temporary capture file that hasn't been saved (in its entirety - saving selected frames doesn't count). Do the same (if there *is* a current capture file) when exiting. The "Ready to load or capture" message is the only statusbar message in the "main" context; "close_cap_file()" should never pop it, it should only pop whatever message exists in the "file" context, and thus has no need to take, as an argument, the context for the message it should pop. Update the man page to reflect the new behavior of "File:Save" and "File:Save As", and to reflect recent changes to "Display:Match Selected". svn path=/trunk/; revision=1170
1999-11-30In "Go To Frame", distinguish between "there is no frame with that frameGuy Harris1-2/+9
number" and "there is a frame with that frame number, but it didn't pass the current display filter". svn path=/trunk/; revision=1164
1999-11-29Expand some comments.Guy Harris1-7/+7
svn path=/trunk/; revision=1152
1999-11-29Move the callback for input available on the sync pipe from "file.c" toGuy Harris1-2/+4
"capture.c", along with the other code that deals with the sync pipe. Close the sync pipe, and get rid of the temporary capture file, on errors. Split "tail_cap_file()" into routines to set up to read from the capture file, to read a specified number of packets from it when told to do so by the child process, and to read the rest of the capture file and finish up the capture, to provide the code in "capture.c" the hooks it needs. Have a common routine to set the status bar to report the file name and number of dropped packets, to use both when reading in a capture file in its entirety all at once and when done with a "read it while the capture is writing to it" live capture. svn path=/trunk/; revision=1137
1999-11-25Change display filter entry widget to a GtkCombo.Gerald Combs1-2/+2
Modify filter_packtes to return 1 on success, and 0 on failure. svn path=/trunk/; revision=1106
1999-11-18Clean up some ANSI C nits pointed out by "gcc -pedantic".Guy Harris1-8/+1
svn path=/trunk/; revision=1060
1999-11-08Add a "Go To Frame" menu item, which lets you go to a frame by frameGuy Harris1-1/+2
number. svn path=/trunk/; revision=989
1999-11-06Pop up a message box if a search for a frame fails.Guy Harris1-2/+2
svn path=/trunk/; revision=985
1999-11-06Add a "Find Frame" menu item under "Display"; it lets you use a displayGuy Harris1-4/+9
filter to search forward or backward in the list of displayed frames for a matching frame. When filtering the display, readjust the display to show the "current" frame if it passed the display filter. When a file is read in, the first frame becomes the "current" frame; when a frame is selected, it becomes the "current" frame, and remains so *even if you unselect it*, until another frame is selected. Select the first frame when a file is read in. Disable most of the "Display" and "Tools" menu items if there's no current capture file, and enable the relevant ones if there is. svn path=/trunk/; revision=982
1999-10-11When a new display filter is to be applied, don't set "cf.dfilter" orGuy Harris1-5/+3
"cf.dfcode" if the new filter doesn't compile, because the filter currently in effect will be the one that was last applied - just free up the text of the new filter, and whatever memory was allocated for the new filter code. This means we allocate a new dfilter when a new filter is to be applied, rather than recycling stuff from the old filter, as we want the old filter code to remain around if the new filter doesn't compile. This means that "cf.dfilter" and "cf.dfcode" will be null if there's no filter in effect. svn path=/trunk/; revision=803
1999-10-02Get rid of some unused fields in a "capture_file" structure.Guy Harris1-4/+1
svn path=/trunk/; revision=756
1999-09-29Add an item to the "File/Print" dialog box to ask that the full hex dataGuy Harris1-11/+1
of the packet be printed (this is only done if "Print detail" is selected; it should be grayed out of "Print summary" is selected). If that item is selected, suppress the hex printing of uninterpreted data items in the protocol tree. Move some GTK+ keys not used outside of "gtk/print_dlg.c" from "gtk/keys.h" into "gtk/print_dlg.c". svn path=/trunk/; revision=736
1999-09-23Adds progress bar functionality back for loading files (it was changed toAshok Narayanan1-1/+2
bounce bar for compressed file support). Note that the progress bar may not grow smoothly for compressed files, but it should be reasonably accurate for files which are large enough to matter. svn path=/trunk/; revision=701
1999-09-22This commit contains support for reading capture files compressed usingAshok Narayanan1-2/+35
gzip. The zLib library is used for this purpose. If zLib is not available (or it's use is disabled by the --disable-zlib option to configure), you can still compile Ethereal but it will be unable to read compressed capture files. IMPORTANT: Now all file accesses to capture files should be done through special macros. Specifically, for any use of the following functions on capture files, replace them. The arguments for the right-side functions are exactly the same as for the original stdio functions. fopen file_open fdopen filed_open fread file_read fwrite file_write fseek file_seek fclose file_close ferror file_error svn path=/trunk/; revision=695
1999-09-12Add a "Expand all levels"/"Print as displayed" pair of radio buttons toGuy Harris1-1/+3
the "File/Print" dialog box; "Expand all levels" means that all levels of the protocol tree should be printed, while "Print as displayed" means that only those levels shown in the display should be printed. Free the table of column widths once printing is done. svn path=/trunk/; revision=671
1999-09-12Add summary-vs-detail radio buttons to the print dialog box; detailGuy Harris1-2/+10
prints the protocol tree, and summary prints the fields in the summary clist, with a header line at the beginning of the printout. Print only packets selected by the current packet filter. Just have "ARP" and "RARP" in the "Protocol" field for ARP packets; whether it's a request or a reply can be seen in the "Info" field. Add to the "Frame" section of the protocol tree the time between the current packet and the previous displayed packet, and the packet number. Have FT_RELATIVE_TIME fields be a "struct timeval", and display them as seconds and fractional seconds (we didn't have any fields of that type, and that type of time fits the delta time above). Add an FT_DOUBLE field type (although we don't yet have anything using it). svn path=/trunk/; revision=666
1999-08-28Don't do file-read progress bar updates with a timeout; instead, updateGuy Harris1-1/+4
the progress bar up to 100 times, as we get another percent closer to completion. That reduces the number of times we run the GTK+ main loop; that main loop may do a "select()" or "poll()" or FIONREAD "ioctl" to check for input from the X server, adding to the CPU overhead of reading a file. The packet filtering progress bar is already updated in a similar fashion; make it also do up to 100 updates. svn path=/trunk/; revision=597
1999-08-24Added John McDermott's colorization routines. There's still someGilbert Ramirez1-1/+9
debug printf's in there. svn path=/trunk/; revision=562
1999-08-22Remove the include of <sys/time.h> from "file.h" - it's neitherGuy Harris1-6/+1
necessary nor sufficient if you're using "struct tm" (on many, perhaps most, perhaps even all modern UNIXes, <sys/time.h> includes <time.h>, which declares "struct tm", but that's not necessarily the case on non-UNIX systems). Include <time.h> in "file.c", to declare "struct tm". Don't use PCAP_ERRBUF_SIZE to declare a message string buffer - that won't work if you don't have "libpcap". svn path=/trunk/; revision=549
1999-08-22DLT_NULL, from "libpcap", means different things on different platformsGuy Harris1-8/+2
and in different capture files; throw in some heuristics to try to figure out whether the 4-byte header is: 1) PPP-over-HDLC (some version of ISDN4BSD?); 2) big-endian AF_ value (BSD on big-endian platforms); 3) little-endian AF_ value (BSD on little-endian platforms); 4) two octets of 0 followed by an Ethernet type (Linux, at least on little-endian platforms, as mutated by "libpcap"). Make a separate Wiretap encapsulation type, WTAP_ENCAP_NULL, corresponding to DLT_NULL. Have the PPP code dissect the frame if it's PPP-over-HDLC, and have "ethertype()" dissect the Ethernet type and the rest of the packet if it's a Linux-style header; dissect it ourselves only if it's an AF_ value. Have Wiretap impose a maximum packet size of 65535 bytes, so that it fails more gracefully when handed a corrupt "libpcap" capture file (other capture file formats with more than a 16-bit capture length field, if any, will have that check added later), and put that size in "wtap.h" and have Ethereal use it as its notion of a maximum packet size. Have Ethereal put up a "this file appears to be damaged or corrupt" message box if Wiretap returns a WTAP_ERR_BAD_RECORD error when opening or reading a capture file. Include loopback interfaces in the list of interfaces offered by the "Capture" dialog box, but put them at the end of the list so that it doesn't default to a loopback interface unless there are no other interfaces. Also, don't require that an interface in the list have an IP address associated with it, and only put one entry in the list for a given interface (SIOCGIFCONF returns one entry per interface *address*, not per *interface* - and even if you were to use only IP addresses, an interface could conceivably have more than one IP address). Exclusively use Wiretap encapsulation types internally, even when capturing; don't use DLT_ types. svn path=/trunk/; revision=540
1999-08-18Re-arranged Ethereal's definitions of DLT_RAW et al. since capture.cGilbert Ramirez1-1/+2
is the only file that uses them. I hope to avoid some compiler warnings with this. svn path=/trunk/; revision=512
1999-08-18Add to Wiretap the ability to write capture files; for now, it can onlyGuy Harris1-5/+3
write them in "libpcap" format, but the mechanism can have other formats added. When creating the temporary file for a capture, use "create_tempfile()", to close a security hole opened by the fact that "tempnam()" creates a temporary file, but doesn't open it, and we open the file with the name it gives us - somebody could remove the file and plant a link to some file, and, if as may well be the case when Ethereal is capturing packets, it's running as "root", that means we write a capture on top of that file.... (The aforementioned changes to Wiretap let you open a capture file for writing given an file descriptor, "fdopen()"-style, which this change requires.) svn path=/trunk/; revision=509
1999-08-15Don't preserve the read filter from file to file - you won't necessarilyGuy Harris1-3/+3
want to read the next file with the same filter that you used on the last file. In the "File/Open" dialog box, parse the read filter before trying to open the file, and if the parse fails, leave the dialog box up so the user still has the filter and file name around and can try to fix the problem. Keep the compiled read filter attached to the "capture_file" structure, so you don't have to reparse it on a "File/Reload". svn path=/trunk/; revision=497
1999-08-15Have "wtap_open_offline()" return, on failure, an indication of theGuy Harris1-14/+1
reason for the failure, and have it do the checks to make sure the file being opened is a plain file or a pipe. Have "open_cap_file()" make use of that. Don't automatically set "last_open_dir" if a "-r" flag was specified on the command line - do so only if the file in question could actually be opened. svn path=/trunk/; revision=495
1999-08-15"read_cap_file()" doesn't need to be passed a file name as an argument -Guy Harris1-2/+2
it's called after "open_cap_file()" has been called, and is always passed the file name passed to "open_cap_file()", and that file name is stored as "cf->filename", so "read_cap_file()" can just use "cf->filename" as the pathname of the file. svn path=/trunk/; revision=494
1999-08-15Split "load_cap_file()" into "open_cap_file()" and "read_cap_file()".Guy Harris1-2/+2
The former, which used to be called by "load_cap_file()", now just opens the file and, if the open succeeds, closes any capture file we previously had open, reinitializes any protocols that need reinitialization, and saves information about the new capture file in the "capture_file" structure to which it was passed a pointer. The latter reads the file already opened by "read_cap_file()". For "File/Open", call "open_cap_file()" before dismissing the file selection box; if it fails, "open_cap_file()" will have popped up a message box complaining about it - just return, leaving the file selection box open so the user can, after dismissing the message box, either try again with a different file name, or dismiss the file selection box. (Other file selection boxes should be made to work the same way.) If "open_cap_file()" succeeds, dismiss the file selection box, and read the capture file in. svn path=/trunk/; revision=492