Commit graph

69 commits

Author SHA1 Message Date
Jakub Zawadzki
064082e68a Change G_GINT64_CONSTANT(xxxxU) to G_GUINT64_CONSTANT(xxxx)
svn path=/trunk/; revision=54314
2013-12-20 22:39:32 +00:00
Michael Tüxen
54413b17b9 Fix writing enhanced packet blocks when flags are
provided: Don't write the end od options parameter
twice.

svn path=/trunk/; revision=52682
2013-10-18 22:39:31 +00:00
Guy Harris
9a0e88b3a5 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
2013-09-29 22:54:13 +00:00
Guy Harris
3a57abec44 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
2013-09-29 22:20:32 +00:00
Guy Harris
b06876390d 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
2013-09-29 20:53:13 +00:00
Guy Harris
c42263f28a 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
that's what, for example, fwrite() takes as a size argument.

svn path=/trunk/; revision=52274
2013-09-29 20:26:25 +00:00
Guy Harris
9b2ecdc9a7 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
2013-09-29 19:11:37 +00:00
Michael Tüxen
ae7966a9cb Whitespace changes. Use 8-space indents consistently.
svn path=/trunk/; revision=46898
2013-01-02 16:25:33 +00:00
Michael Tüxen
8d91633a3b Fix bug introduced by myself in
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=46592

svn path=/trunk/; revision=46897
2013-01-02 16:18:20 +00:00
Michael Tüxen
ed89f0f9df Fix bug introduced in
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=46891

svn path=/trunk/; revision=46896
2013-01-02 16:16:09 +00:00
Michael Tüxen
3946845d31 Use consistent indentation.
svn path=/trunk/; revision=46894
2013-01-02 11:42:54 +00:00
Gerald Combs
a5f59570d9 Cast size_t to something the Visual C++ CRT will accept.
svn path=/trunk/; revision=46893
2013-01-02 05:25:50 +00:00
Michael Mann
18580d6703 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
2013-01-02 04:01:22 +00:00
Guy Harris
8ed7a73e22 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.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Michael Tüxen
01d97c7ee1 Fix writing of PCAP-NG files when flags are provided.
svn path=/trunk/; revision=46742
2012-12-25 22:25:40 +00:00
Michael Tüxen
644f8485da 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
2012-12-23 09:25:42 +00:00
Michael Tüxen
197ac6704d Need to include Windows.h for gettting FILETIME.
svn path=/trunk/; revision=46638
2012-12-20 15:40:28 +00:00
Michael Tüxen
9a2f4c8e9d 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.

svn path=/trunk/; revision=46637
2012-12-20 15:20:10 +00:00
Michael Tüxen
7e84abf005 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
2012-12-20 14:53:09 +00:00
Michael Tüxen
10dbe80c65 Add support for writing the flags option in the enhanced
packet block (pcapng).

svn path=/trunk/; revision=46619
2012-12-19 20:27:12 +00:00
Michael Tüxen
3895df85aa Simplify code.
svn path=/trunk/; revision=46594
2012-12-18 19:16:11 +00:00
Michael Tüxen
86925e10e1 fwrite() returns the number of objects written, not the number of bytes.
svn path=/trunk/; revision=46593
2012-12-18 19:09:27 +00:00
Michael Tüxen
f55922be77 Fix sequence of parameters. The size is the second parameter of fwrite,
the nitems the third, not vice versa.

svn path=/trunk/; revision=46592
2012-12-18 18:18:11 +00:00
Jeff Morriss
3551a86c36 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45015
2012-09-20 01:29:52 +00:00
Jakub Zawadzki
bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Michael Tüxen
8ea1984ddc Allow writing ISB with given recv/drop counters.
No functional change by this commit.

svn path=/trunk/; revision=42242
2012-04-25 20:50:38 +00:00
Michael Tüxen
bacf81ff06 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
2012-04-15 11:11:36 +00:00
Jeff Morriss
2256fabd86 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
2012-03-26 21:57:57 +00:00
Anders Broman
237a850f84 To be consistent with the wiretap API don't null terminate the counted strings.
svn path=/trunk/; revision=41682
2012-03-20 11:41:58 +00:00
Anders Broman
cbde63643e From Jose Pedro Oliveira:
Enforce the modelines in dumpcap.c and in pcapio.c

svn path=/trunk/; revision=41505
2012-03-12 15:40:57 +00:00
Anders Broman
8fa5ef33f9 From Jose Pedro Oliveira: Add Modlines
svn path=/trunk/; revision=41496
2012-03-12 06:42:47 +00:00
Gerald Combs
7a8df2f485 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
2012-03-10 00:24:42 +00:00
Anders Broman
abbdb721dd 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
2012-03-09 11:47:55 +00:00
Gerald Combs
57eeea4b20 Add a note about using GetSystemTimePreciseAsFileTime.
svn path=/trunk/; revision=41382
2012-03-06 21:11:31 +00:00
Anders Broman
a20cfcc745 Fix calculation of pading for if_filter_str.
svn path=/trunk/; revision=41351
2012-03-05 09:21:36 +00:00
Anders Broman
971cb84877 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
2012-03-04 19:01:14 +00:00
Anders Broman
e994e78412 From Jose Pedro Oliveira: pcapio is writing the if_speed value in the IDB_TSRESOL optiones
svn path=/trunk/; revision=41184
2012-02-25 08:20:50 +00:00
Anders Broman
cacbe31797 Fix a typo and revert previous.
svn path=/trunk/; revision=41179
2012-02-24 15:57:56 +00:00
Anders Broman
8fff390455 - Write ISB(s) at start and end of capture.
- Read all options.
- Prepare to write ISB.

svn path=/trunk/; revision=41137
2012-02-22 14:41:02 +00:00
Anders Broman
af2100d4c3 Expand the API for ISB:s
svn path=/trunk/; revision=41136
2012-02-22 10:01:16 +00:00
Michael Tüxen
28b74c5760 Correctly write os string...
svn path=/trunk/; revision=41125
2012-02-21 18:01:44 +00:00
Michael Tüxen
bb3a686a99 Whitespace changes.
svn path=/trunk/; revision=41117
2012-02-21 16:30:22 +00:00
Michael Tüxen
3806dfa6c8 Whitespace changes.
svn path=/trunk/; revision=41113
2012-02-21 15:38:30 +00:00
Michael Tüxen
e485ac5175 Use tab indentation as elsewhere in the files.
Only whitespace changes.

svn path=/trunk/; revision=41110
2012-02-21 15:16:45 +00:00
Anders Broman
3d0ac5c69a Check if the string exists first.
svn path=/trunk/; revision=41109
2012-02-21 13:59:08 +00:00
Anders Broman
5df11d41bb Extend libpcap_write_interface_description_block() wiyh more options
all exept os curently unused.

svn path=/trunk/; revision=41108
2012-02-21 13:35:04 +00:00
Michael Tüxen
68204c94a4 From Anders: Add support for options in the SHB.
From me: Some whitespace changes.

svn path=/trunk/; revision=41026
2012-02-14 17:07:52 +00:00
Alexis La Goutte
8b66d8fae7 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).

svn path=/trunk/; revision=40423
2012-01-10 13:59:27 +00:00
Guy Harris
37654b4023 Constify some arguments.
svn path=/trunk/; revision=37674
2011-06-15 20:13:42 +00:00
Bill Meier
f7d44fa268 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
2011-03-21 17:07:18 +00:00