aboutsummaryrefslogtreecommitdiffstats
path: root/ringbuffer.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-8/+0
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-12Add editor modelines; Adjust whitespace as needed.Bill Meier1-7/+20
Change-Id: I4da7b335d905dbca10bbce03aa88e1cdeeb1f8ad Reviewed-on: https://code.wireshark.org/review/4626 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-24Modify includes of config.h so that out-of-tree builds, i.e. CMakeGraham Bloice1-1/+1
don't pick up the in-tree copy. Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71 Reviewed-on: https://code.wireshark.org/review/3798 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-25Remove trailing whitespaceBill Meier1-1/+1
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0 Reviewed-on: https://code.wireshark.org/review/385 Reviewed-by: Bill Meier <wmeier@newsguy.com> Tested-by: Bill Meier <wmeier@newsguy.com>
2013-03-31coverity 990813 dereference after null checkMartin Kaiser1-2/+3
(hope I got it right this time) svn path=/trunk/; revision=48673
2013-03-13 add missing NULL checkMartin Kaiser1-1/+1
http://www.wireshark.org/download/automated/analysis/scan-build-2013-03-12-1/report-q1cLLC.html#EndPath svn path=/trunk/; revision=48283
2012-12-20fclose() and fflush() are standard C routines, so there's no need forGuy Harris1-4/+4
our own wrappers. (pcapio.c isn't using wrappers around, for example, fwrite().) svn path=/trunk/; revision=46640
2012-12-20Add ws_fclose(), ws_fflush(), and ws_fdopen() to the fileutils.Michael Tüxen1-10/+17
Retire libpcap_fdopen(), libpcap_dump_flush(), and libpcap_dump_close(). svn path=/trunk/; revision=46636
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-2/+0
svn path=/trunk/; revision=45015
2012-06-28Update Free Software Foundation address.Jakub Zawadzki1-1/+1
(COPYING will be updated in next commit) svn path=/trunk/; revision=43536
2011-05-17Fix another old-style function definition.Guy Harris1-1/+1
svn path=/trunk/; revision=37224
2010-08-28As mentioned on the users-mailinglist[1], it could be useful to have groups ↵Sake Blok1-2/+5
read access to the ringbuffer that dumpcap creates. That way, a group of people can access the capture files without having to use root access. [1] http://www.wireshark.org/lists/wireshark-users/201008/msg00235.html svn path=/trunk/; revision=33978
2010-05-27Set RINGBUFFER_MAX_NUM_FILES to 100000. Use it to generate file names.Gerald Combs1-1/+1
Add RINGBUFFER_WARN_NUM_FILES and use it to print a warning. Print warnings when we change the number of ringbuffer files. svn path=/trunk/; revision=32998
2010-03-11Squelch some compiler warnings.Guy Harris1-1/+1
svn path=/trunk/; revision=32165
2009-04-26Make ringbuffer.[ch] file format agnostic.Michael Tüxen1-14/+4
Move write routines to dumpcap.c This is a preparation for pcapng support. svn path=/trunk/; revision=28155
2008-05-22Move the file utility functions from wiretap to libwsutil so thatJeff Morriss1-12/+12
libwireshark (and the plugins using those functions) do not depend on wiretap on Windows. While doing that, rename the eth_* functions to ws_*. svn path=/trunk/; revision=25354
2007-05-15Fix for bug 1591:Jaap Keuter1-4/+4
The 5 digit file number should contain the monotonic increasing file number modulo 100000 to fit the alloted space. svn path=/trunk/; revision=21775
2006-05-21name changeRonnie Sahlberg1-2/+2
svn path=/trunk/; revision=18197
2006-04-29Have the ring buffer routines take a pointer to a "bytes written" countGuy Harris1-6/+7
as an argument, rather than keeping the count to themselves, so the count kept by the capturing program can be updated correctly - including getting reset when files are switched. Fixes bug 895. svn path=/trunk/; revision=18032
2006-03-04When capturing, we only support writing to libpcap files. Given that,Guy Harris1-18/+21
bypass Wiretap; that means we don't have to run the packet through wtap_process_pcap_packet() and then undo that conversion in Wiretap if we're just going to write it out, shortening the code path. svn path=/trunk/; revision=17461
2005-11-06replace *a lot* of file related calls by their GLib counterparts. This is ↵Ulf Lamping1-14/+7
necessary for the switch to GTK 2.6 (at least on WIN32). to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place. deleted related things from config.h.win32 As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon. svn path=/trunk/; revision=16403
2005-09-14added compression support for capture file output. The Save/As dialog now ↵Ulf Lamping1-1/+1
has a checkbox "Compress with gzip" currently limited to Ethereal and all the variants of libpcap filetypes only. We might want to add output compression support to the other tools as well (tethereal, mergecap, ...). We might also want to add support for the other filetypes, but this is only possible if the filetype functions doesn't use special output operations like fseek. One bug is still left: if the input and output filetypes while saving are the same, Ethereal currently optimizes this by simply copy the binary file instead of using wiretap (so it will be faster but it will ignore the compress setting). Don't know a good workaround for this, as I don't know a way to find out if the input file is currently compressed or not. One idea might be to use a heuristic on the filesize (compared to the packet size summmary). Another workaround I see is to remove this optimization, which is of course not the way I like to do it ... svn path=/trunk/; revision=15804
2005-08-19fix #357: increment ring buffer "file names" (again?)Ulf Lamping1-5/+5
svn path=/trunk/; revision=15440
2005-08-19Add APIs to Wiretap to return the file of the size as supplied by the OSGuy Harris1-5/+1
(so if the file's gzipped, it's *NOT* the size of the file after uncompressing), and an approximation of the amount of that data read sequentially so far. Use those for various progress bars and the like. Make the fstat() in the Ascend trace reader directly use wth->fd, as it's inside Wiretap; that gets rid of the last caller of wtap_fd() (as we're no longer directly using fstat() or lseek() in Ethereal), so get rid of wtap_fd(). svn path=/trunk/; revision=15437
2005-08-08various code cleanup:Ulf Lamping1-5/+1
-use g_snprintf instead of sprintf and snprintf -use g_strdup_printf where appropriate -remove #include "snprintf.h" (as only g_snprintf should be used) -replace some more alloc/realloc/calloc/free with their glib pendants svn path=/trunk/; revision=15264
2005-03-28major capture engine rework: use two task model for EVERY capture modeUlf Lamping1-0/+6
rework of the -b command line parameter (for Ethereal and Tethereal) svn path=/trunk/; revision=13949
2005-02-03prevent ringbuffer from having to know about capture_file type at all ↵Ulf Lamping1-5/+5
(decoupling dependencies) svn path=/trunk/; revision=13266
2005-01-12don't use two variables for keeping the current ringbuffer file numberUlf Lamping1-5/+6
svn path=/trunk/; revision=13009
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-06-30On at least some platforms, a #define of O_BINARY is needed even ifGuy Harris1-1/+6
<fcntl.h> is included, as <fcntl.h> doesn't define it. svn path=/trunk/; revision=11276
2004-06-29define of O_BINARY not needed, if fcntl.h is includedUlf Lamping1-6/+1
other #include related cleanups svn path=/trunk/; revision=11272
2004-06-02If, when rotating capture files, the attempt to close the current fileGuy Harris1-9/+14
fails, set "rb_data.pdh" to NULL, so we know it's not open (if "wtap_dump_close()" fails, the wtap_dumper_t is still closed - and the file descriptor for it is probably closed, too, as, if "close()" fails, the FD is probably closed; the Single UNIX Specification Version 3 says the state of the FD is unspecified, but in practice most OSes probably still close it). If we try to close the current file, first check to make sure it's open, i.e. that "rb_data.pdh" is non-null. (Or perhaps we should avoid trying to close it if the open *or* the most recent attempt to rotate the capture files failed.) Note that if "wtap_dump_close()" fails we might not need to close the underlying file descriptor (and, even if we do, there's no guarantee that attempt won't also fail and leave the FD still open - which is why I suspect that a failed "close()" leaves the FD closed on most OSes). svn path=/trunk/; revision=11075
2004-02-25Only handle as a suffix stuff following a "." in the last component of aGuy Harris1-3/+16
pathname. svn path=/trunk/; revision=10233
2004-02-25Don't unlink ringbuffer files if we haven't yet allocated the array ofGuy Harris1-4/+6
ringbuffer files - yes, we can fail before that's done, so we have to check for that. svn path=/trunk/; revision=10232
2003-06-22Ringbuffer rework.Laurent Deniel1-298/+180
Almost completely rewritten in order to: - be able to use a unlimited number of ringbuffer files 0 specified with -b argument or in the GUI, means that the number of file is unlimited. else the maximum number of ring buffer files is arbitrarily set to 1024. - close the current file and open (truncating it) the next file at switch - set the final file name once open (or reopen) - avoid the deletion of files that could not be truncated (can't arise now) and do not erase empty files The idea behind that is to remove the limitation of the maximum # of ringbuffer files being less than the maximum # of open fd per process and to be able to reduce the amount of virtual memory usage (having only one file open at most) or the amount of file system usage (by truncating the files at switch and not the capture stop, and by closing them which makes possible their move or deletion after a switch). svn path=/trunk/; revision=7912
2002-09-22From Graeme Hewson:Gerald Combs1-15/+62
It can sometimes happen that capturing is stopped just after Ethereal has switched to a new ring buffer. The result is that no frames are displayed. The patch to ringbuffer.c displays the previous ring buffer if the current buffer is empty on close. The patch to capture.c fixes a bug where an error return from ringbuf_wtap_dump_close was ignored, and tidies up the code around the call. svn path=/trunk/; revision=6315
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-24/+24
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6117
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hJörg Mayer1-5/+1
equivalents for the toplevel directory. The removal of winsock2.h will hopefully not cause any problems under MSVC++, as those files using struct timeval still include wtap.h, which still includes winsock2.h. svn path=/trunk/; revision=5932
2002-06-23From Graeme Hewson: flush the output after every frame if Tethereal isGuy Harris1-3/+16
writing a capture to a FIFO, and improve the error checking for ring buffers. svn path=/trunk/; revision=5745
2002-05-04Check whether "fflush()" succeeds, and clean up and return an error ifGuy Harris1-7/+37
it fails. "wtap_dump_close()" allows you to pass a null pointer as the second argument, so an error value isn't returned; use that in the cleanup routine, as we don't care whether the closes fail. svn path=/trunk/; revision=5386
2001-12-04Make the bytes-written information from Wiretap a long, as we allowGuy Harris1-0/+393
files to get that big. From Thomas Wittwer and Matthias Nyffenegger: Support for "ring buffer mode", wherein there's a ring buffer of N capture files; as each capture file reaches its maximum size (the ring buffer works only with a maximum capture file size specified), Ethereal rolls over to the next capture file in the ring buffer, replacing whatever packets might be in it with new packets. svn path=/trunk/; revision=4324