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 / pcapio.c @ master

History | View | Annotate | Download (28.6 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 <>...

f3dd7fe1 08/05/2014 04:42 PM Bill Meier

Fix whitespace/indentation to match editor modelines.

Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca
Reviewed-on: https://code.wireshark.org/review/3452
Reviewed-by: Bill Meier <>

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

064082e6 12/20/2013 05:39 PM Jakub Zawadzki

Change G_GINT64_CONSTANT(xxxxU) to G_GUINT64_CONSTANT(xxxx)

svn path=/trunk/; revision=54314

54413b17 10/18/2013 06:39 PM Michael Tüxen

Fix writing enhanced packet blocks when flags are
provided: Don't write the end od options parameter
twice.

svn path=/trunk/; revision=52682

9a0e88b3 09/29/2013 06:54 PM Guy Harris

For an EPB, write out an "end of options" option if we write out any
other options.

Eliminate duplicate comment.

Fix indentation.

svn path=/trunk/; revision=52280

3a57abec 09/29/2013 06:20 PM Guy Harris

Add a routine to return the length of a string option, given the string;
0 means "this option won't be written", and use it when writing pcap-ng
blocks.

svn path=/trunk/; revision=52277

b0687639 09/29/2013 04:53 PM Guy Harris

Rename routines that write pcap-ng files to "pcapng_xxx" rather than
"libpcap_xxx".

Rename the low-level write routine in pcapio.c to write_to_file(), as
it's used for both pcap and pcap-ng files.

svn path=/trunk/; revision=52275

c42263f2 09/29/2013 04:26 PM Guy Harris

We always write to a FILE *, so:

make libpcap_write_to_file() static;
don't pass it as an argument to write routines, just have them
call it directly;
make the handle argument a FILE *.

Make the data length argument to libpcap_write_to_file() a size_t, as...

9b2ecdc9 09/29/2013 03:11 PM Guy Harris

Use a common routine to write out string options.

This fixes a problem noted in bug 9202, where the calculation of the
padding for the SHB_HARDWARE option was wrong.

svn path=/trunk/; revision=52273

ae7966a9 01/02/2013 11:25 AM Michael Tüxen

Whitespace changes. Use 8-space indents consistently.

svn path=/trunk/; revision=46898

8d91633a 01/02/2013 11:18 AM Michael Tüxen

Fix bug introduced by myself in
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=46592

svn path=/trunk/; revision=46897

ed89f0f9 01/02/2013 11:16 AM Michael Tüxen

Fix bug introduced in
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=46891

svn path=/trunk/; revision=46896

3946845d 01/02/2013 06:42 AM Michael Tüxen

Use consistent indentation.

svn path=/trunk/; revision=46894

a5f59570 01/02/2013 12:25 AM Gerald Combs

Cast size_t to something the Visual C++ CRT will accept.

svn path=/trunk/; revision=46893

18580d67 01/01/2013 11:01 PM Michael Mann

Allow pcap/pcapng format to be written to more than just a file (FILE*). Gives more flexibility if needed.

WRITE_DATA macro replaced and applied consistently throughout pcapio.c

svn path=/trunk/; revision=46891

8ed7a73e 12/26/2012 12:57 AM Guy Harris

Fix a bunch of warnings.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings....

01d97c7e 12/25/2012 05:25 PM Michael Tüxen

Fix writing of PCAP-NG files when flags are provided.

svn path=/trunk/; revision=46742

644f8485 12/23/2012 04:25 AM Michael Tüxen

Add support for writing per packet comments when using pcapng.
Not actually used with this commit, which just brings in the
infrastructure.

svn path=/trunk/; revision=46715

197ac670 12/20/2012 10:40 AM Michael Tüxen

Need to include Windows.h for gettting FILETIME.

svn path=/trunk/; revision=46638

9a2f4c8e 12/20/2012 10:20 AM Michael Tüxen

Don't use an pcap structures in pcapio.[ch].
Currently, pcapio is only used by dumpcap, which is only compiled
if there is pcap support. However, making pcapio independent from
libpcap allows it also to be used from text2pcap, which does not
rely on libpcap....

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

10dbe80c 12/19/2012 03:27 PM Michael Tüxen

Add support for writing the flags option in the enhanced
packet block (pcapng).

svn path=/trunk/; revision=46619

3895df85 12/18/2012 02:16 PM Michael Tüxen

Simplify code.

svn path=/trunk/; revision=46594

86925e10 12/18/2012 02:09 PM Michael Tüxen

fwrite() returns the number of objects written, not the number of bytes.

svn path=/trunk/; revision=46593

f55922be 12/18/2012 01:18 PM Michael Tüxen

Fix sequence of parameters. The size is the second parameter of fwrite,
the nitems the third, not vice versa.

svn path=/trunk/; revision=46592

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

8ea1984d 04/25/2012 04:50 PM Michael Tüxen

Allow writing ISB with given recv/drop counters.
No functional change by this commit.

svn path=/trunk/; revision=42242

bacf81ff 04/15/2012 07:11 AM Michael Tüxen

Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7048

Write timetamps for the interface statistic blocks the way specified
by http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html

svn path=/trunk/; revision=42080

2256fabd 03/26/2012 05:57 PM Jeff Morriss

Fix Coverty 1392 ('name' might be NULL): don't write out the interface name when we're trying to write out the interface description.

svn path=/trunk/; revision=41779

237a850f 03/20/2012 07:41 AM Anders Broman

To be consistent with the wiretap API don't null terminate the counted strings.

svn path=/trunk/; revision=41682

cbde6364 03/12/2012 11:40 AM Anders Broman

From Jose Pedro Oliveira:

Enforce the modelines in dumpcap.c and in pcapio.c

svn path=/trunk/; revision=41505

8fa5ef33 03/12/2012 02:42 AM Anders Broman

From Jose Pedro Oliveira: Add Modlines

svn path=/trunk/; revision=41496

7a8df2f4 03/09/2012 07:24 PM Gerald Combs

In pcapng.c use the units per second value from the interface instead of
the default.

Add support for reading nseclibpcap files to dumpcap.

svn path=/trunk/; revision=41455

abbdb721 03/09/2012 06:47 AM Anders Broman

From Jose Pedro Oliveira:
pcapio.c: write IDB options in numeric order and corrects the IDB block_total_length.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6718

svn path=/trunk/; revision=41447

57eeea4b 03/06/2012 04:11 PM Gerald Combs

Add a note about using GetSystemTimePreciseAsFileTime.

svn path=/trunk/; revision=41382

a20cfcc7 03/05/2012 04:21 AM Anders Broman

Fix calculation of pading for if_filter_str.

svn path=/trunk/; revision=41351

971cb848 03/04/2012 02:01 PM Anders Broman

if_filter isn't a string per se,The first byte of the Option Data keeps a code of the filter used

svn path=/trunk/; revision=41339

e994e784 02/25/2012 03:20 AM Anders Broman

From Jose Pedro Oliveira: pcapio is writing the if_speed value in the IDB_TSRESOL optiones

svn path=/trunk/; revision=41184

cacbe317 02/24/2012 10:57 AM Anders Broman

Fix a typo and revert previous.

svn path=/trunk/; revision=41179

8fff3904 02/22/2012 09:41 AM Anders Broman

- Write ISB at start and end of capture.
- Read all options.
- Prepare to write ISB.

svn path=/trunk/; revision=41137

af2100d4 02/22/2012 05:01 AM Anders Broman

Expand the API for ISB:s

svn path=/trunk/; revision=41136

28b74c57 02/21/2012 01:01 PM Michael Tüxen

Correctly write os string...

svn path=/trunk/; revision=41125

bb3a686a 02/21/2012 11:30 AM Michael Tüxen

Whitespace changes.

svn path=/trunk/; revision=41117

3806dfa6 02/21/2012 10:38 AM Michael Tüxen

Whitespace changes.

svn path=/trunk/; revision=41113

e485ac51 02/21/2012 10:16 AM Michael Tüxen

Use tab indentation as elsewhere in the files.
Only whitespace changes.

svn path=/trunk/; revision=41110

3d0ac5c6 02/21/2012 08:59 AM Anders Broman

Check if the string exists first.

svn path=/trunk/; revision=41109

5df11d41 02/21/2012 08:35 AM Anders Broman

Extend libpcap_write_interface_description_block() wiyh more options
all exept os curently unused.

svn path=/trunk/; revision=41108

68204c94 02/14/2012 12:07 PM Michael Tüxen

From Anders: Add support for options in the SHB.
From me: Some whitespace changes.

svn path=/trunk/; revision=41026

8b66d8fa 01/10/2012 08:59 AM Alexis La Goutte

From Jose Pedro Oliveira via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6719
pcapio.c: bug in libpcap_write_interface_description_block

The attached patch fixes a copy_and_paste error in the code of the function libpcap_write_interface_description_block(): strlen(name) instead of strlen(filter)....

37654b40 06/15/2011 04:13 PM Guy Harris

Constify some arguments.

svn path=/trunk/; revision=37674

f7d44fa2 03/21/2011 01:07 PM Bill Meier

Don't close file handle if a file write error; (caller does the close)

Fixes "USE_AFTER_FREE" defect reported by Coverity Prevent.

svn path=/trunk/; revision=36226

5f960747 04/27/2009 05:58 AM Michael Tüxen

Fix a comment.

svn path=/trunk/; revision=28174

2b36f00d 04/27/2009 04:38 AM Guy Harris

Use GLib's G_MAXUINT16 as the largest value that fits in a guint16.

svn path=/trunk/; revision=28172

6c26c204 04/27/2009 03:12 AM Michael Tüxen

Improve handling of strings longer than 64KB.

svn path=/trunk/; revision=28169

f76f80ac 04/27/2009 01:53 AM Michael Tüxen

Trying to make the Windows compiler happy.

svn path=/trunk/; revision=28168

b8b67161 04/26/2009 06:27 PM Guy Harris

More casts to deal with 64-bit size_t.

svn path=/trunk/; revision=28167

caff2f7c 04/26/2009 06:24 PM Guy Harris

Cast both parts of a FILETIME to guint32, as I think DWORD is signed.

svn path=/trunk/; revision=28166

b6a18ad0 04/26/2009 06:14 PM Guy Harris

Add code that should work on Windows to get current time as microseconds
since January 1, 1970, 00:00:00 UTC.

svn path=/trunk/; revision=28165

46e57a55 04/26/2009 05:30 PM Michael Tüxen

(Try to) fix the 64-bit issues.

svn path=/trunk/; revision=28164

fff39b54 04/26/2009 04:03 PM Michael Tüxen

Don't declare now when not used.

svn path=/trunk/; revision=28163

120bf416 04/26/2009 04:01 PM Michael Tüxen

Windows does not support gettimeofday(). Use 0 as a workaround for now.

svn path=/trunk/; revision=28162

b09b4f40 04/26/2009 03:24 PM Michael Tüxen

constify some args of libpcap_write_enhanced_packet_block()
similar to libpcap_write_packet().

svn path=/trunk/; revision=28161

16027310 04/26/2009 03:16 PM Michael Tüxen

Fix names.

svn path=/trunk/; revision=28160

b23f4a90 04/26/2009 02:40 PM Michael Tüxen

Add functions to write several pcapng blocks.

svn path=/trunk/; revision=28159

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

a95ce819 02/01/2007 07:34 AM Martin Mathieson

OK, fix it properly by adding test after config.h has been included...

svn path=/trunk/; revision=20668

acfb8508 02/01/2007 07:28 AM Martin Mathieson

Fix with-pcap build by disabling HAVE_LIBPCAP guard for now, for some reason it isn't defined when building this file.

svn path=/trunk/; revision=20667

47552993 02/01/2007 03:38 AM Ronnie Sahlberg

there is no point in pcapio unless we have PCAP available.

svn path=/trunk/; revision=20663

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

name change

svn path=/trunk/; revision=18197

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