aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2000-08-15The caplen and iplen are not always going to be equal. Need to use > and <= ↵Mike Hall1-7/+12
instead of != ==. svn path=/trunk/; revision=2273
2000-08-12Initialize "last_blob" and "current_blob" when the file is opened.Guy Harris1-21/+23
Set "current_blob" when the first read is done from the random file, as "current_blob" is the current blob in the random file. svn path=/trunk/; revision=2262
2000-08-11Miscellaneous code cleaningLaurent Deniel21-23/+116
- 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-11If we have a random stream open for a compressed Sniffer file, have theGuy Harris2-174/+354
sequential pass through the file build a list of information about the compressed blobs, with the starting offset in the compressed file and in the uncompressed byte stream for each blob. When seeking on the random stream, check whether the target location is within the uncompressed buffer we currently have; if not, use that list to figure out which blob contains the target location, and read that blob into the buffer. Then, as we now know that the target location is within the uncompressed buffer we currently have, just move the current pointer into that buffer to the target location. This means we don't have to read forwards through any uninteresting blobs in order to seek forwards, and don't have to go all the way back to the beginning and seek forwards in order to seek backwards. svn path=/trunk/; revision=2251
2000-08-08Added wiretap support to read the Cisco Secure Intrusion Detection System ↵Mike Hall7-6/+298
IPLog format. svn path=/trunk/; revision=2231
2000-08-04Mention IDSN4BSD's i4btrace utility as a supported trace file format.Gilbert Ramirez1-1/+6
svn path=/trunk/; revision=2203
2000-07-31Add a comment explaining why we're defining S_ISDIR and company.Guy Harris1-1/+7
svn path=/trunk/; revision=2189
2000-07-31It appears that, at least with Visual C++ 6.0, the "stat()" supplied inGuy Harris1-4/+15
the C run-time library sets "statb.st_mode" appropriately, at least for plain files and directories; it just doesn't offer the POSIX "S_ISxxx()" macros to test the file type. If those macros aren't defined (which might also be the case on really ancient UNIX systems), define them appropriately, and use them even on Win32 systems, so that we can properly report attempts by a user to read from a directory on Win32, just as we do on UNIX. svn path=/trunk/; revision=2188
2000-07-31In "buffer.h", include <winsock.h> if we have it, so that "u_char" isGuy Harris2-5/+9
defined on Win32 systems - it's not defined in <sys/types.h> on those systems. In "buffer.c", include "config.h", to cause HAVE_WINSOCK_H to be defined, on systems that have it, so that we include it in <buffer.h>. svn path=/trunk/; revision=2187
2000-07-30Support for capturing packet data from a pipe (a FIFO, or standard input).Olivier Abad2-64/+64
capture.c : - modified capture() to try to open an interface as a pipe if pcap_open_live() failed, and then read data in libpcap format from this pipe ; - add new functions used by capture() : pipe_open_live() and pipe_dispatch() which are equivalents to the pcap_ functions. libpcap.[ch] : - moved the MAGIC and headers definitions from libpcap.c to libpcap.h because capture() now needs it. svn path=/trunk/; revision=2181
2000-07-26Add a script, "aclocal-flags", which figures out whereGuy Harris1-1/+3
1) aclocal expects autoconf/automake macros to be hidden; 2) GTK+ hid its autoconf/automake macros; and, if both places exist but aren't the same directory, returns a "-I" flag to tell aclocal to look in GTK+'s directory. Then have "autogen.sh", and Makefiles in directories with "acinclude.m4" files, use that script and pass what flag it supplies, if any, to aclocal. This should, I hope, avoid problems such as those FreeBSD systems where GTK+ was installed from a port or package (and thus stuck its macros in "/usr/X11R6/share/aclocal") but aclocal doesn't look there. (It doesn't solve the problem of somebody downloading and installing, say, libtool from source - which means it probably shows up under "/usr/local", with its macros in "/usr/local/share/aclocal" - on a system that comes with aclocal (meaning it probably just looks in "/usr/share/aclocal", but that may be best fixed by, whenever you download a source tarball for something that's part of your OS, configuring it to install in the standard system directories and *overwriting* your OS's version.) svn path=/trunk/; revision=2165
2000-07-26In the final scene of the horror movie, just when you think the monsterGuy Harris4-130/+184
is finally dead, and you're walking away, it springs up again and attacks. It appears that the ss990915 version of Alexey Kuznetzov's libpcap patch has some extra stuff in the per-packet header for some sort of SMP debugging, and that SuSE Linux 6.3 picked it up. Thus, even if a libpcap file has the modified magic number, we *still* have to go through the usual heuristic hell to figure out what type of file it is. svn path=/trunk/; revision=2164
2000-07-26Use unsigned character pointers and arrays rather than signed characterGuy Harris7-26/+28
pointers and arrays in a number of places, to remove warnings some compilers give. svn path=/trunk/; revision=2160
2000-07-20In Tethereal:Guy Harris1-3/+7
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-06-28Don't reposition the random stream in "ngsniffer_open()" if there isn'tGuy Harris1-5/+6
a random stream open. svn path=/trunk/; revision=2097
2000-06-27Add routines to Wiretap to allow a client of Wiretap to get:Guy Harris2-4/+22
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-06-24Joerg Mayer's changes to add support for NetXRay file format versionGuy Harris3-8/+13
2.002, as used by release 3.50 of the Network Associates Sniffer for Windows; currently, we treat it just like the 2.001 version, so we rename the version #define WTAP_FILE_NETXRAY_2_001 to WTAP_FILE_NETXRAY_2_00x and use that for both 2.001 and 2.002. svn path=/trunk/; revision=2087
2000-06-15Patch from Joerg Mayer to fix a problem reading Sniffer files:Guy Harris1-5/+10
Differentiate between LAPB and LAPD sync sniffer traces. Personally I think there must be a better way to find out which protocol is in the trace but I currently lack the time to look at the remaining frame info. svn path=/trunk/; revision=2072
2000-06-15Patch from Joerg Mayer to fix a problem reading Sniffer files:Guy Harris1-27/+24
When trying to decode a sample trace from the NG offline sniffer installation, one trace resulted in a "corrupted" error. The reason was, that the file was a version 2 file format. That format used type 8 for header purposes while version 4 uses it for FRAME4. svn path=/trunk/; revision=2071
2000-06-08Document the fact that we can now read compressed Sniffer files.Gilbert Ramirez1-14/+16
svn path=/trunk/; revision=2047
2000-06-06Fix list of deliverables (add wtap-int.h)Gilbert Ramirez1-2/+3
svn path=/trunk/; revision=2041
2000-05-29Graham Bloice's Win32 Makefile changes to build in batch mode (gets ridGuy Harris1-1/+4
of multiple compile lines in the output of the build, speeds the build up). svn path=/trunk/; revision=2024
2000-05-28Changed my mail address to oabad@cybercable.fr (dhis.net is tooOlivier Abad1-1/+1
unreliable). svn path=/trunk/; revision=2019
2000-05-25Support for reading compressed Sniffer files, from Tim Farley, JoergGuy Harris6-76/+615
Mayer, and yours truly. svn path=/trunk/; revision=2002
2000-05-19Add wtap-int.h. Move definitions relevant to the internal workins of wiretapGilbert Ramirez19-286/+337
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-19In Wiretap, a file stream handle is a "FILE_T", not a "FILE_T *" (aGuy Harris10-47/+47
"FILE_T" is either a "gzFile" or a "FILE *", depending on whether zlib support is enabled or not). Fix various function declarations and definitions. svn path=/trunk/; revision=1984
2000-05-19"wtap.h" doesn't need to include "ascend.h" or "toshiba.h".Guy Harris1-3/+1
svn path=/trunk/; revision=1982
2000-05-18Remove the "union pseudo_header" from the "frame_data" structure;Guy Harris20-443/+887
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-12Use "htoles()" rather than "pletohs()" to convert host-byte-order shortsGuy Harris1-9/+9
to little-endian shorts - and to convert host-byte-order longs to little-endian shorts (if the host-byte-order long will fit into a short, "htoles()" does the right thing; if it doesn't, there is no right thing to do - perhaps we should return a wiretap error, although, at least at present, it's unlikely that we'll have packets bigger than 65535 bytes, so it's unlikely that the values won't fit into a short). svn path=/trunk/; revision=1953
2000-05-12Fix minor typo found by Alan Harrison.Guy Harris1-2/+2
svn path=/trunk/; revision=1951
2000-05-12In wiretap, set err to 0 before doing anything inside wtap_loop().Gilbert Ramirez1-1/+4
Tethereal was dying on me because err was initialized to some random value. It was this section of code that would exit even if wtap_loop was successful (returned TRUE) because err was never initialized or set to anything. err = load_cap_file(&cf, out_file_type); if (err != 0) { dissect_cleanup(); exit(2); } <BIGGER sheepish grin> Fixed even more errors in LLC dissector. I had inadvertantly used the wrong tvbuff_t* when calling dissect_data_tvb(). There is no way we are going to be successful in this tvbuff conversion w/o regression testing. I'm working on setting up a simple Makefile for regression testing tonight. That's why I'm finding so many bugs in my LLC conversion. </BIGGER sheepish grin> svn path=/trunk/; revision=1946
2000-05-10Include an example of "wdd" output data from an Ascend trace I got agesGuy Harris1-1/+17
ago. svn path=/trunk/; revision=1937
2000-05-10Rename the "private" member of a "wtap_dumper" structure to "dump", asGuy Harris5-58/+58
per the "capture" member of a "wtap" structure, so that it doesn't collide with the C++ reserved word "private". svn path=/trunk/; revision=1936
2000-04-29Graham Bloice's changes to, on Win32 using Microsoft's "nmake":Guy Harris1-2/+2
build "register.c" in the top-level Makefile; set path in "config.nmake" to include the Cygwin directory for tools - those tools are needed to build "register.c"; remove constructed source files, and some additional object files, when doing "nmake clean". svn path=/trunk/; revision=1896
2000-04-15Get rid of the "start" field in the private data for RADCOM, i4btrace,Guy Harris4-40/+12
and nettl captures - a "start" field is used for capture files where the time stamps on packets are relative to some initial time stamp, e.g. the time the capture started, but those file formats use absolute time stamps, so no "start" field is needed. Make the "this is an HP-UX 11.x nettl capture" flag a member of the private data structure for a nettl capture, rather than a global - it's per-capture-file state. Once the "start" field is removed from the RADCOM private data structure, there's nothing left, so eliminate the private data structure. svn path=/trunk/; revision=1863
2000-04-12Build tethereal and editcap on Win32.Gilbert Ramirez1-0/+3
Add RCS ID tags to Makefile.nmake's. svn path=/trunk/; revision=1836
2000-04-08Declare, in "wtap.h", Richard's new "wtap_read()" function.Guy Harris1-1/+2
svn path=/trunk/; revision=1820
2000-04-08Some stuff, like libdencode, needs a wiretap routine that allowsRichard Sharpe1-1/+6
them to simply read through the capture file ... svn path=/trunk/; revision=1819
2000-04-06Use the "-o" flag, rather than using the "-t" flag and redirecting theGuy Harris1-1/+1
standard output, in the rules to get Flex to produce scanner code; that way, if Flex fails to run for some reason, we don't leave around a zero-length or otherwise incorrect "XXX-scanner.c" file that might keep a subsequent make from thinking it has to generate that file. svn path=/trunk/; revision=1808
2000-04-04The Win32 port of libpcap requires that programs with which it's builtGuy Harris1-1/+3
be built as multi-threaded programs; add "/MT" to the list of compiler flags. Add "clean" rules in subdirectories, and run subdirectory "nmake -f Makefile.nmake clean" when "nmake -f Makefile.nmake clean" is done in the top-level directory, so that "nmake -f Makefile.nmake clean" cleans everything up. svn path=/trunk/; revision=1791
2000-03-30Jochen Friedrich <jochen@nwe.de>Gilbert Ramirez1-2/+2
protocol type 0x0c in AIX iptrace is used for the IBM SP switch devices. Encoding is RAW IP... svn path=/trunk/; revision=1767
2000-03-29Use the "-o" flag, rather than using the "-t" flag and redirecting theGuy Harris1-2/+2
standard output, in the rules to get Flex to produce scanner code; that way, if Flex fails to run for some reason, we don't leave around a zero-length or otherwise incorrect "XXX-scanner.c" file that might keep a subsequent make from thinking it has to generate that file. svn path=/trunk/; revision=1763
2000-03-22Make the previous checkin actually compile on big-endian machines.Guy Harris1-1/+4
svn path=/trunk/; revision=1742
2000-03-22Byte-swap the frame table on big-endian machines.Guy Harris1-9/+24
Free it as soon as we're at the end of the sequential pass through the file; that way, if we keep the capture file open with Wiretap even after that's done (as I may do as part of some stuff I'm working on), we at least aren't hanging on to the frame table memory after that point. svn path=/trunk/; revision=1741
2000-03-22In a Network Monitor capture file, get the starting offsets of framesGuy Harris11-86/+124
from the frame table - Network Monitor 2.x, at least, doesn't always write frame N+1 right after frame N. To do that, we need to mallocate a big array to hold the frame table, and free it when we close the capture file; this requires that we have capture-file-type-specific close routines as well as capture-file-type-specific read routines - we let it the pointer to that routine be null if it's not needed. Given that, we might as well get rid of the switch statement in "wtap_close()", in favor of using capture-file-type-specific close routines, as per the comment before that switch statement. svn path=/trunk/; revision=1740
2000-03-14Sigh. OpenBSD defines "HAVE_UNISTD_H" in the Makefile for zlib, so,Guy Harris1-11/+28
unlike FreeBSD and older versions of NetBSD, which give "gzseek()" and "gztell()" signatures with "long" file-offset arguments, and thus, on some versions, requires that "HAVE_UNISTD_H" *not* be defined before including "zlib.h" if you want the functions declared with a signature that matches what's actually in the library, it requires that it *be* defined before including "zlib.h" if you want the functions declared with a signature that matches what's actually in the library. svn path=/trunk/; revision=1719
2000-03-04Fix for reading toshiba trace files that were created by using theGilbert Ramirez1-11/+23
"save session" feature in many Windows-based telnet apps. CRT, by VanDyke, in particular, will put in newlines at 80 columns. svn path=/trunk/; revision=1692
2000-03-01The frame header in HP-UX 11 trace files is 4 octets longer (than HP-UX 9Olivier Abad1-3/+52
and 10 files). Add OS version detection to handle this. svn path=/trunk/; revision=1675
2000-02-19Note that one can probably symbolically request that nettl log incomingGuy Harris1-1/+5
and outgoing PDUs, rather than specifying a numerical mask with pduin and pduout (0x30000000). svn path=/trunk/; revision=1649
2000-02-19If we see a file with an unknown network type, report the type in aGuy Harris1-1/+3
"g_message()" message, as other capture-file readers do. svn path=/trunk/; revision=1648