aboutsummaryrefslogtreecommitdiffstats
path: root/mergecap.c
AgeCommit message (Collapse)AuthorFilesLines
2011-12-22Alphabetize the list of encapsulation types via "mergecap -T" as well as the ↵cmaynard1-14/+51
list of capture file types via "mergecap -F". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40282 f5534014-38df-0310-8fa8-9805f1628bb7
2011-12-13Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports anyguy1-2/+2
form of corruption/bogosity in a file, including in a file header as well as in records in the file. Change the error message wtap_strerror() returns for it to reflect that. Use it for some file header problems for which it wasn't already being used - WTAP_ERR_UNSUPPORTED shouldn't be used for that, it should only be used for files that we have no reason to believe are invalid but that have a version number we don't know about or some other non-link-layer-encapsulation-type value we don't know about. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40175 f5534014-38df-0310-8fa8-9805f1628bb7
2011-11-30Hopefully clarify usage a bit to indicate multiple infile's can be specified ↵cmaynard1-2/+20
to be merged. Also, add GPL and copyright info. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40051 f5534014-38df-0310-8fa8-9805f1628bb7
2011-11-30From Eugene Bogush: Initialize read_err to 0 so mergecap works again. Fixes ↵cmaynard1-1/+1
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6623 git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40048 f5534014-38df-0310-8fa8-9805f1628bb7
2011-11-21On an I/O error, merge_read_packet() and merge_append_read_packet() needguy1-2/+7
to return a pointer to the merge_in_file_t that got the error. Set *err to 0 on success and an error code on an err, treat a null return as an EOF indication, and if we don't get a null return check for a non-zero error code and treat that as an I/O error. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39964 f5534014-38df-0310-8fa8-9805f1628bb7
2011-11-19When reporting "sorry, *this* packet can't be written to a file of thatguy1-12/+25
type" when writing out a capture file (i.e., writing a per-packet-encapsulation capture to a file type that supports it but doesn't support one of the packet's encapsulations), report the packet number and, when doing this in a merge operation, report the file from which it came. When reporting "sorry, that file can't be written to a file of that type, period", show the file type rather than the input file link-layer type that causes the problem. (We could show both. We could be *really* ambitious and iterate through all possible file types and show the ones that will or at least might work....) file_write_error_message() is documented as handling only UNIX-style errnos, and libwireshark should be usable without libwiretap, so leave it up to its callers to handle Wiretap errors such as WTAP_ERR_SHORT_WRITE. Clean up indentation. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@39949 f5534014-38df-0310-8fa8-9805f1628bb7
2011-08-09Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5608 :morriss1-3/+1
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@38437 f5534014-38df-0310-8fa8-9805f1628bb7
2011-06-28Replace all strerror() with g_strerror().stig1-1/+1
Remove our local strerror implementation. Mark strerror as locale unsafe API. This fixes bug 5715. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37812 f5534014-38df-0310-8fa8-9805f1628bb7
2011-06-20Have mergecap, tshark, and editcap write pcap-ng files by default. Thisgerald1-1/+5
is mainly an attempt to fix the currently-broken "test.sh" step on the XP buildbot. If this causes too many problems we might want to have suite-capture.sh:capture_step_snapshot pass "-P" to dumpcap instead. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37736 f5534014-38df-0310-8fa8-9805f1628bb7
2011-05-24Move the Windows argument list conversion code to a common routine.gerald1-14/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37372 f5534014-38df-0310-8fa8-9805f1628bb7
2011-01-06On Windows, convert all of our command-line arguments from UTF-16 togerald1-0/+21
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. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35411 f5534014-38df-0310-8fa8-9805f1628bb7
2010-05-28Move some code (including the optional objects) into libwsutilmorriss1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33012 f5534014-38df-0310-8fa8-9805f1628bb7
2009-10-06Invert check for getopt: NEED_GETOPT_H -> HAVE_GETOPT_Hstig1-4/+4
Rename getopt.[ch] -> wsgetopt.[ch] to avoid name collision. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30370 f5534014-38df-0310-8fa8-9805f1628bb7
2009-10-05Fixed a int/long warning.stig1-3/+3
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30330 f5534014-38df-0310-8fa8-9805f1628bb7
2009-07-22Use "svn info" to fetch the version by default. Fetch the repository path asgerald1-1/+1
well. Add the repository path to the version strings. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@29171 f5534014-38df-0310-8fa8-9805f1628bb7
2009-05-12Minor cleanup of "-h" output text.wmeier1-12/+12
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@28334 f5534014-38df-0310-8fa8-9805f1628bb7
2008-05-22Move the file utility functions from wiretap to libwsutil so thatmorriss1-5/+5
libwireshark (and the plugins using those functions) do not depend on wiretap on Windows. While doing that, rename the eth_* functions to ws_*. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@25354 f5534014-38df-0310-8fa8-9805f1628bb7
2008-01-24Fixed some malloc -> g_malloc, free -> g_free, strdup -> g_strdup.stig1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24179 f5534014-38df-0310-8fa8-9805f1628bb7
2006-05-28Ethereal->Wiresharketxrab1-1/+1
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@18235 f5534014-38df-0310-8fa8-9805f1628bb7
2006-03-30From Martin Mathieson:etxrab1-2/+2
wiretap/README.developer - the referenced default seek_read function doesn't exist now wiretap/wtap.c - a "hole" in encap_table was causing the wrong encap value for later types to be looked up (by name) mergecap.c - fix a couple of program name copy+paste errors from editcap.c git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17765 f5534014-38df-0310-8fa8-9805f1628bb7
2006-01-10same command line related changes as recently done with editcapulfl1-33/+62
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16994 f5534014-38df-0310-8fa8-9805f1628bb7
2005-11-06replace *a lot* of file related calls by their GLib counterparts. This is ↵ulfl1-10/+2
necessary for the switch to GTK 2.6 (at least on WIN32). to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place. deleted related things from config.h.win32 As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@16403 f5534014-38df-0310-8fa8-9805f1628bb7
2005-09-14added compression support for capture file output. The Save/As dialog now ↵ulfl1-1/+1
has a checkbox "Compress with gzip" currently limited to Ethereal and all the variants of libpcap filetypes only. We might want to add output compression support to the other tools as well (tethereal, mergecap, ...). We might also want to add support for the other filetypes, but this is only possible if the filetype functions doesn't use special output operations like fseek. One bug is still left: if the input and output filetypes while saving are the same, Ethereal currently optimizes this by simply copy the binary file instead of using wiretap (so it will be faster but it will ignore the compress setting). Don't know a good workaround for this, as I don't know a way to find out if the input file is currently compressed or not. One idea might be to use a heuristic on the filesize (compared to the packet size summmary). Another workaround I see is to remove this optimization, which is of course not the way I like to do it ... git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@15804 f5534014-38df-0310-8fa8-9805f1628bb7
2004-12-29Make the tone of the error messages a bit less formal, by usingguy1-3/+3
contractions. (Safari does, at least when you're trying to open a file to which you don't have read access.) git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12852 f5534014-38df-0310-8fa8-9805f1628bb7
2004-10-29The common merge code merely needs to offer the abstraction of routinesguy1-33/+59
that return the next packet from a set of {chronologically sorted, sequential-by-file} packets; it doesn't need to have a loop over all those packets, or any code to write packets. Supply those abstractions, change the code that merges packets to do its own writing, and have the Ethereal version manage a progress bar and have the mergecap version print packet numbers in verbose mode, as the common merge code used to do. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12427 f5534014-38df-0310-8fa8-9805f1628bb7
2004-10-28Make "merge_files()" and "merge_append_files()" return a tri-stateguy1-12/+40
indication - success, read failure, write failure - and have their callers handle read failures by looking for the file that got the read failure and reporting the failure in question. Free up the err_info string returned by "wtap_read()" after using it. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12423 f5534014-38df-0310-8fa8-9805f1628bb7
2004-10-28Remove all the verbose-mode code from merge.c, and put most of it inguy1-14/+67
mergecap.c (get rid of the verbose printing of information for each packet). Have "merge_append_files()" return FALSE only on a write error, as "merge_files()" does. Sort the routines in "merge.c" in the order from "merge.h". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12422 f5534014-38df-0310-8fa8-9805f1628bb7
2004-10-27Change some of the merge.c APIs to return more information on failure,guy1-31/+78
and use that information to provide better error messages. Have "merge_open_outfile()" do all the work of filling in the merge_out_file_t structure, with the values to use passed as arguments. Get rid of some structure members that used to be used solely to pass information to "merge_open_outfile()". Add a "cf_merge_files()" routine to do the merging and reporting of errors. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12420 f5534014-38df-0310-8fa8-9805f1628bb7
2004-10-27Check whether any input files were specified, and print an error forguy1-0/+4
that - otherwise, you get a "No valid input files" message, which perhaps doesn't make it clear enough that the problem is that there were no input files, period. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@12410 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-18Set the svn:eol-style property on all text files to "native", so thatguy1-1/+1
they have LF at the end of the line on UN*X and CR/LF on Windows; hopefully this means that if a CR/LF version is checked in on Windows, the CRs will be stripped so that they show up only when checked out on Windows, not on UN*X. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11400 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-15Convert make-version.pl and the associated cvsversion.h and CVSVERSIONgerald1-3/+3
definition to Subversion. "svn info" prints out the last changed date of the repository, so we don't have to go hunting through "CVS/Entries" files anymore. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11379 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-13If we fail to open the output file, report the reason why.guy1-5/+7
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11371 f5534014-38df-0310-8fa8-9805f1628bb7
2004-07-12bugfix to a bug reported by jprakashbabu@hotpop.com:ulfl1-6/+6
mergecap didn't created a new output file git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11368 f5534014-38df-0310-8fa8-9805f1628bb7
2004-06-30Initialize "out_filename" to NULL, so it's set to NULL if it's not setguy1-3/+3
by a "-w" flag. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11277 f5534014-38df-0310-8fa8-9805f1628bb7
2004-06-30On at least some platforms, a #define of O_BINARY is needed even ifguy1-1/+5
<fcntl.h> is included, as <fcntl.h> doesn't define it. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11276 f5534014-38df-0310-8fa8-9805f1628bb7
2004-06-29avoid using tmpnam() for security reasons.ulfl1-4/+26
instead of giving the merge stuff a filename, give it an already opened file descriptor git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11273 f5534014-38df-0310-8fa8-9805f1628bb7
2004-06-18merge: remove code duplication in merge.c and mergecap.c (put it in merge.c),ulfl1-351/+16
and doing some more code cleanup git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@11176 f5534014-38df-0310-8fa8-9805f1628bb7
2004-03-04Undo an unnecessary changejmayer1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10297 f5534014-38df-0310-8fa8-9805f1628bb7
2004-03-03Bill Guyton: mergecap can write to stdout by using the special filename -jmayer1-1/+6
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10289 f5534014-38df-0310-8fa8-9805f1628bb7
2004-02-20Add support for a "version.conf" file in the main directory which cangerald1-2/+2
be used to adjust version preferences. It understands two configuration directives: "enable", which can be 0 or 1, and "format", which can be any strftime()-compatible string, e.g. "V12-powered on %A %Y-%m-%d %H:%M:%S". If no configuration file is present, the configuration defaults to enable: 1 format: CVS %Y%m%d%H%M%S git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10139 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-25Free the error info string after using it.guy1-1/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9855 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-25Have the Wiretap open, read, and seek-and-read routines return, inguy1-6/+27
addition to an error code, an error info string, for WTAP_ERR_UNSUPPORTED, WTAP_ERR_UNSUPPORTED_ENCAP, and WTAP_ERR_BAD_RECORD errors. Replace the error messages logged with "g_message()" for those errors with g_strdup()ed or g_strdup_printf()ed strings returned as the error info string, and change the callers of those routines to, for those errors, put the info string into the printed message or alert box for the error. Add messages for cases where those errors were returned without printing an additional message. Nobody uses the error code from "cf_read()" - "cf_read()" puts up the alert box itself for failures; get rid of the error code, so it just returns a success/failure indication. Rename "file_read_error_message()" to "cf_read_error_message()", as it handles read errors from Wiretap, and have it take an error info string as an argument. (That handles a lot of the work of putting the info string into the error message.) Make some variables in "ascend-grammar.y" static. Check the return value of "erf_read_header()" in "erf_seek_read()". Get rid of an unused #define in "i4btrace.c". git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9852 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-18Fix warnings found by -Wstrict-prototypesjmayer1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9722 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-18Output the result of -h to stdout, not stderrjmayer1-18/+18
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9702 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-18Nice rendering of the CVS version as "(cvs 200401181200003000)".obiot1-2/+6
The make-version.pl script only defines CVSVERSION if this was a build from CVS. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9701 f5534014-38df-0310-8fa8-9805f1628bb7
2004-01-16In case of CVS sources, add the date of the last change to the versionjmayer1-2/+3
number. 2do: Add support to Makefile.nmake Enforce the generation of cvsversion.h on each run of make git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@9679 f5534014-38df-0310-8fa8-9805f1628bb7
2002-08-28Removed trailing whitespaces from .h and .c files using thejmayer1-19/+19
winapi_cleanup tool written by Patrik Stridvall for the wine project. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6117 f5534014-38df-0310-8fa8-9805f1628bb7
2002-08-02Replace the types from sys/types.h and netinet/in.h by their glib.hjmayer1-9/+5
equivalents for the toplevel directory. The removal of winsock2.h will hopefully not cause any problems under MSVC++, as those files using struct timeval still include wtap.h, which still includes winsock2.h. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5932 f5534014-38df-0310-8fa8-9805f1628bb7
2002-06-23WinPcap 2.3's <pcap.h> includes <packet32.h>, and WinPcap 2.3'sguy1-3/+3
<packet32.h> includes <winsock2.h>; we include that rather than <winsock.h>, to avoid errors due to conflicting declarations in <winsock.h> and <winsock2.h>. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5742 f5534014-38df-0310-8fa8-9805f1628bb7
2002-03-31From Joerg Mayer: mark function arguments as unused.guy1-2/+2
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@5051 f5534014-38df-0310-8fa8-9805f1628bb7