Commit Graph

105 Commits

Author SHA1 Message Date
Michael Tüxen c2fb93c0de Also print number of bytes written.
svn path=/trunk/; revision=46900
2013-01-02 17:42:16 +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 22df071cef Add support for -D option. The preamble will start with
an I or O indicating the direction of the packet. This
will be stored in the generated file if the pcap-ng
format is used.
Thanks to Jaap for suggesting to integrate this into
the preamble!

svn path=/trunk/; revision=46744
2012-12-25 22:37:40 +00:00
Michael Tüxen 6329407d9a Remove current version of -D option, because:
* it is off by default
* not documented
* makes text2pcap to coredump when used
* its goal is not clear (to me).
I'm willing to reimplement it under a different option name
if I understand what it should do. Then I can fix and test it.


svn path=/trunk/; revision=46741
2012-12-25 19:53:04 +00:00
Michael Tüxen 05827f38ab Add some debug output regarding preamble processing.
svn path=/trunk/; revision=46740
2012-12-25 19:16:28 +00:00
Michael Tüxen 4abfc13149 Clear preamble if no timespec is given.
svn path=/trunk/; revision=46738
2012-12-25 17:45:04 +00:00
Michael Tüxen f8d48662c8 Add support of -m option for SCTP.
svn path=/trunk/; revision=46737
2012-12-25 17:32:30 +00:00
Michael Tüxen dcd2b0614b Fix SCTP packet generation if DATA chunk headers need
to be generated.

svn path=/trunk/; revision=46736
2012-12-25 14:34:24 +00:00
Michael Tüxen 4aa19ce98f Fix bugs I introduced. Now
od -Ax -tx1 -v stream | text2pcap -m1460 -T1234,1234 - stream.pcap
does work again.

svn path=/trunk/; revision=46734
2012-12-25 12:02:39 +00:00
Michael Tüxen d6a70b809e Improve description.
svn path=/trunk/; revision=46731
2012-12-25 10:31:21 +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 b70c24ca79 When using pcapng, provide input file name as comment.
svn path=/trunk/; revision=46714
2012-12-23 09:00:55 +00:00
Michael Tüxen dcadf85feb Specifiy time resolution explicitly.
svn path=/trunk/; revision=46693
2012-12-22 12:35:01 +00:00
Michael Tüxen 91534394cc Fix timestamp computation when using pcapng.
svn path=/trunk/; revision=46692
2012-12-22 12:09:38 +00:00
Michael Tüxen a52b0de406 Add support for writing pcap-ng files by specifying -n as an option.
Leave pcap the default file format for now. The is should be reconsidered
before the next release as it might make sense to use pcapgn as
the default as we do for dumpcap. (We can use the -P option to allow
switching back to pcap).

svn path=/trunk/; revision=46691
2012-12-22 09:43:17 +00:00
Michael Tüxen 3039785ecb Fix a warning on Windows.
svn path=/trunk/; revision=46674
2012-12-21 14:38:00 +00:00
Michael Tüxen 2440176cab Use pcapio routines. This concludes the preperation for
adding pcapng support.

svn path=/trunk/; revision=46673
2012-12-21 14:34:26 +00:00
Michael Tüxen edc47dbf88 This should make the Linux buildbot happy.
svn path=/trunk/; revision=46670
2012-12-21 13:53:21 +00:00
Michael Tüxen 67f86530b1 Address a build issue on Windows.
svn path=/trunk/; revision=46669
2012-12-21 13:17:20 +00:00
Michael Tüxen 2dcbad6126 Build the packet to be sent completely in the buffer and
then send it out at once.
This allows the usage of routines from pcapio.

svn path=/trunk/; revision=46668
2012-12-21 13:05:43 +00:00
Michael Tüxen e8d6a3a627 Make handling of inconsistent transport layer parameters more consistent.
svn path=/trunk/; revision=46599
2012-12-18 22:29:44 +00:00
Michael Tüxen 0ba722d3bf Whitespace changes. Use consistent 4 space indent.
svn path=/trunk/; revision=46597
2012-12-18 21:52:08 +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
Guy Harris 2d6301dd90 There's no __solaris__ predefine for Solaris; just use __sun.
svn path=/trunk/; revision=42012
2012-04-10 19:05:20 +00:00
Jeff Morriss bc465f37fc Revisit https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161
and r39501:

Setting _XOPEN_SOURCE to 600 is only allowed on Solaris 10 if the compiler is
set to C99 mode.  Conversely (and as reported in the bug), simply defining it
(but with no value) is not allowed if the compiler *is* compiling to C99.

So, don't define _XOPEN_SOURCE at all on Solaris.  Keep defining it as 600 on
other OS's as (also) requested in that bug.

Maybe there's a cleaner way to do this but all of this is a "trickery" mess
anyway...

svn path=/trunk/; revision=41182
2012-02-24 20:33:19 +00:00
Jeff Morriss e925843f90 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161 :
Solaris doesn't like _XOPEN_SOURCE being defined but with no value, at least
when being compiled in C99-mode.  So set it to 600 (XPG6); hopefully this
won't break any other systems.

svn path=/trunk/; revision=39501
2011-10-21 01:03:48 +00:00
Stig Bjørlykke d7f7889f0c From Peter Fales via bug 6424:
Corrected IP address with text2pcap -i option on big endian machines.

svn path=/trunk/; revision=39215
2011-10-02 13:43:57 +00:00
Stig Bjørlykke c8a187390d From Pascal Quantin via bug 1723:
Make ASCII text dump identification optional.

svn path=/trunk/; revision=38886
2011-09-05 20:03:03 +00:00
Stig Bjørlykke f27f459195 Change malloc -> g_malloc and free -> g_free.
svn path=/trunk/; revision=38884
2011-09-05 19:12:31 +00:00
Stig Bjørlykke d0f83e0d8d Yet another cast.
svn path=/trunk/; revision=38703
2011-08-24 06:57:14 +00:00
Stig Bjørlykke cf114c1124 Fix a warning by changing a pointer type.
text2pcap.c: In function ‘parse_token’:
text2pcap.c:1076: warning: cast from pointer to integer of different size
text2pcap.c:1076: warning: cast from pointer to integer of different size

svn path=/trunk/; revision=38702
2011-08-24 06:42:40 +00:00
Anders Broman 1f23674191 From Jack Yu modified by Chris Maynard:
Enhancement of text2cap for parsing flexibility.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1723

svn path=/trunk/; revision=38679
2011-08-23 04:36:37 +00:00
Bill Meier e74fe5c6ea Test return value from fwrite(); If an error occurred then exit with a message.
svn path=/trunk/; revision=38449
2011-08-10 17:15:08 +00:00
Jeff Morriss bf95c7b5e4 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :
getopt() can/should normally be found in unistd.h, so:

- When testing for getopt(), define that we HAVE_GETOPT instead of
  HAVE_GETOPT_H (to avoid confusion).
- Don't attempt to include getopt.h: not all OS's have it (for example,
  Solaris 9 does not).
- (All the places which need getopt already include unistd.h (if we have it).)

If this breaks things on some OS, we might need (a real) HAVE_GETOPT_H check.

svn path=/trunk/; revision=38437
2011-08-09 21:02:10 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00
Gerald Combs a24687ce8e Move the Windows argument list conversion code to a common routine.
svn path=/trunk/; revision=37372
2011-05-24 00:07:56 +00:00
Michael Tüxen cbcc0f287a Fix a typo in the help message.
Reported by Matthias Wellmeyer.

svn path=/trunk/; revision=36471
2011-04-05 14:28:33 +00:00
Chris Maynard a3fe8fbd1a Fix a couple of typos.
svn path=/trunk/; revision=36410
2011-03-30 15:54:28 +00:00
Chris Maynard 9e55be72fc Wrap all text lines of help at column 80.
svn path=/trunk/; revision=36408
2011-03-30 14:44:18 +00:00
Bill Meier 31b01ae88e Don't compute each checksum twice when adding dummy headers (-u, -T, -s, -S options)
g_ntohs() & friends may be (are ?) macros and may (will ?) eval args more than once ...


svn path=/trunk/; revision=36272
2011-03-23 00:43:55 +00:00
Gerald Combs 3bc1fc3802 On Windows, convert all of our command-line arguments from UTF-16 to
UTF-8 where we don't already do so. In Wireshark use g_utf16_to_utf8
instead of utf_16to8. This should fix bug 5520.

svn path=/trunk/; revision=35411
2011-01-06 23:28:58 +00:00
Bill Meier 6e011bbf6e Change dummy MAC addresses so we don't get Wireshark expert message:
"[...] Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)"
Specifically: use 0a:01:01:01:01:01 and 0a:02:02:02;02:02 (and dummy IP addresses
10.1.1.1 and 10.2.2.2).

svn path=/trunk/; revision=34571
2010-10-19 16:13:48 +00:00
Jeff Morriss 47e2d75820 Move some code (including the optional objects) into libwsutil
svn path=/trunk/; revision=33012
2010-05-28 20:19:55 +00:00
Bill Meier c14b985146 From Jim Young: Include svnversion.h in capinfos and text2pcap
This patch adds a #include "svnversion.h" statement to the capinfos.c and
text2pcap.c files so that their usage() functions will display the SVNVERSION
and SVNPATH infos (if defined).

See Bug #4360 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4360)

svn path=/trunk/; revision=31382
2009-12-29 16:11:43 +00:00
Stephen Fisher 772e36f433 From Jakub Zawadzki via bug #4289: (Fix for) Frame arrival times (pcap)
are 1 hour more than timestamps in txt


svn path=/trunk/; revision=31195
2009-12-08 07:12:59 +00:00
Stig Bjørlykke 98024a007f Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_H
Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision.

svn path=/trunk/; revision=30370
2009-10-06 16:01:18 +00:00
Gerald Combs 1e93d53b56 Use "svn info" to fetch the version by default. Fetch the repository path as
well. Add the repository path to the version strings.

svn path=/trunk/; revision=29171
2009-07-22 23:59:15 +00:00
Bill Meier fa920e48ed Minor cleanup of "-h" output text.
svn path=/trunk/; revision=28334
2009-05-12 16:06:14 +00:00