aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.c
AgeCommit message (Collapse)AuthorFilesLines
1999-08-22Fix the pcap-encapsulation-to-wiretap-encapsulation mapping table.Guy Harris1-1/+2
Have the code that opens "libpcap" files for writing check to make sure that the Wiretap encapsulation can be written to a "libpcap" file, and return -1 and supply a new WTAP_ERR_UNSUPPORTED_ENCAP error code if it can't. Handle that new error code in "wtap_strerror()". svn path=/trunk/; revision=546
1999-08-22Add a "wtap_strerror()" routine, which takes as an argument an errorGuy Harris1-1/+36
code supplied by a Wiretap routine (whether a positive UNIX "errno" code or a negative Wiretap error code), and returns an error message corresponding to it. Use that to construct the message Ethereal put up in a message box for those errors for which we don't have Ethereal put up a message of its choice. svn path=/trunk/; revision=545
1999-08-19Have the per-capture-file-type open routines "wtap_open_offline()" callsGuy Harris1-4/+10
return 1 on success, -1 if they got an error, and 0 if the file isn't of the type that file is checking for, and supply an error code if they return -1; have "wtap_open_offline()" use that error code. Also, have the per-capture-file-type open routines treat errors accessing the file as errors, and return -1, rather than just returning 0 so that we try another file type. Have the per-capture-file-type read routines "wtap_loop()" calls return -1 and supply an error code on error (and not, as they did in some cases, call "g_error()" and abort), and have "wtap_loop()", if the read routine returned an error, return FALSE (and pass an error-code-pointer argument onto the read routines, so they fill it in), and return TRUE on success. Add some new error codes for them to return. Now that "wtap_loop()" can return a success/failure indication and an error code, in "read_cap_file()" put up a message box if we get an error reading the file, and return the error code. Handle the additional errors we can get when opening a capture file. If the attempt to open a capture file succeeds, but the attempt to read it fails, don't treat that as a complete failure - we may have managed to read some of the capture file, and we should display what we managed to read. svn path=/trunk/; revision=516
1999-08-18Add to Wiretap the ability to write capture files; for now, it can onlyGuy Harris1-7/+19
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-02Add to "wtap_close()" code to free up data structures allocated forGuy Harris1-1/+9
reading RADCOM WAN/LAN analyzer files and NetXRay/Windows Sniffer files. svn path=/trunk/; revision=418
1999-08-02Check in Olivier Abad's patch to add dissectors for LAP-B and X.25, andGuy Harris1-2/+37
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-28Fix the -S option :Laurent Deniel1-2/+3
- read only the real number of packets that have been written by the child process. That's avoid incomplete packet read. - special timeout handling no more necessary and the whole real time capture and display behavior is much more satisfying with this patch. - wiretap modified to allow the reading of 'count' packets with wtap_loop. svn path=/trunk/; revision=398
1999-07-13Added support for compiling on win32 with Visual C and 'nmake'. It compiles,Gilbert Ramirez1-2/+4
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-07Removed old #include's.Gilbert Ramirez1-3/+1
svn path=/trunk/; revision=343
1999-07-07Created a new protocol tree implementation and a new display filterGilbert Ramirez1-29/+3
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-03-01Added display filters to wiretap.Gilbert Ramirez1-6/+36
svn path=/trunk/; revision=198
1999-02-12Change to wtap.c switch() statement to allow compilation under IBM's C compiler.Gilbert Ramirez1-3/+3
It didn't like an empty default case. And <time.h> was forgotten in netmon.c svn path=/trunk/; revision=188
1999-01-08Use g_free instead of free so that I don't have to include <stdlib.h>Gilbert Ramirez1-4/+4
for just one function. svn path=/trunk/; revision=165
1999-01-07I removed the per-file encapsulation type from wiretap, and make all filetypesGilbert Ramirez1-7/+22
provide a per-packet encapsulation type. this required minor modifications to ethereal. svn path=/trunk/; revision=162
1998-11-15Add support to wiretap for reading Sun "snoop" capture files.Guy Harris1-41/+11
That requires that, in the packet-reading loop, we pass to the callback routine the offset in the file of a packet's data, because we can no longer compute that offset by subtracting the size of the captured packet data from the offset in the file after the data was read - "snoop" may stick padding in after the packet data to align packet headers on 4-byte boundaries. Doing that required that we arrange that we do that for "libpcap" capture files as well; the cleanest way to do that was to write our own code for reading "libpcap" capture files, rather than using the "libpcap" code to do it. Make "wtap_dispatch_cb()" and "pcap_dispatch_cb()" static to "file.c", as they're not used elsewhere. If we're using wiretap, don't define in "file.h" stuff used only when we're not using wiretap. Update the wiretap README to reflect Gilbert's and my recent changes. Clean up some memory leaks in "wiretap/lanalyzer.c" and "wiretap/ngsniffer.c", where the capture-file-format-specific data wasn't freed if the open failed. svn path=/trunk/; revision=91
1998-11-12I added the LANalzyer file format to wiretap. I cleaned up some code in theGilbert Ramirez1-6/+31
wiretap functions to be more generic and therefore allow an easier integration of more packet-capture file types. I also put in all the GPL copyrights in the wiretap code. svn path=/trunk/; revision=83
1998-11-12A lengthy patch to add the wiretap library. Wiretap is not used by defaultGilbert Ramirez1-0/+69
because it is still in its infancy, but it can be compiled in optionally. The library exists in its own subdirectory ethereal/wiretap. This patch also edits all the packet-*.c files to remove the #include <pcap.h> line which is unnecessary in these files. In the ethereal code, file.c is the most heavily modified with #ifdef WITH_WIRETAP lines for the optional library. svn path=/trunk/; revision=82