summaryrefslogtreecommitdiff
path: root/text2pcap.c
AgeCommit message (Collapse)AuthorFilesLines
2013-10-05Invert NEED_INET_ATON_H to HAVE_INET_ATON_HJörg Mayer1-1/+1
Remove unused NEED_G_ASCII_STRTOULL_H svn path=/trunk/; revision=52385
2013-09-29Rename routines that write pcap-ng files to "pcapng_xxx" rather thanGuy Harris1-37/+37
"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-29We always write to a FILE *, so:Guy Harris1-6/+6
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-06The 'a' option doesn't take an argument. Fix bug introduced by r49964.Chris Maynard1-1/+1
svn path=/trunk/; revision=51803
2013-07-29In the comments for pcap_link_type, point toGuy Harris1-2/+2
http://www.tcpdump.org/linktypes.html for the details, rather than to some particular OS's net/bpf.h (assuming it even has one), and speak of it as a LINKTYPE_ value rather than a DLT_ value (in those cases where the LINKTYPE_ value for a given link-layer header type is different from the DLT_ value, it's the LINKTYPE_ value that should be passed to text2pcap, as it's what gets written to the file, and those should be the always-platform-independent LINKTYPE_ values rather than the possibly-platform-dependent DLT_ values). svn path=/trunk/; revision=51008
2013-06-25From Dirk Jagdmann: Use a guint32 for IPv4 addresses. Fixes compilationGerald Combs1-2/+2
on OS X + Cmake. svn path=/trunk/; revision=50139
2013-06-21AF_INET and AF_INET6 undefined in textpcap.c when compiling on FreeBSDStephen Fisher1-0/+4
9.1-RELEASE with non-standard gcc 4.6, so pull in sys/socket.h when available. svn path=/trunk/; revision=50110
2013-06-18Fix compile error:Jörg Mayer1-1/+3
[ 79%] Building C object CMakeFiles/text2pcap.dir/text2pcap.c.o In file included from /usr/include/glib-2.0/glib/galloca.h:34:0, from /usr/include/glib-2.0/glib.h:32, from /home/jmayer/work/wireshark/svn/trunk/wsutil/file_util.h:34, from /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:116: /home/jmayer/work/wireshark/svn/trunk/text2pcap.c: In function ‘write_current_packet’: /usr/include/glib-2.0/glib/gtypes.h:186:22: error: declaration of ‘__v’ shadows a previous local [-Werror=shadow] ({ register guint16 __v, __x = ((guint16) (val)); \ ^ /usr/include/glib-2.0/glib/gtypes.h:237:38: note: in expansion of macro ‘GUINT16_SWAP_LE_BE_IA32’ # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) ^ /usr/lib/glib-2.0/include/glibconfig.h:192:29: note: in expansion of macro ‘GUINT16_SWAP_LE_BE’ #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:359:23: note: in expansion of macro ‘GUINT16_TO_BE’ #define g_htons(val) (GUINT16_TO_BE (val)) ^ /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:705:35: note: in expansion of macro ‘g_htons’ pseudoh.length = g_htons(length - g_ntohs(HDR_IPv6.ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(HDR_UDP)); ^ /usr/include/glib-2.0/glib/gtypes.h:237:38: note: in expansion of macro ‘GUINT16_SWAP_LE_BE_IA32’ # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) ^ /usr/lib/glib-2.0/include/glibconfig.h:192:29: note: in expansion of macro ‘GUINT16_SWAP_LE_BE’ #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:327:31: note: in expansion of macro ‘GUINT16_TO_BE’ #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:357:23: note: in expansion of macro ‘GUINT16_FROM_BE’ #define g_ntohs(val) (GUINT16_FROM_BE (val)) ^ /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:705:52: note: in expansion of macro ‘g_ntohs’ pseudoh.length = g_htons(length - g_ntohs(HDR_IPv6.ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(HDR_UDP)); ^ /usr/include/glib-2.0/glib/gtypes.h:186:22: error: shadowed declaration is here [-Werror=shadow] ({ register guint16 __v, __x = ((guint16) (val)); \ ^ /usr/include/glib-2.0/glib/gtypes.h:237:38: note: in expansion of macro ‘GUINT16_SWAP_LE_BE_IA32’ # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) ^ /usr/lib/glib-2.0/include/glibconfig.h:192:29: note: in expansion of macro ‘GUINT16_SWAP_LE_BE’ #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:359:23: note: in expansion of macro ‘GUINT16_TO_BE’ #define g_htons(val) (GUINT16_TO_BE (val)) ^ /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:705:35: note: in expansion of macro ‘g_htons’ pseudoh.length = g_htons(length - g_ntohs(HDR_IPv6.ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(HDR_UDP)); ^ /usr/include/glib-2.0/glib/gtypes.h:186:27: error: declaration of ‘__x’ shadows a previous local [-Werror=shadow] ({ register guint16 __v, __x = ((guint16) (val)); \ ^ /usr/include/glib-2.0/glib/gtypes.h:237:38: note: in expansion of macro ‘GUINT16_SWAP_LE_BE_IA32’ # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) ^ /usr/lib/glib-2.0/include/glibconfig.h:192:29: note: in expansion of macro ‘GUINT16_SWAP_LE_BE’ #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:359:23: note: in expansion of macro ‘GUINT16_TO_BE’ #define g_htons(val) (GUINT16_TO_BE (val)) ^ /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:705:35: note: in expansion of macro ‘g_htons’ pseudoh.length = g_htons(length - g_ntohs(HDR_IPv6.ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(HDR_UDP)); ^ /usr/include/glib-2.0/glib/gtypes.h:237:38: note: in expansion of macro ‘GUINT16_SWAP_LE_BE_IA32’ # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) ^ /usr/lib/glib-2.0/include/glibconfig.h:192:29: note: in expansion of macro ‘GUINT16_SWAP_LE_BE’ #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:327:31: note: in expansion of macro ‘GUINT16_TO_BE’ #define GUINT16_FROM_BE(val) (GUINT16_TO_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:357:23: note: in expansion of macro ‘GUINT16_FROM_BE’ #define g_ntohs(val) (GUINT16_FROM_BE (val)) ^ /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:705:52: note: in expansion of macro ‘g_ntohs’ pseudoh.length = g_htons(length - g_ntohs(HDR_IPv6.ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(HDR_UDP)); ^ /usr/include/glib-2.0/glib/gtypes.h:186:27: error: shadowed declaration is here [-Werror=shadow] ({ register guint16 __v, __x = ((guint16) (val)); \ ^ /usr/include/glib-2.0/glib/gtypes.h:237:38: note: in expansion of macro ‘GUINT16_SWAP_LE_BE_IA32’ # define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val)) ^ /usr/lib/glib-2.0/include/glibconfig.h:192:29: note: in expansion of macro ‘GUINT16_SWAP_LE_BE’ #define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val)) ^ /usr/include/glib-2.0/glib/gtypes.h:359:23: note: in expansion of macro ‘GUINT16_TO_BE’ #define g_htons(val) (GUINT16_TO_BE (val)) ^ /home/jmayer/work/wireshark/svn/trunk/text2pcap.c:705:35: note: in expansion of macro ‘g_htons’ pseudoh.length = g_htons(length - g_ntohs(HDR_IPv6.ip6_ctlun.ip6_un1.ip6_un1_plen) + sizeof(HDR_UDP)); ^ cc1: all warnings being treated as errors make[2]: *** [CMakeFiles/text2pcap.dir/text2pcap.c.o] Error 1 Feel free to choose a less offensive variable name svn path=/trunk/; revision=50005
2013-06-16Prepend custom Destination IP and Source IP (ipv4 or ipv6) in the pcap. Bug ↵Michael Mann1-8/+164
5650 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5650) svn path=/trunk/; revision=49964
2013-04-05Don't forget to move the trailing '\0'.Michael Tüxen1-1/+2
svn path=/trunk/; revision=48746
2013-04-04As forewarned at ↵Chris Maynard1-22/+37
http://www.wireshark.org/lists/wireshark-dev/201304/msg00009.html, change the default snaplen to 65KiB-1. While we're at it, push the max packet size to that value as well. Also: convert the few tabs to spaces and add modelines. svn path=/trunk/; revision=48738
2013-03-20[-Wmissing-prototypes]Anders Broman1-1/+1
Use explicit casts. svn path=/trunk/; revision=48439
2013-02-20When any of our executables start on Windows create or open a "WiresharkGerald Combs1-0/+1
is running" mutex. Have the NSIS installer check for this mutex and ask the user to close Wireshark if it's found. While not perfect this makes the WinSparkle update process much less annoying. svn path=/trunk/; revision=47758
2013-01-23Usage formatting changes:Chris Maynard1-15/+15
-> Wrap all text at column 80 -> Reference http://www.tcpdump.org/linktypes.html instead of net/bpf.h -> Other misc. wording changes. svn path=/trunk/; revision=47234
2013-01-03Cleanup error handling when processing preamble.Michael Tüxen1-16/+11
svn path=/trunk/; revision=46911
2013-01-03Don't try to process timestamp without the format beingMichael Tüxen1-0/+5
specified. svn path=/trunk/; revision=46910
2013-01-02Fix indentation.Michael Tüxen1-4/+4
svn path=/trunk/; revision=46901
2013-01-02Also print number of bytes written.Michael Tüxen1-2/+3
svn path=/trunk/; revision=46900
2013-01-02Allow pcap/pcapng format to be written to more than just a file (FILE*). ↵Michael Mann1-8/+8
Gives more flexibility if needed. WRITE_DATA macro replaced and applied consistently throughout pcapio.c svn path=/trunk/; revision=46891
2012-12-26Fix a bunch of warnings.Guy Harris1-68/+68
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-25Add support for -D option. The preamble will start withMichael Tüxen1-3/+36
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-25Remove current version of -D option, because:Michael Tüxen1-11/+1
* 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-25Add some debug output regarding preamble processing.Michael Tüxen1-4/+7
svn path=/trunk/; revision=46740
2012-12-25Clear preamble if no timespec is given.Michael Tüxen1-1/+4
svn path=/trunk/; revision=46738
2012-12-25Add support of -m option for SCTP.Michael Tüxen1-12/+23
svn path=/trunk/; revision=46737
2012-12-25Fix SCTP packet generation if DATA chunk headers needMichael Tüxen1-11/+18
to be generated. svn path=/trunk/; revision=46736
2012-12-25Fix bugs I introduced. NowMichael Tüxen1-6/+6
od -Ax -tx1 -v stream | text2pcap -m1460 -T1234,1234 - stream.pcap does work again. svn path=/trunk/; revision=46734
2012-12-25Improve description.Michael Tüxen1-1/+1
svn path=/trunk/; revision=46731
2012-12-23Add support for writing per packet comments when using pcapng.Michael Tüxen1-0/+1
Not actually used with this commit, which just brings in the infrastructure. svn path=/trunk/; revision=46715
2012-12-23When using pcapng, provide input file name as comment.Michael Tüxen1-3/+4
svn path=/trunk/; revision=46714
2012-12-22Specifiy time resolution explicitly.Michael Tüxen1-1/+1
svn path=/trunk/; revision=46693
2012-12-22Fix timestamp computation when using pcapng.Michael Tüxen1-2/+2
svn path=/trunk/; revision=46692
2012-12-22Add support for writing pcap-ng files by specifying -n as an option.Michael Tüxen1-9/+89
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-21Fix a warning on Windows.Michael Tüxen1-1/+1
svn path=/trunk/; revision=46674
2012-12-21Use pcapio routines. This concludes the preperation forMichael Tüxen1-30/+16
adding pcapng support. svn path=/trunk/; revision=46673
2012-12-21This should make the Linux buildbot happy.Michael Tüxen1-1/+1
svn path=/trunk/; revision=46670
2012-12-21Address a build issue on Windows.Michael Tüxen1-2/+2
svn path=/trunk/; revision=46669
2012-12-21Build the packet to be sent completely in the buffer andMichael Tüxen1-94/+134
then send it out at once. This allows the usage of routines from pcapio. svn path=/trunk/; revision=46668
2012-12-18Make handling of inconsistent transport layer parameters more consistent.Michael Tüxen1-2/+11
svn path=/trunk/; revision=46599
2012-12-18Whitespace changes. Use consistent 4 space indent.Michael Tüxen1-159/+156
svn path=/trunk/; revision=46597
2012-09-20We always HAVE_CONFIG_H so don't bother checking whether we have it or not.Jeff Morriss1-3/+1
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
2012-04-10There's no __solaris__ predefine for Solaris; just use __sun.Guy Harris1-1/+1
svn path=/trunk/; revision=42012
2012-02-24Revisit https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161Jeff Morriss1-1/+3
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
2011-10-21Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161 :Jeff Morriss1-7/+7
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-02From Peter Fales via bug 6424:Stig Bjørlykke1-1/+7
Corrected IP address with text2pcap -i option on big endian machines. svn path=/trunk/; revision=39215
2011-09-05From Pascal Quantin via bug 1723:Stig Bjørlykke1-43/+57
Make ASCII text dump identification optional. svn path=/trunk/; revision=38886
2011-09-05Change malloc -> g_malloc and free -> g_free.Stig Bjørlykke1-2/+2
svn path=/trunk/; revision=38884
2011-08-24Yet another cast.Stig Bjørlykke1-1/+1
svn path=/trunk/; revision=38703
2011-08-24Fix a warning by changing a pointer type.Stig Bjørlykke1-2/+2
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