Commit Graph

396 Commits

Author SHA1 Message Date
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