aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/lanalyzer.c
AgeCommit message (Collapse)AuthorFilesLines
2011-04-12"This file format can't be written to a pipe" and "this file formatGuy Harris1-9/+1
can't be saved in compress form" are both equivalent to "this file file format requires seeking when writing it". Change the "can compress" Boolean in the file format table to "writing requires seeking", give all the entries the proper value, and do the checks for attempting to write a file format to a pipe or write it in compressed format to common code. This means we don't need to pass the "can't seek" flag to the dump open routines. svn path=/trunk/; revision=36575
2011-04-06From Jakub Zawadzki:Guy Harris1-10/+10
file_read(buf, bsize, count, file) macro is compilant with fread function and takes elements count+ size of each element, however to make it compilant with gzread() it always returns number of bytes. In wiretap file_read() this is not really used, file_read is called either with bsize set to 1 or count to 1. Attached patch remove bsize argument from macro. svn path=/trunk/; revision=36491
2011-02-25From Robert Bullen: Fix "Potential access violation when writing to ↵Bill Meier1-1/+13
LANalyzer files" https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5698 (Note from me: Before the fix "File ! Save As" in Lanalyzer format crashed quite consistently on my Windows 7) svn path=/trunk/; revision=36061
2011-02-25Revert SVN #36059; patch from Bug #5698 to be used insteadBill Meier1-2/+1
svn path=/trunk/; revision=36060
2011-02-25Fix Bug #5698: "Potential access violation when writing to LANalyzer files"Bill Meier1-1/+2
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5698 Note: before fix File ! SaveAs in Lanalyzer format crashed quite consistently on Windows. svn path=/trunk/; revision=36059
2010-06-06Don't use fwrite directly when writing a dump file; call it throughGuy Harris1-192/+100
wtap_dump_file_write(). Replace various wrappers around fwrite() with wtap_dump_file_write(), or at least make the wrappers call wtap_dump_file_write(). svn path=/trunk/; revision=33116
2010-02-26Move the definitions of all the private data structures out ofGuy Harris1-22/+14
wtap-int.h, and change the unions of pointers to those private data structures into just void *'s. Have the generic wtap close routine free up the private data, rather than the type-specific close routine, just as the wtap_dumper close routine does for its private data. Get rid of close routines that don't do anything any more. svn path=/trunk/; revision=32015
2010-02-24Define the private data structures for some particular capture fileGuy Harris1-11/+19
types in the modules for those capture file types, not in wtap-int.h, so wtap-int.h doesn't have to change when the code to handle that particular capture type changes, or a new capture file type is added. (Ultimately, we should do this for all the private data structures.) svn path=/trunk/; revision=31974
2009-10-26Update URL for LANalyzer file format.Guy Harris1-1/+1
svn path=/trunk/; revision=30717
2009-03-09P64 fixes.Gerald Combs1-1/+1
svn path=/trunk/; revision=27683
2007-03-21set compiler option "treat warnings as errors" - to prevent new warnings for ↵Ulf Lamping1-2/+2
wiretap remove all compiler warnings: a) prevent wrong malloc/free definitions by lex/yacc generated files b) add int/time_t casts - MSVC2005 is more "sensitive" about this than MSVC6 svn path=/trunk/; revision=21078
2006-11-05change all file offsets from long to gint64 so we can - theoretically - ↵Ulf Lamping1-4/+4
handle files > 2GB correct. Please distclean Win32 builds! svn path=/trunk/; revision=19814
2005-08-28Ethereal requires 64-bit integrer support; do the time stampGuy Harris1-12/+10
calculations with integers, which avoids some floating-point inaccuracy. svn path=/trunk/; revision=15602
2005-08-25timestamp display precision:Ulf Lamping1-0/+1
- automatic adjustment depending on file format - manual adjustment through menu items save the setting in the recent file svn path=/trunk/; revision=15534
2005-08-24EVERYTHING IN THE BUILDBOT IS GOING TO BE RED!!! Sorry! Ulf Lamping1-5/+9
I've done more than a day to change the timestamp resolution from microseconds to nanoseconds. As I really don't want to loose those changes, I'm going to check in the changes I've done so far. Hopefully someone else will give me a helping hand with the things left ... What's done: I've changed the timestamp resolution from usec to nsec in almost any place in the sources. I've changed parts of the implementation in nstime.s/.h and a lot of places elsewhere. As I don't understand the editcap source (well, I'm maybe just too tired right now), hopefully someone else might be able to fix this soon. Doing all those changes, we get native nanosecond timestamp resolution in Ethereal. After fixing all the remaining issues, I'll take a look how to display this in a convenient way... As I've also changed the wiretap timestamp resolution from usec to nsec we might want to change the wiretap version number... svn path=/trunk/; revision=15520
2004-07-18Set the svn:eol-style property on all text files to "native", so thatGuy Harris1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. svn path=/trunk/; revision=11400
2004-07-08If we don't know the board type in a Lanayzer capture, returnGuy Harris1-2/+2
WTAP_ERR_UNSUPPORTED_ENCAP, not WTAP_ERR_UNSUPPORTED, as it presumably means the capture was done on some type of device we don't know about. svn path=/trunk/; revision=11339
2004-03-03Have "wtap_read()" set "wth->phdr.pkt_encap" to "wth->file_encap",Guy Harris1-2/+1
rather than requiring individual capture file type handlers to do it (unless they're doing per-packet encapsulation, in which case we check to make sure they didn't *leave* it as WTAP_ENCAP_PER_PACKET). svn path=/trunk/; revision=10290
2004-01-25Have the Wiretap open, read, and seek-and-read routines return, inGuy Harris1-11/+15
addition to an error code, an error info string, for WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with "g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed strings returned as the error info string, and change the callers of those routines to, for those errors, put the info string into the printed message or alert box for the error. Add messages for cases where those errors were returned without printing an additional message. Nobody uses the error code from "cf_read()" - "cf_read()" puts up the alert box itself for failures; get rid of the error code, so it just returns a success/failure indication. Rename "file_read_error_message()" to "cf_read_error_message()", as it handles read errors from Wiretap, and have it take an error info string as an argument. (That handles a lot of the work of putting the info string into the error message.) Make some variables in "ascend-grammar.y" static. Check the return value of "erf_read_header()" in "erf_seek_read()". Get rid of an unused #define in "i4btrace.c". svn path=/trunk/; revision=9852
2004-01-07The year in a LANalyzer capture's trace summary record is a 2-byte yearGuy Harris1-7/+5
number. svn path=/trunk/; revision=9583
2004-01-05 removed some MSVC warnings (level 3)Ulf Lamping1-2/+2
svn path=/trunk/; revision=9558
2003-12-29Make all the byte arrays for writing out stuff "guint8" rather thanGuy Harris1-11/+11
"gint8" - there's no reason for them to be signed, and making them signed can cause compiler warnings if a value won't fit in 8 bits if sign-extended. svn path=/trunk/; revision=9467
2003-12-28removed some MSVC warnings (warning level 2)Ulf Lamping1-3/+3
svn path=/trunk/; revision=9459
2003-12-11prevent MSVC warning:Ulf Lamping1-13/+13
"warning C4761: Gr��enkonflikt im Argument. Konvertierung vorgenommen" -> size conflict in argument, conversion done svn path=/trunk/; revision=9244
2003-10-01Have a pseudo-header for Ethernet packets, giving the size of the FCS -Guy Harris1-2/+42
0 means "there is no FCS in the packet data", 4 means "there is an FCS in the packet data", -1 means "I don't know whether there's an FCS in the packet data, guess based on the packet size". Assume that Ethernet encapsulated inside other protocols has no FCS, by having the "eth" dissector assume that (and not check for an Ethernet pseudo-header). Have "ethertype()" take an argument giving the FCS size; pass 0 when appropriate. Fix up Wiretap routines to set the pseudo-header. This means we no longer use the "generic" seek-and-read routine, so get rid of it. svn path=/trunk/; revision=8574
2003-07-29Don't free "wdh->dump.opaque" in the close routine - "wtap_dump_close()"Guy Harris1-6/+2
does it for you. "wdh->dump.opaque" should never be null, so unconditionally call "lanalyzer_dump_header()". svn path=/trunk/; revision=8095
2003-06-30Use the "rx_frm_len" field from the trace packet data record header,Guy Harris1-2/+25
rathe than the record length minus the record header length, as the number of available (captured) bytes in the packet. Check to make sure that value isn't bigger than the record length minus the header length. Only subtract the 4-byte FCS length from the purported length of the packet on the wire if that would leave the on-the-wire length >= the number of captured bytes, so that we can better handle capture files from programs that produce LANalyzer-format captures where the on-the-wire length *doesn't* include the FCS. svn path=/trunk/; revision=7948
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-5/+5
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6115
2002-07-29From Joerg Mayer:Guy Harris1-2/+2
All files: - Replace types from sys/types.h by those from glib.h - Replace ntoh family of macros from netinet/in.h and winsock2.h by g_ntoh family from glib.h - Remove now unneeded includes of sys/types.h, netinet/in.h and winsock2.h wtap.h Move includes to the top svn path=/trunk/; revision=5909
2002-07-16From Graeme Hewson:Guy Harris1-3/+9
Allow "-" as the output file name in Wiretap, referring to the standard error. Optimize the capture loop. Fix some of the error-message printing code in Ethereal and Tethereal. Have Wiretap check whether it can seek on a file descriptor, and pass the results of that test to the file-type-specific "open for output" routine. Have the "open for output" routines for files where we need to seek when writing the file return an error if seeks don't work. svn path=/trunk/; revision=5884
2002-06-27From Markus Steinmann: support for writing LANalyzer files.Guy Harris1-16/+516
svn path=/trunk/; revision=5771
2002-06-07Graeme Hewson noted that zlib has a bug wherein "gzseek()" doesn't setGuy Harris1-5/+3
the internal z_err value for the stream if an "fseek()" call it makes fails, so that if "gzerror()" is subsequently called, it returns Z_OK rather than an error. To work around this, we pass "file_seek()" an "int *err", and have the with-zlib version of "file_seek()" check, if "gzseek()" fails, whether the return value of "file_error()" is 0 and, if so, have it return "errno" instead. svn path=/trunk/; revision=5642
2002-05-23The old URL for the LANalyzer file format is no longer valid; replace itGuy Harris1-2/+2
with one that's currently valid. svn path=/trunk/; revision=5527
2002-03-04Check for errors in seeks, "tell"s, and "stat()"s/"fstat()"s.Guy Harris1-4/+12
For file types where we allocate private data, add "close" routines where they were missing, to free the private data. Also fix up the code to clean up after some errors by freeing private data where that wasn't being done. Get rid of unused arguments to "wtap_dump_open_finish()". Fix indentation. svn path=/trunk/; revision=4857
2001-11-13Hopefully the last time I have to change my e-mail address.Gilbert Ramirez1-2/+2
svn path=/trunk/; revision=4199
2001-10-04Use longs as file offsets, so that on platforms with 64-bit "long" weGuy Harris1-3/+3
can handle capture files bigger than 2GB. svn path=/trunk/; revision=3993
2001-04-16GCC 2.95.1 on SPARC/Solaris, at least, is clever enough to figure outGuy Harris1-5/+1
that the loop in "lanalyzer_open()" is an infinite loop, so the "return 0;" at the end isn't necessary to suppress a compiler warning with that compiler - and Sun C not only figures it out, it warns that the "g_assert_not_reached()" and the "return 0;" are unreachable, so I'll take them out for now (and put them back if my older GCC at home still requires it to suppress warnings). svn path=/trunk/; revision=3310
2001-03-10Obliging every capture file reader's "open()" routine to seek to theGuy Harris1-3/+1
beginning of the file before reading anything from the file is bogus - do that in the loop that tries each of the open routines, instead. (They may have to reset the seek pointer later if, for example, the capture file begins with the first packet, and the "open()" routine looks at that packet to try to guess whether the packet is in the file format in question.) Set "wth->data_offset" to 0 while you're at it, so capture file readers don't have to do that, either. svn path=/trunk/; revision=3123
2000-09-21Make sure to pass the sent/received direction from pppdump.c inGilbert Ramirez1-2/+2
pseudo_header. Use generic "p2p_phdr" instead of "lapd_phdr". Modify toshiba.c and packet-lapd.c to take that into account. Add frame.p2p_dir, a filterable field, 0=sent, 1=recvd Make p2p_dir available in packe_info, as I think it will be needed in VJ COMP and UNCOMP dissection. Rename WTAP_ENCAP_TR to WTAP_ENCAP_TOKEN_RING. Mention pppd-log support in man page. Mention atmsnoop in README. svn path=/trunk/; revision=2455
2000-09-07Change wtap_read() API so that the data offset is set via a pointer, andGilbert Ramirez1-15/+11
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-25Move #include <time.h> into wtap-int.h instead of requiring it inGilbert Ramirez1-2/+1
every C file. I noticed this because of a build break of csids.obj on Win32. svn path=/trunk/; revision=2378
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-1/+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-03-22In a Network Monitor capture file, get the starting offsets of framesGuy Harris1-1/+9
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-01-22Fix files that had Gilbert's old e-mail address or that didn't have myGuy Harris1-2/+2
forwarding e-mail address. svn path=/trunk/; revision=1522
2000-01-13We are obliged to define HAVE_UNISTD_H in "config.h"; to avoid theGuy Harris1-2/+2
hideous problem on FreeBSD 3.[23] (and perhaps other BSDs) if HAVE_UNISTD_H is defined before "zlib.h" is included, turn "file_seek()" into a subroutine defined in a file that *undefines* HAVE_UNISTD_H before including "zlib.h", so that the *only* call to "gzseek()" is made from a file that does not have HAVE_UNISTD_H defined when it includes "zlib.h". Move "file_error()" to that file while you're at it, so it holds all the wrappers that hide the presence or absence of zlib from routines to read capture files. Turn "file.h", which declared those wrapper functions as well as wrapper macros, into "file_wrapper.h" - it belongs with the "file_wrapper.c" file that defines the wrapper functions, not with "file.c" which handles higher-layer file access functions. Remove the comment in "configure.in" that explained why defining HAVE_UNISTD_H was a bad idea, as we're not obliged to define it and work around the problem. (The comment in "file_wrapper.c" explains the workaround.) svn path=/trunk/; revision=1463
1999-11-10Fixed small memory leak in wiretap (frame_buffer wasn't being freed),Gilbert Ramirez1-2/+2
and aligned g_malloc calls with g_free calls (i.e, we no longer mix-and-match C-library malloc with GLIB g_free, and vice-versa). svn path=/trunk/; revision=1000
1999-10-05Better handle errors from zlib:Guy Harris1-20/+15
Assign a range of Wiretap errors for zlib errors, and have "wtap_strerror()" use "zError()" to get an error message for them. Have the internal "file_error()" routine return 0 for no error and a Wiretap error code for an error. svn path=/trunk/; revision=769
1999-09-24Fix it so that it builds with "--disable-zlib".Guy Harris1-2/+2
The "fh" member of a "wtap" structure points to something constructed from the "fd" member of that structure, so that closing the stream referred to by "fh" also closes the underlying file descriptor; get rid of an unnecessary close of "wth->fd". svn path=/trunk/; revision=720
1999-09-22This commit contains support for reading capture files compressed usingAshok Narayanan1-20/+21
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