aboutsummaryrefslogtreecommitdiffstats
path: root/text2pcap.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-07Clean up includes of unistd.h, fcntl.h, and sys/stat.h.Guy Harris1-4/+0
Have wsutil/file_util.h include them on UN*X, just as it includes io.h on Windows, so we can have a rule of "if you do file operations, include <wsutil/file_util.h> and use the routines in it". Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't necessary (whether because of the addition of them to wsutil/file_util.h or because they weren't needed in the first place). Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f Reviewed-on: https://code.wireshark.org/review/11619 Petri-Dish: Guy Harris <guy@alum.mit.edu> Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-20Suppress a bunch of cast-qual warnings.Gerald Combs1-0/+3
Squelch warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] similar to g630f54f. Change strtod to g_ascii_strtod to squelch a checkAPIs error. Change-Id: Ib2d26ef89f08827a5adc07e35eaf876cd7b8d14e Reviewed-on: https://code.wireshark.org/review/7269 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-09(Trivial) Fix printf-related 'Mismatch on sign' warningsBill Meier1-1/+1
Found by MSVC2013 Code Analysis Change-Id: I58063946dd558e98308c87b36eeac0ddbe1a6e79 Reviewed-on: https://code.wireshark.org/review/7045 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2015-01-03Use get_ws_vcs_version() to generate the version string.Guy Harris1-11/+9
That's what we do in, for example, dumpcap. Also, use g_strdup_printf() for the strings, rather than using fixed-length arrays. Change-Id: I36ad201e3eda903ef3a089bafb09df0581efe512 Reviewed-on: https://code.wireshark.org/review/6284 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-01-02Add back "version.h" inclusionPascal Quantin1-0/+1
It got removed by the automatic include cleaning scripts Also add it to text2pcap.c as it is used to get the version when writing a pcapng file Change-Id: I3d56985fa1d04bcb066fe015a588c24cf3cb7267 Reviewed-on: https://code.wireshark.org/review/6248 Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-31Do the full string in get_{compiled,runtime}_version_info().Guy Harris1-6/+4
Have them start the string with "Compiled" or "Running on", and return the string when done. Change-Id: Ic4d290c963621fa0385dc5aab766fd4ad31d3810 Reviewed-on: https://code.wireshark.org/review/6155 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31Move the version_info.c stuff to wsutil/ws_version_info.c.Guy Harris1-1/+0
Change-Id: I3a5c7e219974bfb924819b43b4d445eaf00e5bde Reviewed-on: https://code.wireshark.org/review/6153 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-28Don't check the same character twice in a row, check it and the next character.Guy Harris1-1/+1
Fixes Coverity CID 1260460. Change-Id: Ic9ed109a863bcf20a5e67e4f52d628011f5e9ba5 Reviewed-on: https://code.wireshark.org/review/6087 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25Only include <wsutil/os_version_info.h> if we need it.Guy Harris1-1/+0
Change-Id: Idee0e7205969ac2e7b33c4748a1463a0bfffe0a6 Reviewed-on: https://code.wireshark.org/review/6051 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-25Check for getopt_long(), not getopt().Guy Harris1-1/+1
We support three types of platforms: 1) UN*Xes that have both getopt() and getopt_long(); 2) UN*Xes that have getopt() but not getopt_long(); 3) Windows, which has neither. Checking for getopt_long() lets us distinguish between 1) and 2) and build getopt_long() for them. Change-Id: Iaf0f142f9bebaa2eed2128d544ec9786711def45 Reviewed-on: https://code.wireshark.org/review/6045 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-24Move twelve show_version() functions from the varoius programs andStephen Fisher1-16/+1
Wireshark UI files into a single one in wsutil. Change-Id: I0a64f0cc8106bd681bd185289c36272c4c43baad Reviewed-on: https://code.wireshark.org/review/6026 Reviewed-by: Stephen Fisher <sfisher@sdf.org>
2014-10-17Don't use ctype.h routines.Guy Harris1-2/+1
That avoids locale dependency and handles possibly-signed chars(which we weren't always doing before). Change-Id: I89e50678abb8c3e535081c92ca25bc1bab672c68 Reviewed-on: https://code.wireshark.org/review/4798 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-09-28Support nanosecond-resolution time stamps when writing pcap-ng files.Guy Harris1-23/+27
Pcap-ng files have supported variable time stamp resolutions since Day One, and any code that reads those files but can't handle nanosecond-resolution time stamps is broken. Pcap files got a separate magic number for nanosecond-resolution files relatively recently, and not all code that reads pcap files handles that magic number, so we don't support it for pcap files. Based on https://code.wireshark.org/review/#/c/4304/ from Peter Hatina. Change-Id: I4f4e3b5ca0ba4fe9394765edb54bb77a4a776237 Reviewed-on: https://code.wireshark.org/review/4358 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-30Remove some unnecessary definitions.Guy Harris1-20/+0
text2pcap.c uses pcapio.c to write pcap files, so it doesn't itself need to know what those files look like. Change-Id: I013d0c094c27515af91f352b565bc9a8bad3e842 Reviewed-on: https://code.wireshark.org/review/3927 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-08-24Modify includes of config.h so that out-of-tree builds, i.e. CMakeGraham Bloice1-1/+1
don't pick up the in-tree copy. Change-Id: I7ec473876cdba1a025c52362d7f6adc62d24ce71 Reviewed-on: https://code.wireshark.org/review/3798 Petri-Dish: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Roland Knall <rknall@gmail.com> Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2014-08-05Fix whitespace/indentation to match editor modelines.Bill Meier1-1/+1
Change-Id: I3445ae22f10584582d465bf632942e016f5f70ca Reviewed-on: https://code.wireshark.org/review/3452 Reviewed-by: Bill Meier <wmeier@newsguy.com>
2014-08-02Rename variable to avoid -Wshadow on mac buildbotsEvan Huus1-6/+6
Change-Id: I13d591248718fcc36cd300bf28f779e2d9e0265a Reviewed-on: https://code.wireshark.org/review/3339 Reviewed-by: Evan Huus <eapache@gmail.com>
2014-07-06Clean up handling of missing functions.Guy Harris1-2/+2
With autotools, CMake, and nmake, if we have a function, #define HAVE_{function_name_in_all_caps}, otherwise don't #define it. If we provide our own version of a function in libwsutil, make sure we have a header that declares it, and *ONLY* include that header if HAVE_{function_name_in_all_caps} is *NOT* defined, so that we don't have the system declaration and our declaration colliding. Check for inet_aton, strncasecmp, and strptime with CMake, just as we do with autotools. Simplify the addition of {function_name_in_all_caps}_LO to libwsutil in autotools. Change-Id: Id5be5c73f79f81919a3a865324e400eca7b88889 Reviewed-on: https://code.wireshark.org/review/2903 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03Make --help and --version information a bit more uniform.Guy Harris1-51/+129
Have --version print the version number, the copyright information, the "compiled with" information, the "running on/with" information, and the compiler information. Have --help print the version number, a one-line summary of what the program does, a reference to http://www.wireshark.org for more information, a Usage: line, and a list of command-line options. This means programs doing that don't need to include version.h; that's left up to get_ws_vcs_version_info() to do. Change-Id: Idac641bc10e4dfd04c9914d379b3a3e0cc5ca8cb Reviewed-on: https://code.wireshark.org/review/2794 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-03More getopt_long, to add --help and --version support.Guy Harris1-1/+10
Change-Id: I946067b972a70154f02ab561bc0fd029a7a5abc4 Reviewed-on: https://code.wireshark.org/review/2791 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-06-21Add command-line argument to request the version to a number of the utilities.Jeff Morriss1-7/+18
In some cases "-v" was already used so "-V" is the option. Note that the version information in these utilities is much shorter than what is presented by the big programs. As requested by https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5804 Bug: 5804 Change-Id: I35db35a4eace2797afd895f9be7322ef39928480 Reviewed-on: https://code.wireshark.org/review/2489 Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-14Fix Argument with 'nonnull' attribute passed null found by ClangAlexis La Goutte1-0/+5
Change-Id: If1c907308a7c776a6198530663f8dce03839d43b Reviewed-on: https://code.wireshark.org/review/1098 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-24Enhanced text2pcap so that if direction is specified on the command line, "-D",Graham Bloice1-16/+54
and a direction indicator added to the start of each packet in the text file, "I" or "O", then the ip source and destination addresses and udp, tcp and sctp ports are swapped for an inbound packet. Tcp sequence numbers and ack sequence numbers are updated accordingly. Change-Id: Iec2c0fd68d80aad8842b7513fdd30bae6806b96a Reviewed-on: https://code.wireshark.org/review/801 Reviewed-by: Graham Bloice <graham.bloice@trihedral.com> Tested-by: Graham Bloice <graham.bloice@trihedral.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(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 <a.broman58@gmail.com>
2014-03-02Fix text2pcap.c: Argument with 'nonnull' attribute passed null (clang analyzer)Hadriel Kaplan1-0/+9
Clang scan analysis reports API error for text2pcap.c. Change-Id: Ie0861d75888e258d9fd928d5d7441e1e3a8279ba Reviewed-on: https://code.wireshark.org/review/367 Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-07Replace "svn" with "git" all over the place.Gerald Combs1-5/+5
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate. Rename "svnversion.h" to "version.h" as Evan suggested. Update some URLs. In make-version.pl, make sure we don't set an improper upstream branch name. Use the number of commits + short hash from `git describe` for package names by default. Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96 Reviewed-on: https://code.wireshark.org/review/139 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2013-12-31Use the normal convention for exit status and output file descriptors:Bill Meier1-129/+139
Changes: - exit(1) if error (not exit(-1)); - for -h: output to stdout & exit(0); Also: - editor modelines: set tab-width=8; - use a consistent whitespace & formatting style; svn path=/trunk/; revision=54512
2013-12-22'L' constant modifier not needed.Bill Meier1-1/+1
svn path=/trunk/; revision=54362
2013-12-20'guint32 crc_c[256]' array initializer constants should be unsigned 32bit; ↵Bill Meier1-64/+64
Replace 'L' by 'U'. (not that it makes any difference in this case). (I note that in https://tools.ietf.org/id/draft-ietf-tsvwg-sctpcsum-01.txt the definition was 'unsigned long crc_c[256] = {0x...L, ...} presumably from the days when LP32 was still in use. svn path=/trunk/; revision=54308
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