aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
AgeCommit message (Collapse)AuthorFilesLines
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
1999-08-13Moved global memory alloction used in display filters (which was storedGilbert Ramirez1-2/+6
in dfilter-grammar.y) to a new struct dfilter. Display filters now have their own struct, rather than simply being GNode's. This allows multiple display filters to exist at once, aiding John McDermott in his work on colorization. svn path=/trunk/; revision=480
1999-08-11Changed two #include <>'s to #include "" 's, for stylistic reasons only.Gilbert Ramirez1-2/+2
svn path=/trunk/; revision=471
1999-08-10More whitespace fixups, and fix a typo in a comment.Guy Harris1-4/+4
svn path=/trunk/; revision=463
1999-08-10Fix up whitespace.Guy Harris1-2/+2
svn path=/trunk/; revision=462
1999-08-10Add the ability to specify a filter to be used when reading the file toGuy Harris1-29/+30
the "Open File" dialog box (the "Open File" dialog box equivalent of the "-R" flag). Have "load_cap_file()" take the filter expression as an argument, and make the global "rfilter" into a member of a "capture_file" structure. When reading a temporary capture file after a live capture, don't apply any filter. Move the code that pops up error boxes on file opens when reading a capture file back to "load_cap_file()"; it also pops up error boxes if the filter expression can't be parsed. Don't enable "File/Save" or "File/Save As..." if an attempt to read a capture file fails - if there was already an open capture file, it was closed by "load_cap_file()", so we no longer have an open file to save. svn path=/trunk/; revision=460
1999-08-10Building a GList by adding elements to the end with "g_list_append()" isGuy Harris1-2/+3
N^2 in the ultimate size of the list (as "g_list_append()" is linear in the size of the list, at least when used in the way the GLib documentation says to use it); instead, maintain our own linked list of "frame_data" structures for all packets read, including a pointer to the last element. "gtk_clist_set_row_data()" is linear in the row number, so if it's used to attach a pointer to the "frame_data" structure for a packet to the packet list GtkClist row for each packet, that's also N^2 in the number of packets in that packet list; instead, store the row number in the "frame_data" structure, and find the packet for a given row by scanning the list for it (we were already scanning the list linearly to find that packet's index in the list of all packets; that's only done when a packet's selected, so it's not *too* bad, but it might be nice to avoid having to do that scan). svn path=/trunk/; revision=457
1999-08-07Allow compilation of ethereal in a directory different thanLaurent Deniel1-2/+2
the source directory. The doc makefile is still broken however. Thanks to Jan Bernard van Doorn for raising this problem. svn path=/trunk/; revision=453
1999-08-05Added a progress bar to the display filter computation. Unfortunately,Gilbert Ramirez1-1/+2
try as I might, I couldn't get gtk_timeout_add to work. I read all the docs, but no luck. So for now I call dfilter_progress_cb for every 20 packets that are filtered. I'd rather have *something* for the next Ethereal release than nothing. I also modified file_progress_cb to use it's local copy of cf rather than the global copy. svn path=/trunk/; revision=447
1999-08-02Check in Olivier Abad's patch to add dissectors for LAP-B and X.25, andGuy Harris1-1/+2
wiretap support for RADCOM Ltd.'s WAN/LAN analyzers (see http://www.radcom-inc.com/ ). Note: as I remember, IEEE 802.2/ISO 8022 LLC has somewhat of an SDLC flavor to it, just as I think LAP, LAPB, LAPD, and so on do, so we may be able to combine some of the LLC dissection and the LAPB dissection into common code that could, conceivably be used for other SDLC-flavored protocols. Make "S" a mnemonic for "Summary" in the "Tools" menu. Move the routine, used for the "Tools/Summary" display, that turns a wiretap file type into a descriptive string for it into the wiretap library itself, expand on some of its descriptions, and add an entry for files from a RADCOM analyzer. Have "Tools/Summary" display the snapshot length for the capture. svn path=/trunk/; revision=416
1999-07-24Turn "protocol_tree" and "fd" from global variables into members of aGuy Harris1-1/+4
"capture_file" structure, make a "select_packet()" routine to parallel "unselect_packet()", and have "unselect_packet()" free the protocol tree that the "protocol_tree" member of the "capture_file" passed to it points to. It should now be impossible to do a "Print Packet" operation if no packet has been selected, so remove the check for that (we'll probably just blow up if it happens; if it does, that means we probably forgot to gray out "/File/Print Packet" somewhere, so we should fix that). svn path=/trunk/; revision=385
1999-07-24Have "close_cap_file()" disable all menu items that make sense only ifGuy Harris1-1/+4
you have a capture. Leave the job of enabling and disabling menu items that make sense only if you have a capture (except for "File/Save" and "File/Save As...", for now) up to "load_cap_file()", "close_cap_file()", and the like - don't scatter that stuff throughout the code. Disable "File/Print Packet" if no packet is selected; enable it only if a packet is selected. If there's a selected packet, and a display filter is run: if the selected packet passed the filter, re-select it; if the selected packet didn't pass the filter, un-select it. If we've opened a live "pcap" capture, but can't do the capture because we can't get the netmask info, or can't parse the capture filter string, or can't install the filter, close the live capture and the dump and delete the dump file. If we failed to open a live "pcap" capture, don't try to read the capture file - it doesn't exist. svn path=/trunk/; revision=384
1999-07-23Add a "File/Print" menu item, which prints *all* the packets in theGuy Harris1-2/+3
capture to a file or printer. This should eventually get the ability to print either all the packets or only the packets selected by the display filter, and possibly also the ability to print only packets M through N. Get rid of "cur" member of "capture_file" structure; nobody used it. There's no need to pass a pointer to a "dialog_button" variable to "simple_dialog()" for the error boxes displayed if a file copy or move fails; that dialog box is just a message box and has only an "OK" button. Put the declaration of "prefs" into "prefs.h". svn path=/trunk/; revision=378
1999-07-13Added support for compiling on win32 with Visual C and 'nmake'. It compiles,Gilbert Ramirez1-1/+6
but does not link. Perhaps someone who understands the MS tools can help out. I made it link a few months ago, but with different version of glib/gtk+. I can't remember how I made it link. Most of the compatibility issues were resolved with adding #ifdef HAVE_UNISTD_H the the source code. Please be sure to add this to all future code. svn path=/trunk/; revision=359
1999-07-09Added the ability to create a read-only ethereal, i.e., one thatGilbert Ramirez1-2/+11
doesn't link with libpcap, so no packet captures can be made. The "--disable-pcap" option has been added to the configure script. Docs have been updated. And the string buffer size in the simple_dialog() has been doubled so that Johan's e-mail address in the "About" dialogue window doesn't get chopped off. svn path=/trunk/; revision=351
1999-07-07Created a new protocol tree implementation and a new display filterGilbert Ramirez1-57/+6
mechanism that is built into ethereal. Wiretap is now used to read all file formats. Libpcap is used only for capturing. svn path=/trunk/; revision=342
1999-06-22Added Aaron Hillegass' summary dialogue. We're ignoring the problem withGilbert Ramirez1-1/+4
NetMon statistic packets for now. We might fix that problem with wiretap, either filtering out those packets, and/or providing the summary information through a new wiretap API. svn path=/trunk/; revision=326
1999-06-22Update the display if the "command-line-specified" time format isGuy Harris1-2/+3
changed by updating those columns showing the time in the "command-line-specified" format, not by redoing the entire packet list display; that way, the display continues to show the same packets and any packet the user selected remains selected. (It's also less work to do that - you don't have to re-dissect the packet.) Turn "redisplay_packets()" into "filter_packets()", and do some other cleanups. svn path=/trunk/; revision=325
1999-06-19Added "Capture" and "Display" menus; "Capture" has a "Start" item, whichGuy Harris1-3/+4
is the same as "Tools/Capture", and "Display" has an "Options" item, which pops up a dialog box to let you change the "default" time-stamp column display format on the fly (the "default" is what the "-t" command-line option sets), and have the display change when you do that. Made infrastructure changes to make the immediate display update work. Removed some unused functions, declared some functions used only in the file in which they're defined "static", and removed some unnecessary #includes. svn path=/trunk/; revision=317
1999-06-12Improve the alert boxes put up for file open/read/write errors. (SomeGuy Harris1-1/+23
influence came from http://developer.apple.com/techpubs/mac/HIGuidelines/HIGuidelines-232.html which has a section on dialog box and alert box messages. However, we're largely dealing with technoids, not with The Rest Of Us, so I didn't go as far as one perhaps should.) Unfortunately, it looks like it's a bit more work to arrange that, if you give a bad file name to the "-r" flag, the dialog box pop up only *after* the main window pops up - it has the annoying habit of popping up *before* the main window pops up, and sometimes getting *obscured* by it, when I do that. The removal of the dialog box stuff from "load_cap_file()" was intended to facilitate that work. (It might also be nice if, when an open from the "File/Open" menu item fails, we keep the file selection box open, and give the user a chance to correct typos, choose another file name, etc.) svn path=/trunk/; revision=310
1999-05-11Live data capture and display enhancement that allows network capture andLaurent Deniel1-1/+3
display of fully decoded packets at the same time. Options added: -F : fork capture process -S : sync mode ala tail -f (implies -F) -f : filter expression -Q : exit after capture (implies -k) svn path=/trunk/; revision=276
1999-04-06Capturing packets from ethereal now saves the capture in an "anonymous" ↵Gilbert Ramirez1-2/+5
buffer. That is, it's a random name chosen by tempnam(), unknown to the user. If the user decides to save that trace, he then uses File | Save to save it to a file. File | Save As lets him make a copy of his named trace file as well. I also updated my e-mail address in the various credit locations. svn path=/trunk/; revision=242
1999-03-23Removed all references to gtk objects from packet*.[ch] files. They nowGilbert Ramirez1-3/+9
reference the protocol tree with struct proto_tree and struct proto_item objects. That way, the packet decoding source code file can be used with non-gtk packet decoders, like a curses-based ethereal, e.g. I also re-arranged some of the information in packet.h to more appropriate places (like other packet-*.[ch] files). svn path=/trunk/; revision=223
1999-02-11Make the minimum and maximum packet sizes #defines.Guy Harris1-2/+2
Crank the maximum packet size up to 65535 bytes. svn path=/trunk/; revision=185