The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / ringbuffer.c @ master

History | View | Annotate | Download (9.34 KB)

# Date Author Comment
97546165 08/24/2014 04:04 AM Graham Bloice

Modify includes of config.h so that out-of-tree builds, i.e. CMake
don't pick up the in-tree copy.

Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71
Reviewed-on: https://code.wireshark.org/review/3798
Petri-Dish: Graham Bloice <>...

29659139 03/04/2014 09:27 AM Alexis La Goutte

Remove all $Id$ from top of file

(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 <>

11b5c15f 02/25/2014 03:46 PM Bill Meier

Remove trailing whitespace

Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <>
Tested-by: Bill Meier <>

61cad5a8 03/31/2013 12:19 PM Martin Kaiser

coverity 990813 dereference after null check
(hope I got it right this time)

svn path=/trunk/; revision=48673

95ab41e9 03/13/2013 06:39 PM Martin Kaiser

add missing NULL check
http://www.wireshark.org/download/automated/analysis/scan-build-2013-03-12-1/report-q1cLLC.html#EndPath

svn path=/trunk/; revision=48283

0ddce652 12/20/2012 03:00 PM Guy Harris

fclose() and fflush() are standard C routines, so there's no need for
our own wrappers. (pcapio.c isn't using wrappers around, for example,
fwrite().)

svn path=/trunk/; revision=46640

7e84abf0 12/20/2012 09:53 AM Michael Tüxen

Add ws_fclose(), ws_fflush(), and ws_fdopen() to the fileutils.
Retire libpcap_fdopen(), libpcap_dump_flush(), and libpcap_dump_close().

svn path=/trunk/; revision=46636

3551a86c 09/19/2012 09:29 PM Jeff Morriss

We always HAVE_CONFIG_H so don't bother checking whether we have it or not.

svn path=/trunk/; revision=45015

bf81b42e 06/28/2012 06:56 PM Jakub Zawadzki

Update Free Software Foundation address.

(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536

17f8127d 05/17/2011 07:35 PM Guy Harris

Fix another old-style function definition.

svn path=/trunk/; revision=37224

f17c5ac0 08/28/2010 07:05 AM Sake Blok

As mentioned on the users-mailinglist1, it could be useful to have groups 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...

8598c522 05/27/2010 02:00 PM Gerald Combs

Set RINGBUFFER_MAX_NUM_FILES to 100000. Use it to generate file names.
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

e1b68812 03/10/2010 07:36 PM Guy Harris

Squelch some compiler warnings.

svn path=/trunk/; revision=32165

f5547c0d 04/26/2009 11:51 AM Michael Tüxen

Make ringbuffer.[ch] file format agnostic.
Move write routines to dumpcap.c
This is a preparation for pcapng support.

svn path=/trunk/; revision=28155

a5cee04f 05/22/2008 11:46 AM Jeff Morriss

Move the file utility functions from wiretap to libwsutil so that
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

9570ca12 05/15/2007 03:53 AM Jaap Keuter

Fix for bug 1591:
The 5 digit file number should contain the monotonic increasing file number modulo 100000 to fit the alloted space.

svn path=/trunk/; revision=21775

89f022b1 05/21/2006 01:12 AM Ronnie Sahlberg

name change

svn path=/trunk/; revision=18197

25e8c374 04/29/2006 01:54 PM Guy Harris

Have the ring buffer routines take a pointer to a "bytes written" count
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....

e6886d90 03/04/2006 05:33 PM Guy Harris

When capturing, we only support writing to libpcap files. Given that,
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....

c3187174 11/06/2005 05:43 PM Ulf Lamping

replace a lot of file related calls by their GLib counterparts. This is 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....

84cf7ce7 09/14/2005 05:57 PM Ulf Lamping

added compression support for capture file output. The Save/As dialog now 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, ...)....

e93b50c8 08/19/2005 05:13 PM Ulf Lamping

fix #357: increment ring buffer "file names" (again?)

svn path=/trunk/; revision=15440

38ec1644 08/19/2005 03:40 PM Guy Harris

Add APIs to Wiretap to return the file of the size as supplied by the OS
(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....

0dc9fb3d 08/08/2005 02:50 PM Ulf Lamping

various code cleanup:
-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

7e78ef35 03/27/2005 07:19 PM Ulf Lamping

major capture engine rework: use two task model for EVERY capture mode

rework of the -b command line parameter (for Ethereal and Tethereal)

svn path=/trunk/; revision=13949

be0e6a06 02/03/2005 04:58 PM Ulf Lamping

prevent ringbuffer from having to know about capture_file type at all (decoupling dependencies)

svn path=/trunk/; revision=13266

949338af 01/12/2005 04:41 PM Ulf Lamping

don't use two variables for keeping the current ringbuffer file number

svn path=/trunk/; revision=13009

8a8b8834 07/17/2004 08:24 PM Guy Harris

Set the svn:eol-style property on all text files to "native", so that
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...

272a2055 06/30/2004 02:58 AM Guy Harris

On at least some platforms, a #define of O_BINARY is needed even if
<fcntl.h> is included, as <fcntl.h> doesn't define it.

svn path=/trunk/; revision=11276

a24b176c 06/29/2004 04:51 PM Ulf Lamping

define of O_BINARY not needed, if fcntl.h is included
other #include related cleanups

svn path=/trunk/; revision=11272

782e8b79 06/02/2004 02:49 PM Guy Harris

If, when rotating capture files, the attempt to close the current file
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,...

dd264ba1 02/25/2004 12:52 AM Guy Harris

Only handle as a suffix stuff following a "." in the last component of a
pathname.

svn path=/trunk/; revision=10233

983e4f9d 02/25/2004 12:21 AM Guy Harris

Don't unlink ringbuffer files if we haven't yet allocated the array of
ringbuffer files - yes, we can fail before that's done, so we have to
check for that.

svn path=/trunk/; revision=10232

0afce7ca 06/22/2003 12:09 PM Laurent Deniel

Ringbuffer rework.

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....
18061d65 09/22/2002 12:17 PM Gerald Combs

From Graeme Hewson:

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....
7c4176d8 08/28/2002 05:04 PM Jörg Mayer

Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117

173fe5ae 08/02/2002 07:36 PM Jörg Mayer

Replace the types from sys/types.h and netinet/in.h by their glib.h
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....

7ad0ca82 06/23/2002 04:30 PM Guy Harris

From Graeme Hewson: flush the output after every frame if Tethereal is
writing a capture to a FIFO, and improve the error checking for ring
buffers.

svn path=/trunk/; revision=5745

b4df834e 05/04/2002 06:10 AM Guy Harris

Check whether "fflush()" succeeds, and clean up and return an error if
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....

4ee2b1a6 12/04/2001 03:45 AM Guy Harris

Make the bytes-written information from Wiretap a long, as we allow
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...