Commit Graph

314 Commits

Author SHA1 Message Date
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 03b57df5a0 Fix various typos and spelling errors.
svn path=/trunk/; revision=35126
2010-12-06 01:34:58 +00:00
Chris Maynard 5db818390b Attempt to fix warnings not previously seen with VS2008EE.
svn path=/trunk/; revision=35024
2010-11-24 17:10:48 +00:00
Chris Maynard 5519715365 When listing encapsulation types with -T or file types with -F, sort them.
svn path=/trunk/; revision=35022
2010-11-24 16:24:44 +00:00
Sake Blok 9cf1d89732 Make editcap -B work like expected: output no packets after the stop time.
Old behavior was to include a packet with a timestamp of 12:00:00.934 if -B "YYYY-MM-DD 12:00:00" was used.


svn path=/trunk/; revision=34913
2010-11-16 20:22:20 +00:00
Jeff Morriss 1ad1bab262 From Jose Pedro Oliveira via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5353 :
editcap -h sends 9 lines to stderr and the rest to stdout.  This problem
affects editcap 1.4.x (branch 1.4) and devel (trunk).

How to duplicate:
 1) run "editcap -h"
 2) run "editcap -h > /dev/null"

The attached patch replaces 9 ocurrences of "stderr" by "output" in the usage
function.

svn path=/trunk/; revision=34742
2010-11-01 14:33:14 +00:00
Gerald Combs a87bdf9660 Turn on ASLR via /DYNAMICBASE and DEP via SetProcessDEPPolicy().
svn path=/trunk/; revision=34137
2010-09-16 19:20:06 +00:00
Bill Meier 5a307bb6d1 Fix a gcc -Wshadow warning
svn path=/trunk/; revision=33077
2010-06-03 19:14:18 +00:00
Gerald Combs 07354a18c1 From Jim Young via bug 4331:
This patch adds a new '-S' option to editcap that will rewrite timestamps of
packets to insure that the new capture file is in strict chronological order.

This option's primary use case is to fixup the occasional timestamps that have
a negative delta time relative to previous packet.

This feature is related to (but does not depend on) capinfos enhancement
submitted in bug #4315 which helps identify tracefiles with "out-of-order"
packets.

svn path=/trunk/; revision=33042
2010-06-02 00:30:25 +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 e4d6610bd5 Fix various gcc -Wshadow warnings.
svn path=/trunk/; revision=31729
2010-01-29 16:09:25 +00:00
Stephen Fisher 7c125a357b Make edticap behave like the rest of the Wireshark programs where it will
send normal -h output to stdout so it can be paginated and the usage output
to stderr when there was an error in the command arguments.


svn path=/trunk/; revision=31388
2009-12-29 21:04:40 +00:00
Gerald Combs 5ba1582dda From Jim Young via bug 4162:
This patch limits the number of fractional digits used to calculate the
fractional component of editcap's -t and -w options.

Specifically this patch truncates the fractional component (if any) of the -t
and -w options to 6 and 9 respectively.

svn path=/trunk/; revision=30698
2009-10-25 20:18:24 +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
Guy Harris 7595bc232a Clean up the "available XXX type" messages a bit.
svn path=/trunk/; revision=28793
2009-06-21 18:55:32 +00:00
Stig Bjørlykke 9a8e93d88b If no valid packages was found in the input file we write an empty
header in the output file.  This way we at least create a file.

svn path=/trunk/; revision=28617
2009-06-02 23:14:19 +00:00
Stig Bjørlykke fa71489b83 Only call wtap_dump_close() if we have an open file.
We can have a situation where a file only contains a valid file header
without any packages, so this will avoid a crash.

svn path=/trunk/; revision=28602
2009-06-02 17:22:40 +00:00
Guy Harris 5e8e10cfa3 Have fileset_extract_prefix_suffix() print an error message if it fails,
so we don't just exit silently.  Don't bother checking the validity of
arguments - it shouldn't be passed NULL fprefix or fsuffix arguments in
the first place, and isn't passed them.

Exit with an exit status of 1 for command-line syntax errors and 2 for
file open/close/IO errors.

svn path=/trunk/; revision=28458
2009-05-23 20:29:12 +00:00
Guy Harris dc3b1136cc Fix indentation.
svn path=/trunk/; revision=28457
2009-05-23 20:22:42 +00:00
Sake Blok 67bd294b03 Initialize pdh...
svn path=/trunk/; revision=28455
2009-05-23 08:57:20 +00:00
Sake Blok a8eb860103 From Kovarththanan Rajaratnam <krj@rajaratnam.dk> in bug 2683
(https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2683):

Editcap should split file according to fileset pattern


svn path=/trunk/; revision=28454
2009-05-23 07:59:23 +00:00
Bill Meier fa920e48ed Minor cleanup of "-h" output text.
svn path=/trunk/; revision=28334
2009-05-12 16:06:14 +00:00
Gerald Combs c8f44535fe Fix Win64 compilation.
svn path=/trunk/; revision=28076
2009-04-17 16:21:33 +00:00
Balint Reczey 14fa469df3 From Jim Young <jyoung@gsu.edu>:
- New duplicate packet removal options for editcap
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3168

I changed the patch a bit:
- Adapted to 80 chars wide screen
- Merged -w and -W parameters

svn path=/trunk/; revision=28074
2009-04-17 15:21:46 +00:00
Gerald Combs e648060f0f Fix the last(?) of the Win64 compilation problems.
svn path=/trunk/; revision=28065
2009-04-16 04:05:39 +00:00
Guy Harris c73ab7dff7 Change the signature of init_progfile_dir() so the casting of the
function pointer (to main) to an argument to dladdr() is done in
init_progfile_dir() rather than its callers.

svn path=/trunk/; revision=27814
2009-03-22 06:53:17 +00:00
Guy Harris 6f059e8cb7 In Solaris, the second argument to dladdr() is just a void *, not a
const void *.

svn path=/trunk/; revision=27813
2009-03-22 06:38:02 +00:00
Guy Harris 7c6e2155cc Attempt to use dladdr() to get the pathname of the executable image if
it's available and works.

svn path=/trunk/; revision=27812
2009-03-22 00:42:33 +00:00
Guy Harris ace4af44fc Add a routine to report write errors to the list of failure-reporting
routines handled by epan/report_err.c.

Move copy_binary_file() in file.c to epan/filesystem.c, and rename it to
copy_file_binary_mode() (to clarify that it *can* copy text files;
arguably, *all* files are "binary" unless you're on, say, an IBM 1401
:-)).  Have it use the report_err.c routines, so it works in
console-mode programs.

Clean up some comments while we're at it.

svn path=/trunk/; revision=27456
2009-02-15 21:47:57 +00:00
Jeff Morriss a7b7e98cb1 Only declare failure_message() if we HAVE_PLUGINS (since it's only used when that's the case).
svn path=/trunk/; revision=27051
2008-12-18 19:24:34 +00:00
Bill Meier 8afa208ffb Windows build: #include winsock2.h only when needed.
#include winsock2.h pulls in about 90 distinct .h files
and about 140 total .h files. 
Currently winsock2.h is (mostly unnecessarily) included
for each dissector via packet.h/wtap.h.
This patch removes #include winsock2.h from wtap.h and 
then includes winsock2.h (or windows.h) in the 
few specific places required. 
With this patch, my Windows Wireshark build takes 
about 30% less time.


svn path=/trunk/; revision=26535
2008-10-24 00:42:09 +00:00
Jeff Morriss 83f9ecf96f Move privileges.c and unicode-utils.c from epan to wsutil (so things like
capinfos and dumpcap don't need to depend on libwireshark nor directly pull
in those modules).  Because capinfos and editcap were only being linked with
privileges.c if we had plugins, this allows those programs to be linked when
someone is compiling --without-plugins.

svn path=/trunk/; revision=25640
2008-06-30 17:16:29 +00:00
Sake Blok 70ec244f8f From Ken Smith (bug 2574): Allow editcap to parse files into even time intervals
A few changes from me:
- make use of nstime_set_unset and nstime_is_unset i.s.o. extra variable first_pass
- change 'if' to 'while' to allow intervals with no packets
- remove 'unused' variable current_pkt_ts



svn path=/trunk/; revision=25499
2008-06-21 09:45:21 +00:00
Guy Harris be161ba460 Free up the err_info string returned by wtap_read() and
wtap_seek_read().

Clean up indentation.

svn path=/trunk/; revision=25400
2008-05-30 02:44:02 +00:00
Luis Ontanon bf9a9b83a5 Long time ago, I added these to troubleshoot a problem a user was seeing but I could not reproduce, as I had no feedback I forgot about removing these prints.
This must be copied over to the release branch.


svn path=/trunk/; revision=24727
2008-03-25 21:07:52 +00:00
Jeff Morriss b59322ecc1 Don't link plugins against libwireshark: any program that loads the dissector
plugins should already be linked against libwireshark.

Don't link capinfos and editcap against libwireshark: they only needed to be
because the plugins were linked against libwireshark (see rev 24123 and the
ensuing discussion on -dev).

capinfos and editcap: don't complain if plugins fail to load: dissector
plugins should fail to load because they need libwireshark.  I am assuming
here that wiretap plugins don't need libwireshark (I've never seen such a
plugin but LEGO's code and comments suggest this is the case).

(The goal of this checkin is to stop linking capinfos and editcap against
libwireshark while still allowing wiretap plugins.  Since we don't have any
such plugins in the tree I do somewhat doubt the need for all this but I don't
want to be the one to remove the functionality.)

svn path=/trunk/; revision=24650
2008-03-16 00:58:15 +00:00
Jeff Morriss ddca4dd583 Include epan/priveleges.h for get_credential_info()
svn path=/trunk/; revision=24649
2008-03-16 00:41:10 +00:00
Jeff Morriss d951728e6b Have started_with_special_privs() assert out if get_credential_info() was not
previously called.  This prevents the function from always returning TRUE in
programs that hadn't called get_credential_info().

Call get_credential_info() in the programs that should have been.

svn path=/trunk/; revision=24648
2008-03-16 00:32:12 +00:00
Martin Mathieson d7f43bd1b1 When doing random error mutation, protect DCT2000
meta information that is found at the beginning of
the data - this lets me fuzztest my .out files
properly.

Also make some whitespace more consistent.

svn path=/trunk/; revision=24401
2008-02-20 14:13:15 +00:00
Stig Bjørlykke e88b6111a1 Initialize filenamelen to avoid a warning.
svn path=/trunk/; revision=24275
2008-02-06 12:01:48 +00:00
Stig Bjørlykke d856658e6e snprintf -> g_snprintf
svn path=/trunk/; revision=24260
2008-02-03 16:03:33 +00:00
Stig Bjørlykke 47d744b59d More rewrite of prohibited APIs (sprintf, strcpy, strcat).
svn path=/trunk/; revision=24258
2008-02-03 15:38:20 +00:00
Stig Bjørlykke 2df21cb1b7 Fixed some strcpy -> strncpy/g_snprintf cleanups.
Removed a debug printout in t38.

svn path=/trunk/; revision=24188
2008-01-24 23:01:37 +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
Martin Mathieson f16a563466 Replace a handful of tabs with spaces.
svn path=/trunk/; revision=24176
2008-01-24 17:14:01 +00:00
Bill Meier 83888f9c01 From RD Thrush: Fix for 'editcap relies on gnu extension to strptime(3)'
svn path=/trunk/; revision=24124
2008-01-17 21:04:48 +00:00
Sake Blok da42105f77 Clean up the usage information of editcap and change the text
of the -t option to fit its current behaviour

('fixes' bug 2101)


svn path=/trunk/; revision=24072
2008-01-12 18:31:07 +00:00
Gerald Combs 1c9158a00e Add a newline.
svn path=/trunk/; revision=23416
2007-11-09 20:05:44 +00:00
Guy Harris 58585ac5c5 Clean up indentation.
"time_t" is not guaranteed to be an "unsigned long"; when printing it
with %lu, cast it to "unsigned long".

The "secs" field of a wtap_nstime, however, *is* defined to be a time_t;
there's no need to cast it to time_t.

svn path=/trunk/; revision=23036
2007-09-30 22:13:38 +00:00
Sake Blok 27efb95042 This patch fixes the following two errors that appear when
configure is run with "--without-plugins"

cc1: warnings being treated as errors
about_dlg.c: In function ‘about_wireshark_cb’:
about_dlg.c:426: warning: unused variable ‘plugins_page’
make[2]: *** [about_dlg.o] Error 1

editcap.c: In function ‘main’:
editcap.c:663: error: ‘check_ts’ undeclared (first use in this function)
editcap.c:663: error: (Each undeclared identifier is reported only once
editcap.c:663: error: for each function it appears in.)
make[2]: *** [editcap.o] Error 1


svn path=/trunk/; revision=22761
2007-08-31 14:14:17 +00:00
Luis Ontanon d8e818e9da Make sure that wiretap plugins are loaded before dissectors are (if a new encap type is registered the plugin probably needs it before reg_handoff)
svn path=/trunk/; revision=22461
2007-08-07 20:07:43 +00:00
Luis Ontanon c1c9e0bb90 nononono.... print one on 250 not every line
svn path=/trunk/; revision=22426
2007-07-30 21:17:03 +00:00
Luis Ontanon f43578e8f4 for bug 1158 have editcap print the value of the timestamps while running so I can get feedback from the user.
svn path=/trunk/; revision=22425
2007-07-30 21:10:12 +00:00
Jeff Morriss 301432dc5c Increase the maximum number of packet selections to 512 (from 100). More importantly, give the user feedback if we run out of room for packet selections. As mentioned on the list, this could be made completely dynamic if someone actually goes over the (new) limit. OK for 0.99.6 but not necessary.
svn path=/trunk/; revision=22145
2007-06-20 20:02:52 +00:00
Luis Ontanon 162382dcb1 Have editcap and capinfos compile --without-plugins
Should go in 0.99.6


svn path=/trunk/; revision=22116
2007-06-17 04:58:16 +00:00
Luis Ontanon 11f06217ce Have editcap and capinfos loading the wiretap plugins.
epan/filesystem.c
   have get_plugin_dir() calling init_plugin_dir() if necessary

epan/epan.c and epan/report_err.c
   move the report_failure family into the new report_err.c file, have epan_init() calling the initializer

epan/plugins.h and epan/proto.c
   do not have init_plugins() calling the proto_reg functions instead do it in init_proto()

gtk/main.c and tshark.c
   init_plugin_dir() has become suprefluous

capinfos.c and editcap.c
   load the wiretap plugins

Makefiles
   do what's needed to build withe the above changes.




svn path=/trunk/; revision=21935
2007-05-25 17:22:32 +00:00
Jörg Mayer b16106f89f Only #deinfe __USE_XOPEN if not already defined. On my Suse 10.2 it was
already #defined to 1, so this would create a warning/error.


svn path=/trunk/; revision=21508
2007-04-22 20:04:34 +00:00
Ulf Lamping 45c8c7a843 fix MSVC warnings of / and set CFLAGS to block new warnings
svn path=/trunk/; revision=21098
2007-03-21 23:14:23 +00:00
Jaap Keuter 849fafe7f7 From Sebastien Tandeil:
a patch to avoid the warning "implicit declaration of function
'strptime'" in editcap.c
glib.h is included just after the define __USE_XOPEN and include <time.h>

svn path=/trunk/; revision=20455
2007-01-16 19:13:09 +00:00
Gerald Combs 53689800e6 Move epan/crypt-md5.[ch] to epan/crypt. Remove
epan/crypt/airpdcap_md5.[ch].  Fix up whitespace.

svn path=/trunk/; revision=20277
2007-01-02 22:49:57 +00:00
Jörg Mayer dd26a7021b nikai@nikai.net:
Remaining fixes from:
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1225

svn path=/trunk/; revision=19895
2006-11-14 20:32:29 +00:00
Ulf Lamping 59d6c8ea33 change all file offsets from long to gint64 so we can - theoretically - handle files > 2GB correct.
Please distclean Win32 builds!

svn path=/trunk/; revision=19814
2006-11-05 22:46:44 +00:00
Luis Ontanon b09b3c5f46 As proposed by Tim Furlong:
set starttm.tm_isdst to -1 to have mktime() propperly interpret DST.
Might fix Bug 1158

svn path=/trunk/; revision=19662
2006-10-23 14:57:54 +00:00
Gerald Combs 9045703e2c Add duplicate frame detection (and removal) to editcap. (Some switches
generate duplicate packets when a mirror/SPAN port is misconfigured).

svn path=/trunk/; revision=18800
2006-07-27 17:53:29 +00:00
Anders Broman f68d6e4c8c Ethereal->Wireshark
svn path=/trunk/; revision=18235
2006-05-28 20:28:20 +00:00
Luis Ontanon e57aefead5 - Have strptime prototype being included.
- clear struct tm s before passing them to strptime.
- make sure stopttime is a valid value on every plattform.


svn path=/trunk/; revision=17647
2006-03-16 19:45:02 +00:00
Luis Ontanon ecae4ddd06 use time_t instead of an unsigned integer to sstore the time.
svn path=/trunk/; revision=17638
2006-03-15 20:52:37 +00:00
Luis Ontanon fb41328889 Add -A <start time> and -B <stop time> options to editcap
svn path=/trunk/; revision=17614
2006-03-13 22:20:07 +00:00
Ulf Lamping ae477dc44f print the list of available types also if the given type is invalid
svn path=/trunk/; revision=16993
2006-01-10 22:00:37 +00:00
Ulf Lamping 4d9839c0d6 redesign of the usage output (displayed with -h or an unknown option):
option explanation is more detailed now, I've added the option parameters to the description

added version information to the usage output

instead of using the usage page to display the available file and encapsulation types (which makes the usage page almost unreadable), use empty options -F or -T to print the available types. I've used optopt for this, it seems to be portable that way ...


svn path=/trunk/; revision=16991
2006-01-10 21:37:36 +00:00
Ulf Lamping 530861faad add a new command line option "chop", which will simply cut off the last "n" bytes from each packet. This is required (at least by me) when converting from PacketGrabber files which sometimes seem to include some additional bytes.
sort the usage string, so it will be ordered alphabetically

replace appearances of "frame" and "record" with "packet"

svn path=/trunk/; revision=16981
2006-01-09 21:14:32 +00:00
Anders Broman 6f23144e46 From Jaap Keuter:
- Editcap 
Mikko Tiihonen filed bug 379 including a patch for editcap. This wasn't picked up so far. I've ported the patch to svn 16820 and included a documentation patch.

-packet-ieee80211.c
Radek Vokal of RedHat filed a bug found by Vladimir Kondratiev of Intel in the 802.11 dissector. Radek provided a sample capture and Vladimir a oneliner patch. I've ported the patch to svn 16820 and tested it against the provided capture. Works well.


-From Kan Sasaki
A patch for packet-ospf.c is attached:
 - Fix the handling of the DN-bit of options field.
 - Add a new function dissect_ospf_bitfield() to dissect a bitfield
   such as options, flags. The following functions are merged by
   using this function.
     - dissect_ospf_lls_extended_options()
     - dissect_ospf_dbd()


     - dissect_ospf_options()
     - dissect_ospf_v3_prefix_options()
 - dissect the flags and prefix-options bitfield.

- lldp Bugfix Bug 596  LLDP TIA Network Policy Decode is not correct 

- Camel make it possible to dissect based on OID.

svn path=/trunk/; revision=16822
2005-12-16 16:37:03 +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
Ulf Lamping d90d0f9e7c fix usec -> nsec translation
svn path=/trunk/; revision=15521
2005-08-24 22:27:21 +00:00
Anders Broman d410c9ed54 From Peter Johansson:
The supplied patch takes care of the following compilation warnings:

editcap.c(273) : warning C4013: 'getpid' undefined; assuming extern 
returning int
editcap.c(464) : warning C4018: '<' : signed/unsigned mismatch


svn path=/trunk/; revision=15084
2005-07-26 09:34:49 +00:00
Ulf Lamping 46b7ee3e4d the -E probability parameter was missing in the usage summary
svn path=/trunk/; revision=14677
2005-06-17 07:56:27 +00:00
Gerald Combs ccffd9b143 Add random bit errors to the fuzz tests.
svn path=/trunk/; revision=14489
2005-05-30 16:49:47 +00:00
Gerald Combs cd67d1fcf8 Remove debugging printf()s.
svn path=/trunk/; revision=14048
2005-04-10 23:17:05 +00:00
Gerald Combs c8ff864b00 Add an option to Editcap that adds various types of errors to the capture
file.

svn path=/trunk/; revision=14046
2005-04-10 23:12:48 +00:00
Guy Harris 466c3e9c8d Make editcap use wtap_read(); that eliminates the last user of
wtap_loop(), so eliminate wtap_loop().

svn path=/trunk/; revision=14006
2005-04-03 11:00:49 +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 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
Richard Sharpe de8d0fddc9 Another small closing bracket fixup.
svn path=/trunk/; revision=10196
2004-02-23 05:44:34 +00:00
Richard Sharpe 59b1193763 Small fix to usage text to add a trailing closed square bracket (]).
svn path=/trunk/; revision=10194
2004-02-23 04:16:37 +00:00
Guy Harris d6c17f144b Free the error info string after using it.
svn path=/trunk/; revision=9855
2004-01-25 22:21:39 +00:00
Guy Harris d6cd61061e Have the Wiretap open, read, and seek-and-read routines return, in
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".

svn path=/trunk/; revision=9852
2004-01-25 21:55:17 +00:00
Jörg Mayer e68ca30d10 Fix warnings found by -Wstrict-prototypes
svn path=/trunk/; revision=9722
2004-01-18 16:21:12 +00:00
Jörg Mayer 7c4176d868 Removed trailing whitespaces from .h and .c files using the
winapi_cleanup tool written by Patrik Stridvall for the wine
project.

svn path=/trunk/; revision=6117
2002-08-28 21:04:11 +00:00
Jörg Mayer 173fe5aef4 Replace the types from sys/types.h and netinet/in.h by their glib.h
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.

svn path=/trunk/; revision=5932
2002-08-02 23:36:07 +00:00
Guy Harris ac444e6b9d From Joerg Mayer: add some missing static declarations.
svn path=/trunk/; revision=5806
2002-06-30 20:28:54 +00:00
Guy Harris 73ef5a2753 WinPcap 2.3's <pcap.h> includes <packet32.h>, and WinPcap 2.3's
<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>.

svn path=/trunk/; revision=5742
2002-06-23 10:32:36 +00:00
Guy Harris a412a0cec5 From Joerg Mayer: mark function arguments as unused.
svn path=/trunk/; revision=5049
2002-03-31 20:39:08 +00:00
Gilbert Ramirez aacedfa1f2 When defining the struct select_item, don't create an instance of that
struct, alsoc alled select_item, as it's not used.

svn path=/trunk/; revision=4938
2002-03-14 04:32:35 +00:00
Guy Harris 309e86246e From Peter Valchev: fix editcap to assign the result of "getopt()" to an
"int" and to check "getopt()"s return value with -1 rather than EOF.

Fix other "getopt()" loops to check against -1 as well (EOF is -1 on
most if not all platforms, but the Single UNIX Specification says
"getopt()" returns -1, so we should check against -1, not EOF).

svn path=/trunk/; revision=4793
2002-02-24 01:26:45 +00:00
Guy Harris 89a4acb438 Have Wiretap set the snapshot length to 0 if it can't be derived from
reading the capture file.  Have callers of "wtap_snapshot_length()"
treat a value of 0 as "unknown", and default to WTAP_MAX_PACKET_SIZE (so
that, when writing a capture file in a format that *does* store the
snapshot length, we can at least put *something* in the file).

If we don't know the snapshot length of the current capture file, don't
display a value in the summary window.

Don't use "cfile.snap" as the snapshot length option when capturing -
doing so causes Ethereal to default, when capturing, to the snapshot
length of the last capture file that you read in, rather than to the
snapshot length of the last capture you did (or the initial default of
"no snapshot length").

Redo the "Capture Options" dialog box to group options into sections
with frames around them, and add units to the snapshot length, maximum
file size, and capture duration options, as per a suggestion by Ulf
Lamping.  Also add units to the capture count option.

Make the snapshot length, capture count, maximum file size, and capture
duration options into a combination of a check box and a spin button.
If the check box is not checked, the limit in question is inactive
(snapshot length of 65535, no max packet count, no max file size, no max
capture duration); if it's checked, the spinbox specifies the limit.
Default all of the check boxes to "not checked" and all of the spin
boxes to small values.

Use "gtk_toggle_button_get_active()" rather than directly fetching the
state of a check box.

svn path=/trunk/; revision=4709
2002-02-08 10:07:41 +00:00
Guy Harris 3c9efdf478 Use longs as file offsets, so that on platforms with 64-bit "long" we
can handle capture files bigger than 2GB.

svn path=/trunk/; revision=3993
2001-10-04 08:30:36 +00:00
Guy Harris 4eb4021854 From Scott Renfro:
- make a leading zero in the argument to -t optional;

  - includes the -t option in in the summary portion of of the editcap
    usage message.

svn path=/trunk/; revision=3712
2001-07-13 07:55:13 +00:00
Guy Harris fa31197bd0 "-t" flag for editcap, to adjust timestamps in frames, from Scott
Renfro.

svn path=/trunk/; revision=3696
2001-07-12 08:16:45 +00:00
Guy Harris 8c52d3db75 More signed vs. unsigned cleanups, and initialization cleanups, from
Joerg Mayer.

svn path=/trunk/; revision=3578
2001-06-19 23:08:57 +00:00
Guy Harris 2d07385002 In ANSI C (and in pre-ANSI UNIX implementations), if you return from
"main()", the program exits, and exits with an exit status equal to the
return value of "main()", so "return 0;" is sufficient at the end of
"main()".

svn path=/trunk/; revision=3354
2001-04-20 22:35:19 +00:00
Guy Harris 6c4de764d1 Put the "-s" flag into the usage message for editcap.
svn path=/trunk/; revision=2738
2000-12-03 21:11:05 +00:00
Guy Harris 5225efe134 Make "editcap -h" give the usage message without an error message (i.e.,
specify it in the argument to "getopt()").

svn path=/trunk/; revision=2235
2000-08-09 06:00:54 +00:00
Gilbert Ramirez d7e6e0e384 Add wtap-int.h. Move definitions relevant to the internal workins of wiretap
to that file, leave public definitions in wtap.h.

Rename "union pseudo_header" to "union wtap_pseudo_header".
Make the wtap_pseudo_header pointer available in packet_info struct.

svn path=/trunk/; revision=1989
2000-05-19 23:07:04 +00:00
Guy Harris f3d90d30a4 Remove the "union pseudo_header" from the "frame_data" structure;
there's no need to keep it around in memory - when the frame data is
read in when handing a frame, read in the information, if any, necessary
to reconstruct the frame header, and reconstruct it.  This saves some
memory.

This requires that the seek-and-read function be implemented inside
Wiretap, and that the Wiretap handle remain open even after we've
finished reading the file sequentially.

This also points out that we can't really do X.25-over-Ethernet
correctly, as we don't know where the direction (DTE->DCE or DCE->DTE)
flag is stored; it's not clear how the Ethernet type 0x0805 for X.25
Layer 3 is supposed to be handled in any case.  We eliminate
X.25-over-Ethernet support (until we find out what we're supposed to
do).

svn path=/trunk/; revision=1975
2000-05-18 09:09:50 +00:00
Guy Harris 4c071627ed Add a "-s" flag to editcap, to make it truncate packets to a specified
snapshot length before writing them to the output file; this may come in
handy if you are translating the file to a different format so that it
can be read by a program that can't handle packets above a certain size
(e.g., the snoop in Solaris 2.5.1 or 2.6, which reject Ethernet packets
larger than the Ethernet MTU, and thus can't handle gigabit Ethernet
captures using jumbo frames).

svn path=/trunk/; revision=1891
2000-04-27 00:31:30 +00:00
Gilbert Ramirez 73a42b360c Remove optopt and opterr, two unused variables.
svn path=/trunk/; revision=1877
2000-04-17 14:52:32 +00:00
Gilbert Ramirez ed237c129d Build tethereal and editcap on Win32.
Add RCS ID tags to Makefile.nmake's.

svn path=/trunk/; revision=1836
2000-04-12 21:52:11 +00:00
Guy Harris 7b2773fa31 Use "strchr()" rather than "index()" - the ANSI C standard specifies
"strchr()", and it, unlike "index()", is declared in <string.h>.

svn path=/trunk/; revision=1502
2000-01-17 20:21:40 +00:00
Richard Sharpe 656eb3453b Small patch to editcap to allow ranges of packets to be specified
as well as individual packets.

I needed to grab quite a few from the middle of a large capture file.

Will eventually need to sort the extract list.

svn path=/trunk/; revision=1498
2000-01-17 08:06:03 +00:00
Richard Sharpe e6c49cfe4d Another commit from a Qantas Club Lounge ... :-)
Update editcap to print out the type of capture file if -v specified and
add a -h flag.  Also fix a few compiler warnings ...

svn path=/trunk/; revision=1302
1999-12-12 21:04:29 +00:00
Guy Harris e8f5dac7d4 Use the new routines in Wiretap to make the argument to "-T" be a
symbolic name, and to list the encapsulation types in the usage message.

Note in the usage message that the default output encapsulation type is
"same as the input file" and that the default output file type is
"libpcap".

svn path=/trunk/; revision=1213
1999-12-05 01:27:14 +00:00
Guy Harris 3e084400fc It's now called "editcap", as it can read any file format Wiretap can
read, and write any format it can write; change the error messages.

Make the "-F" flag take a symbolic capture file type; use
"wtap_short_string_to_file_type()" to translate it to a WTAP_FILE_
value.

List, in the usage message, the capture file types we can write, and the
symbolic types you use on the command line to specify them.

Give it an RCS ID.

svn path=/trunk/; revision=1210
1999-12-04 21:42:56 +00:00
Richard Sharpe ad33fe84a7 Adding editcap.c. This is an example of a simple wiretap editing program.
Will need new functions in wiretap before I can do more.

Should perhaps be moved into an examples directory and have other bots added.

svn path=/trunk/; revision=1206
1999-12-04 12:53:52 +00:00