Commit Graph

71 Commits

Author SHA1 Message Date
Jeff Morriss 2d30d5beb1 Move strnatcmp.{h,c} from epan into wsutil: there's nothing epan-specific
there and moving it avoids having to recompile the file for use in editcap
and mergecap (which don't link against libwireshark).

svn path=/trunk/; revision=50650
2013-07-16 01:16:50 +00:00
Chris Maynard d602662b36 Add strnatcmp by Martin Pool for 'natural order' string comparisons, and make use of it in editcap and mergecap for listing encapsulation types. For example:
Before:
    user0 - USER 0
    user1 - USER 1
    user10 - USER 10
    user11 - USER 11
    user12 - USER 12
    user13 - USER 13
    user14 - USER 14
    user15 - USER 15
    user2 - USER 2
    user3 - USER 3
    user4 - USER 4
    user5 - USER 5
    user6 - USER 6
    user7 - USER 7
    user8 - USER 8
    user9 - USER 9

After:
    user0 - USER 0
    user1 - USER 1
    user2 - USER 2
    user3 - USER 3
    user4 - USER 4
    user5 - USER 5
    user6 - USER 6
    user7 - USER 7
    user8 - USER 8
    user9 - USER 9
    user10 - USER 10
    user11 - USER 11
    user12 - USER 12
    user13 - USER 13
    user14 - USER 14
    user15 - USER 15


svn path=/trunk/; revision=50482
2013-07-10 16:18:37 +00:00
Michael Tüxen 58f61d29c7 Only cast the variable after checking it.
svn path=/trunk/; revision=48222
2013-03-10 11:51:25 +00:00
Anders Broman b204e38aef Use explicit casts.
svn path=/trunk/; revision=48108
2013-03-05 22:15:20 +00:00
Gerald Combs bd4cffae58 When any of our executables start on Windows create or open a "Wireshark
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-02-20 01:19:42 +00:00
Jakub Zawadzki 78631020b8 Add wtap_pseudo_header union to wtap_pkthdr structure.
Use pkthdr instead of pseudo_header as argument for dissecting.

svn path=/trunk/; revision=45601
2012-10-16 21:50:57 +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
Martin Mathieson 127770efef Avoid needlessly shadowing another variable.
svn path=/trunk/; revision=42553
2012-05-10 16:10:44 +00:00
Michael Tüxen 4088083ae6 Fix typo.
svn path=/trunk/; revision=42239
2012-04-25 19:21:25 +00:00
Michael Tüxen 27a21cd04d Fix copy and paste error.
Reported by Evan Huus. This should fix
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7194

svn path=/trunk/; revision=42238
2012-04-25 19:17:10 +00:00
Michael Tüxen b6ed0f345a Fix compilation. While there, remove some trailing whitespaces.
svn path=/trunk/; revision=42237
2012-04-25 18:38:55 +00:00
Anders Broman 19a53f1ee2 use in_files->filename
svn path=/trunk/; revision=42233
2012-04-25 14:33:06 +00:00
Anders Broman f696fb7bde Add some info in SHB if writing a pcap-ng file.
svn path=/trunk/; revision=42232
2012-04-25 14:01:15 +00:00
Anders Broman e553c70fe8 From Michael Mann:
help page update (pcapng is now the default file format).

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6551

svn path=/trunk/; revision=40658
2012-01-23 07:48:53 +00:00
Chris Maynard 618b231e19 Alphabetize the list of encapsulation types via "mergecap -T" as well as the list of capture file types via "mergecap -F".
svn path=/trunk/; revision=40282
2011-12-22 21:52:16 +00:00
Guy Harris d94bd07f99 Rename WTAP_ERR_BAD_RECORD to WTAP_ERR_BAD_FILE; it really reports any
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.

svn path=/trunk/; revision=40175
2011-12-13 09:53:50 +00:00
Chris Maynard bdd62e33aa Hopefully clarify usage a bit to indicate multiple infile's can be specified to be merged. Also, add GPL and copyright info.
svn path=/trunk/; revision=40051
2011-11-30 15:55:53 +00:00
Chris Maynard 348c681918 From Eugene Bogush: Initialize read_err to 0 so mergecap works again. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6623
svn path=/trunk/; revision=40048
2011-11-30 15:28:58 +00:00
Guy Harris 272c011d19 On an I/O error, merge_read_packet() and merge_append_read_packet() need
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.

svn path=/trunk/; revision=39964
2011-11-21 06:26:03 +00:00
Guy Harris 2929c93ea2 When reporting "sorry, *this* packet can't be written to a file of that
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.

svn path=/trunk/; revision=39949
2011-11-19 20:18:01 +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 4d603719d0 Have mergecap, tshark, and editcap write pcap-ng files by default. This
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.

svn path=/trunk/; revision=37736
2011-06-20 23:31:26 +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
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
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
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
Stig Bjørlykke 41a8561936 Fixed a int/long warning.
svn path=/trunk/; revision=30330
2009-10-05 15:22:34 +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
Jeff Morriss a5cee04fad Move the file utility functions from wiretap to libwsutil so that
libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
2008-05-22 15:46:27 +00:00
Stig Bjørlykke 11a9f57c1a Fixed some malloc -> g_malloc, free -> g_free, strdup -> g_strdup.
svn path=/trunk/; revision=24179
2008-01-24 19:09:30 +00:00
Anders Broman f68d6e4c8c Ethereal->Wireshark
svn path=/trunk/; revision=18235
2006-05-28 20:28:20 +00:00
Anders Broman 901f07af60 From Martin Mathieson:
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

svn path=/trunk/; revision=17765
2006-03-30 04:58:06 +00:00
Ulf Lamping 41c3bca696 same command line related changes as recently done with editcap
svn path=/trunk/; revision=16994
2006-01-10 23:06:05 +00:00
Ulf Lamping c3187174bf replace *a lot* of file related calls by their GLib counterparts. This is 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.

svn path=/trunk/; revision=16403
2005-11-06 22:43:25 +00:00
Ulf Lamping 84cf7ce767 added compression support for capture file output. The Save/As dialog now 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 ...

svn path=/trunk/; revision=15804
2005-09-14 21:57:30 +00:00
Guy Harris f1deabed56 Make the tone of the error messages a bit less formal, by using
contractions.  (Safari does, at least when you're trying to open a file
to which you don't have read access.)

svn path=/trunk/; revision=12852
2004-12-29 01:08:20 +00:00
Guy Harris e09e12621a The common merge code merely needs to offer the abstraction of routines
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.

svn path=/trunk/; revision=12427
2004-10-29 00:36:52 +00:00
Guy Harris 66e85e4e43 Make "merge_files()" and "merge_append_files()" return a tri-state
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.

svn path=/trunk/; revision=12423
2004-10-28 01:52:05 +00:00
Guy Harris dc2280bc1e Remove all the verbose-mode code from merge.c, and put most of it in
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".

svn path=/trunk/; revision=12422
2004-10-28 01:06:11 +00:00
Guy Harris b48b8847b1 Change some of the merge.c APIs to return more information on failure,
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.

svn path=/trunk/; revision=12420
2004-10-27 23:28:37 +00:00
Guy Harris 62988d944a Check whether any input files were specified, and print an error for
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.

svn path=/trunk/; revision=12410
2004-10-27 19:36:22 +00:00
Guy Harris 8a8b883450 Set the svn:eol-style property on all text files to "native", so that
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.

svn path=/trunk/; revision=11400
2004-07-18 00:24:25 +00:00
Gerald Combs 8106dc0862 Convert make-version.pl and the associated cvsversion.h and CVSVERSION
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.


svn path=/trunk/; revision=11379
2004-07-15 21:09:33 +00:00
Guy Harris aaac0102cb If we fail to open the output file, report the reason why.
svn path=/trunk/; revision=11371
2004-07-13 05:58:15 +00:00
Ulf Lamping 4492f58213 bugfix to a bug reported by jprakashbabu@hotpop.com:
mergecap didn't created a new output file

svn path=/trunk/; revision=11368
2004-07-12 21:00:40 +00:00
Guy Harris 99cec606fa Initialize "out_filename" to NULL, so it's set to NULL if it's not set
by a "-w" flag.

svn path=/trunk/; revision=11277
2004-06-30 07:04:42 +00:00
Guy Harris 272a2055ab On at least some platforms, a #define of O_BINARY is needed even if
<fcntl.h> is included, as <fcntl.h> doesn't define it.

svn path=/trunk/; revision=11276
2004-06-30 06:58:59 +00:00
Ulf Lamping 19c7f04794 avoid using tmpnam() for security reasons.
instead of giving the merge stuff a filename,
give it an already opened file descriptor

svn path=/trunk/; revision=11273
2004-06-29 20:59:24 +00:00